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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Oct 23 12:31:46 UTC 2007


Revision: 2114
          http://rkward.svn.sourceforge.net/rkward/?rev=2114&view=rev
Author:   tfry
Date:     2007-10-23 05:31:46 -0700 (Tue, 23 Oct 2007)

Log Message:
-----------
Add settings modules for command editor and debug

Modified Paths:
--------------
    branches/KDE4_port/ChangeLog
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/main.cpp
    branches/KDE4_port/rkward/settings/CMakeLists.txt
    branches/KDE4_port/rkward/settings/rksettings.cpp
    branches/KDE4_port/rkward/settings/rksettings.h
    branches/KDE4_port/rkward/settings/rksettingsmodulephp.h
    branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp
    branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h
    branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.cpp
    branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.rc

Added Paths:
-----------
    branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.cpp
    branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.h
    branches/KDE4_port/rkward/settings/rksettingsmoduledebug.cpp
    branches/KDE4_port/rkward/settings/rksettingsmoduledebug.h

Modified: branches/KDE4_port/ChangeLog
===================================================================
--- branches/KDE4_port/ChangeLog	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/ChangeLog	2007-10-23 12:31:46 UTC (rev 2114)
@@ -1,3 +1,9 @@
+- settings dialog is now shown in "page list" mode
+- port to KDE 4			(TODO)
+
+---- KDE 3 versions
+
+
 - Fixed: Meta information (labels) did not get shown correctly in the data editor
 - Add command line option "--debugger" for debugging purposes
 - Fixed: Pressing the add button in a varslot with no object selected could crash RKWard

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/TODO_KDE4	2007-10-23 12:31:46 UTC (rev 2114)
@@ -76,6 +76,7 @@
 
 rkspinbox:
 	- does it work at all? in both modes?
+	- seems to be at least partially broken
 
 rkobjectlistview:
 	- do the tool-tips for the objects work?

Modified: branches/KDE4_port/rkward/main.cpp
===================================================================
--- branches/KDE4_port/rkward/main.cpp	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/main.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -102,7 +102,7 @@
 	KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
 
 	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-	RK_Debug_Level = 5 - QString (args->getOption ("debug-level")).toInt ();
+	RK_Debug_Level = DL_FATAL - QString (args->getOption ("debug-level")).toInt ();
 	RK_Debug_Flags = QString (args->getOption ("debug-flags")).toInt ();
 	if (!args->getOption ("debugger").isEmpty ()) {
 		RK_DO (qDebug ("--debugger option should have been handled by wrapper script. Ignoring."), ALL, DL_ERROR);

Modified: branches/KDE4_port/rkward/settings/CMakeLists.txt
===================================================================
--- branches/KDE4_port/rkward/settings/CMakeLists.txt	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/settings/CMakeLists.txt	2007-10-23 12:31:46 UTC (rev 2114)
@@ -14,6 +14,8 @@
    rksettingsmodulewatch.cpp
    rksettingsmoduleobjectbrowser.cpp
    rksettingsmoduleconsole.cpp
+   rksettingsmodulecommandeditor.cpp
+   rksettingsmoduledebug.cpp
    )
 
 QT4_AUTOMOC(${settings_STAT_SRCS})

Modified: branches/KDE4_port/rkward/settings/rksettings.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettings.cpp	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/settings/rksettings.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -17,9 +17,6 @@
 #include "rksettings.h"
 
 #include <qlayout.h>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
-#include <Q3Frame>
 
 #include <klocale.h>
 #include <kapplication.h>
@@ -37,6 +34,8 @@
 #include "rksettingsmodulewatch.h"
 #include "rksettingsmoduleobjectbrowser.h"
 #include "rksettingsmoduleconsole.h"
+#include "rksettingsmodulecommandeditor.h"
+#include "rksettingsmoduledebug.h"
 
 #include "../debug.h"
 
@@ -104,7 +103,9 @@
 	modules.insert (PageOutput, new RKSettingsModuleOutput (this, 0));
 	modules.insert (PageWatch, new RKSettingsModuleWatch (this, 0));
 	modules.insert (PageConsole, new RKSettingsModuleConsole (this, 0));
+	modules.insert (PageCommandEditor, new RKSettingsModuleCommandEditor (this, 0));
 	modules.insert (PageObjectBrowser, new RKSettingsModuleObjectBrowser (this, 0));
+	modules.insert (PageDebug, new RKSettingsModuleDebug (this, 0));
 
 	ModuleMap::const_iterator it;
 	for (it = modules.constBegin (); it != modules.constEnd (); ++it) {
@@ -189,6 +190,7 @@
 	RKSettingsModuleOutput::loadSettings(config);
 	RKSettingsModuleWatch::loadSettings(config);
 	RKSettingsModuleConsole::loadSettings(config);
+	RKSettingsModuleCommandEditor::loadSettings(config);
 	RKSettingsModuleObjectBrowser::loadSettings(config);
 }
 
@@ -203,6 +205,7 @@
 	RKSettingsModuleOutput::saveSettings(config);
 	RKSettingsModuleWatch::saveSettings(config);
 	RKSettingsModuleConsole::saveSettings(config);
+	RKSettingsModuleCommandEditor::saveSettings(config);
 	RKSettingsModuleObjectBrowser::saveSettings(config);
 }
 

Modified: branches/KDE4_port/rkward/settings/rksettings.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettings.h	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/settings/rksettings.h	2007-10-23 12:31:46 UTC (rev 2114)
@@ -45,8 +45,10 @@
 		PageOutput=6,
 		PageWatch=7,
 		PageConsole=8,
-		PageObjectBrowser=9,
-		NumPages = PageObjectBrowser + 1
+		PageCommandEditor=9,
+		PageObjectBrowser=10,
+		PageDebug=11,
+		NumPages = PageDebug + 1
 	};
 
 	static void configureSettings (SettingsPage page=NoPage, QWidget *parent=0, RCommandChain *chain=0);

Added: branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.cpp	                        (rev 0)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -0,0 +1,131 @@
+/***************************************************************************
+                          rksettingsmodulecommandeditor  -  description
+                             -------------------
+    begin                : Tue Oct 23 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+#include "rksettingsmodulecommandeditor.h"
+
+#include <klocale.h>
+#include <kconfig.h>
+#include <kconfiggroup.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <QVBoxLayout>
+#include <QCheckBox>
+#include <QGroupBox>
+
+#include "../misc/rkspinbox.h"
+#include "../rkglobals.h"
+#include "../debug.h"
+
+// static members
+int RKSettingsModuleCommandEditor::completion_min_chars;
+int RKSettingsModuleCommandEditor::completion_timeout;
+bool RKSettingsModuleCommandEditor::completion_enabled;
+
+RKSettingsModuleCommandEditor::RKSettingsModuleCommandEditor (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
+	RK_TRACE (SETTINGS);
+
+	QVBoxLayout* main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
+
+	QGroupBox* group = new QGroupBox (i18n ("Code Completion"), this);
+	QVBoxLayout* box_layout = new QVBoxLayout (group);
+
+	completion_enabled_box = new QCheckBox (i18n ("Enable code completion"), group);
+	completion_enabled_box->setChecked (completion_enabled);
+	connect (completion_enabled_box, SIGNAL (stateChanged(int)), this, SLOT (settingChanged(int)));
+	box_layout->addWidget (completion_enabled_box);
+
+	box_layout->addSpacing (RKGlobals::spacingHint ());
+
+	QLabel* label = new QLabel (i18n ("Minimum number of characters before completion is attempted"), group);
+	label->setWordWrap (true);
+	completion_min_chars_box = new RKSpinBox (group);
+	completion_min_chars_box->setIntMode (1, INT_MAX, completion_min_chars);
+	completion_min_chars_box->setEnabled (completion_enabled);
+	connect (completion_min_chars_box, SIGNAL (valueChanged(int)), this, SLOT (settingChanged(int)));
+	box_layout->addWidget (label);
+	box_layout->addWidget (completion_min_chars_box);
+
+	main_vbox->addSpacing (RKGlobals::spacingHint ());
+
+	label = new QLabel (i18n ("Timeout (milli seconds) before completion is attempted"), group);
+	label->setWordWrap (true);
+	completion_timeout_box = new RKSpinBox (group);
+	completion_timeout_box->setIntMode (0, INT_MAX, completion_timeout);
+	completion_timeout_box->setEnabled (completion_enabled);
+	connect (completion_timeout_box, SIGNAL (valueChanged(int)), this, SLOT (settingChanged(int)));
+	box_layout->addWidget (label);
+	box_layout->addWidget (completion_timeout_box);
+
+	main_vbox->addWidget (group);
+
+	main_vbox->addStretch ();
+}
+
+RKSettingsModuleCommandEditor::~RKSettingsModuleCommandEditor () {
+	RK_TRACE (SETTINGS);
+}
+
+void RKSettingsModuleCommandEditor::settingChanged (int) {
+	RK_TRACE (SETTINGS);
+	change ();
+
+	completion_timeout_box->setEnabled (completion_enabled_box->isChecked ());
+	completion_min_chars_box->setEnabled (completion_enabled_box->isChecked ());
+}
+
+QString RKSettingsModuleCommandEditor::caption () {
+	RK_TRACE (SETTINGS);
+	return (i18n ("Script editor"));
+}
+
+bool RKSettingsModuleCommandEditor::hasChanges () {
+	RK_TRACE (SETTINGS);
+	return changed;
+}
+
+void RKSettingsModuleCommandEditor::applyChanges () {
+	RK_TRACE (SETTINGS);
+
+	completion_enabled = completion_enabled_box->isChecked ();
+	completion_min_chars = completion_min_chars_box->intValue ();
+	completion_timeout = completion_timeout_box->intValue ();
+}
+
+void RKSettingsModuleCommandEditor::save (KConfig *config) {
+	RK_TRACE (SETTINGS);
+	saveSettings (config);
+}
+
+void RKSettingsModuleCommandEditor::saveSettings (KConfig *config) {
+	RK_TRACE (SETTINGS);
+
+	KConfigGroup cg = config->group ("Command Editor Windows");
+	cg.writeEntry ("Completion enabled", completion_enabled);
+	cg.writeEntry ("Completion min chars", completion_min_chars);
+	cg.writeEntry ("Completion timeout", completion_timeout);
+}
+
+void RKSettingsModuleCommandEditor::loadSettings (KConfig *config) {
+	RK_TRACE (SETTINGS);
+
+	KConfigGroup cg = config->group ("Command Editor Windows");
+	completion_enabled = cg.readEntry ("Completion enabled", true);
+	completion_min_chars = cg.readEntry ("Completion min chars", 2);
+	completion_timeout = cg.readEntry ("Completion timeout", 200);
+}
+
+#include "rksettingsmodulecommandeditor.moc"

Added: branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.h	                        (rev 0)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulecommandeditor.h	2007-10-23 12:31:46 UTC (rev 2114)
@@ -0,0 +1,62 @@
+/***************************************************************************
+                          rksettingsmodulecommandeditor  -  description
+                             -------------------
+    begin                : Tue Oct 23 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+#ifndef RKSETTINGSMODULECOMMANDEDITOR_H
+#define RKSETTINGSMODULECOMMANDEDITOR_H
+
+#include "rksettingsmodule.h"
+
+class RKSpinBox;
+class QCheckBox;
+
+/**
+configuration for the Command Editor windows
+
+ at author Thomas Friedrichsmeier
+*/
+class RKSettingsModuleCommandEditor : public RKSettingsModule {
+	Q_OBJECT
+public:
+	RKSettingsModuleCommandEditor (RKSettings *gui, QWidget *parent);
+
+	~RKSettingsModuleCommandEditor ();
+	
+	bool hasChanges ();
+	void applyChanges ();
+	void save (KConfig *config);
+	
+	static void saveSettings (KConfig *config);
+	static void loadSettings (KConfig *config);
+	
+	QString caption ();
+
+/// min number of character to try code completion
+	static int completionMinChars () { return completion_min_chars; };
+	static int completionTimeout () { return completion_timeout; };
+	static bool completionEnabled () { return completion_enabled; };
+public slots:
+	void settingChanged (int);
+private:
+	static int completion_min_chars;
+	static int completion_timeout;
+	static bool completion_enabled;
+
+	RKSpinBox* completion_min_chars_box;
+	RKSpinBox* completion_timeout_box;
+	QCheckBox* completion_enabled_box;
+};
+
+#endif

Added: branches/KDE4_port/rkward/settings/rksettingsmoduledebug.cpp
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduledebug.cpp	                        (rev 0)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduledebug.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -0,0 +1,139 @@
+/***************************************************************************
+                          rksettingsmoduledebug  description
+                             -------------------
+    begin                : Tue Oct 23 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+#include "rksettingsmoduledebug.h"
+
+#include <klocale.h>
+#include <kconfig.h>
+#include <kconfiggroup.h>
+
+#include <qlayout.h>
+#include <qlabel.h>
+#include <QVBoxLayout>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QButtonGroup>
+
+#include "../misc/rkspinbox.h"
+#include "../rkglobals.h"
+#include "../debug.h"
+
+RKSettingsModuleDebug::RKSettingsModuleDebug (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
+	RK_TRACE (SETTINGS);
+
+	QVBoxLayout* main_vbox = new QVBoxLayout (this, RKGlobals::marginHint ());
+
+	QLabel* label = new QLabel (i18n ("<b>These settings are for debugging purposes, only.</b> It is safe to leave the untouched. Also, these settings will only apply to the current session, and not be saved."), this);
+	label->setWordWrap (true);
+	main_vbox->addWidget (label);
+
+	main_vbox->addSpacing (2 * RKGlobals::spacingHint ());
+
+	label = new QLabel (i18n ("Debug level"), this);
+	debug_level_box = new RKSpinBox (this);
+	debug_level_box->setIntMode (DL_FATAL, DL_TRACE, DL_FATAL - RK_Debug_Level);
+	connect (debug_level_box, SIGNAL (valueChanged(int)), this, SLOT (settingChanged(int)));
+	main_vbox->addWidget (label);
+	main_vbox->addWidget (debug_level_box);
+
+
+	debug_flags_group = new QButtonGroup (this);
+	debug_flags_group->setExclusive (false);
+	QGroupBox* group = new QGroupBox (i18n ("Debug flags"), this);
+	QVBoxLayout* box_layout = new QVBoxLayout (group);
+
+	debug_flags_group->addButton (new QCheckBox ("APP", group), APP);
+	debug_flags_group->addButton (new QCheckBox ("PLUGIN", group), PLUGIN);
+	debug_flags_group->addButton (new QCheckBox ("OBJECTS", group), OBJECTS);
+	debug_flags_group->addButton (new QCheckBox ("EDITOR", group), EDITOR);
+	debug_flags_group->addButton (new QCheckBox ("SETTINGS", group), SETTINGS);
+	debug_flags_group->addButton (new QCheckBox ("PHP", group), PHP);
+	debug_flags_group->addButton (new QCheckBox ("RBACKEND", group), RBACKEND);
+	debug_flags_group->addButton (new QCheckBox ("COMMANDEDITOR", group), COMMANDEDITOR);
+	debug_flags_group->addButton (new QCheckBox ("MISC", group), MISC);
+	debug_flags_group->addButton (new QCheckBox ("DIALOGS", group), DIALOGS);
+	debug_flags_group->addButton (new QCheckBox ("OUTPUT", group), OUTPUT);
+	debug_flags_group->addButton (new QCheckBox ("XML", group), XML);
+
+	QList<QAbstractButton*> buttons = debug_flags_group->buttons ();
+	for (QList<QAbstractButton*>::const_iterator it = buttons.constBegin (); it != buttons.constEnd (); ++it) {
+		box_layout->addWidget (*it);
+		(*it)->setChecked (RK_Debug_Flags & debug_flags_group->id (*it));
+	}
+	connect (debug_flags_group, SIGNAL (buttonClicked(int)), this, SLOT (settingChanged(int)));
+	main_vbox->addWidget (group);
+
+
+	label = new QLabel (i18n ("Command timeout"), this);
+	command_timeout_box = new RKSpinBox (this);
+	command_timeout_box->setIntMode (0, 10000, RK_Debug_CommandStep);
+	connect (command_timeout_box, SIGNAL (valueChanged(int)), this, SLOT (settingChanged(int)));
+	main_vbox->addWidget (label);
+	main_vbox->addWidget (command_timeout_box);
+
+	main_vbox->addStretch ();
+}
+
+RKSettingsModuleDebug::~RKSettingsModuleDebug () {
+	RK_TRACE (SETTINGS);
+}
+
+void RKSettingsModuleDebug::settingChanged (int) {
+	RK_TRACE (SETTINGS);
+	change ();
+}
+
+QString RKSettingsModuleDebug::caption () {
+	RK_TRACE (SETTINGS);
+	return (i18n ("Debug"));
+}
+
+bool RKSettingsModuleDebug::hasChanges () {
+	RK_TRACE (SETTINGS);
+	return changed;
+}
+
+void RKSettingsModuleDebug::applyChanges () {
+	RK_TRACE (SETTINGS);
+
+	RK_Debug_Level = DL_FATAL - debug_level_box->intValue ();
+	RK_Debug_CommandStep = command_timeout_box->intValue ();
+	int flags = 0;
+	QList<QAbstractButton*> buttons = debug_flags_group->buttons ();
+	for (QList<QAbstractButton*>::const_iterator it = buttons.constBegin (); it != buttons.constEnd (); ++it) {
+		if ((*it)->isChecked ()) flags |= debug_flags_group->id (*it);
+	}
+	RK_Debug_Flags = flags;
+}
+
+void RKSettingsModuleDebug::save (KConfig *config) {
+	RK_TRACE (SETTINGS);
+	saveSettings (config);
+}
+
+void RKSettingsModuleDebug::saveSettings (KConfig *) {
+	RK_TRACE (SETTINGS);
+
+	// left empty on purpose
+}
+
+void RKSettingsModuleDebug::loadSettings (KConfig *) {
+	RK_TRACE (SETTINGS);
+
+	// left empty on purpose
+}
+
+#include "rksettingsmoduledebug.moc"

Added: branches/KDE4_port/rkward/settings/rksettingsmoduledebug.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmoduledebug.h	                        (rev 0)
+++ branches/KDE4_port/rkward/settings/rksettingsmoduledebug.h	2007-10-23 12:31:46 UTC (rev 2114)
@@ -0,0 +1,55 @@
+/***************************************************************************
+                          rksettingsmoduledebug -  description
+                             -------------------
+    begin                : Tue Oct 23 2007
+    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    email                : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+#ifndef RKSETTINGSMODULEDEBUG_H
+#define RKSETTINGSMODULEDEBUG_H
+
+#include "rksettingsmodule.h"
+
+class RKSpinBox;
+class QButtonGroup;
+
+/**
+configuration for the Command Editor windows
+
+ at author Thomas Friedrichsmeier
+*/
+class RKSettingsModuleDebug : public RKSettingsModule {
+	Q_OBJECT
+public:
+	RKSettingsModuleDebug (RKSettings *gui, QWidget *parent);
+
+	~RKSettingsModuleDebug ();
+	
+	bool hasChanges ();
+	void applyChanges ();
+	void save (KConfig *config);
+	
+	static void saveSettings (KConfig *config);
+	static void loadSettings (KConfig *config);
+	
+	QString caption ();
+
+	// static members are declared in debug.h and defined in main.cpp
+public slots:
+	void settingChanged (int);
+private:
+	RKSpinBox* command_timeout_box;
+	RKSpinBox* debug_level_box;
+	QButtonGroup* debug_flags_group;
+};
+
+#endif

Modified: branches/KDE4_port/rkward/settings/rksettingsmodulephp.h
===================================================================
--- branches/KDE4_port/rkward/settings/rksettingsmodulephp.h	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/settings/rksettingsmodulephp.h	2007-10-23 12:31:46 UTC (rev 2114)
@@ -29,9 +29,9 @@
 class RKSettingsModulePHP : public RKSettingsModule {
 	Q_OBJECT
 public:
-    RKSettingsModulePHP (RKSettings *gui, QWidget *parent);
+	RKSettingsModulePHP (RKSettings *gui, QWidget *parent);
 
-    ~RKSettingsModulePHP ();
+	~RKSettingsModulePHP ();
 	
 	bool hasChanges ();
 	void applyChanges ();

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindow.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -16,10 +16,7 @@
  ***************************************************************************/
 #include "rkcommandeditorwindow.h"
 
-#include <kparts/partmanager.h>
-#include <kparts/mainwindow.h>
-#include <kparts/part.h>
-#include <kparts/factory.h>
+#include <kxmlguifactory.h>
 
 #include <ktexteditor/configinterface.h>
 #include <ktexteditor/sessionconfiginterface.h>
@@ -27,17 +24,14 @@
 #include <ktexteditor/editorchooser.h>
 
 #include <qlayout.h>
-#include <q3popupmenu.h>
 #include <qapplication.h>
 #include <qtabwidget.h>
 #include <qfile.h>
 #include <qtimer.h>
 #include <qobject.h>
 #include <QHBoxLayout>
-//Added by qt3to4:
 #include <QCloseEvent>
 #include <QFrame>
-#include <Q3ValueList>
 #include <QLabel>
 #include <QKeyEvent>
 #include <QEvent>
@@ -54,6 +48,7 @@
 
 #include "../misc/rkcommonfunctions.h"
 #include "../core/robjectlist.h"
+#include "../settings/rksettingsmodulecommandeditor.h"
 #include "../rkconsole.h"
 #include "../rkglobals.h"
 #include "../rkward.h"
@@ -95,7 +90,8 @@
 	connect (m_doc, SIGNAL (documentUrlChanged (KTextEditor::Document*)), this, SLOT (updateCaption (KTextEditor::Document*)));
 	connect (m_doc, SIGNAL (modifiedChanged (KTextEditor::Document*)), this, SLOT (updateCaption (KTextEditor::Document*)));		// of course most of the time this causes a redundant call to updateCaption. Not if a modification is undone, however.
 	connect (m_doc, SIGNAL (textChanged (KTextEditor::Document*)), this, SLOT (tryCompletionProxy (KTextEditor::Document*)));
-//KDE4	connect (m_view, SIGNAL (gotFocus (Kate::View *)), this, SLOT (setPopupMenu (Kate::View *)));
+	// somehow the katepart loses the context menu each time it loses focus
+	connect (m_view, SIGNAL (focusIn(KTextEditor::View*)), this, SLOT (setPopupMenu(KTextEditor::View*)));
 	completion_timer = new QTimer (this);
 	connect (completion_timer, SIGNAL (timeout ()), this, SLOT (tryCompletion()));
 
@@ -109,7 +105,7 @@
 	}
 
 	updateCaption ();	// initialize
-//KDE4	QTimer::singleShot (0, this, SLOT (setPopupMenu ()));
+	QTimer::singleShot (0, this, SLOT (setPopupMenu ()));
 }
 
 RKCommandEditorWindow::~RKCommandEditorWindow () {
@@ -118,18 +114,17 @@
 	delete m_doc;
 }
 
-/*
-KDE4 TODO: still needed? Alternatives?
-void RKCommandEditorWindow::setPopupMenu () {
+void RKCommandEditorWindow::setPopupMenu (KTextEditor::View* v) {
 	RK_TRACE (COMMANDEDITOR);
+	RK_ASSERT (v == m_view);
 
-	if (!m_view->factory ()) return;
-	m_view->installPopup (static_cast<Q3PopupMenu *> (m_view->factory ()->container ("ktexteditor_popup", m_view)));
+	if (!getPart ()->factory ()) return;
+	m_view->setContextMenu (static_cast<QMenu *> (getPart ()->factory ()->container ("ktexteditor_popup", getPart ())));
 }
 
-void RKCommandEditorWindow::setPopupMenu (Kate::View*) {
-	setPopupMenu ();
-}*/
+void RKCommandEditorWindow::setPopupMenu () {
+	setPopupMenu (m_view);
+}
 
 QString RKCommandEditorWindow::fullCaption () {
 	RK_TRACE (COMMANDEDITOR);
@@ -238,7 +233,9 @@
 }
 
 void RKCommandEditorWindow::tryCompletionProxy (KTextEditor::Document*) {
-	completion_timer->start (100, true);
+	if (RKSettingsModuleCommandEditor::completionEnabled ()) {
+		completion_timer->start (RKSettingsModuleCommandEditor::completionTimeout (), true);
+	}
 }
 
 void RKCommandEditorWindow::tryCompletion () {
@@ -255,7 +252,7 @@
 	int start;
 	int end;
 	RKCommonFunctions::getCurrentSymbolOffset (current_line, cursor_pos, false, &start, &end);
-	if ((end - start) >= 2) {
+	if ((end - start) >= RKSettingsModuleCommandEditor::completionMinChars ()) {
 		KTextEditor::Range range (para, start, para, end);
 
 		KTextEditor::CodeCompletionInterface *iface = qobject_cast<KTextEditor::CodeCompletionInterface*> (m_view);
@@ -323,8 +320,6 @@
 
 //////////////////////// RKFunctionArgHinter //////////////////////////////
 
-#include <q3vbox.h>
-
 #include "../core/rfunctionobject.h"
 
 RKFunctionArgHinter::RKFunctionArgHinter (RKScriptContextProvider *provider, KTextEditor::View* view) {

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindow.h	2007-10-23 12:31:46 UTC (rev 2114)
@@ -132,8 +132,8 @@
 	void tryCompletionProxy (KTextEditor::Document*);
 /** show a code completion box if appropriate. Use tryCompletionProxy () instead, which will call this function after a timeout */
 	void tryCompletion ();
-//KDE4	void setPopupMenu (KTextEditor::View *);
-//KDE4	void setPopupMenu ();
+	void setPopupMenu ();
+	void setPopupMenu (KTextEditor::View *);
 /** Show help about the current word. */
 	void showHelp ();
 /** run the currently selected command(s) */

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.cpp	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.cpp	2007-10-23 12:31:46 UTC (rev 2114)
@@ -64,6 +64,9 @@
 	helpFunction = actionCollection ()->addAction ("function_reference", command_editor, SLOT (showHelp()));
 	helpFunction->setText (i18n ("&Function reference"));
 	helpFunction->setShortcut (Qt::Key_F2);
+
+	QAction* configure = actionCollection ()->addAction ("configure_commandeditor", command_editor, SLOT (configure()));
+	configure->setText (i18n ("Configure Script Editor"));
 }
 
 #include "rkcommandeditorwindowpart.moc"

Modified: branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.rc
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.rc	2007-10-23 10:21:41 UTC (rev 2113)
+++ branches/KDE4_port/rkward/windows/rkcommandeditorwindowpart.rc	2007-10-23 12:31:46 UTC (rev 2114)
@@ -26,10 +26,13 @@
 	<Menu name="ktexteditor_popup">
 		<Merge/>
 		<Separator/>
-		<Action name="run_line"/>
-		<Action name="run_selection"/>
-		<Action name="run_all"/>
+		<Menu name="run"><text>&Run</text>
+			<Action name="run_line"/>
+			<Action name="run_selection"/>
+			<Action name="run_all"/>
+		</Menu>
+		<Action name="function_reference"/>
 		<Separator/>
-		<Action name="function_reference"/>
+		<Action name="configure_commandeditor"/>
 	</Menu>
 </kpartgui>
\ No newline at end of file


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