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 7bbf5c9 commit 91b8a1a
Showing 1 changed file with 13 additions and 2 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

0 comments on commit 91b8a1a

Please sign in to comment.