mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-05-02 14:46:07 -04:00
Autocomplete usernames based on most frequent in database
* Fixes #3126 * Limit autocompletion to the top ten used usernames - Load common usernames when database is opened - Transition from QLineEdit to QComboBox for usernames - Dropdown menu of the combobox lets user choose a common username - Common usernames are autocompleted via inline completion - Common usernames are sorted by frequency (first) and name (second)
This commit is contained in:
parent
a22e8a1f40
commit
f85642741d
13 changed files with 134 additions and 10 deletions
|
@ -1181,3 +1181,29 @@ void TestGroup::testApplyGroupIconRecursively()
|
|||
QVERIFY(subsubgroup->iconNumber() == iconForGroups);
|
||||
QVERIFY(subsubgroupEntry->iconNumber() == iconForEntries);
|
||||
}
|
||||
|
||||
void TestGroup::testUsernamesRecursive()
|
||||
{
|
||||
Database* database = new Database();
|
||||
|
||||
// Create a subgroup
|
||||
Group* subgroup = new Group();
|
||||
subgroup->setName("Subgroup");
|
||||
subgroup->setParent(database->rootGroup());
|
||||
|
||||
// Generate entries in the root group and the subgroup
|
||||
Entry* rootGroupEntry = database->rootGroup()->addEntryWithPath("Root group entry");
|
||||
rootGroupEntry->setUsername("Name1");
|
||||
|
||||
Entry* subgroupEntry = subgroup->addEntryWithPath("Subgroup entry");
|
||||
subgroupEntry->setUsername("Name2");
|
||||
|
||||
Entry* subgroupEntryReusingUsername = subgroup->addEntryWithPath("Another subgroup entry");
|
||||
subgroupEntryReusingUsername->setUsername("Name2");
|
||||
|
||||
QList<QString> usernames = database->rootGroup()->usernamesRecursive();
|
||||
QCOMPARE(usernames.size(), 2);
|
||||
QVERIFY(usernames.contains("Name1"));
|
||||
QVERIFY(usernames.contains("Name2"));
|
||||
QVERIFY(usernames.indexOf("Name2") < usernames.indexOf("Name1"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue