2 * SPDX-FileCopyrightText: 2012 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2013 Vishesh Handa <me@vhanda.in>
5 * SPDX-License-Identifier: GPL-2.0-or-later
8 #ifndef KBALOO_ROLESPROVIDER_H
9 #define KBALOO_ROLESPROVIDER_H
11 #include "dolphin_export.h"
22 * @brief Allows accessing metadata of a file by providing KFileItemModel roles.
24 * Is a helper class for KFileItemModelRolesUpdater to retrieve roles that
25 * are only accessible with Baloo.
27 class DOLPHIN_EXPORT KBalooRolesProvider
30 static KBalooRolesProvider
& instance();
31 virtual ~KBalooRolesProvider();
34 * @return Roles that can be provided by KBalooRolesProvider.
36 QSet
<QByteArray
> roles() const;
39 * @return Values for the roles \a roles that can be determined from the file
40 * with the URL \a url.
42 QHash
<QByteArray
, QVariant
> roleValues(const Baloo::File
& file
,
43 const QSet
<QByteArray
>& roles
) const;
45 QByteArray
roleForProperty(const QString
& property
) const;
48 KBalooRolesProvider();
52 * @return User visible string for the given tag-values.
53 * The tag-values are sorted in alphabetical order.
55 QString
tagsFromValues(const QStringList
& values
) const;
58 QSet
<QByteArray
> m_roles
;
59 QHash
<QString
, QByteArray
> m_roleForProperty
;
61 friend struct KBalooRolesProviderSingleton
;