kmail
treebase.h
00001 /* 00002 Copyright (c) 2008 Pradeepto K. Bhattacharya <pradeepto@kde.org> 00003 ( adapted from kdepim/kmail/kmfolderseldlg.cpp and simplefoldertree.h ) 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 KMAIL_TREEBASE_H 00021 #define KMAIL_TREEBASE_H 00022 00023 #include "kmfolder.h" 00024 #include "kmfoldertree.h" 00025 00026 #include <kdebug.h> 00027 #include <klistview.h> 00028 00029 namespace KMail { 00030 00031 class TreeItemBase; 00032 00033 class TreeBase : public KListView 00034 { 00035 Q_OBJECT 00036 public: 00037 TreeBase( QWidget * parent, KMFolderTree *folderTree, 00038 const QString &preSelection, bool mustBeReadWrite ); 00039 00040 virtual ~TreeBase() {} 00041 00042 const KMFolder * folder() const; 00044 void setFolder( KMFolder *folder ); 00045 00046 inline void setFolder( const QString& idString ) 00047 { 00048 setFolder( kmkernel->findFolderById( idString ) ); 00049 } 00050 00051 void reload( bool mustBeReadWrite, bool showOutbox, bool showImapFolders, 00052 const QString& preSelection = QString::null ); 00053 00054 int folderColumn() const { return mFolderColumn; } 00055 void setFolderColumn( const int folderCol ) { mFolderColumn = folderCol; } 00056 int pathColumn() const { return mPathColumn; } 00057 void setPathColumn( const int pathCol ) { mPathColumn = pathCol; } 00058 00059 public slots: 00060 void addChildFolder(); 00061 protected slots: 00062 void slotContextMenuRequested( QListViewItem *lvi, 00063 const QPoint &p ); 00064 void recolorRows(); 00065 protected: 00066 virtual QListViewItem* createItem( QListView* ) = 0; 00067 virtual QListViewItem* createItem( QListView*, QListViewItem* ) = 0; 00068 virtual QListViewItem* createItem( QListViewItem* ) = 0; 00069 virtual QListViewItem* createItem( QListViewItem*, QListViewItem* ) = 0; 00070 00071 protected: 00072 KMFolderTree* mFolderTree; 00073 QString mFilter; 00074 bool mLastMustBeReadWrite; 00075 bool mLastShowOutbox; 00076 bool mLastShowImapFolders; 00078 int mFolderColumn; 00079 int mPathColumn; 00080 00081 }; 00082 } 00083 #endif