Skip to content

Commit

Permalink
Sort entries by title in passkey import dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
droidmonkey committed Nov 10, 2023
1 parent de3187e commit 29dbc3a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/gui/passkeys/PasskeyImportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,23 @@ void PasskeyImportDialog::addEntries()
return;
}

for (const auto& entry : group->entries()) {
// Collect all entries in the group and resolve the title
QList<QPair<QString, QUuid>> entries;
for (const auto entry : group->entries()) {
if (!entry || entry->isRecycled()) {
continue;
}
entries.append({entry->resolveMultiplePlaceholders(entry->title()), entry->uuid()});
}

// Sort entries by title
std::sort(entries.begin(), entries.end(), [](const auto& a, const auto& b) {
return a.first.compare(b.first, Qt::CaseInsensitive) < 0;
});

m_ui->selectEntryComboBox->addItem(entry->title(), entry->uuid());
// Add sorted entries to the combobox
for (const auto& pair : entries) {
m_ui->selectEntryComboBox->addItem(pair.first, pair.second);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/passkeys/PasskeyImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void PasskeyImporter::showImportDialog(QSharedPointer<Database>& database,
// Store to entry if given directly
if (entry) {
browserService()->addPasskeyToEntry(
entry, relyingParty, relyingParty, username, userId, userHandle, privateKey);
entry, relyingParty, relyingParty, username, credentialId, userHandle, privateKey);
return;
}

Expand All @@ -122,7 +122,7 @@ void PasskeyImporter::showImportDialog(QSharedPointer<Database>& database,
auto selectedEntry = group->findEntryByUuid(passkeyImportDialog.getSelectedEntryUuid());
if (selectedEntry) {
browserService()->addPasskeyToEntry(
selectedEntry, relyingParty, relyingParty, username, userId, userHandle, privateKey);
selectedEntry, relyingParty, relyingParty, username, credentialId, userHandle, privateKey);
}
}

Expand Down

0 comments on commit 29dbc3a

Please sign in to comment.