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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed May 20 16:17:32 UTC 2009


Revision: 2494
          http://rkward.svn.sourceforge.net/rkward/?rev=2494&view=rev
Author:   tfry
Date:     2009-05-20 16:17:32 +0000 (Wed, 20 May 2009)

Log Message:
-----------
Start working on configurable shortcuts.
RKStandardActions are split out into a separate container, so they can have application-global shortcuts.
TODO: shortcut-settings are not applied to all mdi
TODO: reloadXML causes havoc on customized xml clients.
PART OF r2493 (called svn commit from wrong directory)

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/misc/rkstandardactions.cpp
    trunk/rkward/rkward/misc/rkstandardactions.h
    trunk/rkward/rkward/rkconsole.cpp
    trunk/rkward/rkward/rkconsolepart.rc
    trunk/rkward/rkward/rkwardui.rc

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/ChangeLog	2009-05-20 16:17:32 UTC (rev 2494)
@@ -1,3 +1,4 @@
+- Make keyboard shorcuts configurable		TODO: work in progress, this is still broken
 - Add option to add only single line commands from script editor to the console history
 - Add action to change working directory to that of the current script file
 - Fixed: No warning was shown, when an open script file was changed on disk, externally

Modified: trunk/rkward/rkward/misc/rkstandardactions.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkstandardactions.cpp	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/rkward/misc/rkstandardactions.cpp	2009-05-20 16:17:32 UTC (rev 2494)
@@ -2,7 +2,7 @@
                           rkstandardactions  -  description
                              -------------------
     begin                : Sun Nov 18 2007
-    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -22,43 +22,44 @@
 #include <kaction.h>
 
 #include "rkstandardicons.h"
+#include "../windows/rkmdiwindow.h"
 
 #include "../debug.h"
 
-KAction* RKStandardActions::runLine (KActionCollection* action_collection, const QString &name, const QObject *receiver, const char *member) {
+KAction* RKStandardActions::runLine (RKMDIWindow *window, const QString &name, const QObject *receiver, const char *member) {
 	RK_TRACE (MISC);
 
-	KAction* ret = action_collection->addAction (name, receiver, member);
+	KAction* ret = window->standardActionCollection ()->addAction (name, receiver, member);
 	ret->setText (i18n ("Run current line"));
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunLine));
 	ret->setShortcut (Qt::ShiftModifier + Qt::Key_F7);
 	return ret;
 }
 
-KAction* RKStandardActions::runSelection (KActionCollection* action_collection, const QString &name, const QObject *receiver, const char *member) {
+KAction* RKStandardActions::runSelection (RKMDIWindow *window, const QString &name, const QObject *receiver, const char *member) {
 	RK_TRACE (MISC);
 
-	KAction* ret = action_collection->addAction (name, receiver, member);
+	KAction* ret = window->standardActionCollection ()->addAction (name, receiver, member);
 	ret->setText (i18n ("Run selection"));
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunSelection));
 	ret->setShortcut (Qt::ShiftModifier + Qt::Key_F8);
 	return ret;
 }
 
-KAction* RKStandardActions::runAll (KActionCollection* action_collection, const QString &name, const QObject *receiver, const char *member) {
+KAction* RKStandardActions::runAll (RKMDIWindow *window, const QString &name, const QObject *receiver, const char *member) {
 	RK_TRACE (MISC);
 
-	KAction* ret = action_collection->addAction (name, receiver, member);
+	KAction* ret = window->standardActionCollection ()->addAction (name, receiver, member);
 	ret->setText (i18n ("Run all"));
 	ret->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionRunAll));
 	ret->setShortcut (Qt::ShiftModifier + Qt::Key_F9);
 	return ret;
 }
 
-KAction* RKStandardActions::functionHelp (KActionCollection* action_collection, const QString &name, const QObject *receiver, const char *member) {
+KAction* RKStandardActions::functionHelp (RKMDIWindow *window, const QString &name, const QObject *receiver, const char *member) {
 	RK_TRACE (MISC);
 
-	KAction* ret = action_collection->addAction (name, receiver, member);
+	KAction* ret = window->standardActionCollection ()->addAction (name, receiver, member);
 	ret->setText (i18n ("&Function reference"));
 	ret->setShortcut (Qt::Key_F2);
 	return ret;

Modified: trunk/rkward/rkward/misc/rkstandardactions.h
===================================================================
--- trunk/rkward/rkward/misc/rkstandardactions.h	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/rkward/misc/rkstandardactions.h	2009-05-20 16:17:32 UTC (rev 2494)
@@ -2,7 +2,7 @@
                           rkstandardactions  -  description
                              -------------------
     begin                : Sun Nov 18 2007
-    copyright            : (C) 2007 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -21,17 +21,17 @@
 class KAction;
 class QString;
 class QObject;
-class KActionCollection;
+class RKMDIWindow;
 
 /** This namespace provides functions to generate some standard actions, i.e. actions which are needed at more than one place.
 
 @author Thomas Friedrichsmeier */
 namespace RKStandardActions {
-	KAction* runLine (KActionCollection* action_collection, const QString &name, const QObject *receiver=0, const char *member=0);
-	KAction* runSelection (KActionCollection* action_collection, const QString &name, const QObject *receiver=0, const char *member=0);
-	KAction* runAll (KActionCollection* action_collection, const QString &name, const QObject *receiver=0, const char *member=0);
+	KAction* runLine (RKMDIWindow *window, const QString &name, const QObject *receiver=0, const char *member=0);
+	KAction* runSelection (RKMDIWindow *window, const QString &name, const QObject *receiver=0, const char *member=0);
+	KAction* runAll (RKMDIWindow *window, const QString &name, const QObject *receiver=0, const char *member=0);
 
-	KAction* functionHelp (KActionCollection* action_collection, const QString &name, const QObject *receiver=0, const char *member=0);
+	KAction* functionHelp (RKMDIWindow *window, const QString &name, const QObject *receiver=0, const char *member=0);
 };
 
 #endif

Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/rkward/rkconsole.cpp	2009-05-20 16:17:32 UTC (rev 2494)
@@ -797,9 +797,9 @@
 void RKConsole::initializeActions (KActionCollection *ac) {
 	RK_TRACE (APP);
 
-	context_help_action = RKStandardActions::functionHelp (ac, "function_reference", this, SLOT(showContextHelp()));
+	context_help_action = RKStandardActions::functionHelp (this, "function_reference", this, SLOT(showContextHelp()));
 
-	run_selection_action = RKStandardActions::runSelection (ac, "run_selection", this, SLOT (runSelection()));
+	run_selection_action = RKStandardActions::runSelection (this, "run_selection", this, SLOT (runSelection()));
 
 	interrupt_command_action = ac->addAction ("interrupt", this, SLOT (slotInterruptCommand()));
 	interrupt_command_action->setText (i18n ("Interrupt running command"));

Modified: trunk/rkward/rkward/rkconsolepart.rc
===================================================================
--- trunk/rkward/rkward/rkconsolepart.rc	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/rkward/rkconsolepart.rc	2009-05-20 16:17:32 UTC (rev 2494)
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="0.4.8">
+<kpartgui name="rkward" version="0.5.1">
 	<MenuBar>
 		<Menu name="edit"><text>&Edit</text>
 			<Action name="rkconsole_copy"></Action>
@@ -9,32 +9,25 @@
 			<Action name="rkconsole_clear"></Action>
 		</Menu>
 		<Menu name="run"><text>&Run</text>
-			<Merge/>
-			<Separator/>
-			<Action name="run_selection"/>
-			<Action name="interrupt"/>
+			<Action name="interrupt" group="postrun_actions_merge"/>
 		</Menu>
 		<Menu name="settings"><text>&Settings</text>
 			<Action name="rkconsole_configure"></Action>
 		</Menu>
-		<Menu name="help"><text>&Help</text>
-			<Action name="function_reference"></Action>
-		</Menu>
 	</MenuBar>
 	<ToolBar fullWidth="true" name="mdiToolBar">
-		<Action name="run_selection"/>
-		<Action name="interrupt"/>
+		<Action name="interrupt" group="postrun_actions_merge"/>
 	</ToolBar>
 	<Menu name="rkconsole_context_menu">
 		<Action name="rkconsole_copy"></Action>
 		<Action name="rkconsole_copy_literal"></Action>
 		<Action name="rkconsole_paste"></Action>
 		<Separator/>
-		<Action name="function_reference"></Action>
-		<Separator/>
-		<Action name="run_selection"/>
+		<DefineGroup name="rkconsole_context_merge1" append="rkconsole_context_merge1"/>
 		<Action name="interrupt"></Action>
 		<Separator/>
+		<DefineGroup name="rkconsole_context_merge2" append="rkconsole_context_merge2"/>
+		<Separator/>
 		<Action name="rkconsole_clear"></Action>
 		<Separator/>
 		<Action name="rkconsole_configure"></Action>

Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc	2009-05-20 16:13:46 UTC (rev 2493)
+++ trunk/rkward/rkward/rkwardui.rc	2009-05-20 16:17:32 UTC (rev 2494)
@@ -1,6 +1,9 @@
 <!DOCTYPE kpartgui>
 <kpartgui name="rkward" version="0.5.1">
 <MenuBar>
+	<!-- The Main Window ui.rc is the only one, where merging happens, reliably. That is, why we need to define
+	     a lot of merge points, here, which can then be used be mdi windows and their children.
+	     That's a bit unfortunate, as it's rather non-modular, but so it is... -->
 	<Menu name="file"><text>&File</text>
 		<Menu name="new_data"><text>&New</text>
 			<Action name="new_data_frame"/>
@@ -29,15 +32,15 @@
 	<!-- These menus are actually defined in KParts. We also declare them here, to avoid menus jumping around -->
 	<Menu name="edit"><text>&Edit</text>
 		<Action name="edit_menu_dummy"/>
-		<Merge/>
 	</Menu>
 	<Menu name="view"><text>&View</text>
 		<Action name="view_menu_dummy"/>
-		<Merge/>
 	</Menu>
 	<Menu name="run"><text>&Run</text>
 		<Action name="run_menu_dummy"/>
-		<Merge/>
+		<DefineGroup name="prerun_actions_merge" append="prerun_actions_merge"/>
+		<DefineGroup name="run_actions_merge" append="run_actions_merge"/>
+		<DefineGroup name="postrun_actions_merge" append="postrun_actions_merge"/>
 	</Menu>
 	
 	<Merge name="rkwardcomponents" />
@@ -67,9 +70,10 @@
 	</Menu>
 
 	<Menu name="help"><text>&Help</text>
-		<Merge/>
+		<DefineGroup name="prehelp_actions_merge" append="prehelp_actions_merge"/>
+		<DefineGroup name="help_actions_merge" append="help_actions_merge"/>
+		<DefineGroup name="posthelp_actions_merge" append="posthelp_actions_merge"/>
 	</Menu>
-
 </MenuBar>
 <ToolBar fullWidth="true" name="mainToolBar">
 		<Action name="new_data_frame"/>
@@ -80,5 +84,8 @@
 		<Action name="next_window"/>
 </ToolBar>
 <ToolBar fullWidth="true" name="mdiToolBar">
+	<DefineGroup name="pretoolbar_actions_merge" append="pretoolbar_actions_merge"/>
+	<DefineGroup name="toolbar_actions_merge" append="toolbar_actions_merge"/>
+	<DefineGroup name="posttoolbar_actions_merge" append="posttoolbar_actions_merge"/>
 </ToolBar>
 </kpartgui>


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