00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef __KFOLDERTREE
00022
#define __KFOLDERTREE
00023
00024
#include <qpixmap.h>
00025
#include <qbitarray.h>
00026
#include <qdragobject.h>
00027
#include <klistview.h>
00028
00029
class KFolderTree;
00030
00032 struct KPaintInfo {
00033
bool pixmapOn;
00034
QPixmap pixmap;
00035
QColor colFore;
00036
QColor colBack;
00037
QColor colNew;
00038
QColor colUnread;
00039
QColor colFlag;
00040
bool showSize;
00041
#ifdef SCORING
00042
bool showScore;
00043
int scoreCol;
00044
#endif
00045
bool orderOfArrival;
00046
bool status;
00047
int flagCol;
00048
int senderCol;
00049
int subCol;
00050
int dateCol;
00051
int sizeCol;
00052
bool showCryptoIcons;
00053
bool showAttachmentIcon;
00054 };
00055
00056
00057
00058
class KFolderTreeItem :
public KListViewItem
00059 {
00060
public:
00062
enum Protocol {
00063 Imap,
00064 Local,
00065 News,
00066 CachedImap,
00067 Search,
00068 NONE
00069 };
00070
00072
enum Type {
00073 Inbox,
00074 Outbox,
00075 SentMail,
00076 Trash,
00077 Drafts,
00078 Templates,
00079 Root,
00080 Calendar,
00081 Tasks,
00082 Journals,
00083 Contacts,
00084 Notes,
00085 Other
00086 };
00087
00089 KFolderTreeItem( KFolderTree *parent,
const QString & label=QString::null,
00090 Protocol protocol=NONE, Type type=Root );
00091
00093 KFolderTreeItem( KFolderTreeItem *parent,
const QString & label=QString::null,
00094 Protocol protocol=NONE, Type type=Other,
int unread=0,
int total=0 );
00095
00097
virtual int compare(
QListViewItem * i,
int col,
00098
bool ascending )
const;
00099
00101
int unreadCount() {
return mUnread; }
00102
virtual void setUnreadCount(
int aUnread );
00103
00105
int totalCount() {
return mTotal; }
00106
virtual void setTotalCount(
int aTotal );
00107
00109 Protocol protocol()
const {
return mProtocol; }
00110
virtual void setProtocol( Protocol aProtocol ) { mProtocol = aProtocol; }
00111
00113 Type type()
const {
return mType; }
00114
virtual void setType( Type aType ) { mType = aType; }
00115
00117
virtual int countUnreadRecursive();
00118
00120
virtual void paintCell(
QPainter * p,
const QColorGroup & cg,
00121
int column,
int width,
int align );
00122
00124
virtual bool acceptDrag(
QDropEvent* )
const {
return true; }
00125
00126
private:
00128
int protocolSortingKey() const;
00130
int typeSortingKey() const;
00131
00132 protected:
00133 Protocol mProtocol;
00134 Type mType;
00135
int mUnread;
00136
int mTotal;
00137 };
00138
00139
00140
00141 class KFolderTree : public KListView
00142 {
00143 Q_OBJECT
00144
00145
public:
00146 KFolderTree(
QWidget *parent,
const char *name=0 );
00147
00152
virtual void addAcceptableDropMimetype(
const char *mimeType,
bool outsideOk );
00153
00155
virtual bool acceptDrag(
QDropEvent* event )
const;
00156
00158
KPaintInfo paintInfo()
const {
return mPaintInfo; }
00159
00161
virtual void addUnreadColumn(
const QString & name,
int width=70 );
00162
virtual void removeUnreadColumn();
00163
virtual void addTotalColumn(
const QString & name,
int width=70 );
00164
virtual void removeTotalColumn();
00165
00167
int unreadIndex()
const {
return mUnreadIndex; }
00168
int totalIndex()
const {
return mTotalIndex; }
00169
00171
bool isUnreadActive()
const {
return mUnreadIndex >= 0; }
00172
bool isTotalActive()
const {
return mTotalIndex >= 0; }
00173
00175
virtual void setFullWidth(
bool fullWidth );
00176
00177
protected:
00180
void styleChange(
QStyle& oldStyle );
00181
00184
void setStyleDependantFrameWidth();
00185
00186
virtual void drawContentsOffset(
QPainter * p,
int ox,
int oy,
00187
int cx,
int cy,
int cw,
int ch );
00188
00189
virtual void contentsMousePressEvent(
QMouseEvent *e );
00190
virtual void contentsMouseReleaseEvent(
QMouseEvent *e );
00191
00193
QMemArray<const char*> mAcceptableDropMimetypes;
00194
QBitArray mAcceptOutside;
00195
00197
KPaintInfo mPaintInfo;
00198
00201
int mUnreadIndex;
00202
int mTotalIndex;
00203 };
00204
00205
#endif