treebase.h
00001 /* 00002 Copyright (c) 2008 Pradeepto K. Bhattacharya <pradeepto@kde.org> 00003 ( adapted from tdepim/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 <tdelistview.h> 00028 00029 namespace KMail { 00030 00031 class TreeItemBase; 00032 00033 class TreeBase : public TDEListView 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 TreeBase( TQWidget * parent, KMFolderTree *folderTree, 00039 const TQString &preSelection, bool mustBeReadWrite ); 00040 00041 virtual ~TreeBase() {} 00042 00043 const KMFolder * folder() const; 00045 void setFolder( KMFolder *folder ); 00046 00047 inline void setFolder( const TQString& idString ) 00048 { 00049 setFolder( kmkernel->findFolderById( idString ) ); 00050 } 00051 00052 void reload( bool mustBeReadWrite, bool showOutbox, bool showImapFolders, 00053 const TQString& preSelection = TQString() ); 00054 00055 int folderColumn() const { return mFolderColumn; } 00056 void setFolderColumn( const int folderCol ) { mFolderColumn = folderCol; } 00057 int pathColumn() const { return mPathColumn; } 00058 void setPathColumn( const int pathCol ) { mPathColumn = pathCol; } 00059 00060 public slots: 00061 void addChildFolder(); 00062 protected slots: 00063 void slotContextMenuRequested( TQListViewItem *lvi, 00064 const TQPoint &p ); 00065 void recolorRows(); 00066 protected: 00067 virtual TQListViewItem* createItem( TQListView* ) = 0; 00068 virtual TQListViewItem* createItem( TQListView*, TQListViewItem* ) = 0; 00069 virtual TQListViewItem* createItem( TQListViewItem* ) = 0; 00070 virtual TQListViewItem* createItem( TQListViewItem*, TQListViewItem* ) = 0; 00071 00072 protected: 00073 KMFolderTree* mFolderTree; 00074 TQString mFilter; 00075 bool mLastMustBeReadWrite; 00076 bool mLastShowOutbox; 00077 bool mLastShowImapFolders; 00079 int mFolderColumn; 00080 int mPathColumn; 00081 00082 }; 00083 } 00084 #endif