diff options
| author | Thomas Surrel <[email protected]> | 2018-11-22 22:24:37 +0100 |
|---|---|---|
| committer | Thomas Surrel <[email protected]> | 2018-12-01 21:07:29 +0100 |
| commit | b714604a6795f9ed398a886c23348a2d52fbb7d1 (patch) | |
| tree | 18f534ab8e1a84a80192c15e3ba794daeb401351 /src/kitemviews/kitemmodelbase.h | |
| parent | d0cfe1e658efc2de7269ed1568143dc1070fa556 (diff) | |
Do not sort twice when changing role and order at the same time
Summary:
When using the list header to change the role and order, if one
changes the order to descending and then changes role, dolphin
also changes the order back to ascending. This results in sorting
the list of files twice in a row. This patch removes the first
(useless) sort.
Reviewers: #dolphin, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: elvisangelaccio, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D17111
Diffstat (limited to 'src/kitemviews/kitemmodelbase.h')
| -rw-r--r-- | src/kitemviews/kitemmodelbase.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index 257872f9c..f1945de06 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -85,8 +85,9 @@ public: * Sets the sort-role to \a role. The method KItemModelBase::onSortRoleChanged() will be * called so that model-implementations can react on the sort-role change. Afterwards the * signal sortRoleChanged() will be emitted. + * The implementation should resort only if \a resortItems is true. */ - void setSortRole(const QByteArray& role); + void setSortRole(const QByteArray& role, bool resortItems = true); QByteArray sortRole() const; /** @@ -266,8 +267,9 @@ protected: * Usually the most efficient way is to emit a * itemsRemoved() signal for all items, reorder the items internally and to emit a * itemsInserted() signal afterwards. + * The implementation should resort only if \a resortItems is true. */ - virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous); + virtual void onSortRoleChanged(const QByteArray& current, const QByteArray& previous, bool resortItems = true); /** * Is invoked if the sort order has been changed by KItemModelBase::setSortOrder(). Allows |
