mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[auth] Update wording of auth settings widget; add formatted warnings
This commit is contained in:
parent
74e9242d44
commit
3852e5db98
@ -22,6 +22,12 @@ class QgsAuthSettingsWidget : QWidget
|
||||
%End
|
||||
public:
|
||||
|
||||
enum WarningType
|
||||
{
|
||||
ProjectFile,
|
||||
UserSettings
|
||||
};
|
||||
|
||||
explicit QgsAuthSettingsWidget( QWidget *parent /TransferThis/ = 0,
|
||||
const QString &configId = QString(),
|
||||
const QString &username = QString(),
|
||||
@ -41,6 +47,7 @@ class QgsAuthSettingsWidget : QWidget
|
||||
%Docstring
|
||||
setWarningText set the text of the warning label
|
||||
\param warningText the text of the warning label
|
||||
.. seealso:: formattedWarning()
|
||||
%End
|
||||
|
||||
void setBasicText( const QString &basicText );
|
||||
@ -101,6 +108,14 @@ class QgsAuthSettingsWidget : QWidget
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
static const QString formattedWarning( WarningType warning );
|
||||
%Docstring
|
||||
warning text message based upon where credentials are stored
|
||||
\param enum of warning type
|
||||
:return: pre-formatted warning text
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
bool btnConvertToEncryptedIsEnabled( ) const;
|
||||
%Docstring
|
||||
convertButtonEnabled, mainly useful for unit tests
|
||||
@ -145,7 +160,6 @@ class QgsAuthSettingsWidget : QWidget
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
|
||||
bool configurationTabIsSelected( );
|
||||
%Docstring
|
||||
configurationTabIsSelected
|
||||
|
@ -312,7 +312,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
||||
mAuthSettings->setDataprovider( QStringLiteral( "proxy" ) );
|
||||
QString authcfg = mSettings->value( QStringLiteral( "proxy/authcfg" ) ).toString();
|
||||
mAuthSettings->setConfigId( authcfg );
|
||||
mAuthSettings->setWarningText( tr( "<b style=\"color:red\">Warning: credentials are stored unencrypted (in clear text) in the system settings!</b>" ) );
|
||||
mAuthSettings->setWarningText( mAuthSettings->formattedWarning( QgsAuthSettingsWidget::UserSettings ) );
|
||||
|
||||
//Web proxy settings
|
||||
grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), "0" ).toBool() );
|
||||
|
@ -39,6 +39,8 @@ QgsAuthSettingsWidget::QgsAuthSettingsWidget( QWidget *parent,
|
||||
mAuthConfigSelect->setConfigId( configId );
|
||||
}
|
||||
setBasicText( "" );
|
||||
// default to warning about basic settings stored in project file
|
||||
setWarningText( formattedWarning( ProjectFile ) );
|
||||
connect( btnConvertToEncrypted, &QPushButton::clicked, this, &QgsAuthSettingsWidget::convertToEncrypted );
|
||||
connect( txtUserName, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::userNameTextChanged );
|
||||
connect( txtPassword, &QLineEdit::textChanged, this, &QgsAuthSettingsWidget::passwordTextChanged );
|
||||
@ -99,6 +101,18 @@ const QString QgsAuthSettingsWidget::dataprovider() const
|
||||
return mDataprovider;
|
||||
}
|
||||
|
||||
const QString QgsAuthSettingsWidget::formattedWarning( WarningType warning )
|
||||
{
|
||||
QString out = tr( "<div>Warning: credentials stored as plain text in %1.</div>" );
|
||||
switch ( warning )
|
||||
{
|
||||
case ProjectFile:
|
||||
return out.arg( tr( "project file" ) );
|
||||
case UserSettings:
|
||||
return out.arg( tr( "user settings" ) );
|
||||
}
|
||||
}
|
||||
|
||||
const QString QgsAuthSettingsWidget::configId() const
|
||||
{
|
||||
return mAuthConfigSelect->configId();
|
||||
|
@ -35,6 +35,14 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
|
||||
public:
|
||||
|
||||
//! Type of certificate usage
|
||||
enum WarningType
|
||||
{
|
||||
ProjectFile,
|
||||
UserSettings
|
||||
};
|
||||
Q_ENUM( WarningType )
|
||||
|
||||
/**
|
||||
* Create a dialog for setting an associated authentication config, either
|
||||
* from existing configs, or creating/removing them from auth database
|
||||
@ -53,6 +61,7 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
/**
|
||||
* \brief setWarningText set the text of the warning label
|
||||
* \param warningText the text of the warning label
|
||||
* \see formattedWarning()
|
||||
*/
|
||||
void setWarningText( const QString &warningText );
|
||||
|
||||
@ -110,6 +119,13 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
*/
|
||||
const QString dataprovider( ) const;
|
||||
|
||||
/**
|
||||
* \brief warning text message based upon where credentials are stored
|
||||
* \param enum of warning type
|
||||
* \return pre-formatted warning text
|
||||
*/
|
||||
static const QString formattedWarning( WarningType warning );
|
||||
|
||||
/**
|
||||
* \brief convertButtonEnabled, mainly useful for unit tests
|
||||
* \return true if the convert button is enabled
|
||||
@ -151,7 +167,6 @@ class GUI_EXPORT QgsAuthSettingsWidget : public QWidget, private Ui::QgsAuthSett
|
||||
*/
|
||||
bool storeUsernameIsChecked( ) const;
|
||||
|
||||
|
||||
/**
|
||||
* \brief configurationTabIsSelected
|
||||
* \return true if the configuration tab is the currently selected tab
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>315</width>
|
||||
<height>243</height>
|
||||
<width>226</width>
|
||||
<height>179</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -69,7 +69,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose or create a configuration.</string>
|
||||
<string>Choose or create an authentication configuration</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
@ -101,7 +101,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Credentials are encrypted and stored in the QGIS authentication database. </string>
|
||||
<string>Configurations store encrypted credentials in the QGIS authentication database.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
@ -146,26 +146,66 @@
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="6" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnConvertToEncrypted">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert to configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbStorePassword">
|
||||
<property name="text">
|
||||
<string>Store</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblWarning">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel{color: rgb(255, 0, 0);font-weight: bold;}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Warning text!</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtUserName">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cbStoreUsername">
|
||||
<property name="text">
|
||||
<string>&User name</string>
|
||||
<string>Store</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>txtUserName</cstring>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -195,49 +235,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="txtUserName">
|
||||
<property name="minimumSize">
|
||||
<item row="6" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cbStoreUsername">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Store</string>
|
||||
<string>&User name</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cbStorePassword">
|
||||
<property name="text">
|
||||
<string>Store</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="lblWarning">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Warning: credentials stored unencrypted!</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
<property name="buddy">
|
||||
<cstring>txtUserName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -257,23 +274,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnConvertToEncrypted">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Convert to configuration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user