┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorAthanasios Kanellopoulos <[email protected]>2017-04-29 12:59:30 +0200
committerElvis Angelaccio <[email protected]>2017-04-29 12:59:30 +0200
commit65467d80198b222e4f01b40004a73f888fb5a82b (patch)
tree21209f5a97a7cad640902e597bd58f6f0aafaef6 /src/kitemviews
parentde01efd9c31328492b9fbd62719c5e86a69cdcfc (diff)
Sort the tag-values alphabetically in the "Tags" column
Up until now tag-values have appeared unsorted in the Tags column when the selected View Mode is "Details". In older versions of Dolphin (in KDE4) the tags-values were alphabetically sorted in the Tags column, which means that back then this was the desired behavior. This commit restores this functionality. BUG: 377589 FIXED-IN: 17.04.1 REVIEW: 130068
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.cpp7
-rw-r--r--src/kitemviews/private/kbaloorolesprovider.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp
index 16e3935ca..d6c15afcd 100644
--- a/src/kitemviews/private/kbaloorolesprovider.cpp
+++ b/src/kitemviews/private/kbaloorolesprovider.cpp
@@ -29,6 +29,7 @@
#include <QTime>
#include <QMap>
+#include <QCollator>
struct KBalooRolesProviderSingleton
{
@@ -159,7 +160,11 @@ KBalooRolesProvider::KBalooRolesProvider() :
QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
{
- return values.join(QStringLiteral(", "));
+ QStringList alphabeticalOrderTags = values;
+ QCollator coll;
+ coll.setNumericMode(true);
+ std::sort(alphabeticalOrderTags.begin(), alphabeticalOrderTags.end(), [&](const QString& s1, const QString& s2){ return coll.compare(s1, s2) < 0; });
+ return alphabeticalOrderTags.join(QStringLiteral(", "));
}
QString KBalooRolesProvider::orientationFromValue(int value) const
diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h
index a9bd2e8ef..65b59793c 100644
--- a/src/kitemviews/private/kbaloorolesprovider.h
+++ b/src/kitemviews/private/kbaloorolesprovider.h
@@ -62,6 +62,7 @@ protected:
private:
/**
* @return User visible string for the given tag-values.
+ * The tag-values are sorted in alphabetical order.
*/
QString tagsFromValues(const QStringList& values) const;