QGIS API Documentation  3.0.2-Girona (307d082)
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 #include <QLabel>
22 #include "qgis.h"
23 
24 #include "ui_qgsauthconfigselect.h"
25 #include "qgsauthconfig.h"
26 #include "qgis_gui.h"
27 
28 
33 class GUI_EXPORT QgsAuthConfigSelect : public QWidget, private Ui::QgsAuthConfigSelect
34 {
35  Q_OBJECT
36 
37  public:
38 
45  explicit QgsAuthConfigSelect( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QString &dataprovider = QString() );
46 
48  void setConfigId( const QString &authcfg );
49 
51  const QString configId() const { return mAuthCfg; }
52 
54  void setDataProviderKey( const QString &key );
55 
56  signals:
58  void selectedConfigIdChanged( const QString &authcfg );
59 
61  void selectedConfigIdRemoved( const QString &authcfg );
62 
63  public slots:
65  void showMessage( const QString &msg );
66 
68  void clearMessage();
69 
70  private slots:
71  void loadConfig();
72  void clearConfig();
73  void validateConfig();
74  void populateConfigSelector();
75 
76  void cmbConfigSelect_currentIndexChanged( int index );
77 
78  void btnConfigAdd_clicked();
79 
80  void btnConfigEdit_clicked();
81 
82  void btnConfigRemove_clicked();
83 
84  void btnConfigMsgClear_clicked();
85 
86  private:
87  void loadAvailableConfigs();
88 
89  QString mAuthCfg;
90  QString mDataProvider;
91  QgsAuthMethodConfigsMap mConfigs;
92 
93  bool mDisabled = false;
94  QVBoxLayout *mAuthNotifyLayout = nullptr;
95  QLabel *mAuthNotify = nullptr;
96 };
97 
98 
100 
101 #include "ui_qgsauthconfiguriedit.h"
102 
103 class QPushButton;
104 
109 class GUI_EXPORT QgsAuthConfigUriEdit : public QDialog, private Ui::QgsAuthConfigUriEdit
110 {
111  Q_OBJECT
112 
113  public:
114 
121  explicit QgsAuthConfigUriEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr,
122  const QString &datauri = QString(),
123  const QString &dataprovider = QString() );
124 
126  void setDataSourceUri( const QString &datauri );
127 
129  QString dataSourceUri();
130 
132  static bool hasConfigId( const QString &txt );
133 
134  private slots:
135  void saveChanges();
136 
137  void resetChanges();
138 
139  void authCfgUpdated( const QString &authcfg );
140 
141  void authCfgRemoved( const QString &authcfg );
142 
143  private:
144  int authCfgIndex();
145 
146  QString authCfgFromUri();
147 
148  void selectAuthCfgInUri();
149 
150  void updateUriWithAuthCfg();
151 
152  void removeAuthCfgFromUri();
153 
154  QString mAuthCfg;
155  QString mDataUri;
156  QString mDataUriOrig;
157 
158  bool mDisabled = false;
159  QVBoxLayout *mAuthNotifyLayout = nullptr;
160  QLabel *mAuthNotify = nullptr;
161 };
162 
163 #endif // QGSAUTHCONFIGSELECT_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
Dialog wrapper of select widget to edit an authcfg in a data source URI.
QHash< QString, QgsAuthMethodConfig > QgsAuthMethodConfigsMap
Selector widget for authentication configs.
const QString configId() const
Get the authentication config id for the resource.