[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: kio&kcontrol patch against hardcoded subdir paths
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-09-05 20:41:20
[Download RAW message or body]

On Tue, 05 Sep 2000, Waldo Bastian wrote :
>On Tue, 05 Sep 2000, David Faure wrote:
>> >The other thing that I don't like about it is that you do a linear search
>> > for these items. If you add an index for "basegroups" you can find them
>> > much faster.
>>
>> Thought about that too, but I'm lost in the new ksycoca design ;-)
>> Where would I do that ?
>
>You can add a KSycocaDict to kservicegroupfactory. Just like e.g. m_nameDict 
>in kservicefactory. 
>
>In kbuildservicegroupfactory ::addEntry() you add the entries that you want 
>to put in this dictionairy (e.g. those with a non-empty basegroup). In 
>::saveHeader() you must save the offset of this dictionairy and in ::save() 
>you save the dictionairy itself.
Cool stuff. The new design is very modular indeed, good job.

Ok, I did all this, and the result is attached.

Patch getting huge, I'm looking forward to commit so that I can move on to other things :)

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://home.clara.net/faure/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2
["applnk.diff" (text/plain)]

Index: settings.desktop
===================================================================
RCS file: /home/kde/kdebase/applnk/settings.desktop,v
retrieving revision 1.46
diff -u -p -r1.46 settings.desktop
--- settings.desktop	2000/09/04 04:12:01	1.46
+++ settings.desktop	2000/09/05 11:20:18
@@ -35,3 +35,4 @@ Name[tr]=Tercihler
 Name[uk]=Настройки
 Name[zh_CN.GB2312]=选项
 Icon=package_settings
+X-KDE-BaseGroup=settings
Index: system-screensavers.desktop
===================================================================
RCS file: /home/kde/kdebase/applnk/system-screensavers.desktop,v
retrieving revision 1.43
diff -u -p -r1.43 system-screensavers.desktop
--- system-screensavers.desktop	2000/09/04 04:12:05	1.43
+++ system-screensavers.desktop	2000/09/05 11:20:19
@@ -34,6 +34,7 @@ Name[tr]=Ekran Koruyucular
 Name[uk]=Зберігач екрану
 Name[zh_CN.GB2312]=屏幕保护程序
 Icon=kscreensaver
+X-KDE-BaseGroup=screensavers
 
 Comment=Screen saver demos
 Comment[ca]=Demostracions del salvapantalles

["kcontrol.diff" (text/x-c)]

Index: global.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/global.cpp,v
retrieving revision 1.6
diff -u -p -b -r1.6 global.cpp
--- global.cpp	2000/04/07 14:23:40	1.6
+++ global.cpp	2000/09/05 20:39:39
@@ -21,6 +21,9 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/utsname.h>
+#include <kservicegroup.h>
+#include <ksycoca.h>
+#include <kdebug.h>
 
 #include "config.h"
 #include "utils.h"
@@ -37,6 +40,7 @@ QString KCGlobal::_iversion = "";
 QString KCGlobal::_imachine = "";
 IndexViewMode KCGlobal::_viewmode = Icon;
 IndexIconSize KCGlobal::_iconsize = Medium;
+QString KCGlobal::_baseGroup = QString::null;
 
 void KCGlobal::init()
 {
@@ -68,4 +72,25 @@ void KCGlobal::setType(const QCString& s
 {
   QString string = s.lower();
   splitString(string, ',', _types);
+}
+
+QString KCGlobal::baseGroup()
+{
+  if ( _baseGroup.isEmpty() )
+  {
+    KServiceGroup::Ptr group = KServiceGroup::baseGroup( "settings" );
+    if (group)
+    {
+      _baseGroup = group->relPath();
+      kdDebug() << "Found basegroup = " << _baseGroup << endl;
+      return _baseGroup;
+    }
+    // Compatibility with old behaviour, in case of missing .directory files.
+    if (_baseGroup.isEmpty())
+    {
+      kdWarning() << "No K menu group with X-KDE-KControl-Base=true found ! \
Defaulting to Settings/" << endl; +      _baseGroup = \
QString::fromLatin1("Settings"); +    }
+  }
+  return _baseGroup;
 }
Index: global.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/global.h,v
retrieving revision 1.5
diff -u -p -b -r1.5 global.h
--- global.h	2000/04/07 14:16:30	1.5
+++ global.h	2000/09/05 20:39:40
@@ -44,6 +44,7 @@ public:
   static QString systemMachine() { return _imachine; }
   static IndexViewMode viewMode() { return _viewmode; }
   static IndexIconSize iconSize() { return _iconsize; }
+  static QString baseGroup();
 
   static void setRoot(bool r) { _root = r; }
   static void setType(const QCString& s);
@@ -63,6 +64,7 @@ private:
   static QString _uname, _hname, _isystem, _irelease, _iversion, _imachine, \
_kdeversion;  static IndexViewMode _viewmode;
   static IndexIconSize _iconsize;
+  static QString _baseGroup;
 };
 
 #endif
Index: kcmshell.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/kcmshell.cpp,v
retrieving revision 1.22
diff -u -p -b -r1.22 kcmshell.cpp
--- kcmshell.cpp	2000/08/30 11:42:36	1.22
+++ kcmshell.cpp	2000/09/05 20:39:41
@@ -38,6 +38,7 @@
 #include "kcdialog.h"
 #include "moduleinfo.h"
 #include "modloader.h"
+#include "global.h"
 
 
 static KCmdLineOptions options[] =
@@ -70,7 +71,7 @@ int main(int _argc, char *_argv[])
     if (args->isSet("list")) {
 	QStringList files;
 	KGlobal::dirs()->findAllResources("apps",
-					  "Settings/*.desktop",
+                                          KCGlobal::baseGroup() + "*.desktop",
 					  true, true, files);
 	QStringList modules;
 	QStringList descriptions;
@@ -80,8 +81,8 @@ int main(int _argc, char *_argv[])
 	    if (KDesktopFile::isDesktopFile(*it)) {
 		KDesktopFile file(*it, true);
 		QString module = *it;
-		if (module.left(9) == "Settings/")
-		    module = module.mid(9);
+                if (module.startsWith(KCGlobal::baseGroup()))
+                    module = module.mid(KCGlobal::baseGroup().length());
 		if (module.right(8) == ".desktop")
 		    module.truncate(module.length() - 8);
 
@@ -123,7 +124,7 @@ int main(int _argc, char *_argv[])
 	//files.append(args->arg(0));
     }
 
-    QCString path = "Settings/";
+    QString path = KCGlobal::baseGroup();
     path += arg;
     path += ".desktop";
 
@@ -132,7 +133,7 @@ int main(int _argc, char *_argv[])
         // Path didn't work. Trying as a name
         KService::Ptr serv = KService::serviceByDesktopName( arg );
         if ( serv )
-            path = QFile::encodeName(serv->entryPath());
+            path = serv->entryPath();
         else
         {
             cerr << i18n("Module %1 not found!").arg(arg).local8Bit() << endl;
Index: moduleiconview.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/moduleiconview.cpp,v
retrieving revision 1.20
diff -u -p -b -r1.20 moduleiconview.cpp
--- moduleiconview.cpp	2000/07/05 09:31:04	1.20
+++ moduleiconview.cpp	2000/09/05 20:39:42
@@ -143,7 +143,7 @@ void ModuleIconView::fill()
   {
     QString subdir = (*it);
 
-    KServiceGroup::Ptr group = KServiceGroup::group("Settings/"+subdir+"/");
+    KServiceGroup::Ptr group = \
KServiceGroup::group(KCGlobal::baseGroup()+subdir+'/');  
     if (KCGlobal::iconSize() == Small)
     {
@@ -228,7 +228,7 @@ QDragObject *ModuleIconView::dragObject(
 	if (!item->tag().isEmpty())
 	  {
 	    QString dir = _path + "/" + item->tag();
-	    dir = locate("apps", "Settings/"+dir+"/.directory");
+            dir = locate("apps", KCGlobal::baseGroup()+dir+"/.directory");
 	    int pos = dir.findRev("/.directory");
 	    if (pos > 0)
 	      {
Index: moduleinfo.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/moduleinfo.cpp,v
retrieving revision 1.21
diff -u -p -b -r1.21 moduleinfo.cpp
--- moduleinfo.cpp	2000/08/11 15:41:50	1.21
+++ moduleinfo.cpp	2000/09/05 20:39:43
@@ -29,6 +29,7 @@
 #include "moduleinfo.h"
 #include "moduleinfo.moc"
 #include "utils.h"
+#include "global.h"
 
 ModuleInfo::ModuleInfo(QString desktopFile)
   : _fileName(desktopFile)
@@ -52,9 +53,9 @@ ModuleInfo::ModuleInfo(QString desktopFi
  
   // try to find out the modules groups
   QString group = desktopFile; 
-  int pos = group.find("Settings/");
+  int pos = group.find(KCGlobal::baseGroup());
   if (pos >= 0)
-     group = group.mid(pos+9);
+     group = group.mid(pos+KCGlobal::baseGroup().length());
   pos = group.findRev('/');
   if (pos >= 0)
      group = group.left(pos);
Index: modulemenu.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/modulemenu.cpp,v
retrieving revision 1.8
diff -u -p -b -r1.8 modulemenu.cpp
--- modulemenu.cpp	2000/07/05 09:31:04	1.8
+++ modulemenu.cpp	2000/09/05 20:39:43
@@ -95,7 +95,7 @@ KPopupMenu *ModuleMenu::getGroupMenu(con
   KPopupMenu *menu = new KPopupMenu(parent);
   connect(menu, SIGNAL(activated(int)), this, SLOT(moduleSelected(int)));
 
-  KServiceGroup::Ptr group = KServiceGroup::group("Settings/"+path);
+  KServiceGroup::Ptr group = KServiceGroup::group(KCGlobal::baseGroup()+path);
   parent->insertItem(KGlobal::iconLoader()->loadIcon(group->icon(), KIcon::Desktop, \
KIcon::SizeSmall)  , group->caption(), menu);
 
Index: modules.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/modules.cpp,v
retrieving revision 1.18
diff -u -p -b -r1.18 modules.cpp
--- modules.cpp	2000/07/30 11:04:06	1.18
+++ modules.cpp	2000/09/05 20:39:44
@@ -27,6 +27,7 @@
 
 
 #include <kapp.h>
+#include <kdebug.h>
 #include <kglobal.h>
 #include <kservicegroup.h>
 #include <kcmodule.h>
@@ -39,6 +40,7 @@
 
 #include "modules.h"
 #include "modules.moc"
+#include "global.h"
 #include "utils.h"
 #include "proxywidget.h"
 #include "modloader.h"
@@ -204,7 +206,7 @@ const KAboutData *ConfigModule::aboutDat
 
 void ConfigModuleList::readDesktopEntries()
 {
-  readDesktopEntriesRecursive("Settings/");
+  readDesktopEntriesRecursive( KCGlobal::baseGroup() );
 }
 
 void ConfigModuleList::readDesktopEntriesRecursive(const QString &path)
Index: moduletreeview.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/moduletreeview.cpp,v
retrieving revision 1.26
diff -u -p -b -r1.26 moduletreeview.cpp
--- moduletreeview.cpp	2000/08/12 12:50:50	1.26
+++ moduletreeview.cpp	2000/09/05 20:39:46
@@ -188,7 +188,7 @@ ModuleTreeItem *ModuleTreeView::getGroup
   else
     menu = new ModuleTreeItem(this);
 
-  KServiceGroup::Ptr group = KServiceGroup::group("Settings/"+path);
+  KServiceGroup::Ptr group = KServiceGroup::group(KCGlobal::baseGroup()+path);
   QString defName = path.left(path.length()-1);
   int pos = defName.findRev('/');
   if (pos >= 0)
Index: toplevel.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/toplevel.cpp,v
retrieving revision 1.70
diff -u -p -b -r1.70 toplevel.cpp
--- toplevel.cpp	2000/09/01 05:03:57	1.70
+++ toplevel.cpp	2000/09/05 20:39:47
@@ -302,7 +302,7 @@ void TopLevel::showModule(QString deskto
 
   // locate the desktop file
   QStringList files;
-  files = KGlobal::dirs()->findAllResources("apps", \
"Settings/"+desktopFile+".desktop", TRUE); +  files = \
KGlobal::dirs()->findAllResources("apps", \
KCGlobal::baseGroup()+desktopFile+".desktop", TRUE);  
   // show all matches
   QStringList::Iterator it;


["kio.diff" (text/english)]

? ftp/RFC_for_aborting
? ftp/.ftp.cc.swp
Index: kservicegroup.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kservicegroup.cpp,v
retrieving revision 1.6
diff -u -p -b -r1.6 kservicegroup.cpp
--- kservicegroup.cpp	2000/08/07 09:01:11	1.6
+++ kservicegroup.cpp	2000/09/05 20:41:32
@@ -44,6 +44,7 @@ KServiceGroup::KServiceGroup( const QStr
      m_strIcon = config.readEntry( "Icon" );
      m_strComment = config.readEntry( "Comment" );
      m_bDeleted = config.readBoolEntry( "Hidden", false );
+     m_strBaseGroupName = config.readEntry( "X-KDE-BaseGroup" );
   }
   // Fill in defaults.
   if (m_strCaption.isEmpty())
@@ -75,7 +76,7 @@ void KServiceGroup::load( QDataStream& s
   QStringList groupList;
 
   s >> m_strCaption >> m_strIcon >>
-       m_strComment >> groupList;
+       m_strComment >> groupList >> m_strBaseGroupName;
 
   if (m_bDeep)
   {
@@ -130,7 +131,7 @@ void KServiceGroup::save( QDataStream& s
   }
 
   s << m_strCaption << m_strIcon <<
-       m_strComment << groupList;
+       m_strComment << groupList << m_strBaseGroupName;
 }
 
 KServiceGroup::List
@@ -216,6 +217,12 @@ KServiceGroup::entries(bool sort)
 	sorted.append(*sit);
 
     return sorted;
+}
+
+KServiceGroup::Ptr
+KServiceGroup::baseGroup( const QString & _baseGroupName )
+{
+    return KServiceGroupFactory::self()->findBaseGroup(_baseGroupName, true);
 }
 
 KServiceGroup::Ptr
Index: kservicegroup.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kservicegroup.h,v
retrieving revision 1.6
diff -u -p -b -r1.6 kservicegroup.h
--- kservicegroup.h	2000/08/24 12:44:48	1.6
+++ kservicegroup.h	2000/09/05 20:41:33
@@ -102,6 +102,23 @@ public:
    */
   virtual List entries(bool sorted = false);
 
+  /**
+   * @return non-empty string if the group is a special base group.
+   * By default, "Settings/" is the kcontrol base group ("settings")
+   * and "System/Screensavers/" is the screensavers base group ("screensavers").
+   * This allows moving the groups without breaking those apps.
+   *
+   * The base group is defined by the X-KDE-BaseGroup key
+   * in the .directory file.
+   */
+  QString baseGroupName() const { return m_strBaseGroupName; }
+
+  /**
+   * @return the group for the given baseGroupName
+   * Can return 0L if the directory (or the .directory file) was deleted.
+   */
+  static Ptr baseGroup( const QString &baseGroupName );
+
   static Ptr root();
   static Ptr group(const QString &relPath);
 
@@ -118,5 +135,6 @@ protected:
 
   List m_serviceList;
   bool m_bDeep;
+  QString m_strBaseGroupName;
 };
 #endif
Index: kservicegroupfactory.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kservicegroupfactory.cpp,v
retrieving revision 1.3
diff -u -p -b -r1.3 kservicegroupfactory.cpp
--- kservicegroupfactory.cpp	2000/05/21 04:26:02	1.3
+++ kservicegroupfactory.cpp	2000/09/05 20:41:33
@@ -32,12 +32,31 @@
 KServiceGroupFactory::KServiceGroupFactory()
  : KSycocaFactory( KST_KServiceGroupFactory )
 {
+   m_baseGroupDictOffset = 0;
+   if (m_str)
+   {
+      // Read Header
+      Q_INT32 i;
+      (*m_str) >> i;
+      m_baseGroupDictOffset = i;
+
+      int saveOffset = m_str->device()->at();
+      // Init index tables
+      m_baseGroupDict = new KSycocaDict(m_str, m_baseGroupDictOffset);
+      m_str->device()->at(saveOffset);
+   }
+   else
+   {
+      // Build new database
+      m_baseGroupDict = new KSycocaDict();
+   }
    _self = this;
 }
 
 KServiceGroupFactory::~KServiceGroupFactory()
 {
    _self = 0L;
+   delete m_baseGroupDict;
 }
 
 KServiceGroupFactory * KServiceGroupFactory::self()
@@ -70,6 +89,29 @@ KServiceGroup * KServiceGroupFactory::fi
    return newGroup;
 }
 
+KServiceGroup * KServiceGroupFactory::findBaseGroup(const QString &_baseGroupName, bool deep)
+{
+   if (!m_baseGroupDict) return 0; // Error!
+
+   // Warning : this assumes we're NOT building a database
+   // But since findServiceByName isn't called in that case...
+   // [ see KServiceTypeFactory for how to do it if needed ]
+
+   int offset = m_baseGroupDict->find_string( _baseGroupName );
+   if (!offset) return 0; // Not found
+
+   KServiceGroup * newGroup = createGroup(offset, deep);
+
+   // Check whether the dictionary was right.
+   if (newGroup && (newGroup->baseGroupName() != _baseGroupName))
+   {
+      // No it wasn't...
+      delete newGroup;
+      newGroup = 0; // Not found
+   }
+   return newGroup;
+}
+
 KServiceGroup* KServiceGroupFactory::createGroup(int offset, bool deep)
 {
    KServiceGroup * newEntry = 0L;
Index: kservicegroupfactory.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kservicegroupfactory.h,v
retrieving revision 1.2
diff -u -p -b -r1.2 kservicegroupfactory.h
--- kservicegroupfactory.h	2000/05/11 22:10:30	1.2
+++ kservicegroupfactory.h	2000/09/05 20:41:34
@@ -55,12 +55,19 @@ public:
   KServiceGroup * findGroupByDesktopPath( const QString &_name, bool deep = true );
 
   /**
+   * Find a base group by name, e.g. "settings"
+   */
+  KServiceGroup * findBaseGroup( const QString &_baseGroupName, bool deep = true );
+
+  /**
    * @return the unique service group factory, creating it if necessary
    */
   static KServiceGroupFactory * self();
 protected:
   KServiceGroup* createGroup(int offset, bool deep);
   KServiceGroup* createEntry(int offset);
+  KSycocaDict *m_baseGroupDict;
+  int m_baseGroupDictOffset;
 
 private:
   static KServiceGroupFactory *_self;
Index: ksycoca.h
===================================================================
RCS file: /home/kde/kdelibs/kio/ksycoca.h,v
retrieving revision 1.33
diff -u -p -b -r1.33 ksycoca.h
--- ksycoca.h	2000/07/18 13:06:47	1.33
+++ ksycoca.h	2000/09/05 20:41:34
@@ -33,7 +33,7 @@ class KSycocaFactoryList;
  * If the existing file is outdated, it will not get read
  * but instead we'll ask kded to regenerate a new one...
 */
-#define KSYCOCA_VERSION 27
+#define KSYCOCA_VERSION 29
 
 /**
  * @internal
Index: kded/kbuildservicefactory.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kded/kbuildservicefactory.h,v
retrieving revision 1.7
diff -u -p -b -r1.7 kbuildservicefactory.h
--- kded/kbuildservicefactory.h	2000/07/04 11:19:24	1.7
+++ kded/kbuildservicefactory.h	2000/09/05 20:41:36
@@ -53,7 +53,7 @@ public:
   void addEntry(KSycocaEntry *newEntry, const char *resource);
 
   /**
-   * Write out service type specific index files.
+   * Write out service specific index files.
    */
   virtual void save(QDataStream &str);
 
Index: kded/kbuildservicegroupfactory.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kded/kbuildservicegroupfactory.cpp,v
retrieving revision 1.6
diff -u -p -b -r1.6 kbuildservicegroupfactory.cpp
--- kded/kbuildservicegroupfactory.cpp	2000/07/08 00:28:09	1.6
+++ kded/kbuildservicegroupfactory.cpp	2000/09/05 20:41:37
@@ -105,5 +105,35 @@ void
 KBuildServiceGroupFactory::addEntry( KSycocaEntry *newEntry, const char *resource)
 {
    KSycocaFactory::addEntry(newEntry, resource);
+   KServiceGroup * serviceGroup = (KServiceGroup *) newEntry;
+
+   if ( !serviceGroup->baseGroupName().isEmpty() )
+   {
+       m_baseGroupDict->add( serviceGroup->baseGroupName(), newEntry );
+   }
 }
 
+void
+KBuildServiceGroupFactory::saveHeader(QDataStream &str)
+{
+   KSycocaFactory::saveHeader(str);
+
+   str << (Q_INT32) m_baseGroupDictOffset;
+}
+
+void
+KBuildServiceGroupFactory::save(QDataStream &str)
+{
+   KSycocaFactory::save(str);
+
+   m_baseGroupDictOffset = str.device()->at();
+   m_baseGroupDict->save(str);
+
+   int endOfFactoryData = str.device()->at();
+
+   // Update header (pass #3)
+   saveHeader(str);
+
+   // Seek to end.
+   str.device()->at(endOfFactoryData);
+}
Index: kded/kbuildservicegroupfactory.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kded/kbuildservicegroupfactory.h,v
retrieving revision 1.6
diff -u -p -b -r1.6 kbuildservicegroupfactory.h
--- kded/kbuildservicegroupfactory.h	2000/07/08 00:28:09	1.6
+++ kded/kbuildservicegroupfactory.h	2000/09/05 20:41:37
@@ -53,6 +53,16 @@ public:
    * Add a new entry
    */
   virtual void addEntry( KSycocaEntry *newEntry, const char *resource );
+
+  /**
+   * Write out servicegroup  specific index files.
+   */
+  virtual void save(QDataStream &str);
+
+  /**
+   * Write out header information
+   */
+  virtual void saveHeader(QDataStream &str);
 
 };
 

["screensaver.diff" (text/x-c)]

Index: Makefile.am
===================================================================
RCS file: /home/kde/kdebase/kcontrol/screensaver/Makefile.am,v
retrieving revision 1.1
diff -u -p -b -r1.1 Makefile.am
--- Makefile.am	2000/06/28 11:09:26	1.1
+++ Makefile.am	2000/09/05 20:39:52
@@ -8,7 +8,7 @@ lib_LTLIBRARIES = libkcm_screensaver.la
 
 libkcm_screensaver_la_SOURCES = scrnsave.cpp
 libkcm_screensaver_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined
-libkcm_screensaver_la_LIBADD = $(LIB_KDEUI) $(DPMSLIB)
+libkcm_screensaver_la_LIBADD = $(LIB_KSYCOCA) $(DPMSLIB)
 libkcm_screensaver_la_METASOURCES = scrnsave.moc
 
 noinst_HEADERS = scrnsave.h
Index: scrnsave.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/screensaver/scrnsave.cpp,v
retrieving revision 1.6
diff -u -p -b -r1.6 scrnsave.cpp
--- scrnsave.cpp	2000/08/10 10:29:39	1.6
+++ scrnsave.cpp	2000/09/05 20:39:57
@@ -35,6 +35,7 @@
 #include <qwhatsthis.h>
 
 #include <kapp.h>
+#include <kdebug.h>
 #include <kprocess.h>
 #include <ksimpleconfig.h>
 #include <knuminput.h>
@@ -46,6 +47,7 @@
 #include <kcmodule.h>
 #include <kglobal.h>
 #include <dcopclient.h>
+#include <kservicegroup.h>
 
 #include <X11/Xlib.h>
 
@@ -147,9 +149,14 @@ KScreenSaver::KScreenSaver(QWidget *pare
                                      "apps/ScreenSavers/");
 
     // Add KDE specific screensaver path
+    QString relPath="System/ScreenSavers/";
+    KServiceGroup::Ptr servGroup = KServiceGroup::baseGroup( "screensavers" );
+    if (servGroup)
+      relPath=servGroup->relPath();
+
     KGlobal::dirs()->addResourceType("scrsav",
                                      KGlobal::dirs()->kde_default("apps") +
-                                     "System/ScreenSavers/");
+                                     relPath);
 
     readSettings();
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic