QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsauthconfigselect.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsauthconfigselect.h
3  ---------------------
4  begin : October 5, 2014
5  copyright : (C) 2014 by Boundless Spatial, Inc. USA
6  author : Larry Shaffer
7  email : lshaffer at boundlessgeo dot com
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 
17 #ifndef QGSAUTHCONFIGSELECT_H
18 #define QGSAUTHCONFIGSELECT_H
19 
20 #include <QWidget>
21 
22 #include "ui_qgsauthconfigselect.h"
23 #include "qgsauthconfig.h"
24 
25 
29 class GUI_EXPORT QgsAuthConfigSelect : public QWidget, private Ui::QgsAuthConfigSelect
30 {
31  Q_OBJECT
32 
33  public:
40  explicit QgsAuthConfigSelect( QWidget *parent = nullptr, const QString &dataprovider = QString() );
42 
44  void setConfigId( const QString& authcfg );
45 
47  const QString configId() const { return mAuthCfg; }
48 
50  void setDataProviderKey( const QString &key );
51 
52  signals:
54  void selectedConfigIdChanged( const QString& authcfg );
55 
57  void selectedConfigIdRemoved( const QString& authcfg );
58 
59  public slots:
61  void showMessage( const QString &msg );
62 
64  void clearMessage();
65 
66  private slots:
67  void loadConfig();
68  void clearConfig();
69  void validateConfig();
70  void populateConfigSelector();
71 
72  void on_cmbConfigSelect_currentIndexChanged( int index );
73 
74  void on_btnConfigAdd_clicked();
75 
76  void on_btnConfigEdit_clicked();
77 
78  void on_btnConfigRemove_clicked();
79 
80  void on_btnConfigMsgClear_clicked();
81 
82  private:
83  void loadAvailableConfigs();
84 
85  QString mAuthCfg;
86  QString mDataProvider;
87  QgsAuthMethodConfigsMap mConfigs;
88 
89  bool mDisabled;
90  QVBoxLayout *mAuthNotifyLayout;
91  QLabel *mAuthNotify;
92 };
93 
94 
96 
97 #include "ui_qgsauthconfiguriedit.h"
98 
99 class QPushButton;
100 
104 class GUI_EXPORT QgsAuthConfigUriEdit : public QDialog, private Ui::QgsAuthConfigUriEdit
105 {
106  Q_OBJECT
107 
108  public:
115  explicit QgsAuthConfigUriEdit( QWidget *parent = nullptr,
116  const QString &datauri = QString(),
117  const QString &dataprovider = QString() );
119 
121  void setDataSourceUri( const QString &datauri );
122 
124  QString dataSourceUri();
125 
127  static bool hasConfigID( const QString &txt );
128 
129  private slots:
130  void saveChanges();
131 
132  void resetChanges();
133 
134  void authCfgUpdated( const QString &authcfg );
135 
136  void authCfgRemoved( const QString &authcfg );
137 
138  private:
139  int authCfgIndex();
140 
141  QString authCfgFromUri();
142 
143  void selectAuthCfgInUri();
144 
145  void updateUriWithAuthCfg();
146 
147  void removeAuthCfgFromUri();
148 
149  QString mAuthCfg;
150  QString mDataUri;
151  QString mDataUriOrig;
152 
153  bool mDisabled;
154  QVBoxLayout *mAuthNotifyLayout;
155  QLabel *mAuthNotify;
156 };
157 
158 #endif // QGSAUTHCONFIGSELECT_H
static unsigned index
Dialog wrapper of select widget to edit an authcfg in a data source URI.
Selector widget for authentication configs.
const QString configId() const
Get the authentication config id for the resource.