19 #include "qgis_core.h"
63 QgsAction(
ActionType type,
const QString &description,
const QString &command,
bool capture =
false,
bool enabledOnlyWhenEditable =
false )
65 , mDescription( description )
67 , mCaptureOutput( capture )
68 , mId( QUuid::createUuid() )
69 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
72 QgsAction( ActionType type,
const QString &description,
const QString &command,
bool capture =
false )
74 , mDescription( description )
76 , mCaptureOutput( capture )
77 , mId( QUuid::createUuid() )
78 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
96 QgsAction(
ActionType type,
const QString &description,
const QString &action,
const QString &icon,
bool capture,
const QString &shortTitle = QString(),
const QSet<QString> &actionScopes = QSet<QString>(),
const QString ¬ificationMessage = QString(),
bool enabledOnlyWhenEditable =
false )
98 , mDescription( description )
99 , mShortTitle( shortTitle )
102 , mCaptureOutput( capture )
103 , mActionScopes( actionScopes )
104 , mNotificationMessage( notificationMessage )
105 , mId( QUuid::createUuid() )
106 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
109 QgsAction( ActionType type,
const QString &description,
const QString &action,
const QString &icon,
bool capture,
const QString &shortTitle = QString(),
const QSet<QString> &actionScopes = QSet<QString>(),
const QString ¬ificationMessage = QString() )
111 , mDescription( description )
112 , mShortTitle( shortTitle )
115 , mCaptureOutput( capture )
116 , mActionScopes( actionScopes )
117 , mNotificationMessage( notificationMessage )
118 , mId( QUuid::createUuid() )
119 , mIsEnabledOnlyWhenEditable( enabledOnlyWhenEditable )
124 QString
name()
const {
return mDescription; }
134 QUuid
id()
const {
return mId; }
141 bool isValid()
const {
return !mId.isNull(); }
147 QIcon
icon()
const {
return QIcon( mIcon ); }
169 bool capture()
const {
return mCaptureOutput; }
177 bool runable()
const;
201 QSet<QString> actionScopes()
const;
210 void setActionScopes(
const QSet<QString> &actionScopes );
218 void readXml(
const QDomNode &actionNode );
226 void writeXml( QDomNode &actionsNode )
const;
243 ActionType mType = Generic;
244 QString mDescription;
248 bool mCaptureOutput =
false;
249 QSet<QString> mActionScopes;
250 QString mNotificationMessage;
251 mutable std::shared_ptr<QAction> mAction;
254 bool mIsEnabledOnlyWhenEditable =
false;
259 #endif // QGSACTION_H