kmail Library API Documentation

kmfoldertree.h

00001 /* -*- mode: C++ -*- 00002 This file is part of the KDE libraries 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef __KMFOLDERTREE 00019 #define __KMFOLDERTREE 00020 00021 #include "kmheaders.h" 00022 #include "kmfolder.h" 00023 00024 #include <klocale.h> 00025 #include <kpopupmenu.h> 00026 #include <kfoldertree.h> 00027 #include <kiconloader.h> 00028 00029 #include <qwidget.h> 00030 #include <qtimer.h> 00031 #include <qheader.h> 00032 00033 class QDropEvent; 00034 class QPixmap; 00035 class QPainter; 00036 class KMFolderImap; 00037 class KMFolderTree; 00038 class KMMainWidget; 00039 class KMAccount; 00040 template <typename T> class QGuardedPtr; 00041 00042 class KMFolderTreeItem : public QObject, public KFolderTreeItem 00043 00044 { 00045 Q_OBJECT 00046 public: 00048 KMFolderTreeItem( KFolderTree *parent, const QString & name, 00049 KFolderTreeItem::Protocol protocol=KFolderTreeItem::NONE ); 00050 00052 KMFolderTreeItem( KFolderTree *parent, const QString & name, 00053 KMFolder* folder ); 00054 00056 KMFolderTreeItem( KFolderTreeItem* parent, const QString & name, 00057 KMFolder* folder ); 00058 virtual ~KMFolderTreeItem(); 00059 00060 QPixmap normalIcon(int size=16) const; 00061 QPixmap unreadIcon(int size=16) const; 00062 00063 void setNeedsRepaint( bool value ) { mNeedsRepaint = value; } 00064 bool needsRepaint() const { return mNeedsRepaint; } 00065 00067 KMFolder* folder() const { return mFolder; } 00068 QListViewItem* parent() const { return KFolderTreeItem::parent(); } 00069 00072 void adjustUnreadCount( int newUnreadCount ); 00073 00075 virtual bool acceptDrag(QDropEvent* ) const; 00076 00077 signals: 00079 void iconChanged( KMFolderTreeItem * ); 00081 void nameChanged( KMFolderTreeItem * ); 00082 00083 public slots: 00084 void properties(); 00085 void slotRepaint(); 00086 void slotNameChanged() { emit nameChanged( this ); } 00087 00088 00089 protected: 00090 void init(); 00091 KMFolder* mFolder; 00092 private: 00093 bool mNeedsRepaint; 00094 }; 00095 00096 //========================================================================== 00097 00098 class KMFolderTree : public KFolderTree 00099 { 00100 Q_OBJECT 00101 00102 public: 00103 KMFolderTree( KMMainWidget *mainWidget, QWidget *parent=0, 00104 const char *name=0 ); 00105 00107 void writeConfig(); 00108 00110 virtual void reload(bool openFolders = false); 00111 00113 virtual void addDirectory( KMFolderDir *fdir, KMFolderTreeItem* parent ); 00114 00116 virtual QListViewItem* indexOfFolder(const KMFolder*); 00117 00119 void createFolderList( QStringList *str, 00120 QValueList<QGuardedPtr<KMFolder> > *folders, 00121 bool localFolders=true, 00122 bool imapFolders=true, 00123 bool dimapFolders=true, 00124 bool searchFolders=false, 00125 bool includeNoContent=true, 00126 bool includeNoChildren=true ); 00127 00129 virtual void readConfig(void); 00130 00132 void readColorConfig(void); 00133 00135 void cleanupConfigFile(); 00136 00138 void nextUnreadFolder(bool confirm); 00139 00141 bool checkUnreadFolder(KMFolderTreeItem* ftl, bool confirm); 00142 00143 KMFolder *currentFolder() const; 00144 00145 enum ColumnMode {unread=15, total=16}; 00146 00148 void toggleColumn(int column, bool openFolders = false); 00149 00152 virtual void updatePopup() const; 00153 00155 KMMainWidget * mainWidget() const { return mMainWidget; } 00156 00158 void showFolder( KMFolder* ); 00159 00160 signals: 00162 void folderSelected(KMFolder*); 00163 00165 void folderSelectedUnread( KMFolder * ); 00166 00168 void folderDrop(KMFolder*); 00169 00171 void folderDropCopy(KMFolder*); 00172 00174 void columnsChanged(); 00175 00177 void iconChanged( KMFolderTreeItem * ); 00178 00180 void nameChanged( KMFolderTreeItem * ); 00181 00182 public slots: 00184 void nextUnreadFolder(); 00185 00187 void prevUnreadFolder(); 00188 00190 void incCurrentFolder(); 00191 00193 void decCurrentFolder(); 00194 00196 void selectCurrentFolder(); 00197 00199 void delayedUpdate(); 00200 00202 void slotAccountRemoved(KMAccount*); 00203 00205 void doFolderSelected(QListViewItem*); 00206 00208 void startAutoScroll(); 00209 void stopAutoScroll(); 00210 00216 void slotResetFolderList( QListViewItem* item = 0, bool startList = true ); 00217 00218 protected slots: 00219 // void slotRMB(int, int); 00221 void doFolderListChanged(); 00222 00224 void slotFolderRemoved(KMFolder *); 00225 00227 void refresh(); 00228 00230 void addChildFolder(); 00231 00233 void openFolder(); 00234 00236 void slotFolderExpanded( QListViewItem * item ); 00237 00239 void slotFolderCollapsed( QListViewItem * item ); 00240 00242 void slotRenameFolder( QListViewItem * item, int col, const QString& text); 00243 00245 void slotUpdateCounts(KMFolder * folder); 00246 void slotUpdateCounts(KMFolderImap * folder, bool success = true); 00247 void slotUpdateOneCount(); 00248 00250 void slotToggleUnreadColumn(); 00251 void slotToggleTotalColumn(); 00252 00253 void autoScroll(); 00254 00255 void slotContextMenuRequested( QListViewItem *, const QPoint & ); 00256 00258 void slotCheckMail(); 00259 00260 void slotNewMessageToMailingList(); 00261 00262 protected: 00264 virtual bool event(QEvent *e); 00265 00266 virtual void contentsMouseReleaseEvent(QMouseEvent* me); 00267 00269 virtual void updateUnreadAll( ); 00270 00271 virtual void resizeEvent(QResizeEvent*); 00272 00274 bool readIsListViewItemOpen(KMFolderTreeItem *fti); 00275 void writeIsListViewItemOpen(KMFolderTreeItem *fti); 00276 00277 QTimer mUpdateTimer; 00278 00280 void contentsDragEnterEvent( QDragEnterEvent *e ); 00281 void contentsDragMoveEvent( QDragMoveEvent *e ); 00282 void contentsDragLeaveEvent( QDragLeaveEvent *e ); 00283 void contentsDropEvent( QDropEvent *e ); 00284 00286 QListViewItem *oldCurrent, *oldSelected; 00287 QListViewItem *dropItem; 00288 KMFolderTreeItem *mLastItem; 00289 QTimer autoopen_timer; 00290 00291 // filter some rmb-events 00292 bool eventFilter(QObject*, QEvent*); 00293 00295 void prepareItem( KMFolderTreeItem* ); 00296 00298 void connectSignals(); 00299 00300 private: 00301 QTimer autoscroll_timer; 00302 int autoscroll_time; 00303 int autoscroll_accel; 00304 00306 QListViewItemIterator mUpdateIterator; 00307 00309 KPopupMenu* mPopup; 00310 int mUnreadPop; 00311 int mTotalPop; 00312 00314 bool mShowPopupAfterDnD; 00315 KMMainWidget *mMainWidget; 00316 bool mReloading; 00317 }; 00318 00319 #endif
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:37 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003