french -> French
[kdepim.git] / knode / kncollectionview.h
blobbea1f9676d824786ffc20bd9598e2a6e75ae8380
1 /*
2 KNode, the KDE newsreader
3 Copyright (c) 2004-2005 Volker Krause <vkrause@kde.org>
4 Copyright (c) 2009 Olivier Trichet <nive@nivalis.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #ifndef KNODE_KNCOLLECTIONVIEW_H
16 #define KNODE_KNCOLLECTIONVIEW_H
18 #include "kngroup.h"
19 #include "knfolder.h"
20 #include "knnntpaccount.h"
22 #include <foldertreewidget.h>
24 class QContextMenuEvent;
25 class QDropEvent;
27 using namespace KPIM;
29 /** The group/folder tree. */
30 class KNCollectionView : public FolderTreeWidget
33 Q_OBJECT
35 public:
36 explicit KNCollectionView( QWidget *parent );
37 ~KNCollectionView();
39 /** Selects @p item and set it the current item. */
40 void setActive( QTreeWidgetItem *item );
42 void readConfig();
43 void writeConfig();
45 public slots:
46 void addAccount( KNNntpAccount::Ptr a );
47 void removeAccount( KNNntpAccount::Ptr a );
48 void updateAccount( KNNntpAccount::Ptr a );
49 void reloadAccounts();
51 void addGroup( KNGroup::Ptr g );
52 void removeGroup( KNGroup::Ptr g );
53 void updateGroup( KNGroup::Ptr g );
55 void addFolder( KNFolder::Ptr f );
56 void removeFolder( KNFolder::Ptr f );
57 void activateFolder( KNFolder::Ptr f );
58 void updateFolder( KNFolder::Ptr f );
59 void addPendingFolders();
60 void reloadFolders();
62 void reload();
64 void nextGroup();
65 void prevGroup();
67 // KMail like keyboard navigation
68 void decCurrentFolder();
69 void incCurrentFolder();
70 void selectCurrentFolder();
72 signals:
73 /**
74 This signal is emitted when a context menu should be displayed
75 for @p item as global position @p position.
77 void contextMenu( QTreeWidgetItem *item, const QPoint &position );
79 protected:
80 /**
81 Emits the signal contextMenu() to display a context menu on
82 items of the view.
83 Reimplemented from QAbstractScrollArea.
85 virtual void contextMenuEvent( QContextMenuEvent *event );
88 virtual void paintEvent( QPaintEvent *event );
91 // Drag and drop
92 /**
93 Reimplement to only accept MIME types which are accepted in dropEvent.
95 virtual void dragEnterEvent ( QDragEnterEvent *event );
96 /**
97 Reimplemented to hide the drop indicator when the drag leave the view.
99 virtual void dragLeaveEvent ( QDragLeaveEvent *event );
101 Reimplemented to accept the @p event only when the target folder can be
102 dropped articles or folders.
104 virtual void dragMoveEvent( QDragMoveEvent *event );
106 Handles actual droping of articles or folder.
108 virtual void dropEvent( QDropEvent *event );
110 Called by dragMoveEvent() and dropEvent().
111 @param event The drop/drag-move event.
112 @param enforceDrop If true the actual move of folder or move/copy of articles happens.
114 void handleDragNDropEvent( QDropEvent *event, bool enforceDrop );
117 Returns the "x-knode-drag/folder" mime-type for drag&droping of folders within this view.
119 virtual QStringList mimeTypes() const;
122 Reimplemented to perform the actual drag operations of folders.
123 This takes care of showing a nice drag icon/cursor instead of the default that consists
124 of the whole item widget (cells of label & counts).
125 @param supportedActions unused parameter.
127 virtual void startDrag( Qt::DropActions supportedActions );
130 private:
131 /** Loads the column layout. */
132 void loadLayout();
134 QTreeWidgetItem *mActiveItem;
137 Current target of a drag & drop operation.
138 Used to highlight this item.
140 QTreeWidgetItem *mDragTargetItem;
143 #endif // KNODE_KNCOLLECTIONVIEW_H