kmail Library API Documentation

kmheaders.h

00001 #ifndef __KMHEADERS 00002 #define __KMHEADERS 00003 00004 #include <qwidget.h> 00005 #include <qstrlist.h> 00006 #include <klistview.h> 00007 #include <kfoldertree.h> 00008 #include <qmemarray.h> 00009 #include <qmap.h> 00010 #include <qdragobject.h> 00011 #include <qdict.h> 00012 #include "kmmessage.h" 00013 #include "kmime_util.h" 00014 #include <kpopupmenu.h> 00015 00016 class KMFolder; 00017 class KMMessage; 00018 class KMMsgBase; 00019 class KMMainWidget; 00020 class QPalette; 00021 class KMHeaderItem; 00022 class QPixmap; 00023 class QIconSet; 00024 class QDateTime; 00025 class KMSortCacheItem; 00026 00027 typedef QPtrList<KMMsgBase> KMMessageList; 00028 typedef QValueList<Q_UINT32> SerNumList; 00029 typedef QMap<int,KMFolder*> KMMenuToFolder; 00030 enum NestingPolicy { AlwaysOpen = 0, DefaultOpen, DefaultClosed, OpenUnread }; 00031 enum LoopOnGotoUnreadValue { DontLoop = 0, LoopInCurrentFolder, LoopInAllFolders }; 00032 00034 class KMHeaders : public KListView 00035 { 00036 Q_OBJECT 00037 friend class KMHeaderItem; // For easy access to the pixmaps 00038 00039 public: 00040 KMHeaders(KMMainWidget *owner, QWidget *parent=0, const char *name=0); 00041 virtual ~KMHeaders(); 00042 00044 virtual void setFolder(KMFolder *, bool jumpToFirst = false); 00045 00047 KMFolder* folder(void) { return mFolder; } 00048 00050 void refreshNestedState(void); 00051 00054 virtual void setCurrentMsg(int msgId); 00055 00057 QPtrList<QListViewItem> currentThread() const; 00058 00061 virtual void setThreadStatus(KMMsgStatus status, bool toggle=false); 00062 00063 /* Set message status to read if it is new, or unread */ 00064 virtual void setMsgRead(int msgId); 00065 00067 virtual void setMsgStatus(KMMsgStatus status, bool toggle=false); 00068 virtual void deleteMsg(); 00069 virtual void applyFiltersOnMsg(); 00070 virtual void undo(); 00071 virtual bool canUndo() const; 00072 virtual void resendMsg(); 00073 virtual KMHeaderItem * prepareMove( int *contentX, int *contentY ); 00074 virtual void finalizeMove( KMHeaderItem *item, int contentX, int contentY ); 00075 00078 virtual void moveMsgToFolder(KMFolder* destination); 00079 00082 virtual void copyMsgToFolder(KMFolder* destination, 00083 KMMessage* aMsg = 0); 00084 00086 virtual void clearSelectableAndAboutToBeDeleted(Q_UINT32 serNum); 00089 virtual KMMessageList* selectedMsgs(bool toBeDeleted = false); 00090 00092 int indexOfGetMsg (void) const { return getMsgIndex; } 00093 00095 KMMainWidget* owner(void) const { return mOwner; } 00096 00098 const KPaintInfo *paintInfo(void) const { return &mPaintInfo; } 00099 00101 virtual void readConfig(void); 00102 00104 virtual void readColorConfig(void); 00105 00107 virtual void reset(void); 00108 00110 void showNewMail(); 00111 00113 virtual KMMessage* currentMsg(); 00115 virtual KMHeaderItem* currentHeaderItem(); 00117 virtual int currentItemIndex(); 00119 virtual void setCurrentItemByIndex( int msgIdx ); 00121 virtual int topItemIndex(); 00124 virtual void setTopItemByIndex( int aMsgIdx ); 00125 virtual void setNestedOverride( bool override ); 00126 virtual void setSubjectThreading( bool subjThreading ); 00128 virtual void setOpen ( QListViewItem *, bool ); 00129 00130 NestingPolicy getNestingPolicy() const { return nestingPolicy; } 00132 bool isThreaded() const { 00133 return mNested != mNestedOverride; // xor 00134 } 00135 00138 virtual int findUnread(bool findNext, int startAt=-1, bool onlyNew = false, bool acceptCurrent = false); 00139 00141 LoopOnGotoUnreadValue loopOnGotoUnread() { return mLoopOnGotoUnread; } 00142 00143 void highlightMessage(QListViewItem*, bool markitread); 00144 00146 static QString fancyDate( time_t otime ); 00147 00148 QFont dateFont; 00149 00150 bool noRepaint; 00151 00152 // filter events for popup 00153 bool eventFilter ( QObject *o, QEvent *e ); 00154 00155 signals: 00158 virtual void selected(KMMessage *); 00161 virtual void activated(KMMessage *); 00163 virtual void maybeDeleting(); 00164 00165 public slots: 00166 void workAroundQListViewLimitation(); 00167 00169 void selectMessage(QListViewItem*); 00171 void highlightMessage(QListViewItem*); 00173 void slotRMB(); 00175 void msgHeaderChanged(KMFolder *folder, int msgId); 00177 void msgChanged(); 00179 void folderCleared(); 00181 void msgAdded(int); 00183 void msgRemoved(int, QString, QString); 00185 void nextMessage(); 00187 void selectNextMessage(); 00189 void prevMessage(); 00191 void selectPrevMessage(); 00194 bool nextUnreadMessage(bool acceptCurrent = false); 00197 bool prevUnreadMessage(); 00199 void slotNoDrag(); 00201 void resetCurrentTime(); 00202 00205 void slotExpandOrCollapseThread( bool expand ); 00208 void slotExpandOrCollapseAllThreads( bool expand ); 00209 00210 virtual void ensureCurrentItemVisible(); 00211 00214 virtual void setSelected(QListViewItem *item, bool selected); 00215 00217 void slotToggleSizeColumn(); 00218 00220 void setFolderInfoStatus(); 00221 00222 protected: 00223 static QPixmap *pixNew, *pixUns, *pixDel, *pixRead, *pixRep, *pixSent, 00224 *pixQueued, *pixFwd, *pixFlag, *pixWatched, *pixIgnored, *pixSpam, *pixHam, 00225 *pixFullySigned, *pixPartiallySigned, *pixUndefinedSigned, 00226 *pixFullyEncrypted, *pixPartiallyEncrypted, *pixUndefinedEncrypted, 00227 *pixFiller, *pixEncryptionProblematic, 00228 *pixSignatureProblematic; 00229 00231 virtual bool event(QEvent *e); 00232 00234 virtual void paintEmptyArea( QPainter * p, const QRect & rect ); 00235 00237 void makeHeaderVisible(); 00238 00240 void findUnreadAux( KMHeaderItem*&, bool &, bool, bool ); 00241 00246 virtual int firstSelectedMsg() const; 00247 00249 virtual void readFolderConfig(void); 00250 00252 virtual void writeFolderConfig(void); 00253 00255 virtual void writeConfig(void); 00256 00258 virtual void contentsMousePressEvent(QMouseEvent*); 00259 virtual void contentsMouseReleaseEvent(QMouseEvent* e); 00260 virtual void keyPressEvent( QKeyEvent * e ); 00261 00263 virtual void setSorting( int column, bool ascending = true); 00264 00266 void contentsMouseMoveEvent( QMouseEvent *e ); 00267 00270 void styleChange( QStyle& oldStyle ); 00271 00274 void setStyleDependantFrameWidth(); 00275 00276 protected slots: 00279 virtual void moveSelectedToFolder( int menuId ); 00281 virtual void copySelectedToFolder( int menuId ); 00283 virtual int slotFilterMsg( KMMessage * ); 00285 void dirtySortOrder(int); 00287 void rightButtonPressed( QListViewItem *, const QPoint &, int ); 00288 00289 private slots: 00290 void slotMoveCompleted( bool success ); 00291 void slotMoveAborted( ); 00292 00293 private: 00296 virtual void updateMessageList( bool set_selection=false ); 00297 00299 KMFolder* mFolder; 00301 KMMainWidget* mOwner; 00303 int mTopItem; 00305 int mCurrentItem; 00307 QMemArray<KMHeaderItem*> mItems; 00308 00309 // ===== threading and sorting ========== 00310 bool mNested, mNestedOverride, mSubjThreading; 00311 NestingPolicy nestingPolicy; 00312 int mSortCol; 00313 bool mSortDescending; 00314 00315 struct { 00316 uint ascending : 1; 00317 uint dirty : 1; 00318 short column; 00319 uint fakeSort : 1; 00320 uint removed : 1; 00321 } mSortInfo; 00322 00323 00325 QDict< KMSortCacheItem > mSortCacheItems; 00327 QDict< QPtrList< KMSortCacheItem > > mSubjectLists; 00329 QPtrList<KMHeaderItem> mImperfectlyThreadedList; 00330 00332 void buildThreadingTree( QMemArray<KMSortCacheItem *> sortCache ); 00334 void buildSubjectThreadingTree( QMemArray<KMSortCacheItem *> sortCache ); 00336 KMSortCacheItem* findParent(KMSortCacheItem *item); 00338 KMSortCacheItem* findParentBySubject(KMSortCacheItem *item); 00339 00341 void appendItemToSortFile(KMHeaderItem *); 00343 bool writeSortOrder(); 00345 bool readSortOrder(bool set_selection=false); 00346 00348 bool showingSize; 00350 int getMsgIndex; 00352 bool getMsgMulti; 00354 KMHeaderItem* getMsgItem; 00356 KMMessageList mSelMsgBaseList; 00357 QPtrList<KMMessage> mSelMsgList; 00358 KMHeaderItem* mPrevCurrent; 00359 00361 KPaintInfo mPaintInfo; 00362 00364 static QIconSet *up, *down; 00366 KMMenuToFolder mMenuToFolder; 00367 00369 bool mMousePressed; 00371 QPoint mPressPos; 00372 00373 KMime::DateFormatter mDate; 00375 LoopOnGotoUnreadValue mLoopOnGotoUnread; 00376 bool mJumpToUnread; 00377 bool mReaderWindowActive; 00378 00380 KPopupMenu* mPopup; 00381 int mSizeColumn; 00382 }; 00383 00384 #endif
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 Wed Jul 28 23:58:01 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003