[rkward-cvs] rkward/rkward/plugin rkcomponentmap.cpp,1.1,1.2 rkcomponentmap.h,1.1,1.2 rkpluginhandle.cpp,1.3,1.4
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Sun Sep 11 18:53:07 UTC 2005
Update of /cvsroot/rkward/rkward/rkward/plugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23838/rkward/plugin
Modified Files:
rkcomponentmap.cpp rkcomponentmap.h rkpluginhandle.cpp
Log Message:
Finish restructuring plugin-hierarchy creation. Allow to select several .pluginmap files in Settings->Configure RKWard. Some fixes and cleanups
Index: rkpluginhandle.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkpluginhandle.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rkpluginhandle.cpp 9 Sep 2005 13:02:57 -0000 1.3
--- rkpluginhandle.cpp 11 Sep 2005 18:53:04 -0000 1.4
***************
*** 20,32 ****
--- 20,36 ----
#include "../rkward.h"
#include "../rkglobals.h"
+ #include "../debug.h"
RKPluginHandle::RKPluginHandle (const QString &filename, RKComponentType type) : QObject (RKGlobals::rkApp ()), RKComponentHandle (filename, type) {
+ RK_TRACE (PLUGIN);
}
RKPluginHandle::~RKPluginHandle () {
+ RK_TRACE (PLUGIN);
}
void RKPluginHandle::activated () {
+ RK_TRACE (PLUGIN);
new RKPlugin (getFilename ());
}
Index: rkcomponentmap.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponentmap.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcomponentmap.h 9 Sep 2005 13:02:57 -0000 1.1
--- rkcomponentmap.h 11 Sep 2005 18:53:04 -0000 1.2
***************
*** 39,43 ****
RKComponentHandle (const QString &filename, RKComponentType type);
! ~RKComponentHandle ();
QString getFilename () { return filename; };
--- 39,43 ----
RKComponentHandle (const QString &filename, RKComponentType type);
! virtual ~RKComponentHandle ();
QString getFilename () { return filename; };
***************
*** 71,76 ****
~RKComponentMap ();
! /** adds all Plugins / components in a .pluginmap-file. Also takes care of creating the menu-items, etc. */
! void addPluginMap (const QString& plugin_map_file);
/** clears out (and deletes) all components / plugins */
void clear ();
--- 71,77 ----
~RKComponentMap ();
! /** adds all Plugins / components in a .pluginmap-file. Also takes care of creating the menu-items, etc.
! @returns number of plugins (i.e. stand-alone components/menu-entries) added successfully */
! int addPluginMap (const QString& plugin_map_file);
/** clears out (and deletes) all components / plugins */
void clear ();
***************
*** 81,86 ****
/** recurse into a lower menu-level
@param parent the parent menu
! @param element the QDomElement containing the description for the new submenu */
! void addSubMenu (RKMenu* parent, const QDomElement& element, const QString& cnamespace);
/** typedef for easy reference to iterator */
--- 82,88 ----
/** recurse into a lower menu-level
@param parent the parent menu
! @param element the QDomElement containing the description for the new submenu
! @returns number of plugins/menu-entries added successfully */
! int addSubMenu (RKMenu* parent, const QDomElement& element, const QString& cnamespace);
/** typedef for easy reference to iterator */
Index: rkcomponentmap.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponentmap.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcomponentmap.cpp 9 Sep 2005 13:02:57 -0000 1.1
--- rkcomponentmap.cpp 11 Sep 2005 18:53:04 -0000 1.2
***************
*** 38,42 ****
}
! void RKComponentMap::addPluginMap (const QString& plugin_map_file) {
RK_TRACE (PLUGIN);
--- 38,42 ----
}
! int RKComponentMap::addPluginMap (const QString& plugin_map_file) {
RK_TRACE (PLUGIN);
***************
*** 44,48 ****
QDomElement document_element = xml->openXMLFile (plugin_map_file, DL_ERROR);
! if (xml->highestError () >= DL_ERROR) return;
QString prefix = QFileInfo (plugin_map_file).dirPath (true) + "/" + xml->getStringAttribute(document_element, "base_prefix", "", DL_WARNING);
--- 44,48 ----
QDomElement document_element = xml->openXMLFile (plugin_map_file, DL_ERROR);
! if (xml->highestError () >= DL_ERROR) return (0);
QString prefix = QFileInfo (plugin_map_file).dirPath (true) + "/" + xml->getStringAttribute(document_element, "base_prefix", "", DL_WARNING);
***************
*** 71,77 ****
list = xml->getChildElements (element, "menu", DL_ERROR);
for (XMLChildList::const_iterator it=list.begin (); it != list.end (); ++it) {
! addSubMenu (0, (*it), cnamespace);
}
}
--- 71,79 ----
list = xml->getChildElements (element, "menu", DL_ERROR);
+ int counter = 0;
for (XMLChildList::const_iterator it=list.begin (); it != list.end (); ++it) {
! counter += addSubMenu (0, (*it), cnamespace);
}
+ return counter;
}
***************
*** 81,86 ****
RKGlobals::rkApp ()->getMenuList ()->clear ();
for (ComponentMap::iterator it = components.begin (); it != components.end (); ++it) {
! delete it.data ();
}
}
--- 83,89 ----
RKGlobals::rkApp ()->getMenuList ()->clear ();
for (ComponentMap::iterator it = components.begin (); it != components.end (); ++it) {
! delete (it.data ());
}
+ components.clear ();
}
***************
*** 91,97 ****
}
! void RKComponentMap::addSubMenu (RKMenu* parent, const QDomElement& element, const QString& cnamespace) {
RK_TRACE (PLUGIN);
XMLHelper* xml = XMLHelper::getStaticHelper ();
--- 94,101 ----
}
! int RKComponentMap::addSubMenu (RKMenu* parent, const QDomElement& element, const QString& cnamespace) {
RK_TRACE (PLUGIN);
+ int counter = 0;
XMLHelper* xml = XMLHelper::getStaticHelper ();
***************
*** 108,112 ****
for (XMLChildList::const_iterator it=list.begin (); it != list.end (); ++it) {
! addSubMenu (menu, (*it), cnamespace);
}
--- 112,116 ----
for (XMLChildList::const_iterator it=list.begin (); it != list.end (); ++it) {
! counter += addSubMenu (menu, (*it), cnamespace);
}
***************
*** 122,127 ****
--- 126,133 ----
} else {
menu->addEntry (id, static_cast<RKPluginHandle*> (handle), xml->getStringAttribute ((*it), "label", i18n ("(no label)"), DL_WARNING));
+ counter++;
}
}
+ return counter;
}
More information about the rkward-tracker
mailing list