Revision: 7405
http://mahogany.svn.sourceforge.net/mahogany/?rev=7405&view=rev
Author: vadz
Date: 2008-03-27 08:17:38 -0700 (Thu, 27 Mar 2008)
Log Message:
-----------
ensure that the composer is reenabled even if sending the message fails
Modified Paths:
--------------
trunk/M/src/gui/wxComposeView.cpp
Modified: trunk/M/src/gui/wxComposeView.cpp
===================================================================
--- trunk/M/src/gui/wxComposeView.cpp 2008-03-04 13:30:16 UTC (rev 7404)
+++ trunk/M/src/gui/wxComposeView.cpp 2008-03-27 15:17:38 UTC (rev 7405)
@@ -60,6 +60,7 @@
#include <wx/tokenzr.h>
#include <wx/textbuf.h>
#include <wx/fontmap.h>
+#include <wx/scopeguard.h>
#ifdef __WINE__
// it includes wrapwin.h which includes windows.h which defines SendMessage
under Windows
#undef SendMessage
@@ -4642,11 +4643,21 @@
CHECK( !m_sending, false, _T("wxComposeView::Send() reentered") );
m_sending = true;
+ class ResetVar
+ {
+ public:
+ ResetVar(bool *flag) : m_flag(flag) { }
+ ~ResetVar() { *m_flag = false; }
+ private:
+ bool *m_flag;
+ } reset(&m_sending);
+
MBusyCursor bc;
wxLogStatus(this, m_mode == Mode_News ? _("Posting message")
: _("Sending message..."));
Disable();
+ wxON_BLOCK_EXIT_OBJ1(*this, wxWindow::Enable, true);
SendMessage_obj msg(BuildMessage());
if ( !msg )
@@ -4672,7 +4683,7 @@
wxLogError(_("Cannot schedule message for sending later because "
"the calendar module is not available."));
- success = FALSE;
+ success = false;
}
}
else
@@ -4746,15 +4757,8 @@
wxLogStatus(this, _("Message was not sent."));
}
- // reenable the window disabled previously
- Enable();
-
- m_sending = false;
-
if ( !success )
- {
return false;
- }
// we can now safely remove the draft message, if any
DeleteDraft();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates