Группа :: Графические оболочки/KDE
Пакет: kdelibs
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: kdecore-3.2.0-custom_menu_path.patch
--- kdelibs-3.2.0/kdecore/kstandarddirs.cpp~ 2004-02-18 13:57:49 +0300
+++ kdelibs-3.2.0/kdecore/kstandarddirs.cpp 2004-02-18 15:35:34 +0300
@@ -52,6 +52,49 @@
#include <sys/param.h>
#include <unistd.h>
+bool have_custom_path_suffix = false;
+bool path_suffix_customized = false;
+QString custom_path_suffix("/");
+QString addCustomPathSuffix(QString prefix, QString alternate_suffix = QString::null )
+{
+ if( ! have_custom_path_suffix )
+ {
+ QString standard_menu_user( QDir::homeDirPath() + "/.menu/disable_customization" );
+ QString custom_menu_user( QDir::homeDirPath() + "/.menu/enable_customization" );
+ QString standard_menu_system( "/etc/menu/disable_customization" );
+
+ if( ! QFile(standard_menu_user).exists())
+ {
+ if( QFile(custom_menu_user).exists() )
+ {
+ custom_path_suffix = "-custom/";
+ path_suffix_customized = true;
+ }
+ else
+ {
+ if( ! QFile(standard_menu_system).exists() )
+ {
+ custom_path_suffix = "-custom/";
+ path_suffix_customized = true;
+ }
+ }
+ }
+ have_custom_path_suffix = true;
+ }
+
+ if( path_suffix_customized )
+ {
+ if( alternate_suffix.isEmpty() )
+ return prefix + custom_path_suffix;
+ else
+ return prefix + alternate_suffix;
+ }
+ else
+ {
+ return prefix + custom_path_suffix;
+ }
+}
+
template class QDict<QStringList>;
class KStandardDirs::KStandardDirsPrivate
@@ -887,7 +930,7 @@ QString KStandardDirs::kde_default(const
if (!strcmp(type, "pixmap"))
return "share/pixmaps/";
if (!strcmp(type, "apps"))
- return "share/applnk/";
+ return addCustomPathSuffix("share/applnk", "-alt/");
if (!strcmp(type, "sound"))
return "share/sounds/";
if (!strcmp(type, "locale"))
@@ -913,11 +956,11 @@ QString KStandardDirs::kde_default(const
if (!strcmp(type, "qtplugins"))
return "lib/kde3/plugins";
if (!strcmp(type, "xdgdata-apps"))
- return "applications/";
+ return addCustomPathSuffix("applications", "-alt/");
if (!strcmp(type, "xdgdata-dirs"))
- return "desktop-directories/";
+ return addCustomPathSuffix("desktop-directories", "-alt/");
if (!strcmp(type, "xdgconf-menu"))
- return "menus/";
+ return addCustomPathSuffix("menus", "-alt/");
if (!strcmp(type, "kcfg"))
return "share/config.kcfg";
qFatal("unknown resource type %s", type);