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:
Gaurav Pruthi 2021-10-02 12:25:42 +05:30 committed by GitHub
parent 2514c1d5c5
commit 6c18b10979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1155,13 +1155,18 @@ void Group::applyGroupIconToChildEntries()
void Group::sortChildrenRecursively(bool reverse) void Group::sortChildrenRecursively(bool reverse)
{ {
std::sort( Group* recycleBin = nullptr;
m_children.begin(), m_children.end(), [reverse](const Group* childGroup1, const Group* childGroup2) -> bool { if (database()) {
QString name1 = childGroup1->name(); recycleBin = database()->metadata()->recycleBin();
QString name2 = childGroup2->name(); }
return reverse ? name1.compare(name2, Qt::CaseInsensitive) > 0 std::sort(m_children.begin(), m_children.end(), [=](const Group* childGroup1, const Group* childGroup2) -> bool {
: name1.compare(name2, Qt::CaseInsensitive) < 0; 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) { for (auto child : m_children) {
child->sortChildrenRecursively(reverse); child->sortChildrenRecursively(reverse);