Update of /cvsroot/mahogany/M/include
In directory usw-pr-cvs1:/tmp/cvs-serv10213/include

Modified Files:
        MEvent.h MailFolderCmn.h Message.h 
Log Message:
1. added MessageVirt class implementing a Message in MailFolderVirt
   (solves the problem with previewing messages in the virtual folders)
2. refactored the status change processing code (fixes changing status
   of a message in a virtual folder)


Index: MEvent.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MEvent.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -b -u -2 -r1.48 -r1.49
--- MEvent.h    14 Jul 2002 23:41:22 -0000      1.48
+++ MEvent.h    17 Jul 2002 14:43:54 -0000      1.49
@@ -209,4 +209,19 @@
 
 /**
+  The struct containing status change information used by MEventMsgStatus
+ */
+struct StatusChangeData
+{
+   /// the msgnos of the message whose status has changed
+   wxArrayInt msgnos;
+
+   /// the old status of the messages with the msgnos from above array
+   wxArrayInt statusOld;
+
+   /// the new status of the messages with the msgnos from above array
+   wxArrayInt statusNew;
+};
+
+/**
    MEventMsgStatus Data - carries folder pointer and HeaderInfo object with
    its index in the folder list
@@ -217,48 +232,38 @@
 {
 public:
-   /// ctor takes ownership of the arrays passed to it
+   /// ctor takes ownership of the data passed to it
    MEventMsgStatusData(MailFolder *folder,
-                       wxArrayInt *msgnos,
-                       wxArrayInt *statusOld,
-                       wxArrayInt *statusNew)
+                       StatusChangeData *statusChangeData)
       : MEventWithFolderData(MEventId_MsgStatus, folder)
    {
-      ASSERT_MSG( msgnos && statusNew && statusOld &&
-                  msgnos->GetCount() == statusNew->GetCount() &&
-                  msgnos->GetCount() == statusOld->GetCount(),
-                  "invalid parameters for MEventMsgStatus event" );
-
-      m_msgnos = msgnos;
-      m_statusNew = statusNew;
-      m_statusOld = statusOld;
+      ASSERT_MSG( statusChangeData, "NULL pointer in MEventMsgStatus" );
+
+      m_statusChangeData = statusChangeData;
    }
 
-   /// dtor frees the arrays
+   /// dtor frees the data
    ~MEventMsgStatusData()
    {
-      delete m_msgnos;
-      delete m_statusNew;
-      delete m_statusOld;
+      delete m_statusChangeData;
    }
 
    /// return the number of messages affected
-   size_t GetCount() const { return m_msgnos ? m_msgnos->GetCount() : 0; }
+   size_t GetCount() const
+      { return m_statusChangeData->msgnos.GetCount(); }
 
    /// get the msgno of the n-th changed header
-   MsgnoType GetMsgno(size_t n) const { return m_msgnos->Item(n); }
+   MsgnoType GetMsgno(size_t n) const
+      { return (MsgnoType)m_statusChangeData->msgnos[n]; }
 
    /// get the new status of the n-th changed header
-   int GetStatusNew(MsgnoType n) const { return m_statusNew->Item(n); }
+   int GetStatusNew(MsgnoType n) const
+      { return m_statusChangeData->statusNew[n]; }
 
    /// get the old status of the n-th changed header
-   int GetStatusOld(MsgnoType n) const { return m_statusOld->Item(n); }
+   int GetStatusOld(MsgnoType n) const
+      { return m_statusChangeData->statusOld[n]; }
 
 private:
-   /// the array containing the msgnos of messages whose status changed
-   wxArrayInt *m_msgnos;
-
-   /// the new and previous values of the message status
-   wxArrayInt *m_statusNew,
-              *m_statusOld;
+   StatusChangeData *m_statusChangeData;
 };
 

Index: MailFolderCmn.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/MailFolderCmn.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -b -u -2 -r1.76 -r1.77
--- MailFolderCmn.h     16 Jul 2002 20:21:43 -0000      1.76
+++ MailFolderCmn.h     17 Jul 2002 14:43:55 -0000      1.77
@@ -200,4 +200,11 @@
    void CacheLastMessages(MsgnoType count);
 
+   /**
+     Send the message status event for the data in m_statusChangeData and clear
+     it afterwards. It is safe to call this method even if m_statusChangeData
+     is NULL, then simply nothing is done.
+   */
+   void SendMsgStatusChangeEvent();
+
    /** @name Config management */
    //@{
@@ -253,4 +260,7 @@
    /// a timer to update information
    class MailFolderTimer *m_Timer;
+
+   /// struct used by SendMsgStatusChangeEvent()
+   StatusChangeData *m_statusChangeData;
 
 private:

Index: Message.h
===================================================================
RCS file: /cvsroot/mahogany/M/include/Message.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -b -u -2 -r1.63 -r1.64
--- Message.h   11 Jun 2002 20:22:27 -0000      1.63
+++ Message.h   17 Jul 2002 14:43:55 -0000      1.64
@@ -21,4 +21,5 @@
 
 class WXDLLEXPORT wxArrayString;
+
 class AddressList;
 class MailFolder;
@@ -26,15 +27,4 @@
 
 // ----------------------------------------------------------------------------
-// compatibility defines
-// ----------------------------------------------------------------------------
-
-// c-client needs this
-#ifdef   OS_WIN
-#  define   TEXT_DATA_CAST(x)    ((unsigned char *)x)
-#else
-#  define   TEXT_DATA_CAST(x)    ((char *)x)
-#endif
-
-// ----------------------------------------------------------------------------
 // Message class
 // ----------------------------------------------------------------------------
@@ -53,5 +43,7 @@
 
 /**
-   Message class, containing the most commonly used message headers.
+   Message class represents a message in a mail folder. It provides access to
+   the message headers as well as to the message contents (in conjunction with
+   MimePart class)
    */
 class Message : public MObjectRC
@@ -389,6 +381,8 @@
 protected:
    /** virtual destructor */
-   virtual ~Message() {}
+   virtual ~Message();
+
    GCC_DTOR_WARN_OFF
+
    MOBJECT_NAME(Message)
 };



-------------------------------------------------------
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