-/***************************************************************************
- * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
- * Copyright (C) 2013 by Vishesh Handa <me@vhanda.in> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2012 Peter Penz <peter.penz19@gmail.com>
+ * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
#include "kbaloorolesprovider.h"
#include <Baloo/File>
#include <KFileMetaData/PropertyInfo>
#include <KFileMetaData/UserMetaData>
-#include <KFormat>
-#include <KLocalizedString>
#include <QCollator>
#include <QDebug>
#include <QTime>
+namespace {
+ QString tagsFromValues(const QStringList& values)
+ {
+ if (values.size() == 1) {
+ return values.at(0);
+ }
+
+ 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(QLatin1String(", "));
+ }
+}
+
struct KBalooRolesProviderSingleton
{
KBalooRolesProvider instance;
m_roleForProperty.insert(propertyInfoList[i].property, propertyInfoList[i].role);
m_roles.insert(propertyInfoList[i].role);
}
-}
-QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
-{
- 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(QLatin1String(", "));
}
+