blob: 55a5fb2accc2bb8e8d30338372205d7a713b6d24 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
/*
* Copyright (C) 2008 Nokia Corporation.
*
* Contact: Marius Vollmer <marius.vollmer@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef CONTEXTREGISTRYINFO_H
#define CONTEXTREGISTRYINFO_H
#include <QVariant>
#include <QStringList>
#include <QObject>
class ContextRegistryInfo : public QObject
{
Q_OBJECT
public:
static ContextRegistryInfo* instance(const QString &backendName = "");
QStringList listKeys() const;
QStringList listKeys(QString providername) const;
QStringList listKeysForPlugin(QString plugin) const;
QStringList listProviders() const;
QStringList listPlugins() const;
QString backendName() const;
private:
ContextRegistryInfo() {}; ///< Private constructor. Do not use.
ContextRegistryInfo(const ContextRegistryInfo&); ///< Private constructor. Do not use.
ContextRegistryInfo& operator=(const ContextRegistryInfo&); ///< Private operator. Do not use.
/// Holds the actual pointer to the singelton instance.
/// Mutex protected during creation.
static ContextRegistryInfo* registryInstance;
protected:
void connectNotify(const char *signal);
private slots:
void onKeysChanged(const QStringList& currentKeys);
void onKeysAdded(const QStringList& newKeys);
void onKeysRemoved(const QStringList& removedKeys);
void onListChanged();
signals:
/// DEPRECATED use changed signal instead.
/// Emitted when the registry changes. For performance reasons
/// this is not a strict signal - it's emitted also even when no actual
/// changes happened to the key content. For strict monitoring of a partular
/// key use the \a ContextPropertyInfo.
/// \param currentKeys List of all the keys that are now in the registry.
void keysChanged(const QStringList& currentKeys);
/// DEPRECATED use changed signal instead.
/// Emitted when new keys become availible in the registry.
/// The list contains only the new keys.
/// \param newKeys New keys that appeared in the regisitry.
void keysAdded(const QStringList& newKeys);
/// DEPRECATED use changed signal instead.
/// Emitted when keys disappear (are removed) from the registry.
/// The list contains only the removed keys.
/// \param removedKeys The list of removed keys.
void keysRemoved(const QStringList& removedKeys);
/// Emitted when the list of provided keys changes (keys were
/// added or removed). This is not a strict signal - it's possible
/// for the emission to happen even if no actual change
/// happened.
void changed();
friend class ContextRegistryInfoUnitTest;
};
#endif
|