[rkward-cvs] rkward/rkward/misc rkcommonfunctions.cpp,1.1,1.2 rkcommonfunctions.h,1.1,1.2
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Mon Apr 10 13:11:47 UTC 2006
- Previous message: [rkward-cvs] rkward/rkward/dataeditor twintabledatamember.cpp,1.12,1.13 twintablemember.cpp,1.19,1.20 twintablemember.h,1.17,1.18 twintablemetamember.cpp,1.14,1.15
- Next message: [rkward-cvs] rkward/rkward/windows rkcommandeditorwindow.cpp,1.26,1.27 rkcommandeditorwindowpart.rc,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/rkward/rkward/rkward/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26092
Modified Files:
rkcommonfunctions.cpp rkcommonfunctions.h
Log Message:
Remove some clutter in RKCommandEditorWindow
Index: rkcommonfunctions.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/misc/rkcommonfunctions.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcommonfunctions.cpp 17 Oct 2005 18:53:35 -0000 1.1
--- rkcommonfunctions.cpp 10 Apr 2006 13:11:45 -0000 1.2
***************
*** 57,59 ****
--- 57,99 ----
}
+ void moveContainer (KXMLGUIClient *client, const QString &tagname, const QString &name, const QString &to_name, bool recursive) {
+ QDomDocument doc = client->xmlguiBuildDocument ();
+ if (doc.documentElement ().isNull ()) doc = client->domDocument ();
+
+ // find the given elements
+ QDomElement e = doc.documentElement ();
+
+ QDomElement from_elem;
+ QDomElement to_elem;
+
+ QDomNodeList list = e.elementsByTagName (tagname);
+ int count = list.count ();
+ for (int i = 0; i < count; ++i) {
+ QDomElement elem = list.item (i).toElement ();
+ if (elem.isNull ()) continue;
+ if (elem.attribute ("name") == name) {
+ from_elem = elem;
+ } else if (elem.attribute ("name") == to_name) {
+ to_elem = elem;
+ }
+ }
+
+ // move
+ from_elem.parentNode ().removeChild (from_elem);
+ to_elem.appendChild (from_elem);
+
+ // set result
+ client->setXMLGUIBuildDocument (doc);
+
+ // recurse
+ if (recursive) {
+ QPtrList <KXMLGUIClient> *children = const_cast<QPtrList <KXMLGUIClient> *> (client->childClients ());
+ if (children) {
+ for (KXMLGUIClient *child = children->first (); child; child = children->next ()) {
+ moveContainer (child, tagname, name, to_name, true);
+ }
+ }
+ }
+ }
+
} // namespace
Index: rkcommonfunctions.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/misc/rkcommonfunctions.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcommonfunctions.h 17 Oct 2005 18:53:35 -0000 1.1
--- rkcommonfunctions.h 10 Apr 2006 13:11:45 -0000 1.2
***************
*** 19,22 ****
--- 19,23 ----
class QStringList;
+ class QString;
class QDomNode;
class KXMLGUIClient;
***************
*** 32,35 ****
--- 33,38 ----
/** remove containers (actions, menus, etc.) with attribute 'name="..."' from KXMLGUIClient from s XML gui, where "..." is any of the strings in names. If recursive, also removes those containers from child clients. */
void removeContainers (KXMLGUIClient *from, const QStringList &names, bool recursive);
+ /** move container (action, menu, etc.) with tagname "tagname" and attribute 'name="..."' to be a child node of the tag with tagname=tagname and attribute name=to_name. Can be used to make a top-level menu a sub-menu of another menu instead */
+ void moveContainer (KXMLGUIClient *client, const QString &tagname, const QString &name, const QString &to_name, bool recursive);
};
- Previous message: [rkward-cvs] rkward/rkward/dataeditor twintabledatamember.cpp,1.12,1.13 twintablemember.cpp,1.19,1.20 twintablemember.h,1.17,1.18 twintablemetamember.cpp,1.14,1.15
- Next message: [rkward-cvs] rkward/rkward/windows rkcommandeditorwindow.cpp,1.26,1.27 rkcommandeditorwindowpart.rc,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the rkward-tracker
mailing list