kmail Library API Documentation

messageproperty.h

00001 /*  Message Property
00002 
00003     This file is part of KMail, the KDE mail client.
00004     Copyright (c) Don Sanders <sanders@kde.org>
00005 
00006     KMail is free software; you can redistribute it and/or modify it
00007     under the terms of the GNU General Public License, version 2, as
00008     published by the Free Software Foundation.
00009 
00010     KMail is distributed in the hope that it will be useful, but
00011     WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019     In addition, as a special exception, the copyright holders give
00020     permission to link the code of this program with any edition of
00021     the Qt library by Trolltech AS, Norway (or with modified versions
00022     of Qt that use the same license as Qt), and distribute linked
00023     combinations including the two.  You must obey the GNU General
00024     Public License in all respects for all of the code used other than
00025     Qt.  If you modify this file, you may extend this exception to
00026     your version of the file, but you are not obligated to do so.  If
00027     you do not wish to do so, delete this exception statement from
00028     your version.
00029 */
00030 #ifndef messageproperty_h
00031 #define messageproperty_h
00032 
00033 #include "kmfilteraction.h" // for KMFilterAction::ReturnCode
00034 #include "kmfolder.h"
00035 
00036 #include <qptrlist.h>
00037 #include <qguardedptr.h>
00038 #include <qobject.h>
00039 
00040 class KMFilter;
00041 class KMFilterDlg;
00042 
00043 namespace KMail {
00044 
00045 class ActionScheduler;
00046 
00047 /* A place to store properties that some but not necessarily all messages
00048    have.
00049 
00050    These properties do not need to be stored persistantly on disk but
00051    rather only are required while KMail is running.
00052 
00053    Furthermore some properties, namely complete, transferInProgress, and
00054    serialCache should only exist during the lifetime of a particular
00055    KMMsgBase based instance.
00056  */
00057 class MessageProperty : public QObject
00058 {
00059   Q_OBJECT
00060 
00061 public:
00063   static bool filtering( Q_UINT32 );
00064   static void setFiltering( Q_UINT32, bool filtering );
00065   static bool filtering( const KMMsgBase* );
00066   static void setFiltering( const KMMsgBase*, bool filtering );
00070   static KMFolder* filterFolder( Q_UINT32 );
00071   static void setFilterFolder( Q_UINT32, KMFolder* folder );
00072   static KMFolder* filterFolder( const KMMsgBase* );
00073   static void setFilterFolder( const KMMsgBase*, KMFolder* folder );
00074   /* Set the filterHandler for a message */
00075   static ActionScheduler* filterHandler( Q_UINT32 );
00076   static void setFilterHandler( Q_UINT32, ActionScheduler* filterHandler );
00077   static ActionScheduler* filterHandler( const KMMsgBase* );
00078   static void setFilterHandler( const KMMsgBase*, ActionScheduler* filterHandler );
00079 
00080   /* Caches the serial number for a message, or more correctly for a
00081      KMMsgBase based instance representing a message.
00082      This property becomes invalid when the message is destructed or
00083      assigned a new value */
00084   static void setSerialCache( const KMMsgBase*, Q_UINT32 );
00085   static Q_UINT32 serialCache( const KMMsgBase* );
00086   /* Set the completeness for a message
00087      This property becomes invalid when the message is destructed or
00088      assigned a new value */
00089   static void setComplete( const KMMsgBase*, bool );
00090   static bool complete( const KMMsgBase* );
00091   static void setComplete( Q_UINT32, bool );
00092   static bool complete( Q_UINT32 );
00093   /* Set whether this message is ready to be shown in the readerwin
00094      This property becomes invalid when the message is destructed or
00095      assigned a new value */
00096   static void setReadyToShow( const KMMsgBase*, bool );
00097   static bool readyToShow( const KMMsgBase* );
00098   static void setReadyToShow( Q_UINT32, bool );
00099   static bool readyToShow( Q_UINT32 );
00100   /* Set the transferInProgress for a message
00101      This property becomes invalid when the message is destructed or
00102      assigned a new value */
00103   static void setTransferInProgress( const KMMsgBase*, bool, bool = false );
00104   static bool transferInProgress( const KMMsgBase* );
00105   static void setTransferInProgress( Q_UINT32, bool, bool = false );
00106   static bool transferInProgress( Q_UINT32 );
00110   static void forget( const KMMsgBase* );
00111 
00112 private:
00113   // The folder a message is to be moved into once filtering is finished if any
00114   static QMap<Q_UINT32, QGuardedPtr<KMFolder> > sFolders;
00115   // The action scheduler currently processing a message if any
00116   static QMap<Q_UINT32, QGuardedPtr<ActionScheduler> > sHandlers;
00117   // The completeness state of a message if any
00118   static QMap<Q_UINT32, bool > sCompletes;
00119   // The readytoshow state of a message if any
00120   static QMap<Q_UINT32, bool > sReadyToShows;
00121   // The transferInProgres state of a message if any.
00122   static QMap<Q_UINT32, int > sTransfers;
00123   // The cached serial number of a message if any.
00124   static QMap<const KMMsgBase*, long > sSerialCache;
00125 };
00126 
00127 }
00128 
00129 #endif /*messageproperty_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:34 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003