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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Sep 14 11:13:24 UTC 2010


Revision: 3034
          http://rkward.svn.sourceforge.net/rkward/?rev=3034&view=rev
Author:   tfry
Date:     2010-09-14 11:13:24 +0000 (Tue, 14 Sep 2010)

Log Message:
-----------
Add support for window-specific standard help and configure actions. Used for X11-window, and console, for now.

Modified Paths:
--------------
    trunk/rkward/rkward/rkconsole.cpp
    trunk/rkward/rkward/rkconsole.h
    trunk/rkward/rkward/rkconsolepart.rc
    trunk/rkward/rkward/settings/rksettingsmodulegraphics.h
    trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
    trunk/rkward/rkward/windows/detachedwindowcontainer.rc
    trunk/rkward/rkward/windows/rkmdiwindow.cpp
    trunk/rkward/rkward/windows/rkmdiwindow.h
    trunk/rkward/rkward/windows/rkstandardactions.rc
    trunk/rkward/rkward/windows/rkwindowcatcher.cpp

Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/rkconsole.cpp	2010-09-14 11:13:24 UTC (rev 3034)
@@ -112,6 +112,7 @@
 	setCaption (i18n ("R Console"));
 	console_part = new RKConsolePart (this);
 	setPart (console_part);
+	setMetaInfo (shortCaption (), "rkward://page/rkward_console", RKSettings::PageConsole);
 	initializeActivationSignals ();
 	initializeActions (getPart ()->actionCollection ());
 
@@ -796,11 +797,6 @@
 	tryNextInBatch (true);
 }
 
-void RKConsole::configure () {
-	RK_TRACE (APP);
-	RKSettings::configureSettings (RKSettings::PageConsole, this);
-}
-
 void RKConsole::slotInterruptCommand () {
 	RK_TRACE (APP);
 	RK_ASSERT (current_command || command_incomplete);
@@ -849,8 +845,6 @@
 
 	ac->addAction (KStandardAction::Clear, "rkconsole_clear", this, SLOT (clear()));
 	paste_action = ac->addAction (KStandardAction::Paste, "rkconsole_paste", this, SLOT (paste()));
-	QAction *action = ac->addAction ("rkconsole_configure", this, SLOT (configure()));
-	action->setText (i18n ("Configure"));
 
 	addProxyAction ("file_print", i18n ("Print Console"));
 	addProxyAction ("file_export_html");

Modified: trunk/rkward/rkward/rkconsole.h
===================================================================
--- trunk/rkward/rkward/rkconsole.h	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/rkconsole.h	2010-09-14 11:13:24 UTC (rev 3034)
@@ -175,7 +175,6 @@
 	void literalCopy ();
 /** Clear the view, and add a prompt at the top. */
 	void clear ();
-	void configure ();
 /** show context help on the current word */
 	void showContextHelp ();
 /** interrupt current command. */

Modified: trunk/rkward/rkward/rkconsolepart.rc
===================================================================
--- trunk/rkward/rkward/rkconsolepart.rc	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/rkconsolepart.rc	2010-09-14 11:13:24 UTC (rev 3034)
@@ -32,9 +32,6 @@
 		<Menu name="run"><text>&Run</text>
 			<Action name="interrupt" group="postrun_actions_merge"/>
 		</Menu>
-		<Menu name="settings"><text>&Settings</text>
-			<Action name="rkconsole_configure"></Action>
-		</Menu>
 	</MenuBar>
 	<ToolBar fullWidth="true" name="mdiToolBar">
 		<Action name="interrupt" group="postrun_actions_merge"/>
@@ -51,7 +48,5 @@
 		<DefineGroup name="rkconsole_context_merge2"/>
 		<Separator/>
 		<Action name="rkconsole_clear"/>
-		<Separator/>
-		<Action name="rkconsole_configure"/>
 	</Menu>
 </kpartgui>
\ No newline at end of file

Modified: trunk/rkward/rkward/settings/rksettingsmodulegraphics.h
===================================================================
--- trunk/rkward/rkward/settings/rksettingsmodulegraphics.h	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/settings/rksettingsmodulegraphics.h	2010-09-14 11:13:24 UTC (rev 3034)
@@ -45,7 +45,8 @@
 	static void loadSettings (KConfig *config);
 	
 	QString caption ();
-	
+	QString helpURL () { return ("rkward://page/rkward_plot_history#scd_settings"); };
+
 	static bool plotHistoryEnabled () { return graphics_hist_enable; };
 public slots:
 	void boxChanged ();

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2010-09-14 11:13:24 UTC (rev 3034)
@@ -100,7 +100,7 @@
 
 	// remove empty menus (we had to define them in detachedwindowcontainer.rc in order to force a sane menu order)
 	QStringList menu_names;
-	menu_names << "file" << "device" << "edit" << "run" << "view" << "settings";
+	menu_names << "file" << "device" << "history" << "edit" << "run" << "view" << "settings";
 	foreach (QString name, menu_names) {
 		QMenu* menu = dynamic_cast<QMenu*>(guiFactory ()->container (name, this));
 		if (menu) menu->menuAction ()->setVisible (!menu->isEmpty ());

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.rc
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.rc	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.rc	2010-09-14 11:13:24 UTC (rev 3034)
@@ -24,6 +24,9 @@
 		<Menu name="view"><text>&View</text>
 			<DefineGroup name="view_dummy_merge" />
 		</Menu>
+		<Menu name="history"><text>&History</text>
+			<DefineGroup name="history_dummy_merge" />
+		</Menu>
 		<Menu name="run"><text>&Run</text>
 			<DefineGroup name="prerun_actions_merge" append="prerun_actions_merge"/>
 			<DefineGroup name="run_actions_merge" append="run_actions_merge"/>
@@ -40,9 +43,13 @@
 			<Separator/>
 			<Action name="dwindow_attach"/>
 		</Menu>
-		<Menu name="settings"/>
+		<Menu name="settings"><text>&Settings</text>
+			<DefineGroup name="settings_dummy_merge" />
+		</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>
 </kpartgui>

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2010-09-14 11:13:24 UTC (rev 3034)
@@ -2,7 +2,7 @@
                           rkmdiwindow  -  description
                              -------------------
     begin                : Tue Sep 26 2006
-    copyright            : (C) 2006, 2007, 2008, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2006, 2007, 2008, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -26,6 +26,8 @@
 #include <kparts/event.h>
 #include <kxmlguifactory.h>
 #include <kactioncollection.h>
+#include <klocale.h>
+#include <kaction.h>
 
 #include "rkworkplace.h"
 #include "rkworkplaceview.h"
@@ -260,4 +262,38 @@
 	QFrame::enterEvent (event);
 }
 
+void RKMDIWindow::setMetaInfo (const QString& _generic_window_name, const QString& _help_url, RKSettings::SettingsPage _settings_page) {
+	RK_TRACE (APP);
+
+	// only meant to be called once
+	RK_ASSERT (generic_window_name.isEmpty() && _help_url.isEmpty ());
+	generic_window_name = _generic_window_name;
+	help_url = _help_url;
+	settings_page = _settings_page;
+
+	if (!help_url.isEmpty ()) {
+		KAction *action = standardActionCollection ()->addAction ("window_help", this, SLOT (showWindowHelp()));
+		action->setText (i18n ("Help on %1", generic_window_name));
+	}
+	if (settings_page != RKSettings::NoPage) {
+		KAction *action = standardActionCollection ()->addAction ("window_configure", this, SLOT (showWindowSettings()));
+		action->setText (i18n ("Configure %1", generic_window_name));
+	}
+}
+
+void RKMDIWindow::showWindowHelp () {
+	RK_TRACE (APP);
+
+	RK_ASSERT (!help_url.isEmpty ());
+	RKWorkplace::mainWorkplace()->openHelpWindow (help_url, true);
+}
+
+void RKMDIWindow::showWindowSettings () {
+	RK_TRACE (APP);
+
+	RK_ASSERT (settings_page != RKSettings::NoPage);
+	RKSettings::configureSettings (settings_page, this);
+}
+
+
 #include "rkmdiwindow.moc"

Modified: trunk/rkward/rkward/windows/rkmdiwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.h	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/rkmdiwindow.h	2010-09-14 11:13:24 UTC (rev 3034)
@@ -23,6 +23,8 @@
 
 #include <kparts/part.h>
 
+#include "../settings/rksettings.h"
+
 class QEvent;
 class QPaintEvent;
 class RKWorkplace;
@@ -114,8 +116,12 @@
 	void captionChanged (RKMDIWindow *);
 /** This signal is emitted, when the window was activated *with* focus */
 	void windowActivated (RKMDIWindow *);
+protected slots:
+	void showWindowHelp ();
+	void showWindowSettings ();
 protected:
 	void setPart (KParts::Part *p) { part = p; };
+	void setMetaInfo (const QString& generic_window_name, const QString& help_url, RKSettings::SettingsPage settings_page=RKSettings::NoPage);
 	void initializeActivationSignals ();
 	void paintEvent (QPaintEvent *e);
 	void windowActivationChange (bool);
@@ -137,6 +143,9 @@
 	RKMDIStandardActionClient *standard_client;
 /** @see globalContextProperty() */
 	QMap<QString, QString> global_context_properties;
+	QString generic_window_name;
+	QString help_url;
+	RKSettings::SettingsPage settings_page;
 };
 
 #endif

Modified: trunk/rkward/rkward/windows/rkstandardactions.rc
===================================================================
--- trunk/rkward/rkward/windows/rkstandardactions.rc	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/rkstandardactions.rc	2010-09-14 11:13:24 UTC (rev 3034)
@@ -16,7 +16,11 @@
 		</Menu>
 		<Menu name="help">
 			<Action name="function_reference" group="help_actions_merge"/>
+			<Action name="window_help" group="prehelp_actions_merge"/>
 		</Menu>
+		<Menu name="settings">
+			<Action name="window_configure"/>
+		</Menu>
 	</MenuBar>
 	<ToolBar fullWidth="true" name="mdiToolBar">
 		<Action name="run_line" group="toolbar_actions_merge"/>
@@ -40,6 +44,8 @@
 		<Action name="paste_special" group="rkconsole_context_merge_paste"/>
 		<Action name="run_selection" group="rkconsole_context_merge1"/>
 		<Action name="function_reference" group="rkconsole_context_merge2"/>
+		<Separator/>
+		<Action name="window_configure"/>
 	</Menu>
 	<Menu name="rkcommandlog_context_menu">
 		<Action name="run_selection" group="rkcommandlog_context_merge1"/>

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2010-09-14 08:21:32 UTC (rev 3033)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2010-09-14 11:13:24 UTC (rev 3034)
@@ -145,6 +145,7 @@
 
 	error_dialog = new RKProgressControl (0, i18n ("An error occurred"), i18n ("An error occurred"), RKProgressControl::DetailedError);
 	setPart (new RKCaughtX11WindowPart (this));
+	setMetaInfo (i18n ("Graphics Device Window"), "rkward://page/rkward_plot_history", RKSettings::PageX11);
 	initializeActivationSignals ();
 	setFocusPolicy (Qt::ClickFocus);
 	updateHistoryActions (0, 0, QStringList ());


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