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

List:       kdevelop-devel
Subject:    KDE4 Patch to allow testing/execution of uninstalled kparts/XMLGUI applications
From:       Adam Treat <treat () kde ! org>
Date:       2005-08-08 16:15:54
Message-ID: 200508081215.54790.treat () kde ! org
[Download RAW message or body]

Hello,

I have a simple patch to KStandardDirs that will allow developers to test and 
run KParts/XMLGUI applications without having to install them first.

What I've done is to simply look for a '.krcdirs' file in the same directory 
where the application is currently being executed.  This file is a simple INI 
file like so:

[KStandardDirs]
module = .libs
data = .

The file is read and each key is added to KStandardDirs by using the 
addResourceDir( const char* type, const QString &absDir ) method.  When the 
application is loaded the KDE defaults for KStandardDirs are set and this all 
takes place before the KParts/XMLGUI machinery jumps in.  It is also done 
before the configuration system kicks in, so I had to use QSettings for the 
INI file reader.

Advantages include:

1.  It is simple.
2.  It is build system independent.
3.  It can be used to find icons/wallpapers and other resources without them 
having to be installed.
4.  KDevelop can automatically create this file and integrate it into the 
various application templates without any hassle.

So, whaddya think?  Should I commit?

Adam

-- 
I'm running a Marathon in December!
HELP ME SAVE LIVES and Donate Today!
http://helpmesavelives.blogspot.com/

["kstandarddirs_patch_for_noinstallparts.patch" (text/x-diff)]

Index: kstandarddirs.cpp
===================================================================
--- kstandarddirs.cpp	(revision 444071)
+++ kstandarddirs.cpp	(working copy)
@@ -1265,8 +1265,29 @@
   return s->defaultbindir;
 }
 
+void KStandardDirs::addResourcesFrom_krcdirs()
+{
+    QString localFile = QDir::currentPath() + QDir::separator() + ".krcdirs";
+    if (!QFile::exists(localFile))
+        return;
+
+    QSettings iniFile(localFile, QSettings::IniFormat);
+    iniFile.beginGroup("KStandardDirs");
+    QStringList resources = iniFile.allKeys();
+    foreach(QString key, resources)
+    {
+        QDir path(iniFile.value(key).toString());
+        if (!path.exists())
+            continue;
+
+        if(path.makeAbsolute())
+            addResourceDir(key.ascii(), path.path());
+    }
+}
+
 void KStandardDirs::addKDEDefaults()
 {
+    addResourcesFrom_krcdirs();
     QStringList kdedirList;
 
     // begin KDEDIRS
Index: kstandarddirs.h
===================================================================
--- kstandarddirs.h	(revision 444071)
+++ kstandarddirs.h	(working copy)
@@ -636,6 +636,8 @@
 	void addXdgConfigPrefix( const QString& dir, bool priority );
 	void addXdgDataPrefix( const QString& dir, bool priority );
 
+	void addResourcesFrom_krcdirs();
+
 	// If priority is true, the directory is added before any other,
 	// otherwise after
 	bool addResourceType( const char *type,

_______________________________________________
KDevelop-devel mailing list
KDevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel

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

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