kmail
favoritefolderview.h
Go to the documentation of this file.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 public: 00032 FavoriteFolderViewItem( FavoriteFolderView *parent, const QString & name, KMFolder* folder ); 00033 00034 protected: 00035 bool useTopLevelIcon() const { return false; } 00036 int iconSize() const { return 22; } 00037 00038 private slots: 00039 void nameChanged(); 00040 00041 private: 00042 QString mOldName; 00043 }; 00044 00045 class FavoriteFolderView : public FolderTreeBase 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 FavoriteFolderView( KMMainWidget *mainWidget, QWidget *parent = 0 ); 00051 ~FavoriteFolderView(); 00052 00053 void readConfig(); 00054 void writeConfig(); 00055 00056 KMFolderTreeItem* addFolder( KMFolder *folder, const QString &name = QString::null, 00057 QListViewItem *after = 0 ); 00058 void addFolder( KMFolderTreeItem *fti ); 00059 00060 public slots: 00061 void folderTreeSelectionChanged( KMFolder *folder ); 00062 void checkMail(); 00063 00064 protected: 00065 bool acceptDrag(QDropEvent* e) const; 00066 void contentsDragEnterEvent( QDragEnterEvent *e ); 00067 void readColorConfig(); 00068 00069 private: 00070 static QString prettyName( KMFolderTreeItem* fti ); 00071 KMFolderTreeItem* findFolderTreeItem( KMFolder* folder ) const; 00072 void handleGroupwareFolder( KMFolderTreeItem *fti ); 00073 00074 private slots: 00075 void selectionChanged(); 00076 void itemClicked( QListViewItem *item ); 00077 void folderRemoved( KMFolder *folder ); 00078 void dropped( QDropEvent *e, QListViewItem *after ); 00079 void contextMenu( QListViewItem *item, const QPoint &point ); 00080 void removeFolder(); 00081 void initializeFavorites(); 00082 void renameFolder(); 00083 void addFolder(); 00084 void notifyInstancesOnChange(); 00085 void refresh(); 00086 00087 private: 00088 KMFolderTreeItem* mContextMenuItem; 00089 static QValueList<FavoriteFolderView*> mInstances; 00090 bool mReadingConfig; 00091 }; 00092 00093 } 00094 00095 #endif