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 <AkonadiCore/Collection>
27 #include <QModelIndex>
32 class KActionCollection
;
37 class FolderShortcutCommand
: public QObject
42 FolderShortcutCommand(QWidget
*mainwidget
, const Akonadi::Collection
&col
);
43 ~FolderShortcutCommand();
47 /** Assign a QAction to the command which is used to trigger it. This
48 * action will be deleted along with the command, so you don't need to
49 * keep track of it separately. */
50 void setAction(QAction
*);
53 void selectCollectionFolder(const Akonadi::Collection
&col
);
56 Akonadi::Collection mCollectionFolder
;
61 class KMAIL_EXPORT FolderShortcutActionManager
: public QObject
66 explicit FolderShortcutActionManager(QWidget
*parent
, KActionCollection
*actionCollection
);
72 * Updates the shortcut action for this collection. Call this when a shortcut was
73 * added, removed or changed.
75 void shortcutChanged(const Akonadi::Collection
&collection
);
79 * Removes the shortcut actions associated with a folder.
81 void slotCollectionRemoved(const Akonadi::Collection
&collection
);
83 void slotRowsInserted(const QModelIndex
&parent
, int start
, int end
);
86 void updateShortcutsForIndex(const QModelIndex
&parent
, int start
, int end
);
87 QHash
< Akonadi::Collection::Id
, FolderShortcutCommand
* > mFolderShortcutCommands
;
88 KActionCollection
*mActionCollection
;