18 #ifndef __KMFOLDERTREE
19 #define __KMFOLDERTREE
21 #include "foldertreebase.h"
23 #include <tdelocale.h>
24 #include <tdemacros.h>
26 #include <tqguardedptr.h>
42 typedef TQMap<int,KMFolder*> KMMenuToFolder;
43 template <
typename T>
class TQGuardedPtr;
45 class TDE_EXPORT KMFolderTreeItem :
public TQObject,
public KFolderTreeItem
51 KMFolderTreeItem( KFolderTree *parent,
const TQString & name,
52 KFolderTreeItem::Protocol protocol=KFolderTreeItem::NONE );
55 KMFolderTreeItem( KFolderTree *parent,
const TQString & name,
59 KMFolderTreeItem( KFolderTreeItem* parent,
const TQString & name,
61 virtual ~KMFolderTreeItem();
63 TQPixmap normalIcon(
int size )
const;
64 TQPixmap unreadIcon(
int size )
const;
66 void setNeedsRepaint(
bool value ) { mNeedsRepaint = value; }
67 bool needsRepaint()
const {
return mNeedsRepaint; }
70 KMFolder* folder()
const {
return mFolder; }
71 TQListViewItem* parent()
const {
return KFolderTreeItem::parent(); }
75 void adjustUnreadCount(
int newUnreadCount );
78 virtual bool acceptDrag(TQDropEvent* e)
const;
82 void iconChanged( KMFolderTreeItem * );
84 void nameChanged( KMFolderTreeItem * );
88 void assignShortcut();
89 void slotShowExpiryProperties();
90 void slotIconsChanged();
91 void slotNameChanged();
92 void slotNoContentChanged();
99 virtual bool useTopLevelIcon()
const {
return depth() == 0; }
101 virtual int iconSize()
const {
return 16; }
109 class KMFolderTree :
public KMail::FolderTreeBase
115 KMFolderTree( KMMainWidget *mainWidget, TQWidget *parent=0,
116 const char *name=0 );
122 virtual void addDirectory(
KMFolderDir *fdir, KMFolderTreeItem* parent );
125 void createFolderList( TQStringList *str,
126 TQValueList<TQGuardedPtr<KMFolder> > *folders,
127 bool localFolders=
true,
128 bool imapFolders=
true,
129 bool dimapFolders=
true,
130 bool searchFolders=
false,
131 bool includeNoContent=
true,
132 bool includeNoChildren=
true );
135 virtual void readConfig(
void);
138 void cleanupConfigFile();
141 void nextUnreadFolder(
bool confirm);
144 bool checkUnreadFolder(KMFolderTreeItem* ftl,
bool confirm);
148 TQValueList<TQGuardedPtr<KMFolder> > selectedFolders();
150 enum ColumnMode {unread=15, total=16, foldersize=17};
153 void toggleColumn(
int column,
bool openFolders =
false);
157 virtual void updatePopup()
const;
171 void folderToPopupMenu( MenuAction action, TQObject *receiver, KMMenuToFolder *,
172 TQPopupMenu *menu, TQListViewItem *start = 0 );
179 void folderSelectedUnread(
KMFolder * );
182 void syncStateChanged();
185 void columnsChanged();
188 void iconChanged( KMFolderTreeItem * );
191 void nameChanged( KMFolderTreeItem * );
195 virtual void reload(
bool openFolders =
false);
198 void nextUnreadFolder();
201 void prevUnreadFolder();
204 void incCurrentFolder();
207 void decCurrentFolder();
210 void selectCurrentFolder();
213 void delayedUpdate();
216 void slotAccountRemoved(KMAccount*);
219 void doFolderSelected(TQListViewItem *qlvi,
bool keepSelection =
false);
226 void slotResetFolderList( TQListViewItem* item = 0,
bool startList =
true );
229 void addChildFolder(
KMFolder *folder = 0, TQWidget * parent = 0 );
241 void delayedReload();
246 void doFolderListChanged();
252 void slotFolderMoveOrCopyOperationFinished();
261 void slotFolderExpanded( TQListViewItem * item );
264 void slotFolderCollapsed( TQListViewItem * item );
267 void slotRenameFolder( TQListViewItem * item,
int col,
const TQString& text);
270 void slotUpdateCountsDelayed(
KMFolder * folder);
271 void slotUpdateCountTimeout();
272 void slotUpdateOneCount();
275 void slotToggleUnreadColumn();
276 void slotToggleTotalColumn();
277 void slotToggleSizeColumn();
279 void slotContextMenuRequested( TQListViewItem *,
const TQPoint & );
282 void slotCheckMail();
284 void slotNewMessageToMailingList();
287 virtual void moveSelectedToFolder(
int menuId );
289 virtual void copySelectedToFolder(
int menuId );
292 void updateCopyActions();
294 void slotSyncStateChanged();
297 virtual void contentsMousePressEvent( TQMouseEvent *e );
298 virtual void contentsMouseReleaseEvent(TQMouseEvent* me);
301 virtual void updateUnreadAll( );
303 virtual void resizeEvent(TQResizeEvent*);
306 bool readIsListViewItemOpen(KMFolderTreeItem *fti);
307 void writeIsListViewItemOpen(KMFolderTreeItem *fti);
309 TQTimer mUpdateTimer;
312 void contentsDragEnterEvent( TQDragEnterEvent *e );
313 void contentsDragMoveEvent( TQDragMoveEvent *e );
314 void contentsDragLeaveEvent( TQDragLeaveEvent *e );
315 void contentsDropEvent( TQDropEvent *e );
316 virtual TQDragObject* dragObject();
319 TQListViewItem *oldCurrent, *oldSelected;
320 TQListViewItem *dropItem;
321 KMFolderTreeItem *mLastItem;
322 TQTimer autoopen_timer;
325 bool eventFilter(TQObject*, TQEvent*);
328 void prepareItem( KMFolderTreeItem* );
331 void connectSignals();
334 void moveOrCopyFolder( TQValueList<TQGuardedPtr<KMFolder> > sources,
KMFolder* destination,
bool move=
false );
337 void slotAddToFavorites();
338 void slotUnhideLocalInbox();
342 TQListViewItemIterator mUpdateIterator;
345 TDEPopupMenu* mPopup;
351 TQValueList<TQGuardedPtr<KMFolder> > mCopySourceFolders;
354 TQTimer *mUpdateCountTimer;
355 TQMap<TQString,KMFolder*> mFolderToUpdateCount;
358 KMMenuToFolder mMenuToFolder;
KMail list that manages the contents of one directory that may contain folders and/or other directori...