akonadi
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 QItemSelectionModel; 00032 class QWidget; 00033 00034 namespace Akonadi { 00035 00042 class AKONADI_EXPORT AgentActionManager : public QObject 00043 { 00044 Q_OBJECT 00045 public: 00049 enum Type { 00050 CreateAgentInstance, 00051 DeleteAgentInstance, 00052 ConfigureAgentInstance, 00053 LastType 00054 }; 00055 00059 enum TextContext { 00060 DialogTitle, 00061 DialogText, 00062 MessageBoxTitle, 00063 MessageBoxText, 00064 MessageBoxAlternativeText, 00065 ErrorMessageTitle, 00066 ErrorMessageText 00067 }; 00068 00075 explicit AgentActionManager( KActionCollection *actionCollection, QWidget *parent = 0 ); 00076 00080 ~AgentActionManager(); 00081 00086 void setSelectionModel( QItemSelectionModel *model ); 00087 00091 void setMimeTypeFilter( const QStringList &mimeTypes ); 00092 00096 void setCapabilityFilter( const QStringList &capabilities ); 00097 00103 KAction* createAction( Type type ); 00104 00109 void createAllActions(); 00110 00114 KAction* action( Type type ) const; 00115 00125 void interceptAction( Type type, bool intercept = true ); 00126 00133 Akonadi::AgentInstance::List selectedAgentInstances() const; 00134 00140 void setContextText( Type type, TextContext context, const QString &text ); 00141 00142 Q_SIGNALS: 00148 void actionStateUpdated(); 00149 00150 private: 00151 //@cond PRIVATE 00152 class Private; 00153 Private* const d; 00154 00155 Q_PRIVATE_SLOT( d, void updateActions() ) 00156 00157 Q_PRIVATE_SLOT( d, void slotCreateAgentInstance() ) 00158 Q_PRIVATE_SLOT( d, void slotDeleteAgentInstance() ) 00159 Q_PRIVATE_SLOT( d, void slotConfigureAgentInstance() ) 00160 00161 Q_PRIVATE_SLOT( d, void slotAgentInstanceCreationResult(KJob*) ) 00162 //@endcond 00163 }; 00164 00165 } 00166 00167 #endif