IJHack / QtPass

QtPass is a multi-platform GUI for pass, the standard unix password manager.
https://qtpass.org/
GNU General Public License v3.0
1.03k stars 162 forks source link

Restore directories-first order of passwords tree view on non-Mac platforms #475

Closed maciejsszmigiero closed 5 years ago

maciejsszmigiero commented 5 years ago

Since commit b4dc9e6 ("Auto update CHANGELOG and sorting of treeview") directories are no longer listed first in the tree view of passwords.

This is because a simple sort of the tree view widget (as enabled by the aforementioned commit) does its work by sorting the backing StoreModel (QSortFilterProxyModel), which in turn does just a simple lexicographical order sort on the path of each its item.

Before that commit the sort was done by QFileSystemModel via QFileSystemModelSorter, which always places its directories first on non-Mac platforms.

Unfortunately, QFileSystemModelSorter is an internal Qt helper class, so we can't just use it directly, we need to open-code a bit of logic from QFileSystemModelSorter::compareNodes() into StoreModel::lessThan() to restore the old behavior.

This PR also contains 3 small improvements around the modified code (in separate commits).

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.01%) to 6.938% when pulling a06be7ff54122c0b10834d2b8ffcf3a74dc6b7b2 on maciejsszmigiero:directories-first-order-fix into f9f9fba7ebad4f7fee7516f562d7bf9aa41dd703 on IJHack:master.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.01%) to 6.938% when pulling a06be7ff54122c0b10834d2b8ffcf3a74dc6b7b2 on maciejsszmigiero:directories-first-order-fix into f9f9fba7ebad4f7fee7516f562d7bf9aa41dd703 on IJHack:master.

codecov[bot] commented 5 years ago

Codecov Report

Merging #475 into master will decrease coverage by 0.02%. The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #475      +/-   ##
========================================
- Coverage    7.32%   7.3%   -0.03%     
========================================
  Files          44     44              
  Lines        2798   2806       +8     
========================================
  Hits          205    205              
- Misses       2593   2601       +8
Impacted Files Coverage Δ
src/storemodel.h 0% <ø> (ø) :arrow_up:
src/mainwindow.cpp 0% <0%> (ø) :arrow_up:
src/storemodel.cpp 0% <0%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f9f9fba...a06be7f. Read the comment docs.