Update of /cvsroot/mahogany/M/src/classes
In directory usw-pr-cvs1:/tmp/cvs-serv4124/src/classes

Modified Files:
        MApplication.cpp 
Log Message:
modified the program exiting logic to behave in the same way whether it
exits because of a menu command or because the main frame was closed


Index: MApplication.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/classes/MApplication.cpp,v
retrieving revision 1.248
retrieving revision 1.249
diff -b -u -2 -r1.248 -r1.249
--- MApplication.cpp    14 Apr 2002 09:32:35 -0000      1.248
+++ MApplication.cpp    15 Apr 2002 23:45:13 -0000      1.249
@@ -729,13 +729,33 @@
       msg += _("Do you want to exit anyway?");
 
-      return MDialog_YesNoDialog(msg, NULL, MDIALOG_YESNOTITLE,
+      if ( !MDialog_YesNoDialog(msg, NULL, MDIALOG_YESNOTITLE,
                                  M_DLG_NO_DEFAULT,
-                                 M_MSGBOX_ABANDON_CRITICAL);
+                                M_MSGBOX_ABANDON_CRITICAL) )
+         return false;
    }
 
+   // ok, we're going to shut down
    return true;
 }
 
 void
+MAppBase::OnClose()
+{
+#if 0
+   if ( READ_APPCONFIG(MP_REOPENLASTFOLDER) )
+   {
+      // reset the list of folders to be reopened, it will be recreated in
+      // MEventId_AppExit handlers
+      GetProfile()->writeEntry(MP_OPENFOLDERS, "");
+   }
+#endif // 0
+
+   // send an event telling everybody we're closing: note that this can't
+   // be blocked, it is just a notification
+   MEventManager::Send(new MEventData(MEventId_AppExit));
+   MEventManager::DispatchPending();
+}
+
+void
 MAppBase::AddToFramesOkToClose(const wxMFrame *frame)
 {
@@ -746,4 +766,11 @@
 }
 
+void
+MAppBase::ResetFramesOkToClose()
+{
+   if ( m_framesOkToClose )
+      m_framesOkToClose->Empty();
+}
+
 bool
 MAppBase::IsOkToClose(const wxMFrame *frame) const
@@ -755,31 +782,8 @@
 MAppBase::Exit(bool ask)
 {
-   // in case it's still opened...
-   CloseSplash();
-
-   if ( !ask || CanClose() )
-   {
-      if ( READ_APPCONFIG(MP_REOPENLASTFOLDER) )
-      {
-         // reset the list of folders to be reopened, it will be recreated in
-         // MEventId_AppExit handlers
-         GetProfile()->writeEntry(MP_OPENFOLDERS, "");
-      }
+   CHECK_RET( m_topLevelFrame, "can't close main window - there is none" );
 
-      // send an event telling everybody we're closing: note that this can't
-      // be blocked, it is just a notification
-      MEventManager::Send(new MEventData(MEventId_AppExit));
-      MEventManager::DispatchPending();
-
-      // this will close all our window and thus terminate the application
-      DoExit();
-   }
-   else
-   {
-      // when we will try to close the next time, we shouldn't assume that
-      // these frames still don't mind being closed - may be the user will
-      // modify the compose view contents or something else changes
-      m_framesOkToClose->Empty();
-   }
+   // if we don't ask, force closing the frame by passing TRUE to Close()
+   m_topLevelFrame->Close(!ask);
 }
 


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to