Use translated string for password helper

And fix capitalisation of strings
This commit is contained in:
Nyall Dawson 2025-02-05 08:20:25 +10:00
parent 0520d1f68a
commit db7b9afb6b
No known key found for this signature in database
GPG Key ID: 4C61673F0BF197FC
9 changed files with 81 additions and 30 deletions

View File

@ -4,10 +4,11 @@ QgsAuthManager.WARNING = QgsAuthManager.MessageLevel.WARNING
QgsAuthManager.CRITICAL = QgsAuthManager.MessageLevel.CRITICAL
QgsAuthManager.MessageLevel.baseClass = QgsAuthManager
try:
QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent)', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'}
QgsAuthManager.__attribute_docs__ = {'SIP_DEPRECATED': 'The display name of the password helper (platform dependent).\n\n.. deprecated:: 3.42\n\n Use :py:func:`~QgsAuthManager.passwordHelperDisplayName` instead.', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'}
QgsAuthManager.isFilesystemBasedDatabase = staticmethod(QgsAuthManager.isFilesystemBasedDatabase)
QgsAuthManager.hasConfigId = staticmethod(QgsAuthManager.hasConfigId)
QgsAuthManager.passwordHelperEnabled = staticmethod(QgsAuthManager.passwordHelperEnabled)
QgsAuthManager.passwordHelperDisplayName = staticmethod(QgsAuthManager.passwordHelperDisplayName)
QgsAuthManager.__signal_arguments__ = {'passwordHelperMessageLog': ['message: str', 'tag: str = QgsAuthManager.AUTH_MAN_TAG', 'level: Qgis.MessageLevel = Qgis.MessageLevel.Info'], 'masterPasswordVerified': ['verified: bool']}
QgsAuthManager.__group__ = ['auth']
except (NameError, AttributeError):

View File

@ -810,7 +810,17 @@ Store the password manager into the wallet
Available in Python bindings since QGIS 3.8.0
%End
static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME /Deprecated="Since 3.42. Use passwordHelperDisplayName() instead."/;
static QString passwordHelperDisplayName( bool titleCase = false );
%Docstring
Returns a translated display name of the password helper (platform dependent).
If ``titleCase`` is ``True`` then a title case version of the string will be returned. Otherwise
a mid-sentence case version will be returned.
.. versionadded:: 3.42
%End
static const QString AUTH_MAN_TAG;

View File

@ -1,10 +1,11 @@
# The following has been generated automatically from src/core/auth/qgsauthmanager.h
QgsAuthManager.MessageLevel.baseClass = QgsAuthManager
try:
QgsAuthManager.__attribute_docs__ = {'AUTH_PASSWORD_HELPER_DISPLAY_NAME': 'The display name of the password helper (platform dependent)', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'}
QgsAuthManager.__attribute_docs__ = {'SIP_DEPRECATED': 'The display name of the password helper (platform dependent).\n\n.. deprecated:: 3.42\n\n Use :py:func:`~QgsAuthManager.passwordHelperDisplayName` instead.', 'AUTH_MAN_TAG': 'The display name of the Authentication Manager', 'passwordHelperFailure': 'Signals emitted on password helper failure,\nmainly used in the tests to exit main application loop\n', 'passwordHelperSuccess': 'Signals emitted on password helper success,\nmainly used in the tests to exit main application loop\n', 'messageOut': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.messageLog` instead.\n', 'messageLog': 'Custom logging signal to relay to console output and :py:class:`QgsMessageLog`\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'passwordHelperMessageOut': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. deprecated:: 3.40\n\n Use :py:func:`~QgsAuthManager.passwordHelperMessageLog` instead.\n', 'passwordHelperMessageLog': 'Custom logging signal to inform the user about master password <-> password manager interactions\n\n:param message: Message to send\n:param tag: Associated tag (title)\n:param level: Message log level\n\n.. seealso:: :py:class:`QgsMessageLog`\n\n.. versionadded:: 3.40\n', 'masterPasswordVerified': "Emitted when a password has been verify (or not)\n\n:param verified: The state of password's verification\n", 'authDatabaseEraseRequested': 'Emitted when a user has indicated they may want to erase the authentication db.\n', 'authDatabaseChanged': 'Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.\n'}
QgsAuthManager.isFilesystemBasedDatabase = staticmethod(QgsAuthManager.isFilesystemBasedDatabase)
QgsAuthManager.hasConfigId = staticmethod(QgsAuthManager.hasConfigId)
QgsAuthManager.passwordHelperEnabled = staticmethod(QgsAuthManager.passwordHelperEnabled)
QgsAuthManager.passwordHelperDisplayName = staticmethod(QgsAuthManager.passwordHelperDisplayName)
QgsAuthManager.__signal_arguments__ = {'passwordHelperMessageLog': ['message: str', 'tag: str = QgsAuthManager.AUTH_MAN_TAG', 'level: Qgis.MessageLevel = Qgis.MessageLevel.Info'], 'masterPasswordVerified': ['verified: bool']}
QgsAuthManager.__group__ = ['auth']
except (NameError, AttributeError):

View File

@ -810,7 +810,17 @@ Store the password manager into the wallet
Available in Python bindings since QGIS 3.8.0
%End
static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME /Deprecated="Since 3.42. Use passwordHelperDisplayName() instead."/;
static QString passwordHelperDisplayName( bool titleCase = false );
%Docstring
Returns a translated display name of the password helper (platform dependent).
If ``titleCase`` is ``True`` then a title case version of the string will be returned. Otherwise
a mid-sentence case version will be returned.
.. versionadded:: 3.42
%End
static const QString AUTH_MAN_TAG;

View File

@ -71,6 +71,7 @@ const QLatin1String QgsAuthManager::AUTH_PASSWORD_HELPER_FOLDER_NAME( "QGIS" );
Q_NOWARN_DEPRECATED_PUSH
#if defined(Q_OS_MAC)
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Keychain" );
#elif defined(Q_OS_WIN)
@ -80,6 +81,7 @@ const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( QStringLiteral(
#else
const QString QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME( "Password Manager" );
#endif
Q_NOWARN_DEPRECATED_POP
QgsAuthManager *QgsAuthManager::instance()
{
@ -3074,6 +3076,19 @@ bool QgsAuthManager::passwordHelperSync()
return false;
}
QString QgsAuthManager::passwordHelperDisplayName( bool titleCase )
{
#if defined(Q_OS_MAC)
return titleCase ? QObject::tr( "Keychain" ) : QObject::tr( "keychain" );
#elif defined(Q_OS_WIN)
return titleCase ? QObject::tr( "Password Manager" ) : QObject::tr( "password manager" );
#elif defined(Q_OS_LINUX)
return titleCase ? QObject::tr( "Wallet/Key Ring" ) : QObject::tr( "wallet/key ring" );
#else
return titleCase ? QObject::tr( "Password Manager" ) : QObject::tr( "password manager" );
#endif
}
////////////////// Certificate calls - end ///////////////////////
@ -3234,7 +3249,7 @@ bool QgsAuthManager::passwordHelperDelete()
{
ensureInitialized();
passwordHelperLog( tr( "Opening %1 for DELETE…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
passwordHelperLog( tr( "Opening %1 for DELETE…" ).arg( passwordHelperDisplayName() ) );
bool result;
QKeychain::DeletePasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME );
QgsSettings settings;
@ -3269,7 +3284,7 @@ QString QgsAuthManager::passwordHelperRead()
// Retrieve it!
QString password;
passwordHelperLog( tr( "Opening %1 for READ…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
passwordHelperLog( tr( "Opening %1 for READ…" ).arg( passwordHelperDisplayName() ) );
QKeychain::ReadPasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME );
QgsSettings settings;
job.setInsecureFallback( settings.value( QStringLiteral( "password_helper_insecure_fallback" ), false, QgsSettings::Section::Auth ).toBool() );
@ -3282,7 +3297,7 @@ QString QgsAuthManager::passwordHelperRead()
if ( job.error() )
{
mPasswordHelperErrorCode = job.error();
mPasswordHelperErrorMessage = tr( "Retrieving password from your %1 failed: %2." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, job.errorString() );
mPasswordHelperErrorMessage = tr( "Retrieving password from your %1 failed: %2." ).arg( passwordHelperDisplayName(), job.errorString() );
// Signals used in the tests to exit main application loop
emit passwordHelperFailure();
}
@ -3293,7 +3308,7 @@ QString QgsAuthManager::passwordHelperRead()
if ( password.isEmpty() )
{
mPasswordHelperErrorCode = QKeychain::EntryNotFound;
mPasswordHelperErrorMessage = tr( "Empty password retrieved from your %1." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME );
mPasswordHelperErrorMessage = tr( "Empty password retrieved from your %1." ).arg( passwordHelperDisplayName( true ) );
// Signals used in the tests to exit main application loop
emit passwordHelperFailure();
}
@ -3313,7 +3328,7 @@ bool QgsAuthManager::passwordHelperWrite( const QString &password )
Q_ASSERT( !password.isEmpty() );
bool result;
passwordHelperLog( tr( "Opening %1 for WRITE…" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
passwordHelperLog( tr( "Opening %1 for WRITE…" ).arg( passwordHelperDisplayName() ) );
QKeychain::WritePasswordJob job( AUTH_PASSWORD_HELPER_FOLDER_NAME );
QgsSettings settings;
job.setInsecureFallback( settings.value( QStringLiteral( "password_helper_insecure_fallback" ), false, QgsSettings::Section::Auth ).toBool() );
@ -3327,7 +3342,7 @@ bool QgsAuthManager::passwordHelperWrite( const QString &password )
if ( job.error() )
{
mPasswordHelperErrorCode = job.error();
mPasswordHelperErrorMessage = tr( "Storing password in your %1 failed: %2." ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, job.errorString() );
mPasswordHelperErrorMessage = tr( "Storing password in your %1 failed: %2." ).arg( passwordHelperDisplayName(), job.errorString() );
// Signals used in the tests to exit main application loop
emit passwordHelperFailure();
result = false;
@ -3355,9 +3370,9 @@ void QgsAuthManager::setPasswordHelperEnabled( const bool enabled )
QgsSettings settings;
settings.setValue( QStringLiteral( "use_password_helper" ), enabled, QgsSettings::Section::Auth );
emit messageLog( enabled ? tr( "Your %1 will be <b>used from now</b> on to store and retrieve the master password." )
.arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) :
.arg( passwordHelperDisplayName() ) :
tr( "Your %1 will <b>not be used anymore</b> to store and retrieve the master password." )
.arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
.arg( passwordHelperDisplayName() ) );
}
bool QgsAuthManager::passwordHelperLoggingEnabled()
@ -3395,12 +3410,12 @@ void QgsAuthManager::passwordHelperProcessError()
mPasswordHelperErrorMessage = tr( "There was an error and integration with your %1 system has been disabled. "
"You can re-enable it at any time through the \"Utilities\" menu "
"in the Authentication pane of the options dialog. %2" )
.arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, mPasswordHelperErrorMessage );
.arg( passwordHelperDisplayName(), mPasswordHelperErrorMessage );
}
if ( mPasswordHelperErrorCode != QKeychain::NoError )
{
// We've got an error from the wallet
passwordHelperLog( tr( "Error in %1: %2" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME, mPasswordHelperErrorMessage ) );
passwordHelperLog( tr( "Error in %1: %2" ).arg( passwordHelperDisplayName(), mPasswordHelperErrorMessage ) );
emit passwordHelperMessageLog( mPasswordHelperErrorMessage, authManTag(), Qgis::MessageLevel::Critical );
}
passwordHelperClearErrors();
@ -3429,11 +3444,11 @@ bool QgsAuthManager::masterPasswordInput()
{
ok = true;
storedPasswordIsValid = true;
emit passwordHelperMessageLog( tr( "Master password has been successfully read from your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Info );
emit passwordHelperMessageLog( tr( "Master password has been successfully read from your %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Info );
}
else
{
emit passwordHelperMessageLog( tr( "Master password stored in your %1 is not valid" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Warning );
emit passwordHelperMessageLog( tr( "Master password stored in your %1 is not valid" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning );
}
}
}
@ -3451,11 +3466,11 @@ bool QgsAuthManager::masterPasswordInput()
{
if ( passwordHelperWrite( pass ) )
{
emit passwordHelperMessageLog( tr( "Master password has been successfully written to your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Info );
emit passwordHelperMessageLog( tr( "Master password has been successfully written to your %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Info );
}
else
{
emit passwordHelperMessageLog( tr( "Master password could not be written to your %1" ).arg( AUTH_PASSWORD_HELPER_DISPLAY_NAME ), authManTag(), Qgis::MessageLevel::Warning );
emit passwordHelperMessageLog( tr( "Master password could not be written to your %1" ).arg( passwordHelperDisplayName() ), authManTag(), Qgis::MessageLevel::Warning );
}
}
return true;

View File

@ -756,8 +756,22 @@ class CORE_EXPORT QgsAuthManager : public QObject
*/
bool passwordHelperSync();
//! The display name of the password helper (platform dependent)
static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
/**
* The display name of the password helper (platform dependent).
*
* \deprecated QGIS 3.42. Use passwordHelperDisplayName() instead.
*/
Q_DECL_DEPRECATED static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME SIP_DEPRECATED;
/**
* Returns a translated display name of the password helper (platform dependent).
*
* If \a titleCase is TRUE then a title case version of the string will be returned. Otherwise
* a mid-sentence case version will be returned.
*
* \since QGIS 3.42
*/
static QString passwordHelperDisplayName( bool titleCase = false );
//! The display name of the Authentication Manager
static const QString AUTH_MAN_TAG;

View File

@ -164,9 +164,9 @@ void QgsAuthEditorWidgets::setupUtilitiesMenu()
mActionAutoClearAccessCache->setCheckable( true );
mActionAutoClearAccessCache->setChecked( QgsSettings().value( QStringLiteral( "clear_auth_cache_on_errors" ), true, QgsSettings::Section::Auth ).toBool() );
mActionPasswordHelperSync = new QAction( tr( "Store/update the Master Password in your %1" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this );
mActionPasswordHelperDelete = new QAction( tr( "Clear the Master Password from your %1…" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this );
mActionPasswordHelperEnable = new QAction( tr( "Integrate Master Password with your %1" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), this );
mActionPasswordHelperSync = new QAction( tr( "Store/update the Master Password in your %1" ).arg( QgsAuthManager::passwordHelperDisplayName( true ) ), this );
mActionPasswordHelperDelete = new QAction( tr( "Clear the Master Password from your %1…" ).arg( QgsAuthManager::passwordHelperDisplayName( true ) ), this );
mActionPasswordHelperEnable = new QAction( tr( "Integrate Master Password with your %1" ).arg( QgsAuthManager::passwordHelperDisplayName( true ) ), this );
mActionPasswordHelperLoggingEnable = new QAction( tr( "Enable Password Helper Debug Log" ), this );
mActionPasswordHelperEnable->setCheckable( true );

View File

@ -331,7 +331,7 @@ QString QgsAuthGuiUtils::getOpenFileName( QWidget *parent, const QString &title,
void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, QWidget *parent )
{
if ( QMessageBox::warning( parent, QObject::tr( "Delete Password" ), QObject::tr( "Do you really want to delete the master password from your %1?" ).arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) == QMessageBox::Cancel )
if ( QMessageBox::warning( parent, QObject::tr( "Delete Password" ), QObject::tr( "Do you really want to delete the master password from your %1?" ).arg( QgsAuthManager::passwordHelperDisplayName() ), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel ) == QMessageBox::Cancel )
{
return;
}
@ -345,7 +345,7 @@ void QgsAuthGuiUtils::passwordHelperDelete( QgsMessageBar *msgbar, QWidget *pare
else
{
msg = QObject::tr( "Master password was successfully deleted from your %1" )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
.arg( QgsAuthManager::passwordHelperDisplayName() );
level = Qgis::MessageLevel::Info;
}
@ -360,7 +360,7 @@ void QgsAuthGuiUtils::passwordHelperSync( QgsMessageBar *msgbar )
if ( !QgsApplication::authManager()->masterPasswordIsSet() )
{
msg = QObject::tr( "Master password is not set and cannot be stored in your %1." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
.arg( QgsAuthManager::passwordHelperDisplayName() );
level = Qgis::MessageLevel::Warning;
}
else if ( !QgsApplication::authManager()->passwordHelperSync() )
@ -371,7 +371,7 @@ void QgsAuthGuiUtils::passwordHelperSync( QgsMessageBar *msgbar )
else
{
msg = QObject::tr( "Master password has been successfully stored in your %1." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
.arg( QgsAuthManager::passwordHelperDisplayName() );
level = Qgis::MessageLevel::Info;
}
@ -383,9 +383,9 @@ void QgsAuthGuiUtils::passwordHelperEnable( bool enabled, QgsMessageBar *msgbar
{
QgsApplication::authManager()->setPasswordHelperEnabled( enabled );
const QString msg = enabled ? QObject::tr( "Your %1 will be <b>used from now</b> on to store and retrieve the master password." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME )
.arg( QgsAuthManager::passwordHelperDisplayName() )
: QObject::tr( "Your %1 will <b>not be used anymore</b> to store and retrieve the master password." )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME );
.arg( QgsAuthManager::passwordHelperDisplayName() );
msgbar->clearWidgets();
msgbar->pushMessage( QObject::tr( "Password helper write" ), msg, Qgis::MessageLevel::Info );
}

View File

@ -106,7 +106,7 @@ QgsCredentialDialog::QgsCredentialDialog( QWidget *parent, Qt::WindowFlags fl )
leMasterPass->setPlaceholderText( tr( "Required" ) );
chkbxPasswordHelperEnable->setText( tr( "Store/update the master password in your %1" )
.arg( QgsAuthManager::AUTH_PASSWORD_HELPER_DISPLAY_NAME ) );
.arg( QgsAuthManager::passwordHelperDisplayName() ) );
leUsername->setFocus();
}