Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9259/src/gui
Modified Files:
wxMessageView.cpp
Log Message:
close the message view window if underlying message is deleted (bug 886)
Index: wxMessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMessageView.cpp,v
retrieving revision 1.300
retrieving revision 1.301
diff -b -u -2 -r1.300 -r1.301
--- wxMessageView.cpp 12 Jan 2004 17:48:29 -0000 1.300
+++ wxMessageView.cpp 8 Apr 2004 18:23:05 -0000 1.301
@@ -428,4 +428,6 @@
: wxMFrame(_("Mahogany: Message View"), parent)
{
+ m_eventAsync = MEventManager::Register(*this, MEventId_ASFolderResult);
+
Profile_obj profile(Profile::CreateTemp(asmf->GetProfile()));
m_MessageView = MessageView::CreateStandalone(this, profile);
@@ -528,6 +530,57 @@
}
+bool wxMessageViewFrame::OnMEvent(MEventData& event)
+{
+ // we're only subscribed to ASFolder events
+ ASSERT_MSG( event.GetId() == MEventId_ASFolderResult,
+ _T("Got unexpected event in wxMessageViewFrame") );
+
+ if ( !m_MessageView || !m_MessageView->GetMessage() )
+ {
+ // if we don't have any message, it can't be deleted
+ return true;
+ }
+
+ // check if it's a delete event for the message we show
+ ASMailFolder::Result *res = ((MEventASFolderResultData &)event).GetResult();
+ if ( res->GetOperation() == ASMailFolder::Op_DeleteMessages )
+ {
+ if ( ((ASMailFolder::ResultInt *)res)->GetValue() )
+ {
+ // is it for our folder?
+ if ( res->GetFolder() == m_MessageView->GetFolder() )
+ {
+ // check if our UID appears among the deleted ones
+ const UIdArray& uids = *(res->GetSequence());
+
+ const UIdType uid = m_MessageView->GetMessage()->GetUId();
+
+ const size_t count = uids.Count();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ if ( uids[n] == uid )
+ {
+ // it is: close this frame as we don't want to continue
+ // showing a stale message
+ Close();
+
+ break;
+ }
+ }
+ }
+ //else: we're in a strange state...
+ }
+ //else: it was a delete operation but it failed -- stay opened
+ }
+
+ res->DecRef();
+
+ return true;
+}
+
wxMessageViewFrame::~wxMessageViewFrame()
{
+ MEventManager::Deregister(m_eventAsync);
+
delete m_msgCmdProc;
delete m_MessageView;
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates