QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsauthsettingswidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsauthsettingswidget.h - QgsAuthSettingsWidget
3 
4  ---------------------
5  begin : 28.9.2017
6  copyright : (C) 2017 by Alessandro Pasotti
7  email : apasotti 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 #ifndef QGSAUTHSETTINGSWIDGET_H
17 #define QGSAUTHSETTINGSWIDGET_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 
22 #include "ui_qgsauthsettingswidget.h"
23 
24 #include <QWidget>
25 
36 class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSettingsWidget
37 {
38 
39  Q_OBJECT
40 
41  public:
42 
50  enum WarningType
51  {
52  ProjectFile,
53  UserSettings
54  };
55  Q_ENUM( WarningType )
56 
57 
66  explicit QgsAuthSettingsWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr,
67  const QString &configId = QString(),
68  const QString &username = QString(),
69  const QString &password = QString(),
70  const QString &dataprovider = QString() );
71 
77  void setWarningText( const QString &warningText );
78 
83  void setBasicText( const QString &basicText );
84 
89  QString username() const;
90 
95  void setUsername( const QString &username );
96 
101  QString password() const;
102 
107  void setPassword( const QString &password );
108 
113  QString configId() const;
114 
119  void setConfigId( const QString &configId );
120 
125  void setDataprovider( const QString &dataprovider );
126 
131  QString dataprovider() const;
132 
138  static QString formattedWarning( WarningType warning );
139 
144  bool btnConvertToEncryptedIsEnabled() const;
145 
153  void showStoreCheckboxes( bool enabled );
154 
160  void setStoreUsernameChecked( bool checked );
161 
167  void setStorePasswordChecked( bool checked );
168 
173  bool storePasswordIsChecked() const;
174 
179  bool storeUsernameIsChecked() const;
180 
185  bool configurationTabIsSelected();
186 
187  public slots:
188 
195  bool convertToEncrypted();
196 
197  signals:
198 
204  void usernameChanged();
205 
211  void passwordChanged();
212 
218  void configIdChanged();
219 
220  private slots:
221 
225  void userNameTextChanged( const QString &text );
226 
230  void passwordTextChanged( const QString &text );
231 
232  private:
233 
234  // Mainly for tests
235  QString mDataprovider;
236 
237  void updateConvertBtnState();
238 
239  void updateSelectedTab();
240 
241 };
242 
243 #endif // QGSAUTHSETTINGSWIDGET_H
QgsAuthSettingsWidget
Widget for entering authentication credentials both in the form username/password and by using QGIS A...
Definition: qgsauthsettingswidget.h:36
qgis_sip.h
QgsAuthSettingsWidget::WarningType
WarningType
The WarningType enum is used to determine the text of the message shown to the user about the destina...
Definition: qgsauthsettingswidget.h:64
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53