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 <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-18 23:17:25 +03:00
parent 11b3645f90
commit a224bab20c
6 changed files with 8 additions and 85 deletions

View file

@ -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<QString, QString>& 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()) );
}

View file

@ -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 ))

View file

@ -92,31 +92,21 @@
<item row="1" column="1">
<widget class="QLineEdit" name="userEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="domainLabel">
<property name="text">
<string>Domain:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KLineEdit" name="domainEdit"/>
</item>
<item row="4" column="0">
<item row="2" column="0">
<widget class="QLabel" name="passwordLabel">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="2" column="1">
<widget class="KLineEdit" name="passEdit">
<property name="passwordMode">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="3" column="1">
<widget class="QCheckBox" name="keepCheckBox">
<property name="text">
<string>Remember password</string>

View file

@ -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;
}

View file

@ -164,7 +164,6 @@ public:
*/
bool keepPassword;
QString domain;
bool anonymousMode;
bool hideUserName;
};

View file

@ -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;