Linux : .desktop upgrade. Copy scalable icon into '~/.local/share/icons/hicolor/scalable/apps/'.

Remove iconified option if not in autostart.
This commit is contained in:
Julien Wadel 2023-11-24 11:23:17 +01:00
parent 66354134a3
commit b2f5f77003
20 changed files with 72 additions and 48 deletions

View file

@ -2042,7 +2042,7 @@ Klikněte zde: <a href="%1">%1</a>
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2072,7 +2072,7 @@ Klikněte zde: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,8 +2046,8 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation>Export %1.desktop file to applications</translation> <translation>Create desktop entry</translation>
</message> </message>
</context> </context>
<context> <context>
@ -2076,8 +2076,8 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation>Export %1.desktop file to applications</translation> <translation>Create desktop entry</translation>
</message> </message>
</context> </context>
<context> <context>

View file

@ -2046,7 +2046,7 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2035,7 +2035,7 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2065,7 +2065,7 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2035,7 +2035,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2065,7 +2065,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2057,7 +2057,7 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2087,7 +2087,7 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2057,7 +2057,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2087,7 +2087,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2046,7 +2046,7 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2076,7 +2076,7 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2035,7 +2035,7 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2065,7 +2065,7 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2057,7 +2057,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2087,7 +2087,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -2035,7 +2035,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -2065,7 +2065,7 @@
</message> </message>
<message> <message>
<source>exportDesktopFile</source> <source>exportDesktopFile</source>
<extracomment>&apos;Export %1.desktop file to applications&apos; : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name)</extracomment> <extracomment>&apos;Create desktop entry&apos; : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>

View file

@ -74,6 +74,7 @@ namespace {
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
const QString AutoStartDirectory(QDir::homePath().append(QStringLiteral("/.config/autostart/"))); const QString AutoStartDirectory(QDir::homePath().append(QStringLiteral("/.config/autostart/")));
const QString ApplicationsDirectory(QDir::homePath().append(QStringLiteral("/.local/share/applications/"))); const QString ApplicationsDirectory(QDir::homePath().append(QStringLiteral("/.local/share/applications/")));
const QString IconsDirectory(QDir::homePath().append(QStringLiteral("/.local/share/icons/hicolor/scalable/apps/")));
#elif defined(Q_OS_MACOS) #elif defined(Q_OS_MACOS)
const QString OsascriptExecutable(QStringLiteral("osascript")); const QString OsascriptExecutable(QStringLiteral("osascript"));
#else #else
@ -999,7 +1000,7 @@ void App::setAutoStart (bool enabled) {
} }
const QString confPath(AutoStartDirectory + EXECUTABLE_NAME ".desktop"); const QString confPath(AutoStartDirectory + EXECUTABLE_NAME ".desktop");
if(generateDesktopFile(confPath, !enabled)) { if(generateDesktopFile(confPath, !enabled, true)) {
mAutoStart = enabled; mAutoStart = enabled;
emit autoStartChanged(enabled); emit autoStartChanged(enabled);
} }
@ -1012,10 +1013,10 @@ void App::exportDesktopFile(){
} }
const QString confPath(ApplicationsDirectory + EXECUTABLE_NAME ".desktop"); const QString confPath(ApplicationsDirectory + EXECUTABLE_NAME ".desktop");
if(generateDesktopFile(confPath, true)) if(generateDesktopFile(confPath, true, false))
generateDesktopFile(confPath, false); generateDesktopFile(confPath, false, false);
} }
bool App::generateDesktopFile(const QString& confPath, bool remove){ bool App::generateDesktopFile(const QString& confPath, bool remove, bool openInBackground){
qInfo() << QStringLiteral("Updating `%1`...").arg(confPath); qInfo() << QStringLiteral("Updating `%1`...").arg(confPath);
QFile file(confPath); QFile file(confPath);
@ -1051,18 +1052,41 @@ bool App::generateDesktopFile(const QString& confPath, bool remove){
qDebug() << "exec path autostart set classic package=" << exec; qDebug() << "exec path autostart set classic package=" << exec;
} }
QDir dir;
QString iconPath;
bool haveIcon = false;
if(!dir.mkpath(IconsDirectory)) // Scalable icons folder may be created
qWarning() << "Cannot create scalable icon path at " << IconsDirectory;
else{
iconPath = IconsDirectory +"/"+ EXECUTABLE_NAME +".svg";
QFile icon(Constants::WindowIconPath);
if(!QFile(iconPath).exists()) {// Keep old icon but copy if it doesn't exist
haveIcon = icon.copy(iconPath);
if(!haveIcon)
qWarning() << "Couldn't copy icon svg into " << iconPath;
else {// Update permissions
QFile icon(iconPath);
icon.setPermissions(icon.permissions() | QFileDevice::WriteOwner);
}
}else {
qInfo() << "Icon already exist in " << IconsDirectory << " and is not replaced.";
haveIcon = true;
}
}
QTextStream(&file) << QString( QTextStream(&file) << QString(
"[Desktop Entry]\n" "[Desktop Entry]\n"
"Name=" APPLICATION_NAME "\n" "Name=" APPLICATION_NAME "\n"
"GenericName=SIP Phone\n" "GenericName=SIP Phone\n"
"Comment=" APPLICATION_DESCRIPTION "\n" "Comment=" APPLICATION_DESCRIPTION "\n"
"Type=Application\n" "Type=Application\n")
"Exec=" + exec + " --iconified\n" << (openInBackground ? "Exec=" + exec + " --iconified %u\n" : "Exec=" + exec + " %u\n")
"Terminal=false\n" << (haveIcon ? "Icon=" +iconPath + "\n" : "Icon=" EXECUTABLE_NAME "\n")
<< "Terminal=false\n"
"Categories=Network;Telephony;\n" "Categories=Network;Telephony;\n"
"MimeType=x-scheme-handler/sip-" EXECUTABLE_NAME ";x-scheme-handler/sip;x-scheme-handler/sips-" EXECUTABLE_NAME ";x-scheme-handler/sips;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/" EXECUTABLE_NAME "-config;\n" "MimeType=x-scheme-handler/sip-" EXECUTABLE_NAME ";x-scheme-handler/sip;x-scheme-handler/sips-" EXECUTABLE_NAME ";x-scheme-handler/sips;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/" EXECUTABLE_NAME "-config;\n"
"X-PulseAudio-Properties=media.role=phone\n" "X-PulseAudio-Properties=media.role=phone\n";
);
return true; return true;
} }

View file

@ -130,7 +130,7 @@ public:
Q_INVOKABLE static bool isLinux(); Q_INVOKABLE static bool isLinux();
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
Q_INVOKABLE void exportDesktopFile(); Q_INVOKABLE void exportDesktopFile();
bool generateDesktopFile(const QString& confPath, bool remove); bool generateDesktopFile(const QString& confPath, bool remove, bool openInBackground);
#endif #endif
public slots: public slots:

View file

@ -91,8 +91,8 @@ Item {
MenuItem{ MenuItem{
visible: App.isLinux() visible: App.isLinux()
//: 'Export %1.desktop file to applications' : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name) //: 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux
text: qsTr('exportDesktopFile').arg(executableName) text: qsTr('exportDesktopFile')
onTriggered: App.exportDesktopFile() onTriggered: App.exportDesktopFile()
} }

View file

@ -44,8 +44,8 @@ MenuBar {
} }
MenuItem{ MenuItem{
visible: App.isLinux() visible: App.isLinux()
//: 'Export %1.desktop file to applications' : Label menu to export the %1.desktop file to the ~/.local/share/applications/ folder on Linux (%1 is the exectuable name) //: 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux
text: qsTr('exportDesktopFile').arg(executableName) text: qsTr('exportDesktopFile')
onTriggered: App.exportDesktopFile() onTriggered: App.exportDesktopFile()
} }
MenuItem { MenuItem {