[rkward-cvs] rkward/rkward/settings rksettingsmoduleplugins.cpp,1.9,1.10 rksettingsmoduleplugins.h,1.4,1.5

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Sep 11 18:53:07 UTC 2005


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

Modified Files:
	rksettingsmoduleplugins.cpp rksettingsmoduleplugins.h 
Log Message:
Finish restructuring plugin-hierarchy creation. Allow to select several .pluginmap files in Settings->Configure RKWard. Some fixes and cleanups

Index: rksettingsmoduleplugins.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduleplugins.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rksettingsmoduleplugins.cpp	9 Sep 2005 13:02:57 -0000	1.9
--- rksettingsmoduleplugins.cpp	11 Sep 2005 18:53:05 -0000	1.10
***************
*** 21,24 ****
--- 21,25 ----
  #include <kglobal.h>
  #include <kstandarddirs.h>
+ #include <kfiledialog.h>
  
  #include <qlayout.h>
***************
*** 29,36 ****
  #include "../rkward.h"
  #include "../rkglobals.h"
! #include "../misc/getfilenamewidget.h"
  
  // static members
! QString RKSettingsModulePlugins::plugin_map;
  RKSettingsModulePlugins::PluginPrefs RKSettingsModulePlugins::interface_pref;
  
--- 30,37 ----
  #include "../rkward.h"
  #include "../rkglobals.h"
! #include "../misc/multistringselector.h"
  
  // static members
! QStringList RKSettingsModulePlugins::plugin_maps;
  RKSettingsModulePlugins::PluginPrefs RKSettingsModulePlugins::interface_pref;
  
***************
*** 58,63 ****
  	main_vbox->addStretch ();
  	
! 	map_choser = new GetFileNameWidget (this, GetFileNameWidget::ExistingFile, i18n (".pluginmap file"), "", plugin_map);
! 	connect (map_choser, SIGNAL (locationChanged ()), this, SLOT (pathChanged ()));
  	main_vbox->addWidget (map_choser);
  }
--- 59,66 ----
  	main_vbox->addStretch ();
  	
! 	map_choser = new MultiStringSelector (i18n ("Select .pluginmap file(s)"), this);
! 	map_choser->setValues (plugin_maps);
! 	connect (map_choser, SIGNAL (getNewStrings (QStringList*)), this, SLOT (browseRequest (QStringList*)));
! 	connect (map_choser, SIGNAL (listChanged ()), this, SLOT (pathsChanged ()));
  	main_vbox->addWidget (map_choser);
  }
***************
*** 66,70 ****
  }
  
! void RKSettingsModulePlugins::pathChanged () {
  	change ();
  }
--- 69,73 ----
  }
  
! void RKSettingsModulePlugins::pathsChanged () {
  	change ();
  }
***************
*** 74,77 ****
--- 77,84 ----
  }
  
+ void RKSettingsModulePlugins::browseRequest (QStringList* strings) {
+ 	(*strings) = KFileDialog::getOpenFileNames (KGlobal::dirs()->findResourceDir("plugins", "standard_plugins.pluginmap"), "*.pluginmap", this, i18n ("Select .pluginmap-file"));
+ }
+ 
  QString RKSettingsModulePlugins::caption () {
  	return (i18n ("Plugins"));
***************
*** 83,87 ****
  
  void RKSettingsModulePlugins::applyChanges () {
! 	plugin_map = map_choser->getLocation ();
  #if QT_VERSION < 0x030200
  	interface_pref = static_cast<PluginPrefs> (button_group->id (button_group->selected ()));
--- 90,94 ----
  
  void RKSettingsModulePlugins::applyChanges () {
! 	plugin_maps = map_choser->getValues ();
  #if QT_VERSION < 0x030200
  	interface_pref = static_cast<PluginPrefs> (button_group->id (button_group->selected ()));
***************
*** 98,102 ****
  void RKSettingsModulePlugins::saveSettings (KConfig *config) {
  	config->setGroup ("Plugin Settings");
! 	config->writeEntry ("Plugin-Map", plugin_map);
  	config->writeEntry ("Interface Preferences", static_cast<int> (interface_pref));
  }
--- 105,109 ----
  void RKSettingsModulePlugins::saveSettings (KConfig *config) {
  	config->setGroup ("Plugin Settings");
! 	config->writeEntry ("Plugin Maps", plugin_maps);
  	config->writeEntry ("Interface Preferences", static_cast<int> (interface_pref));
  }
***************
*** 104,115 ****
  void RKSettingsModulePlugins::loadSettings (KConfig *config) {
  	config->setGroup ("Plugin Settings");
! 	plugin_map = config->readEntry ("Plugin-Map", "#unknown#");
! 	if (plugin_map == "#unknown#") {
! 		plugin_map = KGlobal::dirs()->findResourceDir("plugins", "standard_plugins.pluginmap");
! 		if (plugin_map == "") {
  			// try our luck with a relative path
! 			plugin_map = "plugins";
  		}
! 		plugin_map += "/standard_plugins.pluginmap";
  	}
  	interface_pref = static_cast<PluginPrefs> (config->readNumEntry ("Interface Preferences", static_cast<int> (PreferWizard)));
--- 111,122 ----
  void RKSettingsModulePlugins::loadSettings (KConfig *config) {
  	config->setGroup ("Plugin Settings");
! 	plugin_maps = config->readListEntry ("Plugin Maps");
! 	if (!plugin_maps.count ()) {
! 		QString dummy = KGlobal::dirs()->findResourceDir("plugins", "standard_plugins.pluginmap");
! 		if (dummy == "") {
  			// try our luck with a relative path
! 			dummy = "plugins";
  		}
! 		plugin_maps.append (dummy + "/standard_plugins.pluginmap");
  	}
  	interface_pref = static_cast<PluginPrefs> (config->readNumEntry ("Interface Preferences", static_cast<int> (PreferWizard)));

Index: rksettingsmoduleplugins.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/settings/rksettingsmoduleplugins.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rksettingsmoduleplugins.h	9 Sep 2005 13:02:57 -0000	1.4
--- rksettingsmoduleplugins.h	11 Sep 2005 18:53:05 -0000	1.5
***************
*** 20,26 ****
  #include "rksettingsmodule.h"
  
! #include <qstring.h>
  
! class GetFileNameWidget;
  class QButtonGroup;
  
--- 20,26 ----
  #include "rksettingsmodule.h"
  
! #include <qstringlist.h>
  
! class MultiStringSelector;
  class QButtonGroup;
  
***************
*** 34,38 ****
  
      ~RKSettingsModulePlugins ();
! 	
  	bool hasChanges ();
  	void applyChanges ();
--- 34,38 ----
  
      ~RKSettingsModulePlugins ();
! 
  	bool hasChanges ();
  	void applyChanges ();
***************
*** 46,59 ****
  	QString caption ();
  	
! 	static QString &pluginMap () { return plugin_map; };
  	static PluginPrefs getInterfacePreference () { return interface_pref; };
  public slots:
! 	void pathChanged ();
  	void buttonClicked (int);
  private:
! 	GetFileNameWidget *map_choser;
  	QButtonGroup *button_group;
  	
! 	static QString plugin_map;
  	static PluginPrefs interface_pref;
  };
--- 46,60 ----
  	QString caption ();
  	
! 	static QStringList &pluginMaps () { return plugin_maps; };
  	static PluginPrefs getInterfacePreference () { return interface_pref; };
  public slots:
! 	void pathsChanged ();
  	void buttonClicked (int);
+ 	void browseRequest (QStringList* strings);
  private:
! 	MultiStringSelector *map_choser;
  	QButtonGroup *button_group;
  	
! 	static QStringList plugin_maps;
  	static PluginPrefs interface_pref;
  };





More information about the rkward-tracker mailing list