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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Jul 24 10:44:19 UTC 2009


Revision: 2573
          http://rkward.svn.sourceforge.net/rkward/?rev=2573&view=rev
Author:   tfry
Date:     2009-07-24 10:44:19 +0000 (Fri, 24 Jul 2009)

Log Message:
-----------
More effort to sync action shortcuts (this time between several top-level windows)

Modified Paths:
--------------
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
    trunk/rkward/rkward/windows/detachedwindowcontainer.h

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2009-07-23 14:33:56 UTC (rev 2572)
+++ trunk/rkward/rkward/rkward.cpp	2009-07-24 10:44:19 UTC (rev 2573)
@@ -384,6 +384,17 @@
 	run_menu_dummy->setEnabled (false);
 }
 
+void RKWardMainWindow::changeEvent (QEvent *e) {
+	RK_TRACE (APP);
+
+	// see RKWardMainWindow::partChanged() for a detailed comment
+	if ((e->type () == QEvent::ActivationChange) && isActiveWindow () && isVisible ()) {
+		if (factory ()) factory ()->refreshActionProperties ();
+	}
+
+	KParts::MainWindow::changeEvent (e);
+}
+
 void RKWardMainWindow::partChanged (KParts::Part *part) {
 	RK_TRACE (APP);
 

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2009-07-23 14:33:56 UTC (rev 2572)
+++ trunk/rkward/rkward/rkward.h	2009-07-24 10:44:19 UTC (rev 2573)
@@ -95,6 +95,8 @@
 	void initStatusBar();
 	/** reimplemented from KMainWindow to call our doQueryClose (), and then (if quitting was not cancelled), invoke an RKQuitAgent to wait for the R-backend to finish up before actually quitting. */
 	virtual void closeEvent (QCloseEvent *e);
+/** may need to reload the active window's XMLGUI definition */
+	void changeEvent (QEvent *);
 signals:
 	void aboutToQuitRKWard ();
 public slots:

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2009-07-23 14:33:56 UTC (rev 2572)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2009-07-24 10:44:19 UTC (rev 2573)
@@ -21,6 +21,7 @@
 #include <kactioncollection.h>
 #include <kstatusbar.h>
 #include <ktoolbar.h>
+#include <kxmlguifactory.h>
 
 #include <qlayout.h>
 #include <qwidget.h>
@@ -40,17 +41,16 @@
 	setHelpMenuEnabled (false);
 // create own GUI
 	setXMLFile ("detachedwindowcontainer.rc");
+	insertChildClient (toplevel_actions = new RKTopLevelWindowGUI (this));
+	statusBar ()->hide ();
+	createShellGUI ();
+
 	actionCollection ()->addAction (KStandardAction::Close, "dwindow_close", this, SLOT(close()));
 
 	QAction *reattach = actionCollection ()->addAction ("dwindow_attach", this, SLOT(slotReattach()));
 	reattach->setText (i18n ("Attach to main window"));
 	reattach->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionAttachWindow));
 
-	RKTopLevelWindowGUI *toplevel_actions = new RKTopLevelWindowGUI (this);
-	insertChildClient (toplevel_actions);
-	statusBar ()->hide ();
-	createShellGUI ();
-
 // copy main window toolbar settings
 	QMap<QString, Qt::ToolButtonStyle> main_window_toolbar_styles;
 	foreach (KToolBar *bar, RKWardMainWindow::getMain ()->toolBars ()) {
@@ -125,4 +125,17 @@
 	}
 }
 
+void DetachedWindowContainer::changeEvent (QEvent *e) {
+	RK_TRACE (APP);
+
+	// see RKWardMainWindow::partChanged() for a detailed comment
+	if ((e->type () == QEvent::ActivationChange) && isActiveWindow () && isVisible ()) {
+		// why do we need both in this place? No idea, but without the first line, the shortcut is not refreshed, when it was changed via RMB from this window, and without the second line, the shortcut is not refreshed, when it was changed elsewhere.
+		captured->fixupPartGUI (true);
+		if (factory ()) factory ()->refreshActionProperties ();
+	}
+
+	KParts::MainWindow::changeEvent (e);
+}
+
 #include "detachedwindowcontainer.moc"

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.h
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.h	2009-07-23 14:33:56 UTC (rev 2572)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.h	2009-07-24 10:44:19 UTC (rev 2573)
@@ -2,7 +2,7 @@
                           detachedwindowcontainer  -  description
                              -------------------
     begin                : Wed Oct 21 2005
-    copyright            : (C) 2005 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2009 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -22,6 +22,7 @@
 #include <kparts/mainwindow.h>
 
 class RKMDIWindow;
+class RKTopLevelWindowGUI;
 class QCloseEvent;
 
 /** This class is used to host a (KPart enabled) window detached from the main window. @see RKWorkplace::detachWindow ().
@@ -47,8 +48,11 @@
 protected:
 /** when receiving a close event, dispatch to the embedded window */
 	void closeEvent (QCloseEvent *e);
+/** may need to reload embedded window's XMLGUI definition */
+	void changeEvent (QEvent *e);
 private:
 	RKMDIWindow *captured;
+	RKTopLevelWindowGUI *toplevel_actions;
 };
 
 #endif


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