[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdeui
From:       Lubos Lunak <l.lunak () kde ! org>
Date:       2002-12-13 12:46:57
[Download RAW message or body]

CVS commit by lunakl: 

Fix queryExit() being called twice, make it more clear in the documentation
that one should not do any cleanups here, and add a rant about queryExit()
being flawed design.


  M +2 -0      kmainwindow.cpp   1.88
  M +14 -7     kmainwindow.h   1.65


--- kdelibs/kdeui/kmainwindow.cpp  #1.87:1.88
@@ -532,4 +532,6 @@ void KMainWindow::closeEvent ( QCloseEve
         if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted?
             if ( queryExit() ) {            // Yes, Quit app?
+                // don't call queryExit() twice
+                disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
                 kapp->deref();             // ...and quit aplication.
             }  else {

--- kdelibs/kdeui/kmainwindow.h  #1.64:1.65
@@ -586,4 +586,13 @@ protected:
      */
     virtual void closeEvent ( QCloseEvent *);
+    
+    // KDE4 This seems to be flawed to me. Either the app has only one
+    // mainwindow, so queryClose() is enough, or if it can have more of them,
+    // then the windows should take care of themselves, and queryExit()
+    // would be useful only for the annoying 'really quit' dialog, which
+    // also doesn't make sense in apps with multiple mainwindows.
+    // And saving configuration in something called queryExit()? IMHO
+    // one can e.g. use KApplication::shutDown(), which if nothing else
+    // has at least better fitting name.
     /**
        Called before the very last window is closed, either by the
@@ -594,11 +603,9 @@ protected:
        user on @ref queryClose() (see below).
 
-       However, @ref queryExit() is useful to do some final cleanups. A
-       typical example would be to write configuration data back.
-
+       A typical usage of @ref queryExit() is to write configuration data back.
        Note that the application may continue to run after @ref queryExit()
-       (the user may have cancelled a shutdown). The purpose of
-       @ref queryExit() is purely to prepare the application (with possible
-       user interaction) so it can safely be closed later (without
+       (the user may have cancelled a shutdown), so you should not do any cleanups
+       here. The purpose of @ref queryExit() is purely to prepare the application
+       (with possible user interaction) so it can safely be closed later (without
        user interaction).
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic