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

Modified Files:
        wxComposeView.cpp 
Log Message:
fixed bug introduced by last commit: reset the headers dirty flag as well in 
ResetDirty() or CanClose() wouldn't let us close even after sending

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.308
retrieving revision 1.309
diff -b -u -2 -r1.308 -r1.309
--- wxComposeView.cpp   15 Oct 2002 11:24:59 -0000      1.308
+++ wxComposeView.cpp   20 Oct 2002 15:57:44 -0000      1.309
@@ -143,5 +143,5 @@
 extern const MPersMsgBox *M_MSGBOX_MIME_TYPE_CORRECT;
 extern const MPersMsgBox *M_MSGBOX_SEND_EMPTY_SUBJECT;
-extern const MPersMsgBox *M_MSGBOX_UNSAVED_PROMPT;
+extern const MPersMsgBox *M_MSGBOX_ASK_SAVE_HEADERS;
 
 // ----------------------------------------------------------------------------
@@ -2566,4 +2566,8 @@
    bool canClose = true;
 
+   // if the msg is not empty, we're going to show a msg box to the user
+   String msg;
+   const MPersMsgBox *persMsgBox = NULL;
+
    // we can't close while the external editor is running (I think it will
    // lead to a nice crash later)
@@ -2577,4 +2581,27 @@
    else if ( IsModified() )
    {
+      // the text of the new message has been modified, ask the user before
+      // closing -- this message box can't be suppressed
+      msg = _("There are unsaved changes, would you like to save the "
+              "message as a draft?");
+   }
+   else if ( m_txtSubject->IsModified() ||
+               (m_txtFrom && m_txtFrom->IsModified()) ||
+                  m_rcptMain->GetText()->IsModified() )
+   {
+      // the headers of the new message have been modified -- ask the user if
+      // he wants to save but let him disable this msg box
+      msg = _("You have modified some of the headers of this message,\n"
+              "would you like to save the message as a draft?");
+
+      persMsgBox = M_MSGBOX_ASK_SAVE_HEADERS;
+   }
+   else // nothing changed at all
+   {
+      canClose = true;
+   }
+
+   if ( !msg.empty() )
+   {
       // bring the frame to the top to show user which window are we asking him
       // about
@@ -2583,12 +2610,15 @@
 
       // ask the user if he wants to save the changes
+      msg << _T("\n\n")
+          << _("You may also choose \"Cancel\" to not close this "
+               "window at all.");
+
       MDlgResult rc = MDialog_YesNoCancel
                       (
-                        _("There are unsaved changes, would you like to save the "
-                          "message as a draft?\n"
-                          "\n"
-                          "You may also choose \"Cancel\" to not close this "
-                          "window at all."),
-                        this  // parent
+                        msg,
+                        this,                // parent
+                        MDIALOG_YESNOTITLE,
+                        M_DLG_YES_DEFAULT,
+                        persMsgBox
                       );
 
@@ -2608,8 +2638,4 @@
       }
    }
-   else
-   {
-      canClose = true;
-   }
 
    return canClose;
@@ -3764,5 +3790,12 @@
 void wxComposeView::ResetDirty()
 {
+   // ensure that CanClose() returns true now
    m_editor->ResetDirty();
+
+   m_txtSubject->DiscardEdits();
+   if ( m_txtFrom )
+      m_txtFrom->DiscardEdits();
+   m_rcptMain->GetText()->DiscardEdits();
+
    m_isModified = false;
 }



-------------------------------------------------------
This sf.net email is sponsored by:
Access Your PC Securely with GoToMyPC. Try Free Now
https://www.gotomypc.com/s/OSND/DD
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to