mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-03-30 18:08:16 -04:00
Place the 'Recycle Bin' at the bottom of the list when groups are sorted. (#7004)
Co-authored-by: Gaurav Pruthi <gaurav.pruthi@oracle.com>
This commit is contained in:
parent
2514c1d5c5
commit
6c18b10979
@ -1155,13 +1155,18 @@ void Group::applyGroupIconToChildEntries()
|
||||
|
||||
void Group::sortChildrenRecursively(bool reverse)
|
||||
{
|
||||
std::sort(
|
||||
m_children.begin(), m_children.end(), [reverse](const Group* childGroup1, const Group* childGroup2) -> bool {
|
||||
QString name1 = childGroup1->name();
|
||||
QString name2 = childGroup2->name();
|
||||
return reverse ? name1.compare(name2, Qt::CaseInsensitive) > 0
|
||||
: name1.compare(name2, Qt::CaseInsensitive) < 0;
|
||||
});
|
||||
Group* recycleBin = nullptr;
|
||||
if (database()) {
|
||||
recycleBin = database()->metadata()->recycleBin();
|
||||
}
|
||||
std::sort(m_children.begin(), m_children.end(), [=](const Group* childGroup1, const Group* childGroup2) -> bool {
|
||||
if (childGroup1 == recycleBin) {
|
||||
return false;
|
||||
}
|
||||
QString name1 = childGroup1->name();
|
||||
QString name2 = childGroup2->name();
|
||||
return reverse ? name1.compare(name2, Qt::CaseInsensitive) > 0 : name1.compare(name2, Qt::CaseInsensitive) < 0;
|
||||
});
|
||||
|
||||
for (auto child : m_children) {
|
||||
child->sortChildrenRecursively(reverse);
|
||||
|
Loading…
x
Reference in New Issue
Block a user