blob: 5ff33e1c61147a0ded36b7b98278078dbfdbebcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]>
* SPDX-FileCopyrightText: 2013 Vishesh Handa <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KBALOO_ROLESPROVIDER_H
#define KBALOO_ROLESPROVIDER_H
#include "dolphin_export.h"
#include <QHash>
#include <QSet>
#include <QVariant>
namespace Baloo
{
class File;
}
/**
* @brief Allows accessing metadata of a file by providing KFileItemModel roles.
*
* Is a helper class for KFileItemModelRolesUpdater to retrieve roles that
* are only accessible with Baloo.
*/
class DOLPHIN_EXPORT KBalooRolesProvider
{
public:
static KBalooRolesProvider &instance();
virtual ~KBalooRolesProvider();
/**
* @return Roles that can be provided by KBalooRolesProvider.
*/
QSet<QByteArray> roles() const;
/**
* @return Values for the roles \a roles that can be determined from the file
* with the URL \a url.
*/
QHash<QByteArray, QVariant> roleValues(const Baloo::File &file, const QSet<QByteArray> &roles) const;
protected:
KBalooRolesProvider();
private:
QSet<QByteArray> m_roles;
friend struct KBalooRolesProviderSingleton;
};
#endif
|