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

Modified Files:
        wxMessageView.cpp 
Log Message:
added popup menu for mail addresses in the message view

Index: wxMessageView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxMessageView.cpp,v
retrieving revision 1.278
retrieving revision 1.279
diff -b -u -2 -r1.278 -r1.279
--- wxMessageView.cpp   16 Apr 2002 19:15:34 -0000      1.278
+++ wxMessageView.cpp   26 Apr 2002 23:28:09 -0000      1.279
@@ -160,12 +160,34 @@
 {
 public:
-   UrlPopup(wxMessageView *parent, const String& url)
+   UrlPopup(wxMessageView *parent, const String& url, URLKind kind)
       : m_url(url)
    {
       m_MessageView = parent;
 
-      SetTitle(url.BeforeFirst(':').Upper() + _(" url"));
+      // set a descriptive title
+      String title;
+      if ( kind == URL_Mailto )
+      {
+         title = _("EMail address");
+      }
+      else // !mailto
+      {
+         title = url.BeforeFirst(':').Upper() + _(" 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"));
    }
@@ -304,12 +326,23 @@
 UrlPopup::OnCommandEvent(wxCommandEvent &event)
 {
-   switch ( event.GetId() )
+   int id = event.GetId();
+   switch ( id )
    {
       case WXMENU_URL_OPEN:
-         m_MessageView->OpenURL(m_url, FALSE);
+      case WXMENU_URL_OPEN_NEW:
+         m_MessageView->OpenURL
+                        (
+                           m_url,
+                           id == WXMENU_URL_OPEN ? URLOpen_Default
+                                                 : URLOpen_New_Window
+                        );
          break;
 
-      case WXMENU_URL_OPEN_NEW:
-         m_MessageView->OpenURL(m_url, TRUE);
+      case WXMENU_URL_COMPOSE:
+         m_MessageView->OpenAddress(m_url);
+         break;
+
+      case WXMENU_URL_ADD_TO_ADB:
+         m_MessageView->AddToAddressBook(m_url);
          break;
 
@@ -366,7 +399,8 @@
 void wxMessageView::PopupURLMenu(wxWindow *window,
                                  const String& url,
-                                 const wxPoint& pt)
+                                 const wxPoint& pt,
+                                 URLKind urlkind)
 {
-   UrlPopup menu(this, url);
+   UrlPopup menu(this, url, urlkind);
 
    window->PopupMenu(&menu, pt);


_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to