[rkward-cvs] SF.net SVN: rkward: [2062] branches/KDE4_port

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Oct 14 20:18:55 UTC 2007


Revision: 2062
          http://rkward.svn.sourceforge.net/rkward/?rev=2062&view=rev
Author:   tfry
Date:     2007-10-14 13:18:55 -0700 (Sun, 14 Oct 2007)

Log Message:
-----------
subdir settings compiles

Modified Paths:
--------------
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/settings/rksettings.cpp
    branches/KDE4_port/rkward/settings/rksettings.h
    branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.h
    branches/KDE4_port/rkward/settings/rksettingsmodulegeneral.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduleobjectbrowser.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduleoutput.cpp
    branches/KDE4_port/rkward/settings/rksettingsmodulephp.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduleplugins.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduler.cpp
    branches/KDE4_port/rkward/settings/rksettingsmodulewatch.cpp

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/TODO_KDE4	2007-10-14 20:18:55 UTC (rev 2062)
@@ -58,3 +58,8 @@
 
 rkdropdown:
 	- take care of enabling / disabling single options!
+
+rksettings:
+	- direct page activation?
+	- check wether settings seem to be saved / loaded correctly
+	- are the defaults ok?

Modified: branches/KDE4_port/rkward/settings/rksettings.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettings.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettings.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -24,6 +24,7 @@
 #include <klocale.h>
 #include <kapplication.h>
 #include <kglobal.h>
+#include <kvbox.h>
 
 #include "../windows/rkworkplace.h"
 
@@ -72,7 +73,7 @@
 	setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Help);
 // KDE4: is this needed?	setModal (false);
 
-	setWFlags (getWFlags () | QWidget::WDestructiveClose);
+	setAttribute (Qt::WA_DeleteOnClose, true);
 
 	initModules ();
 
@@ -105,22 +106,24 @@
 	modules.append (new RKSettingsModuleObjectBrowser (this, this));
 	
 	ModuleList::const_iterator it;
-	Q3Frame *page;
-	Q3VBoxLayout *layout;
+	KVBox *page;
+	int i=0;
 	for (it = modules.constBegin (); it != modules.constEnd (); ++it) {
-		page = addPage ((*it)->caption ());
-		layout = new Q3VBoxLayout (page, 0, KDialog::spacingHint ());
-// this is somewhat ugly, but works fine
-		(*it)->reparent (page, QPoint (0,0), true);
-		layout->addWidget (*it);
+		page = new KVBox ();
+		pages[i++] = addPage (page, (*it)->caption ());
+
+// this is somewhat ugly, but works fine (KDE4: does it still?)
+		(*it)->setParent (page);
+		(*it)->show ();
 	}
+	RK_ASSERT (i == (NumPages - 1));
 }
 
 void RKSettings::raisePage (SettingsPage page) {
 	RK_TRACE (SETTINGS);
 
 	if (page != NoPage) {
-		showPage (((int) page) - 1);
+		setCurrentPage (pages[(int) page - 1]);
 	}
 }
 
@@ -148,45 +151,47 @@
 	} else {
 		has_help = !(new_module->helpURL ().isEmpty ());
 	}
-	enableButton (KDialogBase::Help, has_help);
+	enableButton (KDialog::Help, has_help);
 }
 
-void RKSettings::slotApply () {
+void RKSettings::slotButtonClicked (int button) {
 	RK_TRACE (SETTINGS);
 
+	if (button == KDialog::Apply) {
+		applyAll ();
+	} else if (button == KDialog::Ok) {
+		applyAll ();
+		accept ();
+		close ();
+	} else if (button == KDialog::Cancel) {
+		reject ();
+	} else if (button == KDialog::Help) {
+		int i = 0;
+		for (i = 0; i < NumPages; ++i) {
+			if (currentPage () == pages[i]) break;
+		}
+		RKSettingsModule *current_module = modules[i];
+		RK_ASSERT (current_module);
+	
+		RKWorkplace::mainWorkplace ()->openHelpWindow (current_module->helpURL ());
+	} else {
+		RK_ASSERT (false);
+	}
+}
+
+void RKSettings::applyAll () {
+	RK_TRACE (SETTINGS);
+
 	ModuleList::const_iterator it;
 	for (it = modules.constBegin (); it != modules.constEnd (); ++it) {
 		if ((*it)->hasChanges ()) {
 			(*it)->applyChanges ();
-			(*it)->save (KGlobal::config ());
+			(*it)->save (KGlobal::config ().data ());
 		}
 	}
 	enableButtonApply (false);
 }
 
-void RKSettings::slotOk () {
-	RK_TRACE (SETTINGS);
-
-	slotApply ();
-	accept ();
-	close ();
-}
-
-void RKSettings::slotCancel () {
-	RK_TRACE (SETTINGS);
-	QDialog::reject ();
-}
-
-void RKSettings::slotHelp () {
-	RK_TRACE (SETTINGS);
-
-	// which page are we on?
-	RKSettingsModule *current_module = modules[activePageIndex ()];
-	RK_ASSERT (current_module);
-
-	RKWorkplace::mainWorkplace ()->openHelpWindow (current_module->helpURL ());
-}
-
 void RKSettings::enableApply () {
 	RK_TRACE (SETTINGS);
 	enableButtonApply (true);

Modified: branches/KDE4_port/rkward/settings/rksettings.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettings.h	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettings.h	2007-10-14 20:18:55 UTC (rev 2062)
@@ -35,7 +35,19 @@
 class RKSettings : public KPageDialog {
 	Q_OBJECT
 public:
-	enum SettingsPage { NoPage=0, Plugins=1, R=2, RPackages=3, PHP=4, General=5, Output=6, Watch=7, Console=8, ObjectBrowser=9 };
+	enum SettingsPage {
+		NoPage=0,
+		Plugins=1,
+		R=2,
+		RPackages=3,
+		PHP=4,
+		General=5,
+		Output=6,
+		Watch=7,
+		Console=8,
+		ObjectBrowser=9,
+		NumPages = ObjectBrowser + 1
+	};
 
 	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=0, RCommandChain *chain=0);
 
@@ -48,21 +60,20 @@
 public slots:
 	void pageAboutToBeShown (QWidget *page);
 protected:
-	void slotApply ();
-	void slotOk ();
-	void slotCancel ();
-	void slotHelp ();
+	void slotButtonClicked (int button);
 protected:
 	RKSettings (QWidget *parent = 0);
 	~RKSettings ();
 private:
+	void applyAll ();
 	void initModules ();
 	void raisePage (SettingsPage page);
 	static void dialogClosed ();
-	
+
 	typedef Q3ValueList<RKSettingsModule *> ModuleList;
 	ModuleList modules;
-	
+	KPageWidgetItem *pages[NumPages];
+
 	static RKSettings *settings_dialog;
 friend class RKWardMainWindow;
 	static RKSettingsTracker *settings_tracker;

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -18,6 +18,7 @@
 
 #include <klocale.h>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 #include <knuminput.h>
 #include <kapplication.h>
 
@@ -52,13 +53,13 @@
 	vbox->addWidget (save_history_box);
 
 	vbox->addWidget (new QLabel (i18n ("Maximum length of command history"), this));
-	max_history_length_spinner = new KIntSpinBox (0, 10000, 10, max_history_length, 10, this);
+	max_history_length_spinner = new KIntSpinBox (0, 10000, 10, max_history_length, this);
 	max_history_length_spinner->setSpecialValueText (i18n ("Unlimited"));
 	connect (max_history_length_spinner, SIGNAL (valueChanged (int)), this, SLOT (changedSetting (int)));
 	vbox->addWidget (max_history_length_spinner);
 
 	vbox->addWidget (new QLabel (i18n ("Maximum number of paragraphs/lines to display in the console"), this));
-	max_console_lines_spinner = new KIntSpinBox (0, 10000, 10, max_console_lines, 10, this);
+	max_console_lines_spinner = new KIntSpinBox (0, 10000, 10, max_console_lines, this);
 	max_console_lines_spinner->setSpecialValueText (i18n ("Unlimited"));
 	connect (max_console_lines_spinner, SIGNAL (valueChanged (int)), this, SLOT (changedSetting (int)));
 	vbox->addWidget (max_console_lines_spinner);
@@ -98,10 +99,10 @@
 }
 
 //static
-bool RKSettingsModuleConsole::shouldDoHistoryContextSensitive (Qt::ButtonState current_state) {
+bool RKSettingsModuleConsole::shouldDoHistoryContextSensitive (Qt::KeyboardModifiers current_state) {
 	RK_TRACE (SETTINGS);
 
-	if (current_state & ShiftButton) return (!context_sensitive_history_by_default);
+	if (current_state & Qt::ShiftModifier) return (!context_sensitive_history_by_default);
 	return context_sensitive_history_by_default;
 }
 
@@ -109,47 +110,45 @@
 void RKSettingsModuleConsole::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Console Settings");
-	config->writeEntry ("save history", save_history);
-	config->writeEntry ("max history length", max_history_length);
-	config->writeEntry ("max console lines", max_console_lines);
-	config->writeEntry ("pipe user commands through console", pipe_user_commands_through_console);
-	config->writeEntry ("add piped commands to history", add_piped_commands_to_history);
-	config->writeEntry ("command history defaults to context sensitive", context_sensitive_history_by_default);
+	KConfigGroup cg = config->group ("Console Settings");
+	cg.writeEntry ("save history", save_history);
+	cg.writeEntry ("max history length", max_history_length);
+	cg.writeEntry ("max console lines", max_console_lines);
+	cg.writeEntry ("pipe user commands through console", pipe_user_commands_through_console);
+	cg.writeEntry ("add piped commands to history", add_piped_commands_to_history);
+	cg.writeEntry ("command history defaults to context sensitive", context_sensitive_history_by_default);
 }
 
 //static
 void RKSettingsModuleConsole::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Console Settings");
-	save_history = config->readBoolEntry ("save history", true);
-	max_history_length = config->readNumEntry ("max history length", 100);
-	max_console_lines = config->readNumEntry ("max console lines", 500);
-	pipe_user_commands_through_console = config->readBoolEntry ("pipe user commands through console", true);
-	add_piped_commands_to_history = config->readBoolEntry ("add piped commands to history", true);
-	context_sensitive_history_by_default = config->readBoolEntry ("command history defaults to context sensitive", false);
+	KConfigGroup cg = config->group ("Console Settings");
+	save_history = cg.readEntry ("save history", true);
+	max_history_length = cg.readEntry ("max history length", 100);
+	max_console_lines = cg.readEntry ("max console lines", 500);
+	pipe_user_commands_through_console = cg.readEntry ("pipe user commands through console", true);
+	add_piped_commands_to_history = cg.readEntry ("add piped commands to history", true);
+	context_sensitive_history_by_default = cg.readEntry ("command history defaults to context sensitive", false);
 }
 
 //static
 QStringList RKSettingsModuleConsole::loadCommandHistory () {
 	RK_TRACE (SETTINGS);
 
-	KConfig *config = KGlobal::config ();
-	config->setGroup ("Console Settings");
-	return config->readListEntry ("history");
+	KConfigGroup cg = KGlobal::config ()->group ("Console Settings");
+	return cg.readEntry ("history", QStringList ());
 }
 
 //static
 void RKSettingsModuleConsole::saveCommandHistory (const QStringList &list) {
 	RK_TRACE (SETTINGS);
 
-	KConfig *config = KGlobal::config ();
-	config->setGroup ("Console Settings");
+	KConfigGroup cg = KGlobal::config ()->group ("Console Settings");
 	if (save_history) {
-		config->writeEntry ("history", list);
+		cg.writeEntry ("history", list);
 	}
-	config->sync ();
+	cg.sync ();
 }
 
 

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.h	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduleconsole.h	2007-10-14 20:18:55 UTC (rev 2062)
@@ -52,7 +52,7 @@
 	/** Given the button state, return whether the command history should be navigated context sensitive or insensitive
 	@param current_state the current button state
 	@returns true, if a the search should be context sensitive, false for a normal search */
-	static bool shouldDoHistoryContextSensitive (Qt::ButtonState current_state);
+	static bool shouldDoHistoryContextSensitive (Qt::KeyboardModifiers current_state);
 
 	static QStringList loadCommandHistory ();
 	static void saveCommandHistory (const QStringList &list);

Modified: branches/KDE4_port/rkward/settings/rksettingsmodulegeneral.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulegeneral.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulegeneral.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -147,49 +147,51 @@
 void RKSettingsModuleGeneral::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Logfiles");
-	config->writeEntry ("logfile dir", new_files_path);
+	KConfigGroup cg;
+	cg = config->group ("Logfiles");
+	cg.writeEntry ("logfile dir", new_files_path);
 
-	config->setGroup ("General");
-	config->writeEntry ("startup action", (int) startup_action);
-	config->writeEntry ("show help on startup", show_help_on_startup);
+	cg = config->group ("General");
+	cg.writeEntry ("startup action", (int) startup_action);
+	cg.writeEntry ("show help on startup", show_help_on_startup);
 
-	config->setGroup ("Workplace");
-	config->writeEntry ("save mode", (int) workplace_save_mode);
+	cg = config->group ("Workplace");
+	cg.writeEntry ("save mode", (int) workplace_save_mode);
 
-	config->setGroup ("Editor");
-	config->writeEntry ("large object warning limit", warn_size_object_edit);
+	cg = config->group ("Editor");
+	cg.writeEntry ("large object warning limit", warn_size_object_edit);
 }
 
 void RKSettingsModuleGeneral::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Logfiles");
-	files_path = new_files_path = config->readEntry ("logfile dir", QDir ().homePath () + "/.rkward/");
+	KConfigGroup cg;
+	cg = config->group ("Logfiles");
+	files_path = new_files_path = cg.readEntry ("logfile dir", QDir ().homePath () + "/.rkward/");
 
-	config->setGroup ("General");
-	startup_action = (StartupDialog::Result) config->readNumEntry ("startup action", StartupDialog::NoSavedSetting);
-	show_help_on_startup = config->readBoolEntry ("show help on startup", true);
+	cg = config->group ("General");
+	startup_action = (StartupDialog::Result) cg.readEntry ("startup action", (int) StartupDialog::NoSavedSetting);
+	show_help_on_startup = cg.readEntry ("show help on startup", true);
 
-	config->setGroup ("Workplace");
-	workplace_save_mode = (WorkplaceSaveMode) config->readNumEntry ("save mode", SaveWorkplaceWithWorkspace);
+	cg = config->group ("Workplace");
+	workplace_save_mode = (WorkplaceSaveMode) cg.readEntry ("save mode", (int) SaveWorkplaceWithWorkspace);
 
-	config->setGroup ("Editor");
-	warn_size_object_edit = config->readNumEntry ("large object warning limit", 250000);
+	cg = config->group ("Editor");
+	warn_size_object_edit = cg.readEntry ("large object warning limit", 250000);
 }
 
 QString RKSettingsModuleGeneral::getSavedWorkplace (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Workplace");
-	return (config->readEntry ("last saved layout", QString::null));
+	KConfigGroup cg = config->group ("Workplace");
+	return (cg.readEntry ("last saved layout", QString ()));
 }
 
 void RKSettingsModuleGeneral::setSavedWorkplace (const QString &description, KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Workplace");
-	config->writeEntry ("last saved layout", description);
+	KConfigGroup cg = config->group ("Workplace");
+	cg.writeEntry ("last saved layout", description);
 }
 
 #include "rksettingsmodulegeneral.moc"

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduleobjectbrowser.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduleobjectbrowser.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduleobjectbrowser.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -19,6 +19,7 @@
 
 #include <klocale.h>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 #include <kinputdialog.h>
 
 #include <qlayout.h>
@@ -134,37 +135,34 @@
 void RKSettingsModuleObjectBrowser::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Object Browser");
-	config->writeEntry ("show hidden vars", settings[RKObjectListViewSettings::ShowObjectsHidden]);
-	config->writeEntry ("show all environments", settings[RKObjectListViewSettings::ShowObjectsAllEnvironments]);
-	config->writeEntry ("show container objects", settings[RKObjectListViewSettings::ShowObjectsContainer]);
-	config->writeEntry ("show function objects", settings[RKObjectListViewSettings::ShowObjectsFunction]);
-	config->writeEntry ("show variable objects", settings[RKObjectListViewSettings::ShowObjectsVariable]);
-	config->writeEntry ("show label field", settings[RKObjectListViewSettings::ShowFieldsLabel]);
-	config->writeEntry ("show type field", settings[RKObjectListViewSettings::ShowFieldsType]);
-	config->writeEntry ("show class field", settings[RKObjectListViewSettings::ShowFieldsClass]);
+	KConfigGroup cg = config->group ("Object Browser");
+	cg.writeEntry ("show hidden vars", settings[RKObjectListViewSettings::ShowObjectsHidden]);
+	cg.writeEntry ("show all environments", settings[RKObjectListViewSettings::ShowObjectsAllEnvironments]);
+	cg.writeEntry ("show container objects", settings[RKObjectListViewSettings::ShowObjectsContainer]);
+	cg.writeEntry ("show function objects", settings[RKObjectListViewSettings::ShowObjectsFunction]);
+	cg.writeEntry ("show variable objects", settings[RKObjectListViewSettings::ShowObjectsVariable]);
+	cg.writeEntry ("show label field", settings[RKObjectListViewSettings::ShowFieldsLabel]);
+	cg.writeEntry ("show type field", settings[RKObjectListViewSettings::ShowFieldsType]);
+	cg.writeEntry ("show class field", settings[RKObjectListViewSettings::ShowFieldsClass]);
 
-	config->writeEntry ("package blacklist", getstructure_blacklist);
+	cg.writeEntry ("package blacklist", getstructure_blacklist);
 }
 
 //static
 void RKSettingsModuleObjectBrowser::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Object Browser");
-	settings[RKObjectListViewSettings::ShowObjectsHidden] = config->readBoolEntry ("show hidden vars", false);
-	settings[RKObjectListViewSettings::ShowObjectsAllEnvironments] = config->readBoolEntry ("show all environments", true);
-	settings[RKObjectListViewSettings::ShowObjectsContainer] = config->readBoolEntry ("show container objects", true);
-	settings[RKObjectListViewSettings::ShowObjectsFunction] = config->readBoolEntry ("show function objects", true);
-	settings[RKObjectListViewSettings::ShowObjectsVariable] = config->readBoolEntry ("show variable objects", true);
-	settings[RKObjectListViewSettings::ShowFieldsLabel] = config->readBoolEntry ("show label field", true);
-	settings[RKObjectListViewSettings::ShowFieldsType] = config->readBoolEntry ("show type field", true);
-	settings[RKObjectListViewSettings::ShowFieldsClass] = config->readBoolEntry ("show class field", true);
+	KConfigGroup cg = config->group ("Object Browser");
+	settings[RKObjectListViewSettings::ShowObjectsHidden] = cg.readEntry ("show hidden vars", false);
+	settings[RKObjectListViewSettings::ShowObjectsAllEnvironments] = cg.readEntry ("show all environments", true);
+	settings[RKObjectListViewSettings::ShowObjectsContainer] = cg.readEntry ("show container objects", true);
+	settings[RKObjectListViewSettings::ShowObjectsFunction] = cg.readEntry ("show function objects", true);
+	settings[RKObjectListViewSettings::ShowObjectsVariable] = cg.readEntry ("show variable objects", true);
+	settings[RKObjectListViewSettings::ShowFieldsLabel] = cg.readEntry ("show label field", true);
+	settings[RKObjectListViewSettings::ShowFieldsType] = cg.readEntry ("show type field", true);
+	settings[RKObjectListViewSettings::ShowFieldsClass] = cg.readEntry ("show class field", true);
 
-	getstructure_blacklist = config->readListEntry ("package blacklist");
-	if (!getstructure_blacklist.count ()) {
-		getstructure_blacklist.append ("GO");
-	}
+	getstructure_blacklist = cg.readEntry ("package blacklist", QStringList ("GO"));
 }
 
 void RKSettingsModuleObjectBrowser::boxChanged (int) {

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduleoutput.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduleoutput.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduleoutput.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -18,10 +18,11 @@
 
 #include <klocale.h>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 
 #include <qlayout.h>
 #include <qlabel.h>
-#include <qvbuttongroup.h>
+#include <Q3VButtonGroup>
 #include <qcheckbox.h>
 //Added by qt3to4:
 #include <Q3VBoxLayout>
@@ -88,17 +89,17 @@
 void RKSettingsModuleOutput::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Output Window");
-	config->writeEntry ("auto_show", auto_show);
-	config->writeEntry ("auto_raise", auto_raise);
+	KConfigGroup cg = config->group ("Output Window");
+	cg.writeEntry ("auto_show", auto_show);
+	cg.writeEntry ("auto_raise", auto_raise);
 }
 
 void RKSettingsModuleOutput::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("Output Window");
-	auto_show = config->readBoolEntry ("auto_show", true);
-	auto_raise = config->readBoolEntry ("auto_raise", true);
+	KConfigGroup cg = config->group ("Output Window");
+	auto_show = cg.readEntry ("auto_show", true);
+	auto_raise = cg.readEntry ("auto_raise", true);
 }
 
 #include "rksettingsmoduleoutput.moc"

Modified: branches/KDE4_port/rkward/settings/rksettingsmodulephp.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulephp.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulephp.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -18,6 +18,7 @@
 
 #include <klocale.h>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 
 #include <qlayout.h>
 #include <qlabel.h>
@@ -81,15 +82,15 @@
 void RKSettingsModulePHP::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("PHP Settings");
-	config->writeEntry ("PHP binary", php_bin);
+	KConfigGroup cg = config->group ("PHP Settings");
+	cg.writeEntry ("PHP binary", php_bin);
 }
 
 void RKSettingsModulePHP::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("PHP Settings");
-	php_bin = config->readEntry ("PHP binary", "/usr/bin/php");
+	KConfigGroup cg = config->group ("PHP Settings");
+	php_bin = cg.readEntry ("PHP binary", "/usr/bin/php");
 }
 
 #include "rksettingsmodulephp.moc"

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduleplugins.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduleplugins.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduleplugins.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -130,36 +130,20 @@
 }
 
 void RKSettingsModulePlugins::saveSettings (KConfig *config) {
-	config->setGroup ("Plugin Settings");
-	config->writeEntry ("Plugin Maps", plugin_maps);
-	config->writeEntry ("Interface Preferences", static_cast<int> (interface_pref));
-	config->writeEntry ("Code display default", show_code);
-	config->writeEntry ("Code display size", code_size);
+	KConfigGroup cg = config->group ("Plugin Settings");
+	cg.writeEntry ("Plugin Maps", plugin_maps);
+	cg.writeEntry ("Interface Preferences", static_cast<int> (interface_pref));
+	cg.writeEntry ("Code display default", show_code);
+	cg.writeEntry ("Code display size", code_size);
 }
 
 void RKSettingsModulePlugins::loadSettings (KConfig *config) {
-	config->setGroup ("Plugin Settings");
-	plugin_maps = config->readListEntry ("Plugin Maps");
-	if (!plugin_maps.count ()) {
-		plugin_maps.append (RKCommonFunctions::getRKWardDataDir () + "/all.pluginmap");
-	}
-// TODO: this code is only needed for transition from rkward 0.3.4 to rkward 0.3.5. Remove some version later!
-// BEGIN
-	bool fix=false;
-	for (QStringList::const_iterator it = plugin_maps.constBegin (); it != plugin_maps.constEnd (); ++it) {
-		if ((*it).contains ("standard_plugins.pluginmap")) {
-			fix = (KMessageBox::questionYesNo (0, i18n ("You appear to have an old configuration for the plugin-paths. The default configuration was changed between rkward 0.3.4 and rkward 0.3.5. Should the configuration be set to the new default (recommended)?"), i18n ("Configuration change"), KStandardGuiItem::yes (), KStandardGuiItem::no (), "pluginmap_upgrade") == KMessageBox::Yes);
-		}
-	}
-	if (fix) {
-		plugin_maps.clear ();
-		plugin_maps.append (RKCommonFunctions::getRKWardDataDir () + "/all.pluginmap");
-	}
-// END
+	KConfigGroup cg = config->group ("Plugin Settings");
+	plugin_maps = cg.readEntry ("Plugin Maps", QStringList (RKCommonFunctions::getRKWardDataDir () + "/all.pluginmap"));
 
-	interface_pref = static_cast<PluginPrefs> (config->readNumEntry ("Interface Preferences", static_cast<int> (PreferRecommended)));
-	show_code = config->readBoolEntry ("Code display default", true);
-	code_size = config->readNumEntry ("Code display size", 40);
+	interface_pref = static_cast<PluginPrefs> (cg.readEntry ("Interface Preferences", static_cast<int> (PreferRecommended)));
+	show_code = cg.readEntry ("Code display default", true);
+	code_size = cg.readEntry ("Code display size", 40);
 }
 
 #include "rksettingsmoduleplugins.moc"

Modified: branches/KDE4_port/rkward/settings/rksettingsmoduler.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduler.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduler.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -25,7 +25,7 @@
 
 #include <qlayout.h>
 #include <qlabel.h>
-#include <qvbuttongroup.h>
+#include <Q3VButtonGroup>
 #include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
@@ -85,19 +85,19 @@
 
 	// options (width)
 	grid->addWidget (new QLabel (i18n ("Output width (characters)"), this), ++row, 0);
-	width_input = new KIntSpinBox (10, 10000, 1, options_width, 10, this);
+	width_input = new KIntSpinBox (10, 10000, 1, options_width, this);
 	connect (width_input, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
 	grid->addWidget (width_input, row, 1);
 
 	// options (max.print)
 	grid->addWidget (new QLabel (i18n ("Maximum number of elements shown in print"), this), ++row, 0);
-	maxprint_input = new KIntSpinBox (100, INT_MAX, 1, options_maxprint, 10, this);
+	maxprint_input = new KIntSpinBox (100, INT_MAX, 1, options_maxprint, this);
 	connect (maxprint_input, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
 	grid->addWidget (maxprint_input, row, 1);
 
 	// options (warnings.length)
 	grid->addWidget (new QLabel (i18n ("Maximum length of warnings/errors to print"), this), ++row, 0);
-	warningslength_input = new KIntSpinBox (100, 8192, 1, options_warningslength, 10, this);
+	warningslength_input = new KIntSpinBox (100, 8192, 1, options_warningslength, this);
 	connect (warningslength_input, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
 	grid->addWidget (warningslength_input, row, 1);
 
@@ -121,13 +121,13 @@
 
 	// options (expressions)
 	grid->addWidget (new QLabel (i18n ("Maximum level of nested expressions"), this), ++row, 0);
-	expressions_input = new KIntSpinBox (25, 500000, 1, options_expressions, 10, this);
+	expressions_input = new KIntSpinBox (25, 500000, 1, options_expressions, this);
 	connect (expressions_input, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
 	grid->addWidget (expressions_input, row, 1);
 
 	// options (digits)
 	grid->addWidget (new QLabel (i18n ("Default decimal precision in print ()"), this), ++row, 0);
-	digits_input = new KIntSpinBox (1, 22, 1, options_digits, 10, this);
+	digits_input = new KIntSpinBox (1, 22, 1, options_digits, this);
 	connect (digits_input, SIGNAL (valueChanged (int)), this, SLOT (boxChanged (int)));
 	grid->addWidget (digits_input, row, 1);
 
@@ -231,37 +231,35 @@
 void RKSettingsModuleR::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("R Settings");
-
-	config->writeEntry ("OutDec", options_outdec);
-	config->writeEntry ("width", options_width);
-	config->writeEntry ("warn", options_warn);
-	config->writeEntry ("maxprint", options_maxprint);
-	config->writeEntry ("warnings.length", options_warningslength);
-	config->writeEntry ("keep.source", options_keepsource);
-	config->writeEntry ("keep.source.pkgs", options_keepsourcepkgs);
-	config->writeEntry ("expressions", options_expressions);
-	config->writeEntry ("digits", options_digits);
-	config->writeEntry ("check.bounds", options_checkbounds);
-	config->writeEntry ("printcmd", options_printcmd);
+	KConfigGroup cg = config->group ("R Settings");
+	cg.writeEntry ("OutDec", options_outdec);
+	cg.writeEntry ("width", options_width);
+	cg.writeEntry ("warn", options_warn);
+	cg.writeEntry ("maxprint", options_maxprint);
+	cg.writeEntry ("warnings.length", options_warningslength);
+	cg.writeEntry ("keep.source", options_keepsource);
+	cg.writeEntry ("keep.source.pkgs", options_keepsourcepkgs);
+	cg.writeEntry ("expressions", options_expressions);
+	cg.writeEntry ("digits", options_digits);
+	cg.writeEntry ("check.bounds", options_checkbounds);
+	cg.writeEntry ("printcmd", options_printcmd);
 }
 
 void RKSettingsModuleR::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("R Settings");
-
-	options_outdec = config->readEntry ("OutDec", ".");
-	options_width = config->readNumEntry ("width", 80);
-	options_warn = config->readNumEntry ("warn", 0);
-	options_maxprint = config->readNumEntry ("max.print", 99999);
-	options_warningslength = config->readNumEntry ("warnings.length", 1000);
-	options_keepsource = config->readBoolEntry ("keep.source", true);
-	options_keepsourcepkgs = config->readBoolEntry ("keep.source.pkgs", false);
-	options_expressions = config->readNumEntry ("expressions", 5000);
-	options_digits = config->readNumEntry ("digits", 7);
-	options_checkbounds = config->readNumEntry ("check.bounds", false);
-	options_printcmd = config->readEntry ("printcmd", "kprinter");
+	KConfigGroup cg = config->group ("R Settings");
+	options_outdec = cg.readEntry ("OutDec", ".");
+	options_width = cg.readEntry ("width", 80);
+	options_warn = cg.readEntry ("warn", 0);
+	options_maxprint = cg.readEntry ("max.print", 99999);
+	options_warningslength = cg.readEntry ("warnings.length", 1000);
+	options_keepsource = cg.readEntry ("keep.source", true);
+	options_keepsourcepkgs = cg.readEntry ("keep.source.pkgs", false);
+	options_expressions = cg.readEntry ("expressions", 5000);
+	options_digits = cg.readEntry ("digits", 7);
+	options_checkbounds = cg.readEntry ("check.bounds", false);
+	options_printcmd = cg.readEntry ("printcmd", "kprinter");
 }
 
 //#################################################
@@ -321,7 +319,7 @@
 
 void RKSettingsModuleRPackages::addLibLoc (QStringList *string_list) {
 	RK_TRACE (SETTINGS);
-	QString new_string = KFileDialog::getExistingDirectory (QString::null, this, i18n ("Add R Library Directory"));
+	QString new_string = KFileDialog::getExistingDirectory (KUrl (), this, i18n ("Add R Library Directory"));
 	if (!new_string.isEmpty ()) {
 		(*string_list).append (new_string);
 	}
@@ -400,26 +398,20 @@
 void RKSettingsModuleRPackages::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("R Settings");
-
-	config->writeEntry ("archive packages", archive_packages);
-	config->writeEntry ("Repositories", package_repositories);
-
-	config->writeEntry ("LibraryLocations", liblocs);
+	KConfigGroup cg = config->group ("R Settings");
+	cg.writeEntry ("archive packages", archive_packages);
+	cg.writeEntry ("Repositories", package_repositories);
+	cg.writeEntry ("LibraryLocations", liblocs);
 }
 
 void RKSettingsModuleRPackages::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("R Settings");
+	KConfigGroup cg = config->group ("R Settings");
+	archive_packages = cg.readEntry ("archive packages", false);
+	package_repositories = cg.readEntry ("Repositories", QStringList ("@CRAN@"));
 
-	archive_packages = config->readBoolEntry ("archive packages", false);
-	package_repositories = config->readListEntry ("Repositories");
-	if (!package_repositories.count ()) {
-		package_repositories.append ("@CRAN@");
-	}
-
-	liblocs = config->readListEntry ("LibraryLocations");
+	liblocs = cg.readEntry ("LibraryLocations", QStringList ());
 }
 
 #include "rksettingsmoduler.moc"

Modified: branches/KDE4_port/rkward/settings/rksettingsmodulewatch.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulewatch.cpp	2007-10-14 19:13:55 UTC (rev 2061)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulewatch.cpp	2007-10-14 20:18:55 UTC (rev 2062)
@@ -18,6 +18,7 @@
 
 #include <klocale.h>
 #include <kconfig.h>
+#include <kconfiggroup.h>
 #include <knuminput.h>
 
 #include <qlayout.h>
@@ -148,7 +149,7 @@
 	vbox->addSpacing (2*RKGlobals::spacingHint ());
 
 	vbox->addWidget (new QLabel (i18n ("Maximum number of paragraphs/lines to display in the Command Log"), this));
-	max_log_lines_spinner = new KIntSpinBox (0, 10000, 10, max_log_lines, 10, this);
+	max_log_lines_spinner = new KIntSpinBox (0, 10000, 10, max_log_lines, this);
 	max_log_lines_spinner->setSpecialValueText (i18n ("Unlimited"));
 	connect (max_log_lines_spinner, SIGNAL (valueChanged (int)), this, SLOT (changedSetting (int)));
 	vbox->addWidget (max_log_lines_spinner);
@@ -229,26 +230,26 @@
 void RKSettingsModuleWatch::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("RInterface Watch Settings");
-	config->writeEntry ("user command filter", user_filter);
-	config->writeEntry ("plugin command filter", plugin_filter);
-	config->writeEntry ("app command filter", app_filter);
-	config->writeEntry ("sync command filter", sync_filter);
+	KConfigGroup cg = config->group ("RInterface Watch Settings");
+	cg.writeEntry ("user command filter", user_filter);
+	cg.writeEntry ("plugin command filter", plugin_filter);
+	cg.writeEntry ("app command filter", app_filter);
+	cg.writeEntry ("sync command filter", sync_filter);
 
-	config->writeEntry ("max log lines", max_log_lines);
+	cg.writeEntry ("max log lines", max_log_lines);
 }
 
 //static
 void RKSettingsModuleWatch::loadSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
-	config->setGroup ("RInterface Watch Settings");
-	user_filter = config->readNumEntry ("user command filter", ShowInput | ShowOutput | ShowError | RaiseWindow);
-	plugin_filter = config->readNumEntry ("plugin command filter", ShowInput | ShowError);
-	app_filter = config->readNumEntry ("app command filter", ShowInput | ShowError);
-	sync_filter = config->readNumEntry ("sync command filter", (int) ShowError);
+	KConfigGroup cg = config->group ("RInterface Watch Settings");
+	user_filter = cg.readEntry ("user command filter", static_cast<int> (ShowInput | ShowOutput | ShowError | RaiseWindow));
+	plugin_filter = cg.readEntry ("plugin command filter", static_cast<int> (ShowInput | ShowError));
+	app_filter = cg.readEntry ("app command filter", static_cast<int> (ShowInput | ShowError));
+	sync_filter = cg.readEntry ("sync command filter", static_cast<int> (ShowError));
 
-	max_log_lines = config->readNumEntry ("max log lines", 1000);
+	max_log_lines = cg.readEntry ("max log lines", 1000);
 }
 
 bool RKSettingsModuleWatch::hasChanges () {


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