favoritefolderview.h
00001 /* 00002 Copyright (c) 2007 Volker Krause <vkrause@kde.org> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef KMAIL_FAVORITEFOLDERVIEW_H 00020 #define KMAIL_FAVORITEFOLDERVIEW_H 00021 00022 #include "kmfoldertree.h" 00023 00024 namespace KMail { 00025 00026 class FavoriteFolderView; 00027 00028 class FavoriteFolderViewItem : public KMFolderTreeItem 00029 { 00030 Q_OBJECT 00031 TQ_OBJECT 00032 public: 00033 FavoriteFolderViewItem( FavoriteFolderView *parent, const TQString & name, KMFolder* folder ); 00034 00035 protected: 00036 bool useTopLevelIcon() const { return false; } 00037 int iconSize() const { return 22; } 00038 00039 private slots: 00040 void nameChanged(); 00041 00042 private: 00043 TQString mOldName; 00044 }; 00045 00046 class FavoriteFolderView : public FolderTreeBase 00047 { 00048 Q_OBJECT 00049 TQ_OBJECT 00050 00051 public: 00052 FavoriteFolderView( KMMainWidget *mainWidget, TQWidget *parent = 0 ); 00053 ~FavoriteFolderView(); 00054 00055 void readConfig(); 00056 void writeConfig(); 00057 00058 KMFolderTreeItem* addFolder( KMFolder *folder, const TQString &name = TQString(), 00059 TQListViewItem *after = 0 ); 00060 void addFolder( KMFolderTreeItem *fti ); 00061 00062 public slots: 00063 void folderTreeSelectionChanged( KMFolder *folder ); 00064 void checkMail(); 00065 00066 protected: 00067 bool acceptDrag(TQDropEvent* e) const; 00068 void contentsDragEnterEvent( TQDragEnterEvent *e ); 00069 void readColorConfig(); 00070 00071 private: 00072 static TQString prettyName( KMFolderTreeItem* fti ); 00073 KMFolderTreeItem* findFolderTreeItem( KMFolder* folder ) const; 00074 void handleGroupwareFolder( KMFolderTreeItem *fti ); 00075 00076 private slots: 00077 void selectionChanged(); 00078 void itemClicked( TQListViewItem *item ); 00079 void folderRemoved( KMFolder *folder ); 00080 void dropped( TQDropEvent *e, TQListViewItem *after ); 00081 void contextMenu( TQListViewItem *item, const TQPoint &point ); 00082 void removeFolder(); 00083 void initializeFavorites(); 00084 void renameFolder(); 00085 void addFolder(); 00086 void notifyInstancesOnChange(); 00087 void refresh(); 00088 00089 private: 00090 KMFolderTreeItem* mContextMenuItem; 00091 static TQValueList<FavoriteFolderView*> mInstances; 00092 bool mReadingConfig; 00093 }; 00094 00095 } 00096 00097 #endif