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
#include <QTime>
#include <QMap>
#include <QTime>
#include <QMap>
struct KBalooRolesProviderSingleton
{
struct KBalooRolesProviderSingleton
{
QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
{
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
}
QString KBalooRolesProvider::orientationFromValue(int value) const
private:
/**
* @return User visible string for the given tag-values.
private:
/**
* @return User visible string for the given tag-values.
+ * The tag-values are sorted in alphabetical order.
*/
QString tagsFromValues(const QStringList& values) const;
*/
QString tagsFromValues(const QStringList& values) const;