agentactionmanager.h
00001 /* 00002 Copyright (c) 2010 Tobias Koenig <tokoe@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify it 00005 under the terms of the GNU Library General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or (at your 00007 option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00011 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00012 License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to the 00016 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301, USA. 00018 */ 00019 00020 #ifndef AKONADI_AGENTACTIONMANAGER_H 00021 #define AKONADI_AGENTACTIONMANAGER_H 00022 00023 #include "akonadi_export.h" 00024 00025 #include <akonadi/agentinstance.h> 00026 00027 #include <QtCore/QObject> 00028 00029 class KAction; 00030 class KActionCollection; 00031 class KLocalizedString; 00032 class QItemSelectionModel; 00033 class QWidget; 00034 00035 namespace Akonadi { 00036 00043 class AKONADI_EXPORT AgentActionManager : public QObject 00044 { 00045 Q_OBJECT 00046 public: 00050 enum Type { 00051 CreateAgentInstance, 00052 DeleteAgentInstance, 00053 ConfigureAgentInstance, 00054 LastType 00055 }; 00056 00060 enum TextContext { 00061 DialogTitle, 00062 DialogText, 00063 MessageBoxTitle, 00064 MessageBoxText, 00065 MessageBoxAlternativeText, 00066 ErrorMessageTitle, 00067 ErrorMessageText 00068 }; 00069 00076 explicit AgentActionManager( KActionCollection *actionCollection, QWidget *parent = 0 ); 00077 00081 ~AgentActionManager(); 00082 00087 void setSelectionModel( QItemSelectionModel *model ); 00088 00092 void setMimeTypeFilter( const QStringList &mimeTypes ); 00093 00097 void setCapabilityFilter( const QStringList &capabilities ); 00098 00104 KAction *createAction( Type type ); 00105 00110 void createAllActions(); 00111 00115 KAction *action( Type type ) const; 00116 00126 void interceptAction( Type type, bool intercept = true ); 00127 00134 Akonadi::AgentInstance::List selectedAgentInstances() const; 00135 00141 void setContextText( Type type, TextContext context, const QString &text ); 00142 00148 void setContextText( Type type, TextContext context, const KLocalizedString &text ); 00149 00150 Q_SIGNALS: 00156 void actionStateUpdated(); 00157 00158 private: 00159 //@cond PRIVATE 00160 class Private; 00161 Private *const d; 00162 00163 Q_PRIVATE_SLOT( d, void updateActions() ) 00164 00165 Q_PRIVATE_SLOT( d, void slotCreateAgentInstance() ) 00166 Q_PRIVATE_SLOT( d, void slotDeleteAgentInstance() ) 00167 Q_PRIVATE_SLOT( d, void slotConfigureAgentInstance() ) 00168 00169 Q_PRIVATE_SLOT( d, void slotAgentInstanceCreationResult(KJob*) ) 00170 //@endcond 00171 }; 00172 00173 } 00174 00175 #endif