[utilities/kgpg] /: Show window when starting app

Rolf Eike Beer <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9491359ee6878611c894714c98173b7b9ae12378 by Rolf Eike Beer, on behalf of Balló György.
Committed on 05/08/2026 at 20:10.
Pushed by dakon into branch 'master'.

Show window when starting app

Currently when starting the app the window isn't shown unless explicity requested.

This is poor UX since starting the app from Kickoff will result in no window being
shown, which is unexpected and confusing.

So rework the logic to always show the key manager window on launch/activation,
unless if explicitly requested to not show (with -t option, used in autostart file),
or the editor is requested (with -d option), or a file is specified.

M  +1    -1    CMakeLists.txt
C  +6    -5    kgpg.autostart.desktop [from: org.kde.kgpg.desktop - 097% similarity]
M  +3    -2    kgpg.cpp
M  +0    -3    org.kde.kgpg.desktop

https://invent.kde.org/utilities/kgpg/-/commit/9491359ee6878611c894714c98173b7b9ae12378

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab1ae809..a548a4f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -284,7 +284,7 @@ install(TARGETS kgpg  ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} )
 install( PROGRAMS org.kde.kgpg.desktop  DESTINATION ${KDE_INSTALL_APPDIR})
 install( FILES org.kde.kgpg.appdata.xml  DESTINATION ${KDE_INSTALL_METAINFODIR})
 install( FILES kgpg.kcfg  DESTINATION ${KDE_INSTALL_KCFGDIR})
-install( FILES org.kde.kgpg.desktop  DESTINATION ${KDE_INSTALL_AUTOSTARTDIR} )
+install( FILES kgpg.autostart.desktop  DESTINATION ${KDE_INSTALL_AUTOSTARTDIR} )
 
 install( PROGRAMS kgpg_encryptfile.desktop kgpg_encryptfolder.desktop kgpg_viewdecrypted.desktop  DESTINATION ${KDE_INSTALL_DATADIR}/kio/servicemenus )
 install( FILES org.kde.kgpg.Key.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
diff --git a/org.kde.kgpg.desktop b/kgpg.autostart.desktop
similarity index 97%
copy from org.kde.kgpg.desktop
copy to kgpg.autostart.desktop
index f5ffdbf5..427a6351 100755
--- a/org.kde.kgpg.desktop
+++ b/kgpg.autostart.desktop
@@ -1,12 +1,12 @@
 # KDE Config File
 [Desktop Entry]
 Type=Application
-Exec=kgpg %U
+Exec=kgpg -t
 Icon=kgpg
 X-DocPath=kgpg/index.html
 MimeType=application/pgp-encrypted;application/pgp-signature;application/pgp-keys;
 GenericName=Encryption Tool
-GenericName[ar]=أداة تعمية
+GenericName[ar]=أداة للتشفير
 GenericName[bg]=Програма за шифроване
 GenericName[br]=Ostilh enrinegadur
 GenericName[bs]=Alatka za šifrovanje
@@ -73,6 +73,7 @@ GenericName[tr]=Şifreleme Aracı
 GenericName[ug]=شىفىرلاش قورالى
 GenericName[uk]=Засіб для шифрування
 GenericName[vi]=Công Cụ Mã Hoá
+GenericName[x-test]=xxEncryption Toolxx
 GenericName[zh_CN]=加密工具
 GenericName[zh_TW]=加密工具
 Comment=A GnuPG frontend
@@ -138,11 +139,12 @@ Comment[ta]=GnuPG முன் அமைப்பு
 Comment[tg]=Пешохири GnuPG
 Comment[th]=ฟร้อนเอนด์ของ GnuPG
 Comment[tr]=Bir GnuPG ön yüzü
-Comment[ug]=GnuPG ئالدى ئۇچ پىروگراممىسى
+Comment[ug]=GnuPG ئالدى ئۇچ پروگراممىسى
 Comment[uk]=Інтерфейс до GnuPG
 Comment[uz]=GnuPG uchun grafik interfeys
 Comment[uz@cyrillic]=GnuPG учун график интерфейс
 Comment[wa]=Ene eterface po GnuPG
+Comment[x-test]=xxA GnuPG frontendxx
 Comment[zh_CN]=GnuPG 前端
 Comment[zh_TW]=GnuPG 前端軟體
 Name=KGpg
@@ -217,9 +219,8 @@ Name[uz]=KGpg
 Name[uz@cyrillic]=KGpg
 Name[vi]=KGpg
 Name[wa]=KGpg
+Name[x-test]=xxKGpgxx
 Name[zh_CN]=KGpg
 Name[zh_TW]=KGpg
-
 X-KDE-autostart-condition=kgpgrc:User Interface:AutoStart:false
-
 Categories=Qt;KDE;Utility;X-KDE-Utilities-PIM;
diff --git a/kgpg.cpp b/kgpg.cpp
index 4984edac..a35a8e70 100644
--- a/kgpg.cpp
+++ b/kgpg.cpp
@@ -94,9 +94,10 @@ bool KGpgApp::newInstance()
 void KGpgApp::handleArguments(const QCommandLineParser &parser, const QDir &workingDirectory)
 {
 	// parsing of command line args
-    if (parser.isSet(QStringLiteral("k")) || (!KGpgSettings::showSystray() && parser.positionalArguments().isEmpty() && !parser.isSet(QStringLiteral("d")))) {
+    if (parser.positionalArguments().isEmpty() && !parser.isSet(QStringLiteral("d")) && !parser.isSet(QStringLiteral("t"))) {
 		s_keyManager->show();
 		s_keyManager->raise();  // set on top
+		s_keyManager->activateWindow();
     } else if (parser.isSet(QStringLiteral("d"))) {
 		s_keyManager->slotOpenEditor();
 		s_keyManager->hide();
@@ -185,7 +186,7 @@ void KGpgApp::handleArguments(const QCommandLineParser &parser, const QDir &work
 void KGpgApp::setupCmdlineParser(QCommandLineParser& parser)
 {
 	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("e"), i18n("Encrypt file")));
-	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("k"), i18n("Open key manager")));
+	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("t"), i18n("Start program in system tray only")));
 	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("d"), i18n("Open editor")));
 	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("s"), i18n("Show encrypted file")));
 	parser.addOption(QCommandLineOption(QStringList() << QLatin1String("S"), i18n("Sign File")));
diff --git a/org.kde.kgpg.desktop b/org.kde.kgpg.desktop
index f5ffdbf5..b2318948 100755
--- a/org.kde.kgpg.desktop
+++ b/org.kde.kgpg.desktop
@@ -219,7 +219,4 @@ Name[vi]=KGpg
 Name[wa]=KGpg
 Name[zh_CN]=KGpg
 Name[zh_TW]=KGpg
-
-X-KDE-autostart-condition=kgpgrc:User Interface:AutoStart:false
-
 Categories=Qt;KDE;Utility;X-KDE-Utilities-PIM;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.