diff --git a/linphone-app/assets/languages/cs.ts b/linphone-app/assets/languages/cs.ts index 4010512e0..42694feb6 100644 --- a/linphone-app/assets/languages/cs.ts +++ b/linphone-app/assets/languages/cs.ts @@ -2042,7 +2042,7 @@ Klikněte zde: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2072,7 +2072,7 @@ Klikněte zde: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 328c06d37..7ff830453 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -2046,7 +2046,7 @@ Klik her: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Klik her: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 7415d1d42..7ded5feb2 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -2046,7 +2046,7 @@ Klicken Sie hier: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Klicken Sie hier: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 6f99490d6..b5bd2d4ce 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -2046,8 +2046,8 @@ Click here: <a href="%1">%1</a> exportDesktopFile - '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) - Export %1.desktop file to applications + 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux + Create desktop entry @@ -2076,8 +2076,8 @@ Click here: <a href="%1">%1</a> exportDesktopFile - '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) - Export %1.desktop file to applications + 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux + Create desktop entry diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index c5de931b6..ce3477d74 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -2046,7 +2046,7 @@ Haga clic aquí: <a href="%1">%1 </a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Haga clic aquí: <a href="%1">%1 </a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 504cdbae0..fe7be497c 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -2046,7 +2046,7 @@ Cliquez ici : <a href="%1">%1</a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Cliquez ici : <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index d220cb88c..714490ee4 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -2035,7 +2035,7 @@ Kattintson ide: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2065,7 +2065,7 @@ Kattintson ide: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index 7f26b25c9..ee3dc0437 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -2046,7 +2046,7 @@ Clicca: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Clicca: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 1b16a0e64..d533f8ca0 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -2035,7 +2035,7 @@ exportDesktopFile - '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 @@ -2065,7 +2065,7 @@ exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 7e768d0a2..6d34841bc 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -2057,7 +2057,7 @@ Spustelėkite čia: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2087,7 +2087,7 @@ Spustelėkite čia: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index b07f3139d..5b8266735 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -2046,7 +2046,7 @@ Clique aqui: <a href="%1">%1 </a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Clique aqui: <a href="%1">%1 </a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index f21fbc900..241c5ce59 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -2057,7 +2057,7 @@ exportDesktopFile - '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 @@ -2087,7 +2087,7 @@ exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index befde22b4..20442ee4f 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -2046,7 +2046,7 @@ Klicka här: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2076,7 +2076,7 @@ Klicka här: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index a34e88dec..a4c81f928 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -2035,7 +2035,7 @@ Buraya tıklayın: <a href="%1">%1</a> exportDesktopFile - '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 @@ -2065,7 +2065,7 @@ Buraya tıklayın: <a href="%1">%1</a> exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index 48e7b91a1..a3aa6f2fd 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -2057,7 +2057,7 @@ exportDesktopFile - '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 @@ -2087,7 +2087,7 @@ exportDesktopFile - '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 diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index cb50a0553..00bf658d8 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -2035,7 +2035,7 @@ exportDesktopFile - '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 @@ -2065,7 +2065,7 @@ exportDesktopFile - '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 diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index 8c9bdf1f8..cb177c548 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -74,6 +74,7 @@ namespace { #ifdef Q_OS_LINUX const QString AutoStartDirectory(QDir::homePath().append(QStringLiteral("/.config/autostart/"))); 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) const QString OsascriptExecutable(QStringLiteral("osascript")); #else @@ -999,7 +1000,7 @@ void App::setAutoStart (bool enabled) { } const QString confPath(AutoStartDirectory + EXECUTABLE_NAME ".desktop"); - if(generateDesktopFile(confPath, !enabled)) { + if(generateDesktopFile(confPath, !enabled, true)) { mAutoStart = enabled; emit autoStartChanged(enabled); } @@ -1012,10 +1013,10 @@ void App::exportDesktopFile(){ } const QString confPath(ApplicationsDirectory + EXECUTABLE_NAME ".desktop"); - if(generateDesktopFile(confPath, true)) - generateDesktopFile(confPath, false); + if(generateDesktopFile(confPath, true, 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); QFile file(confPath); @@ -1051,18 +1052,41 @@ bool App::generateDesktopFile(const QString& confPath, bool remove){ 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( "[Desktop Entry]\n" "Name=" APPLICATION_NAME "\n" "GenericName=SIP Phone\n" "Comment=" APPLICATION_DESCRIPTION "\n" - "Type=Application\n" - "Exec=" + exec + " --iconified\n" - "Terminal=false\n" + "Type=Application\n") + << (openInBackground ? "Exec=" + exec + " --iconified %u\n" : "Exec=" + exec + " %u\n") + << (haveIcon ? "Icon=" +iconPath + "\n" : "Icon=" EXECUTABLE_NAME "\n") + << "Terminal=false\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" - "X-PulseAudio-Properties=media.role=phone\n" - ); + "X-PulseAudio-Properties=media.role=phone\n"; + return true; } diff --git a/linphone-app/src/app/App.hpp b/linphone-app/src/app/App.hpp index 352c158f2..b27abf173 100644 --- a/linphone-app/src/app/App.hpp +++ b/linphone-app/src/app/App.hpp @@ -130,7 +130,7 @@ public: Q_INVOKABLE static bool isLinux(); #ifdef Q_OS_LINUX Q_INVOKABLE void exportDesktopFile(); - bool generateDesktopFile(const QString& confPath, bool remove); + bool generateDesktopFile(const QString& confPath, bool remove, bool openInBackground); #endif public slots: diff --git a/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml b/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml index 49fd53797..ac67aea89 100644 --- a/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml +++ b/linphone-app/ui/views/App/Main/MainWindowMenuBar.qml @@ -91,8 +91,8 @@ Item { MenuItem{ 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) - text: qsTr('exportDesktopFile').arg(executableName) + //: 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux + text: qsTr('exportDesktopFile') onTriggered: App.exportDesktopFile() } diff --git a/linphone-app/ui/views/App/Main/MainWindowTopMenuBar.qml b/linphone-app/ui/views/App/Main/MainWindowTopMenuBar.qml index 28ff24006..51ca83cac 100644 --- a/linphone-app/ui/views/App/Main/MainWindowTopMenuBar.qml +++ b/linphone-app/ui/views/App/Main/MainWindowTopMenuBar.qml @@ -44,8 +44,8 @@ MenuBar { } MenuItem{ 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) - text: qsTr('exportDesktopFile').arg(executableName) + //: 'Create desktop entry' : Label menu to export the application.desktop file to the ~/.local/share/applications/ folder on Linux + text: qsTr('exportDesktopFile') onTriggered: App.exportDesktopFile() } MenuItem {