summaryrefslogtreecommitdiffstats
path: root/quanta/src/dcopquanta.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /quanta/src/dcopquanta.cpp
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/src/dcopquanta.cpp')
-rw-r--r--quanta/src/dcopquanta.cpp113
1 files changed, 113 insertions, 0 deletions
diff --git a/quanta/src/dcopquanta.cpp b/quanta/src/dcopquanta.cpp
new file mode 100644
index 00000000..55ff068e
--- /dev/null
+++ b/quanta/src/dcopquanta.cpp
@@ -0,0 +1,113 @@
+/***************************************************************************
+ dcopquanta.cpp - description
+ -------------------
+ begin : Thu Mar 4 2004
+ copyright : (C) 2004 Andras Mantia <amantia@kde.org>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+//kde includes
+
+//qt includes
+#include <qregexp.h>
+
+//app includes
+#include "dcopquanta.h"
+#include "node.h"
+
+extern GroupElementMapList globalGroupMap;
+
+DCOPQuanta::DCOPQuanta() : DCOPObject("QuantaIf")
+{
+}
+
+QStringList DCOPQuanta::selectors(const QString& tag)
+{
+ const QRegExp rx("\\.|\\#|\\:");
+ QStringList selectorList;
+ GroupElementMapList::Iterator it;
+ for ( it = globalGroupMap.begin(); it != globalGroupMap.end(); ++it )
+ {
+ QString key = it.key();
+ if (key.startsWith("Selectors|"))
+ {
+ QString selectorName = key.mid(10);
+ int index = selectorName.find(':');
+ if (index != -1)
+ selectorName = selectorName.mid(0, index);
+ QString tmpStr;
+ index = selectorName.find(rx);
+ if (index != -1)
+ {
+ tmpStr = selectorName.left(index).lower();
+ } else
+ {
+ tmpStr = selectorName;
+ }
+ if (tmpStr.isEmpty() || tag.lower() == tmpStr || tmpStr == "*")
+ {
+ tmpStr = selectorName.mid(index + 1).replace('.',' ');
+ if (!tmpStr.isEmpty() && !selectorList.contains(tmpStr))
+ selectorList << tmpStr;
+ }
+ }
+ }
+ return selectorList;
+}
+
+QStringList DCOPQuanta::idSelectors()
+{
+ QStringList selectorList;
+ GroupElementMapList::Iterator it;
+ for ( it = globalGroupMap.begin(); it != globalGroupMap.end(); ++it )
+ {
+ QString key = it.key();
+ if (key.startsWith("Selectors|"))
+ {
+ QString selectorName = key.mid(10);
+ QString tmpStr;
+ if (selectorName.startsWith("#"))
+ {
+ selectorList << selectorName.mid(1);
+ }
+ }
+ }
+ return selectorList;
+}
+
+QStringList DCOPQuanta::groupElements(const QString& group)
+{
+ QStringList elementList;
+ GroupElementMapList::Iterator it;
+ for ( it = globalGroupMap.begin(); it != globalGroupMap.end(); ++it )
+ {
+ QString key = it.key();
+ if (key.startsWith(group + "|"))
+ {
+ QString name = key.mid(10);
+ int index = name.find(':');
+ if (index != -1)
+ name = name.mid(0, index);
+ QString tmpStr;
+ index = name.find("|");
+ if (index != -1)
+ {
+ tmpStr = name.left(index).lower();
+ } else
+ {
+ tmpStr = name;
+ }
+
+ elementList << tmpStr;
+ }
+ }
+ return elementList;
+}