[rkward-cvs] SF.net SVN: rkward: [2279] branches/KDE4_port

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Dec 3 01:43:16 UTC 2007


Revision: 2279
          http://rkward.svn.sourceforge.net/rkward/?rev=2279&view=rev
Author:   tfry
Date:     2007-12-02 17:43:16 -0800 (Sun, 02 Dec 2007)

Log Message:
-----------
When edit/view/run menus are empty, insert an explanatory placeholder

Modified Paths:
--------------
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/rkward.cpp
    branches/KDE4_port/rkward/rkward.h
    branches/KDE4_port/rkward/rkwardui.rc
    branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-11-30 15:37:55 UTC (rev 2278)
+++ branches/KDE4_port/TODO_KDE4	2007-12-03 01:43:16 UTC (rev 2279)
@@ -68,3 +68,4 @@
 	-* in administrator mode KdeSudo instead of kdesu or option of both? it is a 'fashion' these days not to have root password (ala *ubuntu)!!
 	-* any means of fetching a description of the package before installing?
 	- when adding vars to a multi varslot, these should become selected (so you can removed them again with a single click)
+	- deal better with overlapping blocks in the script editor (brush merging?)

Modified: branches/KDE4_port/rkward/rkward.cpp
===================================================================
--- branches/KDE4_port/rkward/rkward.cpp	2007-11-30 15:37:55 UTC (rev 2278)
+++ branches/KDE4_port/rkward/rkward.cpp	2007-12-03 01:43:16 UTC (rev 2279)
@@ -155,9 +155,7 @@
 	part_manager = new KParts::PartManager (this);
 	// When the manager says the active part changes,
 	// the builder updates (recreates) the GUI
-	connect (partManager (), SIGNAL (activePartChanged (KParts::Part *)), this, SLOT (createGUI (KParts::Part *)));
-	connect (partManager (), SIGNAL (partAdded (KParts::Part *)), this, SLOT (partAdded (KParts::Part *)));
-	connect (partManager (), SIGNAL (partRemoved (KParts::Part *)), this, SLOT (partRemoved (KParts::Part *)));
+	connect (partManager (), SIGNAL (activePartChanged (KParts::Part *)), this, SLOT (partChanged (KParts::Part *)));
 
 	// create the DBUS adaptor:
 	new RKWardDBUSInterface (qApp);
@@ -381,30 +379,34 @@
 
 	configure = actionCollection ()->addAction ("configure", this, SLOT (slotConfigure()));
 	configure->setText (i18n ("Configure RKWard"));
+
+	edit_menu_dummy = actionCollection ()->addAction ("edit_menu_dummy", this);
+	edit_menu_dummy->setText (i18n ("[No actions available for current view]"));
+	edit_menu_dummy->setEnabled (false);
+	view_menu_dummy = actionCollection ()->addAction ("view_menu_dummy", this);
+	view_menu_dummy->setText (edit_menu_dummy->text ());
+	view_menu_dummy->setEnabled (false);
+	run_menu_dummy = actionCollection ()->addAction ("run_menu_dummy", this);
+	run_menu_dummy->setText (edit_menu_dummy->text ());
+	run_menu_dummy->setEnabled (false);
 }
 
-void RKWardMainWindow::partAdded (KParts::Part *part) {
+void RKWardMainWindow::partChanged (KParts::Part *part) {
 	RK_TRACE (APP);
 
-	if (!part->actionCollection ()) {
-		RK_ASSERT (false);
-		return;
-	}
+	createGUI (part);
 
-// KDE4: remove this function?
-// well, we might use it to add / remove dummy menu-entries to menus that are other wise empty.
-}
-
-void RKWardMainWindow::partRemoved (KParts::Part *part) {
-	RK_TRACE (APP);
-
-	if (!part->actionCollection ()) {
+	if (!guiFactory ()) {
 		RK_ASSERT (false);
 		return;
 	}
 
-// KDE4: remove this function?
-// well, we might use it to add / remove dummy menu-entries to menus that are other wise empty.
+	QMenu* menu = dynamic_cast<QMenu*>(guiFactory ()->container ("edit", this));
+	edit_menu_dummy->setVisible (menu && (menu->actions ().size () <= 1));
+	menu = dynamic_cast<QMenu*>(guiFactory ()->container ("view", this));
+	view_menu_dummy->setVisible (menu && (menu->actions ().size () <= 1));
+	menu = dynamic_cast<QMenu*>(guiFactory ()->container ("run", this));
+	run_menu_dummy->setVisible (menu && (menu->actions ().size () <= 1));
 }
 
 void RKWardMainWindow::initStatusBar () {

Modified: branches/KDE4_port/rkward/rkward.h
===================================================================
--- branches/KDE4_port/rkward/rkward.h	2007-11-30 15:37:55 UTC (rev 2278)
+++ branches/KDE4_port/rkward/rkward.h	2007-12-03 01:43:16 UTC (rev 2279)
@@ -169,10 +169,8 @@
 	void setCaption (const QString &);
 /** HACK this is only to make the compiler happy with -Woverloaded-virtual */
 	void setCaption (const QString &dummy, bool) { setCaption (dummy); };
-/** connected to m_manager->partAdded (). Connects statusbar notifications */
-	void partAdded (KParts::Part *part);
-/** connected to m_manager->partAdded (). Disconnects statusbar notifications */
-	void partRemoved (KParts::Part *part);
+private slots:
+	void partChanged (KParts::Part *new_part);
 private:
 	QLabel* statusbar_r_status;
 	KSqueezedTextLabel* statusbar_cwd;
@@ -200,7 +198,14 @@
 	QAction* window_detach;
 	
 	QAction* configure;
-	
+
+	/** used so that if the menu is empty, there is a note in it, explaining that fact */
+	QAction* edit_menu_dummy;
+	/** used so that if the menu is empty, there is a note in it, explaining that fact */
+	QAction* view_menu_dummy;
+	/** used so that if the menu is empty, there is a note in it, explaining that fact */
+	QAction* run_menu_dummy;
+
 	friend class RKSettingsModule;
 	friend class RKSettingsModulePlugins;
 	friend class RKSettings;

Modified: branches/KDE4_port/rkward/rkwardui.rc
===================================================================
--- branches/KDE4_port/rkward/rkwardui.rc	2007-11-30 15:37:55 UTC (rev 2278)
+++ branches/KDE4_port/rkward/rkwardui.rc	2007-12-03 01:43:16 UTC (rev 2279)
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="0.4.8">
+<kpartgui name="rkward" version="0.5.0">
 <MenuBar>
 	<Menu name="file"><text>&File</text>
 		<Menu name="new_data"><text>&New</text>
@@ -27,9 +27,18 @@
 	</Menu>
 
 	<!-- These menus are actually defined in KParts. We also declare them here, to avoid menus jumping around -->
-	<Menu name="edit"><text>&Edit</text><Separator/><Merge/></Menu>
-	<Menu name="view"><text>&View</text><Separator/><Merge/></Menu>
-	<Menu name="run"><text>&Run</text><Separator/><Merge/></Menu>
+	<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/>
+	</Menu>
 	
 	<Merge name="rkwardcomponents" />
 

Modified: branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp	2007-11-30 15:37:55 UTC (rev 2278)
+++ branches/KDE4_port/rkward/windows/rktoolwindowbar.cpp	2007-12-03 01:43:16 UTC (rev 2279)
@@ -22,6 +22,7 @@
 #include <khbox.h>
 #include <kmenu.h>
 #include <klocale.h>
+#include <kparts/partmanager.h>
 
 #include <QSplitter>
 #include <QContextMenuEvent>
@@ -29,6 +30,7 @@
 #include "rkworkplace.h"
 #include "rkworkplaceview.h"
 #include "rkmdiwindow.h"
+#include "../rkward.h"
 #include "../misc/rkstandardicons.h"
 
 #include "../debug.h"
@@ -218,6 +220,7 @@
 		container->hide ();
 	}
 
+	RKWardMainWindow::getMain()->partManager()->setActivePart (0);
 	widget->active = false;
 	widget->hide ();
 


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