Better wording
[kdepim.git] / kmail / foldershortcutactionmanager.h
blob95d98880dded22f0d794d9035d6475e04d636ab3
1 /* Copyright 2010 Thomas McGuire <mcguire@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License as
5 published by the Free Software Foundation; either version 2 of
6 the License or (at your option) version 3 or any later version
7 accepted by the membership of KDE e.V. (or its successor approved
8 by the membership of KDE e.V.), which shall act as a proxy
9 defined in Section 14 of version 3 of the license.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef FOLDERSHORTCUTACTIONMANAGER_H
20 #define FOLDERSHORTCUTACTIONMANAGER_H
22 #include "kmail_export.h"
24 #include <Akonadi/Entity>
25 #include <Akonadi/Collection>
27 #include <QMap>
28 #include <QModelIndex>
29 #include <QObject>
31 namespace MailCommon {
32 class Kernel;
35 class QAction;
37 class KActionCollection;
39 namespace KMail {
41 class FolderShortcutCommand : public QObject
43 Q_OBJECT
45 public:
46 FolderShortcutCommand( QWidget* mainwidget, const Akonadi::Collection & col );
47 ~FolderShortcutCommand();
49 public slots:
50 void start();
51 /** Assign a KAction to the command which is used to trigger it. This
52 * action will be deleted along with the command, so you don't need to
53 * keep track of it separately. */
54 void setAction( QAction* );
56 signals:
57 void selectCollectionFolder( const Akonadi::Collection & col );
59 private:
60 QWidget *mMainWidget;
61 Akonadi::Collection mCollectionFolder;
62 QAction *mAction;
65 class KMAIL_EXPORT FolderShortcutActionManager : public QObject
67 Q_OBJECT
69 public:
71 FolderShortcutActionManager( QWidget *parent, KActionCollection *actionCollection );
72 void createActions();
74 public slots:
76 /**
77 * Updates the shortcut action for this collection. Call this when a shortcut was
78 * added, removed or changed.
80 void shortcutChanged( const Akonadi::Collection &collection );
82 private slots:
84 /**
85 * Removes the shortcut actions associated with a folder.
87 void slotCollectionRemoved( const Akonadi::Collection &collection );
89 void slotRowsInserted( const QModelIndex &parent, int start, int end );
91 private:
93 void updateShortcutsForIndex( const QModelIndex &parent, int start, int end );
94 QMap< Akonadi::Entity::Id, FolderShortcutCommand* > mFolderShortcutCommands;
95 KActionCollection *mActionCollection;
96 QWidget *mParent;
101 #endif