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

Modified Files:
        wxFolderView.cpp wxMessageView.cpp wxMsgCmdProc.cpp 
Added Files:
        ClickAtt.cpp ClickURL.cpp 
Log Message:
1. Removed MessageViewer::InsertSignature(); added EndText()
2. ClickableInfo reorganization:
 a) ClickableInfo is not in a separate header and is now a base class
 b) instead of switch on type of ClickableInfo we now have
    ClickableAttachment and ClickableURL implementations of the base class


***** Error reading new file: [Errno 2] No such file or directory: 'ClickAtt.cpp'
***** Error reading new file: [Errno 2] No such file or directory: 'ClickURL.cpp'
Index: wxFolderView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderView.cpp,v
retrieving revision 1.619
retrieving revision 1.620
diff -b -u -2 -r1.619 -r1.620
--- wxFolderView.cpp    1 Dec 2002 00:27:34 -0000       1.619
+++ wxFolderView.cpp    5 Dec 2002 19:47:31 -0000       1.620
@@ -315,5 +315,7 @@
 {
 public:
-   wxFolderMsgWindow(wxWindow *parent, wxFolderView *fv);
+   wxFolderMsgWindow(wxWindow *parent,
+                     wxFolderView *folderView,
+                     wxFolderListCtrl *listCtrl);
    virtual ~wxFolderMsgWindow();
 
@@ -349,4 +351,7 @@
    wxFolderView *m_folderView;
 
+   // the folder view list part
+   wxFolderListCtrl *m_listCtrl;
+
    // the current viewer window (may be NULL)
    wxWindow *m_winViewer;
@@ -1054,12 +1059,15 @@
 // ----------------------------------------------------------------------------
 
-wxFolderMsgWindow::wxFolderMsgWindow(wxWindow *parent, wxFolderView *fv)
+wxFolderMsgWindow::wxFolderMsgWindow(wxWindow *parent,
+                                     wxFolderView *folderView,
+                                     wxFolderListCtrl *listCtrl)
                  : wxPanel(parent, -1,
                             wxDefaultPosition, wxDefaultSize,
-                            fv ? wxBORDER_NONE : wxBORDER_DEFAULT)
+                            folderView ? wxBORDER_NONE : wxBORDER_DEFAULT)
 {
    m_winViewer = NULL;
    m_winBar = NULL;
-   m_folderView = fv;
+   m_folderView = folderView;
+   m_listCtrl = listCtrl;
    m_winViewer = NULL;
    m_evtHandlerMsgView = NULL;
@@ -1367,4 +1375,11 @@
                             MEventOptionsChangeData::Ok
                            ));
+
+   // the user will usually use the mouse to select the viewer because it isn't
+   // easy to access it from keyboard (if it's possible at all? hmm...) but he
+   // normally doesn't want to keep the focus on it later any more after
+   // choosing the viewer he wants
+   if ( m_listCtrl )
+      m_listCtrl->SetFocus();
 }
 
@@ -3205,5 +3220,5 @@
    m_SplitterWindow = new wxFolderSplitterWindow(m_Parent);
    m_FolderCtrl = new wxFolderListCtrl(m_SplitterWindow, this);
-   m_MessageWindow = new wxFolderMsgWindow(m_SplitterWindow, this);
+   m_MessageWindow = new wxFolderMsgWindow(m_SplitterWindow, this, m_FolderCtrl);
 
    m_MessagePreview = MessageView::Create(m_MessageWindow, this);

Index: wxMessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMessageView.cpp,v
retrieving revision 1.286
retrieving revision 1.287
diff -b -u -2 -r1.286 -r1.287
--- wxMessageView.cpp   6 Nov 2002 00:26:01 -0000       1.286
+++ wxMessageView.cpp   5 Dec 2002 19:47:31 -0000       1.287
@@ -71,5 +71,4 @@
 #include <wx/mimetype.h>
 #include <wx/fontmap.h>
-#include <wx/clipbrd.h>
 #include <wx/splitter.h>
 
@@ -125,92 +124,4 @@
 
 // ----------------------------------------------------------------------------
-// popup menu classes
-// ----------------------------------------------------------------------------
-
-// the popup menu invoked by clicking on an attachment in the mail message
-class MimePopup : public wxMenu
-{
-public:
-   MimePopup(wxMessageView *parent, const MimePart *mimepart)
-   {
-      // init member vars
-      m_mimepart = mimepart;
-      m_MessageView = parent;
-
-      // create the menu items
-      Append(WXMENU_MIME_INFO, _("&Info"));
-      AppendSeparator();
-      Append(WXMENU_MIME_OPEN, _("&Open"));
-      Append(WXMENU_MIME_OPEN_WITH, _("Open &with..."));
-      Append(WXMENU_MIME_SAVE, _("&Save..."));
-      Append(WXMENU_MIME_VIEW_AS_TEXT, _("&View as text"));
-   }
-
-   // callbacks
-   void OnCommandEvent(wxCommandEvent &event);
-
-private:
-   wxMessageView *m_MessageView;
-
-   const MimePart *m_mimepart;
-
-   DECLARE_EVENT_TABLE()
-};
-
-// the popup menu used with URLs
-class UrlPopup : public wxMenu
-{
-public:
-   UrlPopup(wxMessageView *parent, const String& url, URLKind kind)
-      : m_url(url)
-   {
-      m_MessageView = parent;
-
-      // set a descriptive title
-      String title;
-      if ( kind == URL_Mailto )
-      {
-         title = _("EMail address");
-      }
-      else // !mailto
-      {
-         title = url.BeforeFirst(':').Upper();
-         if ( title.length() == url.length() )
-         {
-            // no ':' in the URL, so it must be HTTP by default
-            title = _T("HTTP");
-         }
-
-         title += _(" url");
-      }
-
-      SetTitle(title);
-
-      // create the menu
-      if ( kind == URL_Mailto )
-      {
-         Append(WXMENU_URL_COMPOSE, _("&Write to"));
-         Append(WXMENU_URL_ADD_TO_ADB, _("&Add to address book..."));
-      }
-      else // !mailto
-      {
-         Append(WXMENU_URL_OPEN, _("&Open"));
-         Append(WXMENU_URL_OPEN_NEW, _("Open in &new window"));
-      }
-
-      Append(WXMENU_URL_COPY, _("&Copy to clipboard"));
-   }
-
-   // callbacks
-   void OnCommandEvent(wxCommandEvent &event);
-
-private:
-   wxMessageView *m_MessageView;
-   String m_url;
-
-   DECLARE_EVENT_TABLE()
-};
-
-// ----------------------------------------------------------------------------
 // DummyViewer: a trivial implementation of MessageViewer which doesn't do
 //              anything but which we use to avoid crashing if no viewers are
@@ -266,5 +177,5 @@
    virtual void InsertText(const String& text, const MTextStyle& style) { }
    virtual void InsertURL(const String& text, const String& url) { }
-   virtual void InsertSignature(const String& signature) { }
+   virtual void EndText() { }
    virtual void EndPart() { }
    virtual void EndBody() { }
@@ -284,100 +195,4 @@
 };
 
-// ----------------------------------------------------------------------------
-// event tables
-// ----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MimePopup, wxMenu)
-   EVT_MENU(-1, MimePopup::OnCommandEvent)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(UrlPopup, wxMenu)
-   EVT_MENU(-1, UrlPopup::OnCommandEvent)
-END_EVENT_TABLE()
-
-// ============================================================================
-// implementation of misc private classes
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// MimePopup
-// ----------------------------------------------------------------------------
-
-void
-MimePopup::OnCommandEvent(wxCommandEvent &event)
-{
-   switch ( event.GetId() )
-   {
-      case WXMENU_MIME_INFO:
-         m_MessageView->MimeInfo(m_mimepart);
-         break;
-
-      case WXMENU_MIME_OPEN:
-         m_MessageView->MimeHandle(m_mimepart);
-         break;
-
-      case WXMENU_MIME_OPEN_WITH:
-         m_MessageView->MimeOpenWith(m_mimepart);
-         break;
-
-      case WXMENU_MIME_VIEW_AS_TEXT:
-         m_MessageView->MimeViewText(m_mimepart);
-         break;
-
-      case WXMENU_MIME_SAVE:
-         m_MessageView->MimeSave(m_mimepart);
-         break;
-   }
-}
-
-// ----------------------------------------------------------------------------
-// UrlPopup
-// ----------------------------------------------------------------------------
-
-void
-UrlPopup::OnCommandEvent(wxCommandEvent &event)
-{
-   int id = event.GetId();
-   switch ( id )
-   {
-      case WXMENU_URL_OPEN:
-      case WXMENU_URL_OPEN_NEW:
-         m_MessageView->OpenURL
-                        (
-                           m_url,
-                           id == WXMENU_URL_OPEN ? URLOpen_Default
-                                                 : URLOpen_New_Window
-                        );
-         break;
-
-      case WXMENU_URL_COMPOSE:
-         m_MessageView->OpenAddress(m_url);
-         break;
-
-      case WXMENU_URL_ADD_TO_ADB:
-         m_MessageView->AddToAddressBook(m_url);
-         break;
-
-      case WXMENU_URL_COPY:
-         {
-            wxClipboardLocker lockClip;
-            if ( !lockClip )
-            {
-               wxLogError(_("Failed to lock clipboard, URL not copied."));
-            }
-            else
-            {
-               wxTheClipboard->UsePrimarySelection();
-               wxTheClipboard->SetData(new wxTextDataObject(m_url));
-            }
-         }
-         break;
-
-      default:
-         FAIL_MSG( _T("unexpected URL popup menu command") );
-         break;
-   }
-}
-
 // ============================================================================
 // wxMessageView implementation
@@ -403,27 +218,4 @@
 {
    return new wxMessageView(parent, folderView);
-}
-
-// ----------------------------------------------------------------------------
-// popup menus
-// ----------------------------------------------------------------------------
-
-void wxMessageView::PopupURLMenu(wxWindow *window,
-                                 const String& url,
-                                 const wxPoint& pt,
-                                 URLKind urlkind)
-{
-   UrlPopup menu(this, url, urlkind);
-
-   window->PopupMenu(&menu, pt);
-}
-
-void wxMessageView::PopupMIMEMenu(wxWindow *window,
-                                  const MimePart *part,
-                                  const wxPoint& pt)
-{
-   MimePopup mimePopup(this, part);
-
-   window->PopupMenu(&mimePopup, pt);
 }
 

Index: wxMsgCmdProc.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMsgCmdProc.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -b -u -2 -r1.36 -r1.37
--- wxMsgCmdProc.cpp    27 Sep 2002 12:19:04 -0000      1.36
+++ wxMsgCmdProc.cpp    5 Dec 2002 19:47:32 -0000       1.37
@@ -44,4 +44,5 @@
 #include "TemplateDialog.h"
 #include "MessageView.h"
+#include "ClickAtt.h"
 #include "Composer.h"
 
@@ -448,8 +449,5 @@
    }
 
-   wxString label = MessageView::GetLabelFor(mimepart);
-#ifdef DEBUG
-   label << " (" << mimepart->GetPartSpec() << ')';
-#endif // DEBUG
+   wxString label = ClickableAttachment::GetLabelFor(mimepart);
 
    wxTreeItemId id  = m_treectrl->AppendItem(idParent,
@@ -476,5 +474,6 @@
          (wxMIMETreeData *)m_treectrl->GetItemData(event.GetItem());
 
-      m_msgView->PopupMIMEMenu(m_treectrl, data->GetMimePart(), event.GetPoint());
+      ClickableAttachment att(m_msgView, data->GetMimePart());
+      att.ShowPopupMenu(m_treectrl, event.GetPoint());
    }
 }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to