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

List:       kde-commits
Subject:    playground/sysadmin/kamion
From:       Milan Mitrovic <milhouse () bankerinter ! net>
Date:       2005-08-31 20:46:17
Message-ID: 1125521177.542965.15106.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 455554 by milhouse:

Environment variable expansion added.


 M             kamion.kdevelop.pcs  
 M  +8 -17     kamion.kdevses  
 M  +3 -16     src/definitions/e-mail.xml  
 M  +5 -5      src/definitions/notes.xml  
 M  +8 -1      src/resourceinstaller.cpp  
 M  +23 -13    src/resourcesupplier.cpp  


--- trunk/playground/sysadmin/kamion/kamion.kdevses #455553:455554
@@ -1,31 +1,22 @@
 <?xml version = '1.0' encoding = 'UTF-8'?>
 <!DOCTYPE KDevPrjSession>
 <KDevPrjSession>
- <DocsAndViews NumberOfDocuments="8" >
+ <DocsAndViews NumberOfDocuments="5" >
   <Doc0 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/kamion.cpp" >
-   <View0 Type="Source" />
+   <View0 line="0" Type="Source" />
   </Doc0>
   <Doc1 NumberOfViews="1" \
                URL="file:///home/milhouse/projects/sysadmin/kamion/src/definitions/e-mail.xml" >
-   <View0 line="24" Type="Source" />
+   <View0 line="9" Type="Source" />
   </Doc1>
   <Doc2 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/definitions/notes.xml" \
                >
-   <View0 line="13" Type="Source" />
+   <View0 line="4" Type="Source" />
   </Doc2>
-  <Doc3 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/kamion.h" >
-   <View0 line="18" Type="Source" />
+  <Doc3 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourceinstaller.h" >
+   <View0 line="25" Type="Source" />
   </Doc3>
-  <Doc4 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourceextractor.h" >
-   <View0 line="34" Type="Source" />
+  <Doc4 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourceinstaller.cpp" \
> +   <View0 line="101" Type="Source" />
   </Doc4>
-  <Doc5 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourceextractor.cpp" \
                >
-   <View0 line="30" Type="Source" />
-  </Doc5>
-  <Doc6 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourcepacker.h" >
-   <View0 line="21" Type="Source" />
-  </Doc6>
-  <Doc7 NumberOfViews="1" URL="file:///home/milhouse/projects/sysadmin/kamion/src/resourcepacker.cpp" >
-   <View0 line="125" Type="Source" />
-  </Doc7>
  </DocsAndViews>
  <pluginList>
   <kdevdebugger>
--- trunk/playground/sysadmin/kamion/src/definitions/e-mail.xml #455553:455554
@@ -4,21 +4,8 @@
 	<version>1.*</version>
 	<icon>kontact_mail</icon>
 	<data>
-		<config>@config/kmailrc</config>
-		<tree><config-entry file="@config/kmailrc" group="General" key="folders" /></tree>
-		<tree>@data/kmail</tree>
+		<config>$config/kmailrc</config>
+		<tree><config-entry file="$config/kmailrc" group="General" key="folders" /></tree>
+		<tree>$data/kmail</tree>
 	</data>
-	<optional>
-		<name>file mod test</name>
-		<data>
-			<config>@config/kmail.eventsrc</config>
-		</data>
-	</optional>
-	<optional>
-		<name>Exclude test</name>
-		<data>
-			<config group="Geometry" exclude="true">@config/kmailrc</config>
-			<config group="Geometry" key="FolderList">@config/kmailrc</config>
-		</data>
-	</optional>
 </resource>
--- trunk/playground/sysadmin/kamion/src/definitions/notes.xml #455553:455554
@@ -3,15 +3,15 @@
 	<app>knotes</app>
 	<version>1.*</version>
 	<data>
-		<config>@config/knotesrc</config>
-		<tree>@data/knotes</tree>
+		<config>$config/knotesrc</config>
+		<tree>$data/knotes</tree>
 	</data>
 	<optional>
 		<name>exfile test</name>
 		<data>
-			<file base="@data/knotes/" exclude="true">.*~</file>
-			<config exclude="true">@config/knotesrc</config>
-			<config group="Network">@config/knotesrc</config>
+			<file base="$data/knotes/" exclude="true">.*~</file>
+			<config exclude="true">$config/knotesrc</config>
+			<config group="Network">$config/knotesrc</config>
 		</data>
 	</optional>
 </resource>
--- trunk/playground/sysadmin/kamion/src/resourceinstaller.cpp #455553:455554
@@ -107,7 +107,14 @@
 	} else if (varPath.section('/', 0, 0) == "home") {
 		result = QDir::home().path() + varPath.section('/', 1);
 	} else {
-		result = KGlobal::dirs()->localkdedir() + '/' + KGlobal::dirs()->kde_default(varPath.section('/', 0, \
0)) + '/' + varPath.section('/', 1); +		QString var = varPath.section('/', 0, 0);
+		QStringList types = KGlobal::dirs()->allTypes();
+		if (types.contains(var)) {
+			result = KGlobal::dirs()->localkdedir() + '/' + KGlobal::dirs()->kde_default(var) + '/' + \
varPath.section('/', 1); +		} else {
+			result = getenv(var);
+			result += '/' + varPath.section('/', 1);
+		}
 	}
 	return result;
 }
--- trunk/playground/sysadmin/kamion/src/resourcesupplier.cpp #455553:455554
@@ -19,14 +19,17 @@
  ***************************************************************************/
 #include "resourcesupplier.h"
 
-#include <kglobal.h>
-#include <kstandarddirs.h>
-#include <ksimpleconfig.h>
+#include <stdlib.h>
+
 #include <qdir.h>
 #include <qfile.h>
 #include <qregexp.h>
 #include <qstringlist.h>
 
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <ksimpleconfig.h>
+
 #include <iostream>
 using namespace std;
 
@@ -265,8 +268,8 @@
 	QString target;
 	bool tree = element.tagName() == "tree";
 	if (!base.isNull()) {
-		if (base[0] != '@') {
-			target = "@none/" + base;
+		if (base[0] != '$') {
+			target = "$none/" + base;
 		} else {
 			target = base;
 		}
@@ -296,10 +299,10 @@
 		QStringList::iterator it = files.begin();
 		QStringList::iterator end = files.end();
 		for (; it != end; ++it) {
-			if ((*it)[0] == '@') {
+			if ((*it)[0] == '$') {
 				target = (*it).section('/', 0, -2);
 			} else {
-				target = "@none/" + (*it).section('/', 0, -2);
+				target = "$none/" + (*it).section('/', 0, -2);
 			}
 			QString name = (*it).section('/', -1);
 			if (tree) {
@@ -394,8 +397,8 @@
 	QRegExp grx(element.attribute("group"));
 	QRegExp krx(element.attribute("key"));
 	QRegExp mrx(element.attribute("mask"));
-	QString base = element.attribute("base", "@none");
-	if (base == "@none") {
+	QString base = element.attribute("base", "$none");
+	if (base == "$none") {
 		QString file = expandVars(element.attribute("file"));
 		KSimpleConfig configFile(file);
 		QStringList groupList = configFile.groupList();
@@ -543,14 +546,21 @@
  */
 QString ResourceSupplier::expandVars(QString varPath) {
 	QString result;
-	if (varPath[0] != '@') {
+	if (varPath[0] != '$') {
 		result = varPath;
-	} else if (varPath.section('/', 0, 0) == "@none") {
+	} else if (varPath.section('/', 0, 0) == "$none") {
 		result = varPath.section('/', 1);
-	} else if (varPath.section('/', 0, 0) == "@home") {
+	} else if (varPath.section('/', 0, 0) == "$home") {
 		result = QDir::home().path() + varPath.section('/', 1);
 	} else {
-		result = KGlobal::dirs()->localkdedir() + '/' + KGlobal::dirs()->kde_default(varPath.section('/', 0, \
0).remove('@')) + '/' + varPath.section('/', 1); +		QString var = varPath.section('/', 0, 0).remove('$');
+		QStringList types = KGlobal::dirs()->allTypes();
+		if (types.contains(var)) {
+			result = KGlobal::dirs()->localkdedir() + '/' + KGlobal::dirs()->kde_default(var) + '/' + \
varPath.section('/', 1); +		} else {
+			result = getenv(var);
+			result += '/' + varPath.section('/', 1);
+		}
 	}
 	return result;
 }


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

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