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

Modified Files:
        wxComposeView.cpp 
Log Message:
added a button to both access the dialog changing whether the message is a 
reply and to show the current status (closes bug 761)

Index: wxComposeView.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxComposeView.cpp,v
retrieving revision 1.381
retrieving revision 1.382
diff -b -u -2 -r1.381 -r1.382
--- wxComposeView.cpp   27 Feb 2005 00:31:39 -0000      1.381
+++ wxComposeView.cpp   27 Feb 2005 01:13:06 -0000      1.382
@@ -448,4 +448,65 @@
 
 // ----------------------------------------------------------------------------
+// wxIsReplyButton: button indicating whether this is a reply
+// ----------------------------------------------------------------------------
+
+class wxIsReplyButton : public wxBitmapButton
+{
+public:
+   wxIsReplyButton(wxComposeView *composer, wxWindow *parent)
+      : wxBitmapButton(parent,
+                       wxID_ANY,
+                       wxNullBitmap,
+                       wxDefaultPosition,
+                       wxDefaultSize,
+                       wxBORDER_NONE),
+        m_composer(composer)
+   {
+      UpdateAppearance();
+
+      Connect(wxEVT_COMMAND_BUTTON_CLICKED,
+               wxCommandEventHandler(wxIsReplyButton::OnClick));
+
+      // AddHeaderEntry("In-Reply-To") is called after composer creation, so we
+      // want to update our state a bit later
+      Connect(wxEVT_IDLE, wxIdleEventHandler(wxIsReplyButton::OnIdle));
+   }
+
+private:
+   void UpdateAppearance()
+   {
+      m_isReply = m_composer->IsInReplyTo();
+
+      SetBitmapLabel(GetTransparentBitmap(m_isReply ? _T("tb_mail_reply")
+                                                    : _T("tb_mail_new")));
+      SetToolTip(m_isReply ? _("This is a reply to another message")
+                         : _("This is a start of new thread"));
+   }
+
+   void OnClick(wxCommandEvent& /* event */)
+   {
+      if ( m_composer->ConfigureInReplyTo() )
+      {
+         UpdateAppearance();
+         Refresh();
+      }
+   }
+
+   void OnIdle(wxIdleEvent& /* event */)
+   {
+      UpdateAppearance();
+
+      Disconnect(wxID_ANY, wxEVT_IDLE,
+                     wxIdleEventHandler(wxIsReplyButton::OnIdle));
+   }
+
+
+   wxComposeView * const m_composer;
+   bool m_isReply;
+
+   DECLARE_NO_COPY_CLASS(wxIsReplyButton)
+};
+
+// ----------------------------------------------------------------------------
 // wxAddressTextCtrl: specialized text control which processes TABs to expand
 // the text it contains and also notifies parent (i.e. wxComposeView) when it
@@ -1806,8 +1867,14 @@
                      0, wxALIGN_CENTRE_VERTICAL);
 
+   wxSizer *sizerSubj = new wxBoxSizer(wxHORIZONTAL);
    m_txtSubject = new wxSubjectTextCtrl(m_panel);
-   sizerHeaders->Add(m_txtSubject, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
+   sizerSubj->Add(m_txtSubject, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
    SetTextAppearance(m_txtSubject);
 
+   sizerSubj->Add(new wxIsReplyButton(this, m_panel),
+                     0, wxLEFT | wxALIGN_CENTRE_VERTICAL, LAYOUT_MARGIN);
+
+   sizerHeaders->Add(sizerSubj, 1, wxEXPAND | wxALIGN_CENTRE_VERTICAL);
+
    sizerTop->Add(sizerHeaders, 0, wxALL | wxEXPAND, LAYOUT_MARGIN);
 
@@ -4337,5 +4404,18 @@
 }
 
-void wxComposeView::ConfigureInReplyTo()
+bool wxComposeView::IsInReplyTo() const
+{
+   kbStringList::iterator i,
+                          end = m_extraHeadersNames.end();
+   for ( i = m_extraHeadersNames.begin(); i != end; ++i )
+   {
+      if ( **i == _T("In-Reply-To") )
+         return true;
+   }
+
+   return false;
+}
+
+bool wxComposeView::ConfigureInReplyTo()
 {
    kbStringList::iterator end = m_extraHeadersNames.end();
@@ -4353,7 +4433,8 @@
 
    String messageIdNew = messageId;
-   if ( ConfigureInReplyToHeader(&messageIdNew, this) &&
-            messageIdNew != messageId )
-   {
+   if ( !ConfigureInReplyToHeader(&messageIdNew, this) ||
+            messageIdNew == messageId )
+      return false;
+
       if ( messageIdNew.empty() )
       {
@@ -4446,5 +4527,6 @@
          }
       }
-   }
+
+   return true;
 }
 



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to