From a8a54f04848fd4a232218297e8e9018c4565e693 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 21 Sep 2015 00:26:31 +0000 Subject: [PATCH] generic: proper support for icon and caption in .desktop files --- kdecore/kernel/kcmdlineargs.cpp | 14 +++++++------- kdecore/kernel/kglobal.cpp | 2 +- kdecore/kernel/kglobal.h | 2 +- kdeui/kernel/kapplication.cpp | 2 +- kio/misc/kmailservice.desktop | 2 +- kio/misc/ktelnetservice.desktop | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/kdecore/kernel/kcmdlineargs.cpp b/kdecore/kernel/kcmdlineargs.cpp index 9e0f2e6d..105d9287 100644 --- a/kdecore/kernel/kcmdlineargs.cpp +++ b/kdecore/kernel/kcmdlineargs.cpp @@ -87,24 +87,24 @@ class KCmdLineParsedOptions : public QHash { public: - KCmdLineParsedOptions() { } + KCmdLineParsedOptions() { } }; class KCmdLineParsedArgs : public QList { public: - KCmdLineParsedArgs() { } + KCmdLineParsedArgs() { } }; class KCmdLineArgsList: public QList { public: - KCmdLineArgsList() { } - ~KCmdLineArgsList() { - while (count()) - delete takeFirst(); - } + KCmdLineArgsList() { } + ~KCmdLineArgsList() { + while (count()) + delete takeFirst(); + } }; // diff --git a/kdecore/kernel/kglobal.cpp b/kdecore/kernel/kglobal.cpp index eb79f9b1..431ba7c1 100644 --- a/kdecore/kernel/kglobal.cpp +++ b/kdecore/kernel/kglobal.cpp @@ -292,7 +292,7 @@ QString KGlobal::caption() PRIVATE_DATA; // Caption set from command line ? KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde"); - if (args && args->isSet("caption")) { + if (args && args->isSet("caption") && !args->getOption("caption").trimmed().isEmpty()) { return args->getOption("caption"); } else { // We have some about data ? diff --git a/kdecore/kernel/kglobal.h b/kdecore/kernel/kglobal.h index 8be766e7..0d6dc04d 100644 --- a/kdecore/kernel/kglobal.h +++ b/kdecore/kernel/kglobal.h @@ -501,7 +501,7 @@ namespace KGlobal * Returns a text for the window caption. * * This may be set by - * "-caption", otherwise it will be equivalent to the name of the + * "--caption", otherwise it will be equivalent to the name of the * executable. * @return the text for the window caption */ diff --git a/kdeui/kernel/kapplication.cpp b/kdeui/kernel/kapplication.cpp index 307d67ae..a43defbc 100644 --- a/kdeui/kernel/kapplication.cpp +++ b/kdeui/kernel/kapplication.cpp @@ -802,7 +802,7 @@ void KApplicationPrivate::parseCommandLine( ) } if ( q->type() != KApplication::Tty ) { - if (args && args->isSet("icon")) + if (args && args->isSet("icon") && !args->getOption("icon").trimmed().isEmpty()) { q->setWindowIcon(KIcon(args->getOption("icon"))); } diff --git a/kio/misc/kmailservice.desktop b/kio/misc/kmailservice.desktop index ad03a939..6ff9f03b 100755 --- a/kio/misc/kmailservice.desktop +++ b/kio/misc/kmailservice.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application -Exec=kmailservice %u +Exec=kmailservice --icon '%i' --caption '%c' %u Icon=mail-message-new MimeType=x-scheme-handler/mailto; diff --git a/kio/misc/ktelnetservice.desktop b/kio/misc/ktelnetservice.desktop index 5472e563..f178368d 100755 --- a/kio/misc/ktelnetservice.desktop +++ b/kio/misc/ktelnetservice.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application -Exec=ktelnetservice %u +Exec=ktelnetservice --icon '%i' --caption '%c' %u Icon=utilities-terminal MimeType=x-scheme-handler/telnet;x-scheme-handler/rlogin;x-scheme-handler/ssh;