Commit ed482e07 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Bring back for saving usernames as well

While this also reintroduces that a password field is used for entering, this
is better than asking for the username every time, which is a regression
compared to 5.18.

Using a proper username input field would need changes in kwidgetsaddons or
some refactoring to ask for username and password at once.

Drop use of wallet->readEntry - it's custom binary data, so the content is
entirely defined by whoever wrote it. We don't use writeEntry here, so using
readEntry is invalud.
parent a4a438c5
......@@ -304,17 +304,11 @@ int main(int argc, char **argv)
wallet->setFolder(walletFolder);
QString retrievedItem;
if (type != TypePassword) {
QByteArray retrievedBytes;
wallet->readEntry(identifier, retrievedBytes);
retrievedItem = QString::fromUtf8(retrievedBytes);
} else {
wallet->readPassword(identifier, retrievedItem);
}
wallet->readPassword(identifier, retrievedItem);
if (!retrievedItem.isEmpty()) {
item = retrievedItem;
} else if (type == TypePassword) {
} else {
// There was a bug in previous versions of ksshaskpass that caused it to create keys with extra space
// appended to key file name. Try these keys too, and, if there's a match, ensure that it's properly
// replaced with proper one.
......@@ -343,15 +337,10 @@ int main(int argc, char **argv)
item = QStringLiteral("yes\n");
break;
}
case TypeClearText: {
bool ok = false;
item = QInputDialog::getText(0, i18n("Ksshaskpass"), dialog, QLineEdit::Normal, QString(), &ok);
if (!ok) {
// dialog has been canceled
return 1;
}
break;
}
case TypeClearText:
// Should use a dialog with visible input, but KPasswordDialog doesn't support that and
// other available dialog types don't have a "Keep" checkbox.
/* fallthrough */
case TypePassword: {
// create the password dialog, but only show "Enable Keep" button, if the wallet is open
KPasswordDialog::KPasswordDialogFlag flag(KPasswordDialog::NoFlags);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment