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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 14 13:09:28 UTC 2010


Revision: 2786
          http://rkward.svn.sourceforge.net/rkward/?rev=2786&view=rev
Author:   tfry
Date:     2010-03-14 13:09:28 +0000 (Sun, 14 Mar 2010)

Log Message:
-----------
Fix order of menus in detached windows

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rkwardui.rc
    trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
    trunk/rkward/rkward/windows/detachedwindowcontainer.h
    trunk/rkward/rkward/windows/detachedwindowcontainer.rc
    trunk/rkward/rkward/windows/rkcommandeditorwindowpart.rc

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/ChangeLog	2010-03-14 13:09:28 UTC (rev 2786)
@@ -1,3 +1,4 @@
+- Fix order of menus for detached windows
 - File->Open R Script File now allows to specify the character encoding to use
 - Fixed: No entries were added the recent script/workspaces actions after "save as"
 - Initialize the output file with an appropriate encoding specification

Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/rkward/rkwardui.rc	2010-03-14 13:09:28 UTC (rev 2786)
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="52">
+<kpartgui name="rkward" version="53">
 <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.
@@ -34,6 +34,9 @@
 	<!-- 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"/>
+		<DefineGroup name="edit_paste_merge" append="edit_paste_merge" />
+		<DefineGroup name="after_edit_paste_merge" append="edit_paste_merge" />
+		<DefineGroup name="edit_select_merge" append="edit_select_merge" />
 	</Menu>
 	<Menu name="view"><text>&View</text>
 		<Action name="view_menu_dummy"/>

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2010-03-14 13:09:28 UTC (rev 2786)
@@ -2,7 +2,7 @@
                           detachedwindowcontainer  -  description
                              -------------------
     begin                : Wed Oct 21 2005
-    copyright            : (C) 2005, 2007, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2007, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -26,6 +26,7 @@
 #include <qlayout.h>
 #include <qwidget.h>
 #include <QCloseEvent>
+#include <QMenu>
 
 #include "rktoplevelwindowgui.h"
 #include "../rkward.h"
@@ -50,7 +51,7 @@
 	setXMLFile ("detachedwindowcontainer.rc");
 	insertChildClient (toplevel_actions = new RKTopLevelWindowGUI (this));
 	statusBar ()->hide ();
-	createShellGUI ();
+	createShellGUI (true);
 	RKXMLGUISyncer::self ()->watchXMLGUIClientUIrc (this);
 
 // copy main window toolbar settings
@@ -68,6 +69,11 @@
 	createGUI (widget_to_capture->getPart ());
 	captured = widget_to_capture;
 
+	hideEmptyMenus ();
+	// hide empty menus now, and after any reloads
+	// the signal is available since KDE 4.1.3, but we can tolerate a bit of aesthethic malfunction on earlier versions
+	connect (guiFactory (), SIGNAL(makingChanges(bool)), this, SLOT(hideEmptyMenus(bool)));
+
 // sanitize toolbars
 	foreach (KToolBar *bar, toolBars ()) {
 		if (main_window_toolbar_styles.contains (bar->objectName ())) {
@@ -87,6 +93,19 @@
 	RK_TRACE (APP);
 }
 
+void DetachedWindowContainer::hideEmptyMenus (bool ignore) {
+	if (ignore) return;
+	RK_TRACE (APP);
+
+	// 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";
+	foreach (QString name, menu_names) {
+		QMenu* menu = dynamic_cast<QMenu*>(guiFactory ()->container (name, this));
+		if (menu) menu->menuAction ()->setVisible (!menu->isEmpty ());
+	}
+}
+
 void DetachedWindowContainer::viewDestroyed (QObject *) {
 	RK_TRACE (APP);
 

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.h
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.h	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.h	2010-03-14 13:09:28 UTC (rev 2786)
@@ -2,7 +2,7 @@
                           detachedwindowcontainer  -  description
                              -------------------
     begin                : Wed Oct 21 2005
-    copyright            : (C) 2005, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -45,6 +45,9 @@
 /** update own caption, when the window's caption has changed */
 	void updateCaption (RKMDIWindow *);
 	void slotSetStatusBarText (const QString &text);
+/** Hide any emtpy menus.
+ at param ignore do nothing if true. For internal use, only. */
+	void hideEmptyMenus (bool ignore=false);
 protected:
 /** when receiving a close event, dispatch to the embedded window */
 	void closeEvent (QCloseEvent *e);

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.rc
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.rc	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.rc	2010-03-14 13:09:28 UTC (rev 2786)
@@ -1,7 +1,28 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="48">
+<kpartgui name="rkward" version="53">
 	<MenuBar>
-		<Merge/>
+		<Menu name="file"><text>&File</text>
+			<DefineGroup name="file_dummy_merge" />
+		</Menu>
+		<Menu name="device" append="first_menu"><text>&Device</text>
+			<DefineGroup name="device_dummy_merge" />
+		</Menu>
+		<Menu name="edit"><text>&Edit</text>
+			<DefineGroup name="edit_paste_merge" append="edit_paste_merge" />
+			<DefineGroup name="after_edit_paste_merge" append="edit_paste_merge" />
+			<DefineGroup name="edit_select_merge" append="edit_select_merge" />
+		</Menu>
+		<Menu name="view"><text>&View</text>
+			<DefineGroup name="view_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"/>
+			<DefineGroup name="postrun_actions_merge" append="postrun_actions_merge"/>
+		</Menu>
+		
+		<Merge name="rkwardcomponents" />
+
 		<Menu name="window"><text>&Window</text>
 			<Merge/>
 			<Action name="dwindow_close"/>
@@ -10,6 +31,7 @@
 			<Separator/>
 			<Action name="dwindow_attach"/>
 		</Menu>
+		<Menu name="settings"/>
 		<Menu name="help"><text>&Help</text>
 			<Merge/>
 		</Menu>

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindowpart.rc
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindowpart.rc	2010-03-14 13:08:21 UTC (rev 2785)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindowpart.rc	2010-03-14 13:09:28 UTC (rev 2786)
@@ -1,14 +1,14 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="51">
+<kpartgui name="rkward" version="53">
 	<MenuBar>
-		<Menu name="edit" noMerge="1"><text>&Edit</text>
+		<Menu name="edit"><text>&Edit</text>
 			<Menu name="tools"><text>&Tools Move</text>
 				<Merge/>
 			</Menu>
 			<Action name="copy"/>
-			<Merge/>
-			<Action name="mark_block"/>
-			<Action name="unmark_block"/>
+			<Action name="paste_vector" group="after_edit_paste_merge"/>
+			<Action name="mark_block" group="edit_select_merge"/>
+			<Action name="unmark_block" group="edit_select_merge"/>
 		</Menu>
 		<Menu name="run" noMerge="1"><text>&Run</text>
 			<Action name="run_block" group="postrun_actions_merge"/>


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