1 /***************************************************************************
2   qgsattributeactionpropertiesdialog.h - QgsAttributeActionPropertiesDialog
3 
4  ---------------------
5  begin                : 18.4.2016
6  copyright            : (C) 2016 by mku
7  email                : [your-email-here]
8  ***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 #ifndef QGSATTRIBUTEACTIONPROPERTIESDIALOG_H
17 #define QGSATTRIBUTEACTIONPROPERTIESDIALOG_H
18 
19 // We don't want to expose this in the public API
20 #define SIP_NO_FILE
21 
22 #include "ui_qgsattributeactionpropertiesdialogbase.h"
23 #include "qgsexpressioncontextgenerator.h"
24 
25 #include "qgsaction.h"
26 #include "qgshelp.h"
27 #include "qgis_gui.h"
28 
29 #include <QDialog>
30 
31 /**
32  * \ingroup gui
33  * \class QgsAttributeActionPropertiesDialog
34  */
35 class GUI_EXPORT QgsAttributeActionPropertiesDialog: public QDialog, private Ui::QgsAttributeActionPropertiesDialogBase, public QgsExpressionContextGenerator
36 {
37     Q_OBJECT
38 
39   public:
40     QgsAttributeActionPropertiesDialog( QgsAction::ActionType type, const QString &description, const QString &shortTitle, const QString &iconPath, const QString &actionText, bool capture, const QSet<QString> &actionScopes, const QString &notificationMessage, bool isEnabledOnlyWhenEditable, QgsVectorLayer *layer, QWidget *parent = nullptr );
41 
42     QgsAttributeActionPropertiesDialog( QgsVectorLayer *layer, QWidget *parent = nullptr );
43 
44     QgsAction::ActionType type() const;
45 
46     QString description() const;
47 
48     QString shortTitle() const;
49 
50     QString iconPath() const;
51 
52     QString actionText() const;
53 
54     QSet<QString> actionScopes() const;
55 
56     QString notificationMessage() const;
57 
58     bool isEnabledOnlyWhenEditable() const;
59 
60     bool capture() const;
61 
62     QgsExpressionContext createExpressionContext() const override;
63 
64   private slots:
65     void browse();
66     void insertExpressionOrField();
67     void chooseIcon();
68     void updateButtons();
69     void showHelp();
70 
71   private:
72     void init( const QSet<QString> &actionScopes );
73 
74     QgsVectorLayer *mLayer = nullptr;
75     QList<QCheckBox *> mActionScopeCheckBoxes;
76 };
77 
78 #endif // QGSATTRIBUTEACTIONPROPERTIESDIALOG_H
79