Skip to content

Commit

Permalink
[auth] Renamed class to QgsAuthSettingsWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Sep 30, 2017
1 parent e9b2eee commit e33ff06
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/auth/qgsauthenticationwidget.h *
* src/gui/auth/qgsauthsettingswidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsAuthenticationWidget : QWidget
class QgsAuthSettingsWidget : QWidget
{
%Docstring
Widget for entering authentication credentials both in the form username/password
Expand All @@ -18,11 +18,11 @@ class QgsAuthenticationWidget : QWidget
%End

%TypeHeaderCode
#include "qgsauthenticationwidget.h"
#include "qgsauthsettingswidget.h"
%End
public:

explicit QgsAuthenticationWidget( QWidget *parent /TransferThis/ = 0,
explicit QgsAuthSettingsWidget( QWidget *parent /TransferThis/ = 0,
const QString &configId = QString(),
const QString &username = QString(),
const QString &password = QString(),
Expand All @@ -46,7 +46,7 @@ class QgsAuthenticationWidget : QWidget
void setBasicText( const QString &basicText );
%Docstring
setBasicText set the text of the warning label
\param warningText the text of the basic tab label
\param basicText the text of the basic tab label
%End

const QString username( ) const;
Expand Down Expand Up @@ -102,7 +102,7 @@ class QgsAuthenticationWidget : QWidget
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/auth/qgsauthenticationwidget.h *
* src/gui/auth/qgsauthsettingswidget.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 1 addition & 1 deletion python/gui/gui_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
%Include auth/qgsauthcerttrustpolicycombobox.sip
%Include auth/qgsauthconfigeditor.sip
%Include auth/qgsauthconfigselect.sip
%Include auth/qgsauthenticationwidget.sip
%Include auth/qgsauthsettingswidget.sip
%Include auth/qgsautheditorwidgets.sip
%Include auth/qgsauthidentitieseditor.sip
%Include auth/qgsauthimportcertdialog.sip
Expand Down
8 changes: 4 additions & 4 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SET(QGIS_GUI_SRCS
auth/qgsauthconfigeditor.cpp
auth/qgsauthconfigidedit.cpp
auth/qgsauthconfigselect.cpp
auth/qgsauthenticationwidget.cpp
auth/qgsauthsettingswidget.cpp
auth/qgsautheditorwidgets.cpp
auth/qgsauthguiutils.cpp
auth/qgsauthidentitieseditor.cpp
Expand Down Expand Up @@ -580,7 +580,7 @@ SET(QGIS_GUI_MOC_HDRS
auth/qgsauthconfigeditor.h
auth/qgsauthconfigidedit.h
auth/qgsauthconfigselect.h
auth/qgsauthenticationwidget.h
auth/qgsauthsettingswidget.h
auth/qgsautheditorwidgets.h
auth/qgsauthidentitieseditor.h
auth/qgsauthimportcertdialog.h
Expand Down Expand Up @@ -730,7 +730,7 @@ SET(QGIS_GUI_HDRS
auth/qgsauthconfigeditor.h
auth/qgsauthconfigidedit.h
auth/qgsauthconfigselect.h
auth/qgsauthenticationwidget.h
auth/qgsauthsettingswidget.h
auth/qgsautheditorwidgets.h
auth/qgsauthguiutils.h
auth/qgsauthidentitieseditor.h
Expand Down Expand Up @@ -785,7 +785,7 @@ SET(QGIS_GUI_UI_HDRS
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthconfigeditor.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthconfigidedit.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthconfigselect.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthenticationwidget.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthsettingswidget.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthconfiguriedit.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsautheditorwidgets.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthidentitieseditor.h
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qgsauthenticationwidget.cpp - QgsAuthenticationWidget
qgsauthsettingswidget.cpp - QgsAuthSettingsWidget
---------------------
begin : 28.9.2017
Expand All @@ -13,13 +13,13 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthenticationwidget.h"
#include "qgsauthsettingswidget.h"
#include "qgsauthmanager.h"
#include "qgsauthconfig.h"

#include <QDateTime>

QgsAuthenticationWidget::QgsAuthenticationWidget( QWidget *parent,
QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent,
const QString &configId,
const QString &username,
const QString &password,
Expand All @@ -42,45 +42,45 @@ QgsAuthenticationWidget::QgsAuthenticationWidget( QWidget *parent,
{
tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
}
setConvertBtnState();
updateConvertBtnState();
}

void QgsAuthenticationWidget::setWarningText( const QString &warningText )
void QgsAuthSettingsWidget::setWarningText( const QString &warningText )
{
lblWarning->setText( warningText );
}

void QgsAuthenticationWidget::setBasicText( const QString &basicText )
void QgsAuthSettingsWidget::setBasicText( const QString &basicText )
{
lblBasic->setText( basicText );
}

const QString QgsAuthenticationWidget::username() const
const QString QgsAuthSettingsWidget::username() const
{
return txtUserName->text();
}

const QString QgsAuthenticationWidget::password() const
const QString QgsAuthSettingsWidget::password() const
{
return txtPassword->text();
}

const QString QgsAuthenticationWidget::configId() const
const QString QgsAuthSettingsWidget::configId() const
{
return mAuthConfigSelect->configId();
}

int QgsAuthenticationWidget::currentTabIndex() const
int QgsAuthSettingsWidget::currentTabIndex() const
{
return tabAuth->currentIndex( );
}

bool QgsAuthenticationWidget::btnConvertToEncryptedIsEnabled() const
bool QgsAuthSettingsWidget::btnConvertToEncryptedIsEnabled() const
{
return btnConvertToEncrypted->isEnabled( );
}

bool QgsAuthenticationWidget::on_btnConvertToEncrypted_clicked()
bool QgsAuthSettingsWidget::on_btnConvertToEncrypted_clicked()
{
tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
QgsAuthMethodConfig config( QStringLiteral( "Basic" ) );
Expand All @@ -101,19 +101,19 @@ bool QgsAuthenticationWidget::on_btnConvertToEncrypted_clicked()
}
}

void QgsAuthenticationWidget::on_txtUserName_textChanged( const QString &text )
void QgsAuthSettingsWidget::on_txtUserName_textChanged( const QString &text )
{
Q_UNUSED( text );
setConvertBtnState();
updateConvertBtnState();
}

void QgsAuthenticationWidget::on_txtPassword_textChanged( const QString &text )
void QgsAuthSettingsWidget::on_txtPassword_textChanged( const QString &text )
{
Q_UNUSED( text );
setConvertBtnState();
updateConvertBtnState();
}

void QgsAuthenticationWidget::setConvertBtnState()
void QgsAuthSettingsWidget::updateConvertBtnState()
{
btnConvertToEncrypted->setEnabled( ! txtUserName->text().isEmpty() || ! txtPassword->text().isEmpty() );
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
qgsauthenticationwidget.h - QgsAuthenticationWidget
qgsauthsettingswidget.h - QgsAuthSettingsWidget
---------------------
begin : 28.9.2017
Expand All @@ -13,13 +13,13 @@
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSAUTHENTICATIONWIDGET_H
#define QGSAUTHENTICATIONWIDGET_H
#ifndef QGSAUTHSETTINGSWIDGET_H
#define QGSAUTHSETTINGSWIDGET_H

#include "qgis_gui.h"
#include "qgis.h"

#include "ui_qgsauthenticationwidget.h"
#include "ui_qgsauthsettingswidget.h"

#include <QWidget>

Expand All @@ -28,7 +28,7 @@
* and by using QGIS Authentication Database and its authentication configurations.
* \since QGIS 3.0
*/
class GUI_EXPORT QgsAuthenticationWidget : public QWidget, private Ui::QgsAuthenticationWidget
class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSettingsWidget
{

Q_OBJECT
Expand All @@ -44,7 +44,7 @@ class GUI_EXPORT QgsAuthenticationWidget : public QWidget, private Ui::QgsAuthen
* \param password
* \param dataprovider The key of the calling layer provider, if applicable
*/
explicit QgsAuthenticationWidget( QWidget *parent SIP_TRANSFERTHIS = 0,
explicit QgsAuthSettingsWidget( QWidget *parent SIP_TRANSFERTHIS = 0,
const QString &configId = QString(),
const QString &username = QString(),
const QString &password = QString(),
Expand All @@ -58,7 +58,7 @@ class GUI_EXPORT QgsAuthenticationWidget : public QWidget, private Ui::QgsAuthen

/**
* \brief setBasicText set the text of the warning label
* \param warningText the text of the basic tab label
* \param basicText the text of the basic tab label
*/
void setBasicText( const QString &basicText );

Expand Down Expand Up @@ -103,22 +103,23 @@ class GUI_EXPORT QgsAuthenticationWidget : public QWidget, private Ui::QgsAuthen

/**
* \brief on_txtUserName_textChanged set convert button state
* \param text the changet text
* \param Not available in Python bindings
*/
void on_txtUserName_textChanged( const QString &text ) SIP_SKIP;

/**
* \brief on_txtPassword_textChanged set convert button state
* \param text
* \param text the changed text
* \note Not available in Python bindings
*/
void on_txtPassword_textChanged( const QString &text ) SIP_SKIP;


private:

void setConvertBtnState( );
void updateConvertBtnState( );

};

#endif // QGSAUTHENTICATIONWIDGET_H
#endif // QGSAUTHSETTINGSWIDGET_H
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsAuthenticationWidget</class>
<widget class="QWidget" name="QgsAuthenticationWidget">
<class>QgsAuthSettingsWidget</class>
<widget class="QWidget" name="QgsAuthSettingsWidget">
<property name="geometry">
<rect>
<x>0</x>
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ ADD_PYTHON_TEST(PyQgsSettings test_qgssettings.py)
ADD_PYTHON_TEST(PyQgsZipUtils test_qgsziputils.py)
ADD_PYTHON_TEST(PyQgsSourceSelectProvider test_qgssourceselectprovider.py)
ADD_PYTHON_TEST(PyQgsAuthManagerProxy test_authmanager_proxy.py)
ADD_PYTHON_TEST(PyQgsAuthenticationWidget test_authenticationwidget.py)
ADD_PYTHON_TEST(PyQgsAuthSettingsWidget test_authsettingswidget.py)

IF (NOT WIN32)
ADD_PYTHON_TEST(PyQgsLogger test_qgslogger.py)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Tests for authentication widget
From build dir, run from test directory:
LC_ALL=en_US.UTF-8 ctest -R PyQgsAuthenticationWidget -V
LC_ALL=en_US.UTF-8 ctest -R PyQgsAuthSettingsWidget -V
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -19,7 +19,7 @@
import random

from qgis.core import QgsAuthManager, QgsAuthMethodConfig, QgsNetworkAccessManager, QgsSettings
from qgis.gui import QgsAuthenticationWidget
from qgis.gui import QgsAuthSettingsWidget
from qgis.testing import start_app, unittest

from utilities import unitTestDataPath
Expand Down Expand Up @@ -73,7 +73,7 @@ def testWidgetNoArgs(self):
"""
Test the widget with no args
"""
w = QgsAuthenticationWidget()
w = QgsAuthSettingsWidget()
self.assertEqual(w.username(), '')
self.assertEqual(w.password(), '')
self.assertEqual(w.configId(), '')
Expand All @@ -84,7 +84,7 @@ def testWidgetConfigId(self):
"""
Test the widget with configId
"""
w = QgsAuthenticationWidget(None, self.auth_config.id())
w = QgsAuthSettingsWidget(None, self.auth_config.id())
self.assertEqual(w.username(), '')
self.assertEqual(w.password(), '')
self.assertEqual(w.configId(), self.auth_config.id())
Expand All @@ -95,7 +95,7 @@ def testWidgetUsername(self):
"""
Test the widget with username only
"""
w = QgsAuthenticationWidget(None, None, 'username')
w = QgsAuthSettingsWidget(None, None, 'username')
self.assertEqual(w.username(), 'username')
self.assertEqual(w.password(), '')
self.assertEqual(w.configId(), '')
Expand All @@ -105,7 +105,7 @@ def testWidgetPassword(self):
"""
Test the widget with password only
"""
w = QgsAuthenticationWidget(None, None, None, 'password')
w = QgsAuthSettingsWidget(None, None, None, 'password')
self.assertEqual(w.username(), '')
self.assertEqual(w.password(), 'password')
self.assertEqual(w.configId(), '')
Expand All @@ -115,7 +115,7 @@ def testWidgetUsernameAndPassword(self):
"""
Test the widget with username and password
"""
w = QgsAuthenticationWidget(None, None, 'username', 'password')
w = QgsAuthSettingsWidget(None, None, 'username', 'password')
self.assertEqual(w.username(), 'username')
self.assertEqual(w.password(), 'password')
self.assertEqual(w.configId(), '')
Expand All @@ -126,7 +126,7 @@ def testConvertToEncrypted(self):
"""
Test the widget to encrypted conversion
"""
w = QgsAuthenticationWidget(None, None, 'username', 'password')
w = QgsAuthSettingsWidget(None, None, 'username', 'password')
self.assertEqual(w.username(), 'username')
self.assertEqual(w.password(), 'password')
self.assertEqual(w.configId(), '')
Expand Down

0 comments on commit e33ff06

Please sign in to comment.