knetattach: update the create button icon and tooltip on page change

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-05 20:00:54 +03:00
parent 18fb5088d0
commit 92f81d4843

View file

@ -75,7 +75,7 @@ KNetAttach::KNetAttach( QWidget* parent )
void KNetAttach::slotPageChanged(int) void KNetAttach::slotPageChanged(int)
{ {
updateFinishButtonText(true); _createIcon->setChecked(true);
} }
void KNetAttach::slotHelpClicked() void KNetAttach::slotHelpClicked()
@ -103,13 +103,7 @@ void KNetAttach::updateParametersPageStatus()
!_path->text().trimmed().isEmpty() && !_path->text().trimmed().isEmpty() &&
!_connectionName->text().trimmed().isEmpty() !_connectionName->text().trimmed().isEmpty()
); );
if (_createIcon->isChecked() && !_pass->text().trimmed().isEmpty()) { updateFinishButtonText(_createIcon->isChecked());
_createIcon->setIcon(KIcon("dialog-warning"));
_createIcon->setToolTip(i18n("The plain password will be stored"));
} else {
_createIcon->setIcon(QIcon());
_createIcon->setToolTip(QString());
}
} }
bool KNetAttach::validateCurrentPage() bool KNetAttach::validateCurrentPage()
@ -297,6 +291,13 @@ void KNetAttach::updateFinishButtonText(bool save)
} else { } else {
button(FinishButton)->setText(i18n("C&onnect")); button(FinishButton)->setText(i18n("C&onnect"));
} }
if (save && !_pass->text().trimmed().isEmpty()) {
_createIcon->setIcon(KIcon("dialog-warning"));
_createIcon->setToolTip(i18n("The plain password will be stored"));
} else {
_createIcon->setIcon(QIcon());
_createIcon->setToolTip(QString());
}
} }
// vim: ts=8 sw=4 noet // vim: ts=8 sw=4 noet