[rkward-cvs] SF.net SVN: rkward: [1987] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Sep 24 15:47:29 UTC 2007
Revision: 1987
http://rkward.svn.sourceforge.net/rkward/?rev=1987&view=rev
Author: tfry
Date: 2007-09-24 08:47:28 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
FOR 0.4.8: Add option to add piped commands to the console (checked by default)
Modified Paths:
--------------
trunk/rkward/NOTES
trunk/rkward/rkward/rkconsole.cpp
trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp
trunk/rkward/rkward/settings/rksettingsmoduleconsole.h
Modified: trunk/rkward/NOTES
===================================================================
--- trunk/rkward/NOTES 2007-09-24 12:36:57 UTC (rev 1986)
+++ trunk/rkward/NOTES 2007-09-24 15:47:28 UTC (rev 1987)
@@ -2,5 +2,6 @@
*** From 0.4.7a to 0.4.8 ***
- With the addition of the new filesystem browser, the shortcuts to show/hide the main tool windows have changed. The filesystem browser window can be toggled using Alt+2, the shortcuts for command log, pending jobs, console, and help search are now Alt+3 through 6, respectively, instead of Alt+2 through 5.
+- All commands run through the console are now added to the command history of the console, by default. This setting can be changed back to the old behavior (only commands *entered* in the console are added to the history) under Settings->Configure RKWard->Console.
*** Changes prior to 0.4.7a not listed in this document. ***
Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp 2007-09-24 12:36:57 UTC (rev 1986)
+++ trunk/rkward/rkward/rkconsole.cpp 2007-09-24 15:47:28 UTC (rev 1987)
@@ -824,7 +824,13 @@
} else {
QString command_string = command->command ();
QString text = command_string;
- text.replace ("\n", QString ("\n") + iprefix);
+ if (RKSettingsModuleConsole::addPipedCommandsToHistory()) {
+ QStringList lines = QStringList::split ('\n', text);
+ for (QStringList::const_iterator it = lines.constBegin (); it != lines.constEnd (); ++it) {
+ addCommandToHistory (*it);
+ }
+ }
+ text.replace ('\n', QString ("\n") + iprefix);
doc->insertText (doc->numLines () - 1, QString (nprefix).length (), text + '\n');
command->addReceiver (this);
command->addTypeFlag (RCommand::Console);
Modified: trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp 2007-09-24 12:36:57 UTC (rev 1986)
+++ trunk/rkward/rkward/settings/rksettingsmoduleconsole.cpp 2007-09-24 15:47:28 UTC (rev 1987)
@@ -35,6 +35,7 @@
uint RKSettingsModuleConsole::max_history_length;
uint RKSettingsModuleConsole::max_console_lines;
bool RKSettingsModuleConsole::pipe_user_commands_through_console;
+bool RKSettingsModuleConsole::add_piped_commands_to_history;
bool RKSettingsModuleConsole::context_sensitive_history_by_default;
RKSettingsModuleConsole::RKSettingsModuleConsole (RKSettings *gui, QWidget *parent) : RKSettingsModule (gui, parent) {
@@ -66,6 +67,12 @@
connect (pipe_user_commands_through_console_box, SIGNAL (stateChanged (int)), this, SLOT (changedSetting (int)));
vbox->addWidget (pipe_user_commands_through_console_box);
+ add_piped_commands_to_history_box = new QCheckBox (i18n ("Also add those commands to console history"), this);
+ add_piped_commands_to_history_box->setChecked (add_piped_commands_to_history);
+ connect (add_piped_commands_to_history_box, SIGNAL (stateChanged (int)), this, SLOT (changedSetting (int)));
+ add_piped_commands_to_history_box->setEnabled (pipe_user_commands_through_console_box->isChecked ());
+ vbox->addWidget (add_piped_commands_to_history_box);
+
vbox->addSpacing (2*RKGlobals::spacingHint ());
reverse_context_mode_box = new QCheckBox (i18n ("Command history is context sensitive by default"), this);
@@ -83,6 +90,8 @@
void RKSettingsModuleConsole::changedSetting (int) {
RK_TRACE (SETTINGS);
change ();
+
+ add_piped_commands_to_history_box->setEnabled (pipe_user_commands_through_console_box->isChecked ());
}
//static
@@ -102,6 +111,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 ("add piped commands to history", add_piped_commands_to_history);
config->writeEntry ("command history defaults to context sensitive", context_sensitive_history_by_default);
}
@@ -114,6 +124,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);
+ 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);
}
@@ -152,6 +163,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 ();
+ add_piped_commands_to_history = add_piped_commands_to_history_box->isChecked ();
context_sensitive_history_by_default = reverse_context_mode_box->isChecked ();
}
Modified: trunk/rkward/rkward/settings/rksettingsmoduleconsole.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmoduleconsole.h 2007-09-24 12:36:57 UTC (rev 1986)
+++ trunk/rkward/rkward/settings/rksettingsmoduleconsole.h 2007-09-24 15:47:28 UTC (rev 1987)
@@ -48,6 +48,7 @@
static uint maxHistoryLength () { return max_history_length; };
static uint maxConsoleLines () { return max_console_lines; };
static bool pipeUserCommandsThroughConsole () { return pipe_user_commands_through_console; };
+ static bool addPipedCommandsToHistory () { return add_piped_commands_to_history; };
/** 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 */
@@ -66,11 +67,13 @@
static uint max_history_length;
static uint max_console_lines;
static bool pipe_user_commands_through_console;
+ static bool add_piped_commands_to_history;
static bool context_sensitive_history_by_default;
QCheckBox *save_history_box;
QCheckBox *reverse_context_mode_box;
QCheckBox *pipe_user_commands_through_console_box;
+ QCheckBox *add_piped_commands_to_history_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