From 274dd3ccb3dd38866e87c83bd5e6f1085ba861d9 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Tue, 23 Apr 2013 08:59:44 -0500 Subject: [PATCH] Fix XDG ShowOnlyIn/NotShowIn conflicts with KDE4. Add cmake WITH_OLD_XDG_STD configure support to retain old style support for potential problematic distros. This resolves bug report 1364. --- CMakeLists.txt | 1 + config.h.cmake | 3 +++ kinit/autostart.cpp | 10 ++++++++++ tdeio/tdeio/kservice.cpp | 10 ++++++++++ tdeio/tdeio/kservicegroup.cpp | 10 ++++++++++ 5 files changed, 34 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6d9f2441..a152c9ccf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ option( WITH_UDISKS "Enable UDISKS support" ${WITH_ALL_OPTIONS} ) option( WITH_UDISKS2 "Enable UDISKS2 support" ${WITH_ALL_OPTIONS} ) OPTION( WITH_NETWORK_MANAGER_BACKEND "Enable network-manager support" OFF ) OPTION( WITH_SUDO_TDESU_BACKEND "Use sudo as backend for tdesu (default is su)" OFF ) +OPTION( WITH_OLD_XDG_STD "Use the pre R14.0.0 XDG standard where both TDE and KDE are recognized in desktop files" OFF ) OPTION( WITH_ASPELL "Enable aspell support" ${WITH_ALL_OPTIONS} ) OPTION( WITH_HSPELL "Enable hspell support" ${WITH_ALL_OPTIONS} ) diff --git a/config.h.cmake b/config.h.cmake index b4e04b43a..1e7dcff74 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -834,6 +834,9 @@ /* Defined if compiling with the network-manager backend */ #cmakedefine WITH_NETWORK_MANAGER_BACKEND 1 +/* Defined if compiling with old XDG standard support */ +#cmakedefine WITH_OLD_XDG_STD 1 + /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD diff --git a/kinit/autostart.cpp b/kinit/autostart.cpp index ccdbd3d97..3f49dfc1d 100644 --- a/kinit/autostart.cpp +++ b/kinit/autostart.cpp @@ -178,13 +178,23 @@ AutoStart::loadAutoStartList() if (config.hasKey("OnlyShowIn")) { +#ifdef WITH_OLD_XDG_STD if ((!config.readListEntry("OnlyShowIn", ';').contains("TDE")) && (!config.readListEntry("OnlyShowIn", ';').contains("KDE"))) continue; +#else + if (!config.readListEntry("OnlyShowIn", ';').contains("TDE")) + continue; +#endif } if (config.hasKey("NotShowIn")) { +#ifdef WITH_OLD_XDG_STD if ((config.readListEntry("NotShowIn", ';').contains("TDE")) || (config.readListEntry("NotShowIn", ';').contains("KDE"))) continue; +#else + if (config.readListEntry("NotShowIn", ';').contains("TDE")) + continue; +#endif } AutoStartItem *item = new AutoStartItem; diff --git a/tdeio/tdeio/kservice.cpp b/tdeio/tdeio/kservice.cpp index 14eb172d5..bbcbed5c9 100644 --- a/tdeio/tdeio/kservice.cpp +++ b/tdeio/tdeio/kservice.cpp @@ -749,8 +749,13 @@ bool KService::noDisplay() const { { TQString aValue = it.data().toString(); TQStringList aList = TQStringList::split(';', aValue); +#ifdef WITH_OLD_XDG_STD if ((!aList.contains("TDE")) && (!aList.contains("KDE"))) return true; +#else + if (!aList.contains("TDE")) + return true; +#endif } it = m_mapProps.find( "NotShowIn" ); @@ -758,8 +763,13 @@ bool KService::noDisplay() const { { TQString aValue = it.data().toString(); TQStringList aList = TQStringList::split(';', aValue); +#ifdef WITH_OLD_XDG_STD if ((aList.contains("TDE")) || (aList.contains("KDE"))) return true; +#else + if (aList.contains("TDE")) + return true; +#endif } if (!kapp->authorizeControlModule(d->menuId)) diff --git a/tdeio/tdeio/kservicegroup.cpp b/tdeio/tdeio/kservicegroup.cpp index 4cb3b8dac..e0ec1321e 100644 --- a/tdeio/tdeio/kservicegroup.cpp +++ b/tdeio/tdeio/kservicegroup.cpp @@ -84,13 +84,23 @@ KServiceGroup::KServiceGroup( const TQString &configFile, const TQString & _relp TQStringList tmpList; if (config.hasKey("OnlyShowIn")) { +#ifdef WITH_OLD_XDG_STD if ((!config.readListEntry("OnlyShowIn", ';').contains("TDE")) && (!config.readListEntry("OnlyShowIn", ';').contains("KDE"))) d->m_bNoDisplay = true; +#else + if (!config.readListEntry("OnlyShowIn", ';').contains("TDE")) + d->m_bNoDisplay = true; +#endif } if (config.hasKey("NotShowIn")) { +#ifdef WITH_OLD_XDG_STD if ((config.readListEntry("NotShowIn", ';').contains("TDE")) || (config.readListEntry("NotShowIn", ';').contains("KDE"))) d->m_bNoDisplay = true; +#else + if (config.readListEntry("NotShowIn", ';').contains("TDE")) + d->m_bNoDisplay = true; +#endif } m_strBaseGroupName = config.readEntry( "X-TDE-BaseGroup" );