Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place the 'Recycle Bin' at the bottom of the list when groups are sorted. #7004

11 changes: 9 additions & 2 deletions src/core/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,15 @@ void Group::applyGroupIconToChildEntries()

void Group::sortChildrenRecursively(bool reverse)
{
std::sort(
m_children.begin(), m_children.end(), [reverse](const Group* childGroup1, const Group* childGroup2) -> bool {
Group* recycleBin = Q_NULLPTR;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use nullptr.

if(database()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after if

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
Expand Down