[rkward-cvs] rkward/rkward rkglobals.cpp,1.6,1.7 rkglobals.h,1.5,1.6 rkward.cpp,1.84,1.85 rkward.h,1.36,1.37

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Sep 9 13:02:59 UTC 2005


Update of /cvsroot/rkward/rkward/rkward
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12794/rkward

Modified Files:
	rkglobals.cpp rkglobals.h rkward.cpp rkward.h 
Log Message:
Changed the way plugin-handles and corresponding menu-entries are created. Added some first building blocks for component infrastructure. Some polishing still needed.

Index: rkward.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -C2 -d -r1.84 -r1.85
*** rkward.cpp	29 Apr 2005 16:47:30 -0000	1.84
--- rkward.cpp	9 Sep 2005 13:02:57 -0000	1.85
***************
*** 60,64 ****
  #include "misc/rkmenu.h"
  #include "misc/rkmenulist.h"
! #include "plugin/rkpluginhandle.h"
  //#include "rkoutputwindow.h"
  #include "settings/rksettings.h"
--- 60,64 ----
  #include "misc/rkmenu.h"
  #include "misc/rkmenulist.h"
! #include "plugin/rkcomponentmap.h"
  //#include "rkoutputwindow.h"
  #include "settings/rksettings.h"
***************
*** 132,135 ****
--- 132,136 ----
  	connect (RKGlobals::editorManager (), SIGNAL (editorOpened ()), this, SLOT (slotEditorsChanged ()));
  	RKGlobals::mtracker = new RKModificationTracker (this);
+ 	RKGlobals::cmap = new RKComponentMap ();
  
  	initial_url = load_url;
***************
*** 218,286 ****
  	slotStatusMsg(i18n("Setting up plugins..."));
  	
! 	if (!initPluginDir (RKSettingsModulePlugins::pluginDir (), 0)) {
! 		KMessageBox::information (0, i18n ("Plugins are needed: you may manage these throught \"Settings->Configure RKWard\".\n"), i18n ("No plugins found"));
  	}
  	
  	slotStatusMsg(i18n("Ready."));
  }
  
- int RKwardApp::initPluginDir (const QString & dirname, RKMenu *parent) {
- 	RK_TRACE (APP);
- 	int num_plugins = 0;
- 	
- 	// list directories only
- 	QDir dir = QDir (dirname, QString::null, QDir::Name, QDir::Dirs);
- 	
- 	// first get and parse the description for the current directory
- 	int error_line, error_column;
- 	QString error_message, dummy;
- 	QDomDocument doc;
- 
- 	QFile description (dir.filePath ("description.xml"));
- 	if (!description.open (IO_ReadOnly)) {
- 		RK_DO (qDebug ("Could not open file for reading: %s", description.name ().latin1 ()), APP | PLUGIN, DL_WARNING);
- 		description.close ();
- 		return 0;
- 	}
- 	if (!doc.setContent(&description, false, &error_message, &error_line, &error_column)) {
- 		description.close();
- 		RK_DO (qDebug ("parsing-error in: %s\nMessage: %s, Line: %d, Column: %d", description.name ().latin1 (), error_message.latin1 (), error_line, error_column), APP | PLUGIN, DL_WARNING);
- 		return 0;
- 	}
- 	description.close();
- 
- 	QDomElement element = doc.documentElement ();
- 	QDomNodeList children = element.elementsByTagName("entry");
- 	element = children.item (0).toElement ();
- 	
- 	RKMenu *menu = 0;
- 	if (element.attribute ("type") == "menu") {
- 		if (!parent) {
- 			menu = menu_list->createMenu (element.attribute ("id"), element.attribute ("label"), 4);
- 		} else {
- 			menu = parent->addSubMenu (element.attribute ("id"), element.attribute ("label", "untitled"));
- 		}
- 	} else {
- 		if (!parent) {
- 			RK_DO (qDebug ("%s", "can't add plugin on the top-level menu"), APP | PLUGIN, DL_WARNING);
- 		} else {
- 			parent->addEntry (element.attribute ("id"), new RKPluginHandle (this, description.name ()), element.attribute ("label", "untitled"));
- 			num_plugins++;
- 		}
- 	}
- 
- 	if (menu) {
- 		// get subdirectories if applicable
- 		for (unsigned int i = 0; i < dir.count (); i++) {
- 			RK_DO (qDebug ("%s", dir[i].latin1 ()), APP | PLUGIN, DL_DEBUG);
- 			if ((dir[i] != ".") && (dir[i] != "..")) {
- 				num_plugins += initPluginDir (dir.filePath (dir[i]), menu);
- 			}
- 		}
- 	}
- 	
- 	return num_plugins;
- }
- 
  void RKwardApp::startR () {
  	RK_TRACE (APP);
--- 219,231 ----
  	slotStatusMsg(i18n("Setting up plugins..."));
  	
! 	RKGlobals::componentMap ()->clear ();
! 	if (!(QFileInfo (RKSettingsModulePlugins::pluginMap ()).isReadable ())) {
! 		KMessageBox::information (0, i18n ("Plugins are needed: you may manage these throught \"Settings->Configure RKWard\".\n"), i18n ("No pluginmap found"));
  	}
+ 	RKGlobals::componentMap ()->addPluginMap (RKSettingsModulePlugins::pluginMap ());
  	
  	slotStatusMsg(i18n("Ready."));
  }
  
  void RKwardApp::startR () {
  	RK_TRACE (APP);

Index: rkward.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** rkward.h	29 Apr 2005 16:47:30 -0000	1.36
--- rkward.h	9 Sep 2005 13:02:57 -0000	1.37
***************
*** 86,89 ****
--- 86,92 ----
  	void openHTML(KURL url);
  
+ /** returns a pointer to the menu-list (in essence the menu-bar) */
+ 	RKMenuList* getMenuList () { return menu_list; };
+ 
  	KParts::PartManager *m_manager;
  protected:
***************
*** 276,282 ****
  	void initPlugins ();
  
- 	/** recursively initialize the plugins in this directory */
- 	int initPluginDir (const QString & dirname, RKMenu *parent);
- 
  	/** Used to receive a signal during startup AFTER the exec loop was entered */
  	QTimer *startup_timer;
--- 279,282 ----

Index: rkglobals.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkglobals.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rkglobals.h	22 Sep 2004 14:06:09 -0000	1.5
--- rkglobals.h	9 Sep 2005 13:02:57 -0000	1.6
***************
*** 23,26 ****
--- 23,27 ----
  class RKEditorManager;
  class RKModificationTracker;
+ class RKComponentMap;
  
  // deletes the given char*, if it is not a special value. Does not set to 0.
***************
*** 48,52 ****
  /// static pointer to the RKModificationTracker
  	static RKModificationTracker *tracker () { return mtracker; };
! 	
  /// an empty char
  	static char *empty_char;
--- 49,55 ----
  /// static pointer to the RKModificationTracker
  	static RKModificationTracker *tracker () { return mtracker; };
! /// static pointer to the RKComponentMap
! 	static RKComponentMap *componentMap () { return cmap; };
! 
  /// an empty char
  	static char *empty_char;
***************
*** 67,70 ****
--- 70,74 ----
  	static RKEditorManager *manager;
  	static RKModificationTracker *mtracker;
+ 	static RKComponentMap *cmap;
  };
  

Index: rkglobals.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkglobals.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rkglobals.cpp	23 Sep 2004 10:53:32 -0000	1.6
--- rkglobals.cpp	9 Sep 2005 13:02:57 -0000	1.7
***************
*** 22,25 ****
--- 22,26 ----
  RKEditorManager *RKGlobals::manager;
  RKModificationTracker *RKGlobals::mtracker;
+ RKComponentMap *RKGlobals::cmap;
  
  /* statics





More information about the rkward-tracker mailing list