-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Place the 'Recycle Bin' at the bottom of the list when groups are sorted. #7004
Conversation
Heck yah! |
Your implementation is not correct. The Recycle Bin is a defined group in the database (database()->metadata()->recycleBin()). You can just check for that group within the sort function and always return such that the group is sorted last. |
This code works perfectly:
|
Codecov Report
@@ Coverage Diff @@
## develop #7004 +/- ##
===========================================
+ Coverage 63.68% 63.69% +0.01%
===========================================
Files 330 330
Lines 41598 41601 +3
===========================================
+ Hits 26489 26494 +5
+ Misses 15109 15107 -2
Continue to review full report at Codecov.
|
src/core/Group.cpp
Outdated
} | ||
|
||
std::sort(beginIter, endIter, [reverse](const Group* childGroup1, const Group* childGroup2) -> bool { | ||
Group* recycleBin = Q_NULLPTR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use nullptr
.
src/core/Group.cpp
Outdated
|
||
std::sort(beginIter, endIter, [reverse](const Group* childGroup1, const Group* childGroup2) -> bool { | ||
Group* recycleBin = Q_NULLPTR; | ||
if(database()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space after if
…b.com/pruthig/keepassxc into feature/groups-sort-recyclebin-at-end
Need to run |
The code changes are made to place 'Recycle bin' at the bottom when the list of groups is sorted. The sorting can be either in ascending order or in descending order. I have added this change in the logic wherein groups are sorted. As per the changes, 'Recycle bin' will be swapped with last index and sorting will be performed on the list excepting the last element (read 'Recycle bin')
Fixes #6495
Screenshots
Following snapshot shows 'Recycle bin' at bottom when list is sorted in ascending order:
Following snapshot shows 'Recycle bin' at bottom when list is sorted in descending order:
Testing strategy
I manually tested the changes on my Windows 10 machine.
Type of change