QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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_sip.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  bool mTemporarilyBlockLoad = false;
97 };
98 
99 
101 
102 #include "ui_qgsauthconfiguriedit.h"
103 
104 class QPushButton;
105 
110 class GUI_EXPORT QgsAuthConfigUriEdit : public QDialog, private Ui::QgsAuthConfigUriEdit
111 {
112  Q_OBJECT
113 
114  public:
115 
122  explicit QgsAuthConfigUriEdit( QWidget *parent SIP_TRANSFERTHIS = nullptr,
123  const QString &datauri = QString(),
124  const QString &dataprovider = QString() );
125 
127  void setDataSourceUri( const QString &datauri );
128 
130  QString dataSourceUri();
131 
133  static bool hasConfigId( const QString &txt );
134 
135  private slots:
136  void saveChanges();
137 
138  void resetChanges();
139 
140  void authCfgUpdated( const QString &authcfg );
141 
142  void authCfgRemoved( const QString &authcfg );
143 
144  private:
145  int authCfgIndex();
146 
147  QString authCfgFromUri();
148 
149  void selectAuthCfgInUri();
150 
151  void updateUriWithAuthCfg();
152 
153  void removeAuthCfgFromUri();
154 
155  QString mAuthCfg;
156  QString mDataUri;
157  QString mDataUriOrig;
158 
159  bool mDisabled = false;
160  QVBoxLayout *mAuthNotifyLayout = nullptr;
161  QLabel *mAuthNotify = nullptr;
162 };
163 
164 #endif // QGSAUTHCONFIGSELECT_H
Selector widget for authentication configs.
void selectedConfigIdRemoved(const QString &authcfg)
Emitted when authentication config is removed.
void selectedConfigIdChanged(const QString &authcfg)
Emitted when authentication config is changed or missing.
const QString configId() const
Gets the authentication config id for the resource.
Dialog wrapper of select widget to edit an authcfg in a data source URI.
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QHash< QString, QgsAuthMethodConfig > QgsAuthMethodConfigsMap