Skip to content
Permalink
Browse files

[auth] New authentication settings widget

  • Loading branch information
elpaso committed Sep 29, 2017
1 parent f9f5aaf commit 91d7a9b611f8c92dc0246d9778ac14f4ec0a313d
@@ -29,6 +29,7 @@
%Include auth/qgsauthcerttrustpolicycombobox.sip
%Include auth/qgsauthconfigeditor.sip
%Include auth/qgsauthconfigselect.sip
%Include auth/qgsauthenticationwidget.sip
%Include auth/qgsautheditorwidgets.sip
%Include auth/qgsauthidentitieseditor.sip
%Include auth/qgsauthimportcertdialog.sip
@@ -73,6 +73,7 @@ SET(QGIS_GUI_SRCS
auth/qgsauthconfigeditor.cpp
auth/qgsauthconfigidedit.cpp
auth/qgsauthconfigselect.cpp
auth/qgsauthenticationwidget.cpp
auth/qgsautheditorwidgets.cpp
auth/qgsauthguiutils.cpp
auth/qgsauthidentitieseditor.cpp
@@ -579,6 +580,7 @@ SET(QGIS_GUI_MOC_HDRS
auth/qgsauthconfigeditor.h
auth/qgsauthconfigidedit.h
auth/qgsauthconfigselect.h
auth/qgsauthenticationwidget.h
auth/qgsautheditorwidgets.h
auth/qgsauthidentitieseditor.h
auth/qgsauthimportcertdialog.h
@@ -728,6 +730,7 @@ SET(QGIS_GUI_HDRS
auth/qgsauthconfigeditor.h
auth/qgsauthconfigidedit.h
auth/qgsauthconfigselect.h
auth/qgsauthenticationwidget.h
auth/qgsautheditorwidgets.h
auth/qgsauthguiutils.h
auth/qgsauthidentitieseditor.h
@@ -782,6 +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_qgsauthconfiguriedit.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsautheditorwidgets.h
${CMAKE_CURRENT_BINARY_DIR}/../ui/ui_qgsauthidentitieseditor.h
@@ -0,0 +1,22 @@
/***************************************************************************
qgsauthenticationwidget.cpp - QgsAuthenticationWidget
---------------------
begin : 28.9.2017
copyright : (C) 2017 by Alessandro Pasotti
email : apasotti at boundlessgeo dot com
***************************************************************************
* *
* 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 *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthenticationwidget.h"

QgsAuthenticationWidget::QgsAuthenticationWidget( QWidget *parent, const QString &dataprovider )
: QWidget( parent )
{
setupUi( new QgsAuthConfigSelect( this, dataprovider ) );
}
@@ -0,0 +1,47 @@
/***************************************************************************
qgsauthenticationwidget.h - QgsAuthenticationWidget
---------------------
begin : 28.9.2017
copyright : (C) 2017 by Alessandro Pasotti
email : apasotti at boundlessgeo dot com
***************************************************************************
* *
* 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 *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSAUTHENTICATIONWIDGET_H
#define QGSAUTHENTICATIONWIDGET_H

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

#include "ui_qgsauthenticationwidget.h"

#include <QWidget>

/** \ingroup gui
* Widget for entering authentication credentials both in the form username/password
* and by using QGIS Authentication Database and its authentication configurations.
*/
class GUI_EXPORT QgsAuthenticationWidget : public QWidget, private Ui::QgsAuthenticationWidget
{

Q_OBJECT

public:

/**
* Create a dialog for setting an associated authentication config, either
* from existing configs, or creating/removing them from auth database
* \param parent Parent widget
* \param dataprovider The key of the calling layer provider, if applicable
*/
explicit QgsAuthenticationWidget( QWidget *parent SIP_TRANSFERTHIS = 0, const QString &dataprovider = QString() );

};

#endif // QGSAUTHENTICATIONWIDGET_H
@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsAuthenticationWidget</class>
<widget class="QWidget" name="QgsAuthenticationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Authentication</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTabWidget" name="tabAuth">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="tabConfigurations">
<attribute name="title">
<string>Configurations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Choose an authentication configuration or create a new one.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QgsAuthConfigSelect" name="mAuthConfigSelect" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Credentials are safely stored in the encrypted QGIS authentication database, protected by your master password. </string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabBasic">
<attribute name="title">
<string>Basic</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#ff0000;&quot;&gt;Note: credentials are stored unencrypted (in clear text) in the project file.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&amp;User name</string>
</property>
<property name="buddy">
<cstring>txtUserName</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QgsPasswordLineEdit" name="txtPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Password</string>
</property>
<property name="buddy">
<cstring>txtPassword</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="txtUserName"/>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="lblBasic">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>If the service requires basic authentication, enter a user name and optional password</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Convert to encrypted</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsPasswordLineEdit</class>
<extends>QLineEdit</extends>
<header>qgspasswordlineedit.h</header>
</customwidget>
<customwidget>
<class>QgsAuthConfigSelect</class>
<extends>QWidget</extends>
<header location="global">qgsauthconfigselect.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

0 comments on commit 91d7a9b

Please sign in to comment.
You can’t perform that action at this time.