Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5465/src/gui

Modified Files:
        wxMsgCmdProc.cpp 
Added Files:
        wxMIMETreeDialog.cpp 
Log Message:
extracted MIME tree dialog in its own file

***** Error reading new file: [Errno 2] No such file or directory: 
'wxMIMETreeDialog.cpp'
Index: wxMsgCmdProc.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMsgCmdProc.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -b -u -2 -r1.64 -r1.65
--- wxMsgCmdProc.cpp    14 Jul 2004 18:35:51 -0000      1.64
+++ wxMsgCmdProc.cpp    13 Aug 2004 20:25:12 -0000      1.65
@@ -32,11 +32,7 @@
    #include "gui/wxIconManager.h"
 
-   #include <wx/layout.h>
-   #include <wx/statbox.h>
    #include <wx/dynarray.h>
 #endif // USE_PCH
 
-#include <wx/imaglist.h>        // for wxImageList
-
 #include "Collect.h"          // for InteractivelyCollectAddresses()
 
@@ -48,5 +44,4 @@
 #include "TemplateDialog.h"
 #include "MessageView.h"
-#include "ClickAtt.h"
 #include "Composer.h"
 #include "SendMessage.h"
@@ -58,4 +53,6 @@
 #include "SpamFilter.h"
 
+#include "MIMETreeDialog.h"
+
 #include "gui/wxDialogLayout.h"
 
@@ -323,66 +320,4 @@
 };
 
-// ----------------------------------------------------------------------------
-// MIME dialog classes
-// ----------------------------------------------------------------------------
-
-class wxMIMETreeCtrl : public wxTreeCtrl
-{
-public:
-   wxMIMETreeCtrl(wxWindow *parent) : wxTreeCtrl(parent, -1)
-   {
-      InitImageLists();
-   }
-
-private:
-   void InitImageLists();
-
-   DECLARE_NO_COPY_CLASS(wxMIMETreeCtrl)
-};
-
-class wxMIMETreeData : public wxTreeItemData
-{
-public:
-   wxMIMETreeData(const MimePart *mimepart) { m_mimepart = mimepart; }
-
-   const MimePart *GetMimePart() const { return m_mimepart; }
-
-private:
-   const MimePart *m_mimepart;
-};
-
-class wxMIMETreeDialog : public wxManuallyLaidOutDialog
-{
-public:
-   wxMIMETreeDialog(const MimePart *partRoot,
-                    wxWindow *parent,
-                    MessageView *msgView);
-
-protected:
-   // event handlers
-   void OnTreeItemRightClick(wxTreeEvent& event);
-
-private:
-   // fill the tree
-   void AddToTree(wxTreeItemId id, const MimePart *mimepart);
-
-   // total number of parts
-   size_t m_countParts;
-
-   // GUI controls
-   wxStaticBox *m_box;
-   wxTreeCtrl *m_treectrl;
-
-   // the parent message view
-   MessageView *m_msgView;
-
-   DECLARE_EVENT_TABLE()
-   DECLARE_NO_COPY_CLASS(wxMIMETreeDialog)
-};
-
-BEGIN_EVENT_TABLE(wxMIMETreeDialog, wxManuallyLaidOutDialog)
-   EVT_TREE_ITEM_RIGHT_CLICK(-1, wxMIMETreeDialog::OnTreeItemRightClick)
-END_EVENT_TABLE()
-
 // ============================================================================
 // implementation
@@ -390,108 +325,4 @@
 
 // ----------------------------------------------------------------------------
-// wxMIMETreeCtrl
-// ----------------------------------------------------------------------------
-
-void wxMIMETreeCtrl::InitImageLists()
-{
-   wxIconManager *iconManager = mApplication->GetIconManager();
-
-   wxImageList *imaglist = new wxImageList(32, 32);
-
-   for ( int i = MimeType::TEXT; i <= MimeType::OTHER; i++ )
-   {
-      // this is a big ugly: we need to get just the primary MIME type
-      MimeType mt((MimeType::Primary)i, _T(""));
-      wxIcon icon = iconManager->GetIconFromMimeType(mt.GetType());
-      imaglist->Add(icon);
-   }
-
-   // and the last icon for the unknown MIME images
-   imaglist->Add(iconManager->GetIcon(_T("unknown")));
-
-   AssignImageList(imaglist);
-}
-
-// ----------------------------------------------------------------------------
-// wxMIMETreeDialog
-// ----------------------------------------------------------------------------
-
-wxMIMETreeDialog::wxMIMETreeDialog(const MimePart *partRoot,
-                                   wxWindow *parent,
-                                   MessageView *msgView)
-                : wxManuallyLaidOutDialog(parent,
-                                          _("MIME structure of the message"),
-                                          _T("MimeTreeDialog"))
-{
-   // init members
-   m_msgView = msgView;
-   m_countParts = 0;
-   m_box = NULL;
-   m_treectrl = NULL;
-
-   // create controls
-   wxLayoutConstraints *c;
-
-   // label will be set later below
-   m_box = CreateStdButtonsAndBox(_T(""), StdBtn_NoCancel);
-
-   m_treectrl = new wxMIMETreeCtrl(this);
-   c = new wxLayoutConstraints;
-   c->top.SameAs(m_box, wxTop, 4*LAYOUT_Y_MARGIN);
-   c->left.SameAs(m_box, wxLeft, 2*LAYOUT_X_MARGIN);
-   c->right.SameAs(m_box, wxRight, 2*LAYOUT_X_MARGIN);
-   c->bottom.SameAs(m_box, wxBottom, 2*LAYOUT_Y_MARGIN);
-   m_treectrl->SetConstraints(c);
-
-   // initialize them
-   AddToTree(wxTreeItemId(), partRoot);
-
-   m_treectrl->Expand(m_treectrl->GetRootItem());
-
-   m_box->SetLabel(wxString::Format(_("%u MIME parts"), m_countParts));
-
-   SetDefaultSize(4*wBtn, 10*hBtn);
-}
-
-void
-wxMIMETreeDialog::AddToTree(wxTreeItemId idParent, const MimePart *mimepart)
-{
-   int image = mimepart->GetType().GetPrimary();
-   if ( image > MimeType::OTHER + 1 )
-   {
-      image = MimeType::OTHER + 1;
-   }
-
-   wxString label = ClickableAttachment::GetLabelFor(mimepart);
-
-   wxTreeItemId id  = m_treectrl->AppendItem(idParent,
-                                             label,
-                                             image, image,
-                                             new wxMIMETreeData(mimepart));
-
-   m_countParts++;
-
-   const MimePart *partChild = mimepart->GetNested();
-   while ( partChild )
-   {
-      AddToTree(id, partChild);
-
-      partChild = partChild->GetNext();
-   }
-}
-
-void wxMIMETreeDialog::OnTreeItemRightClick(wxTreeEvent& event)
-{
-   if ( m_msgView )
-   {
-      wxMIMETreeData *data =
-         (wxMIMETreeData *)m_treectrl->GetItemData(event.GetItem());
-
-      ClickableAttachment att(m_msgView, data->GetMimePart());
-      att.ShowPopupMenu(m_treectrl, event.GetPoint());
-   }
-}
-
-// ----------------------------------------------------------------------------
 // AsyncStatusHandler
 // ----------------------------------------------------------------------------
@@ -960,10 +791,6 @@
    CHECK_RET( mf, _T("no folder in MsgCmdProcImpl::ShowMIMEDialog") );
 
-   const MimePart *part = NULL;
-   Message *msg = mf->GetMessage(uid);
-   if ( msg )
-   {
-      part = msg->GetTopMimePart();
-   }
+   Message_obj msg(mf->GetMessage(uid));
+   const MimePart *part = msg ? msg->GetTopMimePart() : NULL;
 
    if ( !part )
@@ -976,10 +803,6 @@
    // only pass message view to the dialog to allow showing the context menu
    // for the MIME parts - but for this we must be previewing this message!
-   wxMIMETreeDialog dialog(part, GetFrame(),
+   ShowMIMETreeDialog(part, GetFrame(),
                            m_msgView->GetUId() == uid ? m_msgView : NULL);
-
-   (void)dialog.ShowModal();
-
-   msg->DecRef();
 }
 



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to