From a224bab20c546db95c956a04cdd96cb0b821aaf2 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 18 May 2024 23:17:25 +0300 Subject: [PATCH] kdeui: drop the domain feature of KPasswordDialog editing the domain does not make sense, showing domain can be done via comment (the complete URL is shown via comment by the KIO curl slave for example) note the change to KIO::AuthInfo, this invalidates stored data Signed-off-by: Ivailo Monev --- kdeui/dialogs/kpassworddialog.cpp | 29 +------------------------- kdeui/dialogs/kpassworddialog.h | 34 ++----------------------------- kdeui/dialogs/kpassworddialog.ui | 16 +++------------ kio/kio/authinfo.cpp | 6 ++---- kio/kio/authinfo.h | 1 - kio/kio/slavebase.cpp | 7 ------- 6 files changed, 8 insertions(+), 85 deletions(-) diff --git a/kdeui/dialogs/kpassworddialog.cpp b/kdeui/dialogs/kpassworddialog.cpp index ce0e0f68..4eca7be7 100644 --- a/kdeui/dialogs/kpassworddialog.cpp +++ b/kdeui/dialogs/kpassworddialog.cpp @@ -85,7 +85,6 @@ void KPasswordDialog::KPasswordDialogPrivate::updateFields() ui.userEdit->setReadOnly(true); ui.credentialsGroup->setFocusProxy(ui.passEdit); } - ui.domainEdit->setReadOnly(( m_flags & KPasswordDialog::DomainReadOnly )); ui.credentialsGroup->setEnabled( !q->anonymousMode() ); } @@ -102,8 +101,6 @@ void KPasswordDialog::KPasswordDialogPrivate::init() } else { ui.userNameLabel->hide(); ui.userEdit->hide(); - ui.domainLabel->hide(); - ui.domainEdit->hide(); ui.passEdit->setFocus(); ui.credentialsGroup->setFocusProxy( ui.passEdit ); } @@ -114,12 +111,6 @@ void KPasswordDialog::KPasswordDialogPrivate::init() ui.usePasswordButton->hide(); } - if ( !( m_flags & KPasswordDialog::ShowDomainLine ) ) - { - ui.domainLabel->hide(); - ui.domainEdit->hide(); - } - if ( !( m_flags & KPasswordDialog::ShowKeepPassword ) ) { ui.keepCheckBox->hide(); @@ -178,16 +169,6 @@ QString KPasswordDialog::password() const return d->ui.passEdit->text(); } -void KPasswordDialog::setDomain(const QString& domain) -{ - d->ui.domainEdit->setText(domain); -} - -QString KPasswordDialog::domain() const -{ - return d->ui.domainEdit->text(); -} - void KPasswordDialog::setAnonymousMode(bool anonymous) { if (anonymous && !(d->m_flags & KPasswordDialog::ShowAnonymousLoginCheckBox)) { @@ -279,13 +260,6 @@ void KPasswordDialog::showErrorMessage( const QString& message, const ErrorType d->ui.userEdit->setFocus(); } break; - case DomainError: - if ( d->ui.domainEdit->isVisibleTo( this ) ) - { - d->ui.domainLabel->setFont( bold ); - d->ui.domainEdit->setFocus(); - } - break; case FatalError: d->ui.userNameLabel->setEnabled( false ); d->ui.userEdit->setEnabled( false ); @@ -353,8 +327,7 @@ void KPasswordDialog::setKnownLogins( const QMap& knownLogins d->ui.formLayout->setWidget( row > -1 ? row : 0, userEditRole, d->userEditCombo ); setTabOrder( d->ui.userEdit, d->ui.anonymousRadioButton ); - setTabOrder( d->ui.anonymousRadioButton, d->ui.domainEdit ); - setTabOrder( d->ui.domainEdit, d->ui.passEdit ); + setTabOrder( d->ui.anonymousRadioButton, d->ui.passEdit ); setTabOrder( d->ui.passEdit, d->ui.keepCheckBox ); connect( d->ui.userEdit, SIGNAL(returnPressed()), d->ui.passEdit, SLOT(setFocus()) ); } diff --git a/kdeui/dialogs/kpassworddialog.h b/kdeui/dialogs/kpassworddialog.h index faaba482..ea073139 100644 --- a/kdeui/dialogs/kpassworddialog.h +++ b/kdeui/dialogs/kpassworddialog.h @@ -79,17 +79,7 @@ public: * If this flag is set, the Anonymous Login checkbox will be displayed * @since 4.1 */ - ShowAnonymousLoginCheckBox = 0x08, - /** - * If this flag is set, there will be an additional line to let the user enter the domain. - * @since 4.1 - */ - ShowDomainLine = 0x10, - /** - * If this flag is set, the domain lineedit will be in read only mode. - * @since 4.1 - */ - DomainReadOnly = 0x20 + ShowAnonymousLoginCheckBox = 0x08 }; Q_DECLARE_FLAGS(KPasswordDialogFlags, KPasswordDialogFlag) @@ -110,13 +100,7 @@ public: /** * Error preventing further attempts, will result in disabling most of the interface */ - FatalError, - - /** - * A problem with the domain as entered - * @since 4.1 - **/ - DomainError + FatalError }; /** @@ -193,19 +177,6 @@ public: */ QString username() const; - /** - * set the default domain. - * @since 4.1 - */ - void setDomain(const QString&); - - /** - * Returns the domain entered by the user. - * @return the domain name - * @since 4.1 - */ - QString domain() const; - /** * set anonymous mode (all other fields will be grayed out) * @since 4.1 @@ -293,7 +264,6 @@ protected: */ virtual bool checkPassword(); - private: Q_PRIVATE_SLOT(d, void actuallyAccept()) Q_PRIVATE_SLOT(d, void activated( const QString& userName )) diff --git a/kdeui/dialogs/kpassworddialog.ui b/kdeui/dialogs/kpassworddialog.ui index 685b43b1..550808e9 100644 --- a/kdeui/dialogs/kpassworddialog.ui +++ b/kdeui/dialogs/kpassworddialog.ui @@ -92,31 +92,21 @@ - - - - Domain: - - - - - - - + Password: - + true - + Remember password diff --git a/kio/kio/authinfo.cpp b/kio/kio/authinfo.cpp index 184b2344..9101db0f 100644 --- a/kio/kio/authinfo.cpp +++ b/kio/kio/authinfo.cpp @@ -44,7 +44,6 @@ AuthInfo::AuthInfo(const AuthInfo &info) commentLabel = info.commentLabel; readOnly = info.readOnly; keepPassword = info.keepPassword; - domain = info.domain; anonymousMode = info.anonymousMode; hideUserName = info.hideUserName; } @@ -60,7 +59,6 @@ AuthInfo& AuthInfo::operator=(const AuthInfo &info) commentLabel = info.commentLabel; readOnly = info.readOnly; keepPassword = info.keepPassword; - domain = info.domain; anonymousMode = info.anonymousMode; hideUserName = info.hideUserName; return *this; @@ -72,7 +70,7 @@ QDataStream& KIO::operator<<(QDataStream &s, const AuthInfo &a) { s << a.url << a.username << a.password << a.prompt << a.caption << a.comment << a.commentLabel << a.readOnly << a.keepPassword - << a.domain << a.anonymousMode << a.hideUserName; + << a.anonymousMode << a.hideUserName; return s; } @@ -80,6 +78,6 @@ QDataStream& KIO::operator>>(QDataStream &s, AuthInfo &a) { s >> a.url >> a.username >> a.password >> a.prompt >> a.caption >> a.comment >> a.commentLabel >> a.readOnly >> a.keepPassword - >> a.domain >> a.anonymousMode >> a.hideUserName; + >> a.anonymousMode >> a.hideUserName; return s; } diff --git a/kio/kio/authinfo.h b/kio/kio/authinfo.h index 67d294cc..a529d0f1 100644 --- a/kio/kio/authinfo.h +++ b/kio/kio/authinfo.h @@ -164,7 +164,6 @@ public: */ bool keepPassword; - QString domain; bool anonymousMode; bool hideUserName; }; diff --git a/kio/kio/slavebase.cpp b/kio/kio/slavebase.cpp index cb6b5ae2..43ee7097 100644 --- a/kio/kio/slavebase.cpp +++ b/kio/kio/slavebase.cpp @@ -592,10 +592,6 @@ bool SlaveBase::openPasswordDialog(AuthInfo& info, const QString &errorMsg) // assemble dialog-flags KPasswordDialog::KPasswordDialogFlags dialogFlags; - if (!dlgInfo.domain.isEmpty()) { - dialogFlags |= KPasswordDialog::ShowDomainLine; - } - if (dlgInfo.anonymousMode) { dialogFlags |= KPasswordDialog::ShowAnonymousLoginCheckBox; } @@ -637,8 +633,6 @@ bool SlaveBase::openPasswordDialog(AuthInfo& info, const QString &errorMsg) // even if the store is not open passwords can be temporary stored dlg->setKeepPassword(true); - dlg->setDomain(dlgInfo.domain); - if (password.isEmpty() && username.isEmpty()) { dlg->setAnonymousMode(dlgInfo.anonymousMode); } @@ -649,7 +643,6 @@ bool SlaveBase::openPasswordDialog(AuthInfo& info, const QString &errorMsg) dlgInfo.username = dlg->username(); dlgInfo.password = dlg->password(); dlgInfo.keepPassword = dlg->keepPassword(); - dlgInfo.domain = dlg->domain(); dlgInfo.anonymousMode = dlg->anonymousMode(); info = dlgInfo;