[rkward-cvs] SF.net SVN: rkward: [1197] trunk/rkward/rkward/plugin

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 22 23:45:03 UTC 2007


Revision: 1197
          http://svn.sourceforge.net/rkward/?rev=1197&view=rev
Author:   tfry
Date:     2007-01-22 15:45:03 -0800 (Mon, 22 Jan 2007)

Log Message:
-----------
Small improvement to context plugins: Make "incontext" property a string specifying which context is used

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkcomponentcontext.cpp
    trunk/rkward/rkward/plugin/rkcomponentcontext.h
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp

Modified: trunk/rkward/rkward/plugin/rkcomponentcontext.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentcontext.cpp	2007-01-22 23:44:37 UTC (rev 1196)
+++ trunk/rkward/rkward/plugin/rkcomponentcontext.cpp	2007-01-22 23:45:03 UTC (rev 1197)
@@ -23,8 +23,10 @@
 
 #include "../debug.h"
 
-RKContextMap::RKContextMap () : RKComponentGUIXML () {
+RKContextMap::RKContextMap (const QString &id) : RKComponentGUIXML () {
 	RK_TRACE (PLUGIN);
+
+	RKContextMap::id = id;
 }
 
 RKContextMap::~RKContextMap () {
@@ -42,7 +44,7 @@
 RKContextHandler *RKContextMap::makeContextHandler (QObject *parent) {
 	RK_TRACE (PLUGIN);
 
-	RKContextHandler *handler = new RKContextHandler (parent, gui_xml);
+	RKContextHandler *handler = new RKContextHandler (parent, gui_xml, id);
 	for (QStringList::const_iterator it = component_ids.constBegin (); it != component_ids.constEnd (); ++it) {
 		RKComponentHandle *handle = RKComponentMap::getComponentHandle (*it);
 		if (handle->isPlugin ()) {
@@ -61,12 +63,14 @@
 /////////////////// END RKContextMap /////////////////////
 //////////////// BEGIN RKContextHandler //////////////////
 
-RKContextHandler::RKContextHandler (QObject *parent, const QDomDocument &gui_xml) : QObject (parent), RKComponentBase (), KXMLGUIClient () {
+RKContextHandler::RKContextHandler (QObject *parent, const QDomDocument &gui_xml, const QString &id) : QObject (parent), RKComponentBase (), KXMLGUIClient () {
 	RK_TRACE (PLUGIN);
 
 	setXMLGUIBuildDocument (gui_xml);
 
-	addChild ("incontext", new RKComponentPropertyBool (this, false, true));
+	RKComponentPropertyBase *incontext = new RKComponentPropertyBase (this, false);
+	incontext->setValue (id);
+	addChild ("incontext", incontext);
 }
 
 RKContextHandler::~RKContextHandler () {

Modified: trunk/rkward/rkward/plugin/rkcomponentcontext.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentcontext.h	2007-01-22 23:44:37 UTC (rev 1196)
+++ trunk/rkward/rkward/plugin/rkcomponentcontext.h	2007-01-22 23:45:03 UTC (rev 1197)
@@ -28,7 +28,7 @@
 
 class RKContextMap : public RKComponentGUIXML {
 public:
-	RKContextMap ();
+	RKContextMap (const QString &id);
 	~RKContextMap ();
 
 	int create (const QDomElement &context_element, const QString &component_namespace);
@@ -37,6 +37,7 @@
 	void addedEntry (const QString &id, RKComponentHandle * /* handle */);
 private:
 	QStringList component_ids;
+	QString id;
 };
 
 
@@ -45,7 +46,7 @@
 	Q_OBJECT
 friend class RKContextMap;
 protected:
-	RKContextHandler (QObject *parent, const QDomDocument &gui_xml);
+	RKContextHandler (QObject *parent, const QDomDocument &gui_xml, const QString &id);
 	~RKContextHandler ();
 
 	void addAction (const QString &id, RKStandardComponentHandle *handle);

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2007-01-22 23:44:37 UTC (rev 1196)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2007-01-22 23:45:03 UTC (rev 1197)
@@ -264,7 +264,7 @@
 	list = xml->getChildElements (document_element, "context", DL_INFO);
 	for (XMLChildList::const_iterator it=list.constBegin (); it != list.constEnd (); ++it) {
 		QString id = xml->getStringAttribute (*it, "id", QString::null, DL_ERROR);
-		RKContextMap *context = new RKContextMap ();
+		RKContextMap *context = new RKContextMap (id);
 		counter += context->create (*it, cnamespace);
 		contexts.insert (id, context);
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list