[rkward-cvs] SF.net SVN: rkward: [1153] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jan 14 22:08:18 UTC 2007


Revision: 1153
          http://svn.sourceforge.net/rkward/?rev=1153&view=rev
Author:   tfry
Date:     2007-01-14 14:08:17 -0800 (Sun, 14 Jan 2007)

Log Message:
-----------
Setting to toggle default command history search mode between context sensitive and insensitive

Modified Paths:
--------------
    trunk/rkward/rkward/rkconsole.cpp
    trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp
    trunk/rkward/rkward/settings/rksettingsmoduleconsole.h

Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp	2007-01-14 18:55:26 UTC (rev 1152)
+++ trunk/rkward/rkward/rkconsole.cpp	2007-01-14 22:08:17 UTC (rev 1153)
@@ -200,11 +200,11 @@
 	}
 
 	if (e->key () == Qt::Key_Up) {
-		commandsListUp (e->state() & Qt::ShiftButton);
+		commandsListUp (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (e->state ()));
 		return true;
 	}
 	else if (e->key () == Qt::Key_Down) {
-		commandsListDown (e->state() & Qt::ShiftButton);
+		commandsListDown (RKSettingsModuleConsole::shouldDoHistoryContextSensitive (e->state ()));
 		return true;
 	}
 	command_edited = true; // all other keys are considered as "editing" the current comand

Modified: trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp	2007-01-14 18:55:26 UTC (rev 1152)
+++ trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp	2007-01-14 22:08:17 UTC (rev 1153)
@@ -2,7 +2,7 @@
                           rksettingsmoduleconsole  -  description
                              -------------------
     begin                : Sun Oct 16 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -35,6 +35,7 @@
 uint RKSettingsModuleConsole::max_history_length;
 uint RKSettingsModuleConsole::max_console_lines;
 bool RKSettingsModuleConsole::pipe_user_commands_through_console;
+bool RKSettingsModuleConsole::context_sensitive_history_by_default;
 
 RKSettingsModuleConsole::RKSettingsModuleConsole (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
 	RK_TRACE (SETTINGS);
@@ -65,6 +66,13 @@
 	connect (pipe_user_commands_through_console_box, SIGNAL (stateChanged (int)), this, SLOT (changedSetting (int)));
 	vbox->addWidget (pipe_user_commands_through_console_box);
 
+	vbox->addSpacing (2*RKGlobals::spacingHint ());
+
+	reverse_context_mode_box = new QCheckBox (i18n ("Command history is context sensitive by default"), this);
+	connect (reverse_context_mode_box, SIGNAL (stateChanged (int)), this, SLOT (changedSetting (int)));
+	reverse_context_mode_box->setChecked (context_sensitive_history_by_default);
+	vbox->addWidget (reverse_context_mode_box);
+
 	vbox->addStretch ();
 }
 
@@ -78,6 +86,14 @@
 }
 
 //static
+bool RKSettingsModuleConsole::shouldDoHistoryContextSensitive (Qt::ButtonState current_state) {
+	RK_TRACE (SETTINGS);
+
+	if (current_state & ShiftButton) return (!context_sensitive_history_by_default);
+	return context_sensitive_history_by_default;
+}
+
+//static
 void RKSettingsModuleConsole::saveSettings (KConfig *config) {
 	RK_TRACE (SETTINGS);
 
@@ -86,6 +102,7 @@
 	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 ("command history defaults to context sensitive", context_sensitive_history_by_default);
 }
 
 //static
@@ -97,6 +114,7 @@
 	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);
+	context_sensitive_history_by_default = config->readBoolEntry ("command history defaults to context sensitive", false);
 }
 
 //static
@@ -134,6 +152,7 @@
 	max_history_length = max_history_length_spinner->value ();
 	max_console_lines = max_console_lines_spinner->value ();
 	pipe_user_commands_through_console = pipe_user_commands_through_console_box->isChecked ();
+	context_sensitive_history_by_default = reverse_context_mode_box->isChecked ();
 }
 
 void RKSettingsModuleConsole::save (KConfig *config) {

Modified: trunk/rkward/rkward/settings/rksettingsmoduleconsole.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleconsole.h	2007-01-14 18:55:26 UTC (rev 1152)
+++ trunk/rkward/rkward/settings/rksettingsmoduleconsole.h	2007-01-14 22:08:17 UTC (rev 1153)
@@ -2,7 +2,7 @@
                           rksettingsmoduleconsole  -  description
                              -------------------
     begin                : Sun Oct 16 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -19,6 +19,8 @@
 
 #include "rksettingsmodule.h"
 
+#include <qnamespace.h>
+
 class QCheckBox;
 class KIntSpinBox;
 class RKConsole;
@@ -46,6 +48,10 @@
 	static uint maxHistoryLength () { return max_history_length; };
 	static uint maxConsoleLines () { return max_console_lines; };
 	static bool pipeUserCommandsThroughConsole () { return pipe_user_commands_through_console; };
+	/** 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 QStringList loadCommandHistory ();
 	static void saveCommandHistory (const QStringList &list);
@@ -58,8 +64,10 @@
 	static uint max_history_length;
 	static uint max_console_lines;
 	static bool pipe_user_commands_through_console;
+	static bool context_sensitive_history_by_default;
 
 	QCheckBox *save_history_box;
+	QCheckBox *reverse_context_mode_box;
 	QCheckBox *pipe_user_commands_through_console_box;
 	KIntSpinBox *max_history_length_spinner;
 	KIntSpinBox *max_console_lines_spinner;


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