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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 24 14:01:06 UTC 2006


Revision: 930
          http://svn.sourceforge.net/rkward/?rev=930&view=rev
Author:   tfry
Date:     2006-11-24 06:01:06 -0800 (Fri, 24 Nov 2006)

Log Message:
-----------
Fix re-attaching and closing bugs in DetachedWindowContainer

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

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2006-11-20 20:31:34 UTC (rev 929)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp	2006-11-24 14:01:06 UTC (rev 930)
@@ -55,7 +55,8 @@
 void DetachedWindowContainer::viewDestroyed (QObject *) {
 	RK_TRACE (APP);
 
-	delete this;
+	hide ();
+	deleteLater ();
 }
 
 void DetachedWindowContainer::updateCaption (RKMDIWindow *widget) {
@@ -69,10 +70,27 @@
 	RK_TRACE (APP);
 
 	RKMDIWindow *window = static_cast<RKMDIWindow *> (centralWidget ());
+// we will not handle any more signals from the window
+	disconnect (window, SIGNAL (destroyed (QObject *)), this, SLOT (viewDestroyed (QObject *)));
+	disconnect (window, SIGNAL (captionChanged (RKMDIWindow *)), this, SLOT (updateCaption (RKMDIWindow *)));
+
 	window->reparent (0, QPoint (0, 0));
 	RKWorkplace::mainWorkplace ()->attachWindow (window);
 
-	delete this;
+	hide ();
+	deleteLater ();
 }
 
+void DetachedWindowContainer::closeEvent (QCloseEvent *e) {
+	RK_TRACE (APP);
+
+	RKMDIWindow *window = static_cast<RKMDIWindow *> (centralWidget ());
+	if (window->close ()) {
+		e->accept ();
+	} else {
+		e->ignore ();
+	}
+}
+
+
 #include "detachedwindowcontainer.moc"

Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.h
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.h	2006-11-20 20:31:34 UTC (rev 929)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.h	2006-11-24 14:01:06 UTC (rev 930)
@@ -22,6 +22,7 @@
 #include <kparts/mainwindow.h>
 
 class RKMDIWindow;
+class QCloseEvent;
 
 /** This class is used to host a (KPart enabled) window detached from the main window. @see RKWorkplace::detachWindow ().
 
@@ -43,6 +44,9 @@
 	void slotReattach ();
 /** update own caption, when the window's caption has changed */
 	void updateCaption (RKMDIWindow *);
+protected:
+/** when receiving a close event, dispatch to the embedded window */
+	void closeEvent (QCloseEvent *e);
 };
 
 #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