mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Find entry by title.
This commit is contained in:
parent
54ad927044
commit
eeafe77614
@ -497,7 +497,18 @@ Entry* Group::findEntry(QString entryId)
|
||||
}
|
||||
}
|
||||
|
||||
return findEntryByPath(entryId);
|
||||
Entry* entry = findEntryByPath(entryId);
|
||||
if (entry) {
|
||||
return entry;
|
||||
}
|
||||
|
||||
for (Entry* entry : entriesRecursive(false)) {
|
||||
if (entry->title() == entryId) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Entry* Group::findEntryByUuid(const Uuid& uuid)
|
||||
|
@ -606,9 +606,17 @@ void TestGroup::testFindEntry()
|
||||
QVERIFY(entry != nullptr);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
// Should also find the entry only by title.
|
||||
entry = db->rootGroup()->findEntry(QString("entry2"));
|
||||
QVERIFY(entry != nullptr);
|
||||
QCOMPARE(entry->title(), QString("entry2"));
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("invalid/path/to/entry2"));
|
||||
QVERIFY(entry == nullptr);
|
||||
|
||||
entry = db->rootGroup()->findEntry(QString("entry27"));
|
||||
QVERIFY(entry == nullptr);
|
||||
|
||||
// A valid UUID that does not exist in this database.
|
||||
entry = db->rootGroup()->findEntry(QString("febfb01ebcdf9dbd90a3f1579dc75281"));
|
||||
QVERIFY(entry == nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user