• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kmail

kmmsgdict.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of KMail, the KDE mail client
00003  * Copyright (c)  Ronen Tzur <rtzur@shani.net>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  */
00020 #ifndef __KMMSGDICT
00021 #define __KMMSGDICT
00022 
00023 #include <QList>
00024 
00025 class KMFolder;
00026 class KMMsgBase;
00027 class KMMessage;
00028 class KMMsgDictREntry;
00029 class KMDict;
00030 class QString;
00031 class FolderStorage;
00032 
00033 class KMMsgDictSingletonProvider;
00034 
00052 class KMMsgDict
00053 {
00054   friend class KMMsgDictSingletonProvider;
00055   public:
00057     static const KMMsgDict* instance();
00058 
00061     void getLocation( unsigned long key, KMFolder **retFolder, int *retIndex ) const;
00064     void getLocation( const KMMsgBase *msg, KMFolder **retFolder, int *retIndex ) const;
00067     void getLocation( const KMMessage *msg, KMFolder **retFolder, int *retIndex ) const;
00068 
00072     unsigned long getMsgSerNum( KMFolder *folder, int index ) const;
00073 
00075     static QList<unsigned long> serNumList(QList<KMMsgBase *> msgList);
00076 
00077 private:
00078  /* FIXME It would be better to do without these, they are the classes
00079   * involved in filling and maintaining the dict. The MsgList needs access
00080   * because of things it does that should be in FolderIndex, probably, which
00081   * the message list is an implementation detail of. */
00082   friend class FolderStorage;
00083   friend class KMMsgList;
00084   friend class KMFolderIndex;
00085 
00086   // Access for those altering the dict, our friend classes
00087   static KMMsgDict* mutableInstance();
00088 
00092   unsigned long insert(unsigned long msgSerNum, const KMMsgBase *msg, int index = -1);
00093 
00097   unsigned long insert(const KMMsgBase *msg, int index = -1);
00098 
00100   void replace(unsigned long msgSerNum,
00101                const KMMsgBase *msg, int index = -1);
00102 
00104   void remove(unsigned long msgSerNum);
00105 
00107   unsigned long remove(const KMMsgBase *msg);
00108 
00110   void update(const KMMsgBase *msg, int index, int newIndex);
00111 
00112 
00113   // ----- per folder serial number on-disk structure handling ("ids files")
00114 
00116   static QString getFolderIdsLocation( const FolderStorage &folder );
00117 
00119   bool isFolderIdsOutdated( const FolderStorage &folder );
00120 
00122   int readFolderIds( FolderStorage & );
00123 
00125   int writeFolderIds( const FolderStorage & );
00126 
00128   int touchFolderIds( const FolderStorage & );
00129 
00132   int appendToFolderIds( FolderStorage&, int index );
00133 
00135   bool hasFolderIds( const FolderStorage & );
00136 
00138   bool removeFolderIds( FolderStorage & );
00139 
00142   KMMsgDictREntry *openFolderIds( const FolderStorage &, bool truncate);
00143 
00144 
00145   // --------- helpers ------------
00146 
00149   static void deleteRentry(KMMsgDictREntry *entry);
00150 
00152   unsigned long getNextMsgSerNum();
00153 
00154   // prevent creation and deletion, we are a singleton
00155   KMMsgDict();
00156   ~KMMsgDict();
00157 
00159   unsigned long nextMsgSerNum;
00160 
00162   KMDict *dict;
00163 };
00164 
00165 #endif /* __KMMSGDICT */

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal