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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Nov 18 17:49:38 UTC 2007


Revision: 2235
          http://rkward.svn.sourceforge.net/rkward/?rev=2235&view=rev
Author:   tfry
Date:     2007-11-18 09:49:37 -0800 (Sun, 18 Nov 2007)

Log Message:
-----------
Instead of hover close buttons, use a single close tab button. This
a) works (in contrast to the hover close button, which appears to be broken in kdelibs)
b) seems to be de-facto standard in many KDE apps
c) has less potential for mouse accidents

Modified Paths:
--------------
    branches/KDE4_port/NOTES
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/windows/rkworkplaceview.cpp
    branches/KDE4_port/rkward/windows/rkworkplaceview.h

Modified: branches/KDE4_port/NOTES
===================================================================
--- branches/KDE4_port/NOTES	2007-11-18 17:06:57 UTC (rev 2234)
+++ branches/KDE4_port/NOTES	2007-11-18 17:49:37 UTC (rev 2235)
@@ -1,7 +1,8 @@
 Notes about changes in RKWard that existing users need to adapt to:
 
 *** From 0.4.x to 0.5.0 ***
-- Due to clashes with other default shortcuts, the shortcuts for Run->Run Line, Run Selection, and Run All were changed to Shift+F7, Shift+F8, Shift+F9, respectively.
+- Due to clashes with kate default shortcuts, the shortcuts for Run->Run Line, Run Selection, and Run All were changed to Shift+F7, Shift+F8, Shift+F9, respectively.
+- The tabs in the main workplace view no longer have a close button that is shown when hovering the mouse over the respective icon. Rather, there is a single button to close the current tab, shown at the right of the tab bar.
 
 *** From 0.4.7a to 0.4.8 ***
 - With the addition of the new filesystem browser, the shortcuts to show/hide the main tool windows have changed. The filesystem browser window can be toggled using Alt+2, the shortcuts for command log, pending jobs, console, and help search are now Alt+3 through 6, respectively, instead of Alt+2 through 5.

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-11-18 17:06:57 UTC (rev 2234)
+++ branches/KDE4_port/TODO_KDE4	2007-11-18 17:49:37 UTC (rev 2235)
@@ -25,7 +25,6 @@
 	- grep sources for "KDE4"
 	- remove all the passing around of KGlobal::config() as a parameter
 	- the whole idea of having a single mutex for everything is flawed. We should use several specialized ones
-	-* the 'X' icon for closing a tab (Ctl-W) is absent
 	-* when rkward freezes, terminating (window close -> Terminate) rkward does not kill rkward.bin
 	- do some profiling, whether the more expensive lookup in RContainerObject::findObjectByName() is a performance issue
 

Modified: branches/KDE4_port/rkward/windows/rkworkplaceview.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkworkplaceview.cpp	2007-11-18 17:06:57 UTC (rev 2234)
+++ branches/KDE4_port/rkward/windows/rkworkplaceview.cpp	2007-11-18 17:49:37 UTC (rev 2235)
@@ -22,11 +22,12 @@
 #include <kshortcut.h>
 #include <kactioncollection.h>
 #include <kaction.h>
+#include <kicon.h>
 
 #include <qapplication.h>
 #include <qevent.h>
 #include <qlayout.h>
-#include <qicon.h>
+#include <QToolButton>
 
 #include "rkmdiwindow.h"
 
@@ -36,7 +37,13 @@
 RKWorkplaceView::RKWorkplaceView (QWidget *parent) : KTabWidget (parent) {
 	RK_TRACE (APP);
 
-	setHoverCloseButtonDelayed (true);
+	// close button
+	QToolButton* close_button = new QToolButton (this);
+	close_button->setIcon (KIcon ("tab-close"));
+	connect (close_button, SIGNAL (clicked()), this, SLOT (closeCurrentPage()));
+	close_button->adjustSize ();
+	setCornerWidget (close_button, Qt::TopRightCorner);
+
 	setTabBarHidden (true);		// initially
 	connect (this, SIGNAL (currentChanged(int)), this, SLOT (currentPageChanged(int)));
 }
@@ -149,6 +156,19 @@
 	return (dynamic_cast<RKMDIWindow *> (w));
 }
 
+void RKWorkplaceView::closeCurrentPage () {
+	RK_TRACE (APP);
+
+	RKMDIWindow* w = activePage ();
+
+	if (!w) {
+		RK_ASSERT (false);	// the close button should not be visible, if there are no pages
+		return;
+	}
+
+	w->close (true);
+}
+
 void RKWorkplaceView::childCaptionChanged (RKMDIWindow *widget) {
 	RK_TRACE (APP);
 

Modified: branches/KDE4_port/rkward/windows/rkworkplaceview.h
===================================================================
--- branches/KDE4_port/rkward/windows/rkworkplaceview.h	2007-11-18 17:06:57 UTC (rev 2234)
+++ branches/KDE4_port/rkward/windows/rkworkplaceview.h	2007-11-18 17:49:37 UTC (rev 2235)
@@ -68,6 +68,9 @@
 	void pageLeft ();
 /** Active the page right of the current tab */
 	void pageRight ();
+private slots:
+/** (Attempts to) close the current tab */
+	void closeCurrentPage ();
 private:
 	void updateActions ();
 


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