[rkward-cvs] SF.net SVN: rkward:[2798] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Mar 21 20:57:07 UTC 2010
Revision: 2798
http://rkward.svn.sourceforge.net/rkward/?rev=2798&view=rev
Author: tfry
Date: 2010-03-21 20:56:48 +0000 (Sun, 21 Mar 2010)
Log Message:
-----------
Add close buttons to the tabs in the workplace view
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/windows/rkworkplaceview.cpp
trunk/rkward/rkward/windows/rkworkplaceview.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2010-03-21 16:08:32 UTC (rev 2797)
+++ trunk/rkward/ChangeLog 2010-03-21 20:56:48 UTC (rev 2798)
@@ -1,3 +1,4 @@
+- Add close buttons to each tab in the main document view area (not available in KDE 4.0)
- Make "print", "export as HTML", "dynamic word wrap", and "increase/descress font size" available for the console window
- Use a native menu, instead of the default TclTk-menu TODO: test, discuss the settings page, again
- Fixed: Newly created variables were not properly updated when closing and re-opening the editor
Modified: trunk/rkward/rkward/windows/rkworkplaceview.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplaceview.cpp 2010-03-21 16:08:32 UTC (rev 2797)
+++ trunk/rkward/rkward/windows/rkworkplaceview.cpp 2010-03-21 20:56:48 UTC (rev 2798)
@@ -2,7 +2,7 @@
rkworkplaceview - description
-------------------
begin : Tue Sep 26 2006
- copyright : (C) 2006, 2007, 2009 by Thomas Friedrichsmeier
+ copyright : (C) 2006, 2007, 2009, 2010 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -23,6 +23,7 @@
#include <kactioncollection.h>
#include <kaction.h>
#include <kicon.h>
+#include <kdeversion.h>
#include <qapplication.h>
#include <qevent.h>
@@ -37,13 +38,23 @@
RKWorkplaceView::RKWorkplaceView (QWidget *parent) : KTabWidget (parent) {
RK_TRACE (APP);
- // close button
+ // close button(s)
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);
+#if KDE_IS_VERSION(4,1,0)
+# if QT_VERSION >= 0x040500
+ setTabsClosable (true);
+ connect (this, SIGNAL (tabCloseRequested(int)), this, SLOT (closePage(int)));
+# else
+ setCloseButtonEnabled (true);
+ connect (this, SIGNAL (closeRequest(QWidget*)), this, SLOT (closePage(QWidget*)));
+# endif
+#endif
+
setTabBarHidden (true); // initially
connect (this, SIGNAL (currentChanged(int)), this, SLOT (currentPageChanged(int)));
}
@@ -169,6 +180,22 @@
w->close (true);
}
+void RKWorkplaceView::closePage (QWidget* page) {
+ RK_TRACE (APP);
+
+ if (!page) {
+ RK_ASSERT (false);
+ return;
+ }
+ static_cast<RKMDIWindow*>(page)->close (true);
+}
+
+void RKWorkplaceView::closePage (int page) {
+ RK_TRACE (APP);
+
+ closePage (widget (page));
+}
+
void RKWorkplaceView::childCaptionChanged (RKMDIWindow *widget) {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/windows/rkworkplaceview.h
===================================================================
--- trunk/rkward/rkward/windows/rkworkplaceview.h 2010-03-21 16:08:32 UTC (rev 2797)
+++ trunk/rkward/rkward/windows/rkworkplaceview.h 2010-03-21 20:56:48 UTC (rev 2798)
@@ -2,7 +2,7 @@
rkworkplaceview - description
-------------------
begin : Tue Sep 26 2006
- copyright : (C) 2006, 2007 by Thomas Friedrichsmeier
+ copyright : (C) 2006, 2007, 2010 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -68,6 +68,10 @@
void pageLeft ();
/** Active the page right of the current tab */
void pageRight ();
+/** Close a page given the correspoding widget */
+ void closePage (QWidget* page);
+/** Close a page given its index */
+ void closePage (int page);
private slots:
/** (Attempts to) close the current tab */
void closeCurrentPage ();
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