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>
28 #include <QModelIndex>
31 namespace MailCommon
{
37 class KActionCollection
;
41 class FolderShortcutCommand
: public QObject
46 FolderShortcutCommand( QWidget
* mainwidget
, const Akonadi::Collection
& col
);
47 ~FolderShortcutCommand();
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
* );
57 void selectCollectionFolder( const Akonadi::Collection
& col
);
61 Akonadi::Collection mCollectionFolder
;
65 class KMAIL_EXPORT FolderShortcutActionManager
: public QObject
71 FolderShortcutActionManager( QWidget
*parent
, KActionCollection
*actionCollection
);
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
);
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
);
93 void updateShortcutsForIndex( const QModelIndex
&parent
, int start
, int end
);
94 QMap
< Akonadi::Entity::Id
, FolderShortcutCommand
* > mFolderShortcutCommands
;
95 KActionCollection
*mActionCollection
;