Debian Codegraph @

online-accounts-daemon/lib/LomiriOnlineAccountsDaemon/client_registry.h

raw symbols SCIP
1 /*
2 * This file is part of OnlineAccountsDaemon
3 *
4 * Copyright (C) 2015 Canonical Ltd.
5 *
6 * Contact: Alberto Mardegan <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License version 3, as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef ONLINE_ACCOUNTS_DAEMON_CLIENT_REGISTRY_H
22 #define ONLINE_ACCOUNTS_DAEMON_CLIENT_REGISTRY_H
23
24 #include <QObject>
25 #include <QStringList>
26 #include <sys/types.h>
27
28 class QDBusConnection;
29 class QDBusMessage;
30
31 namespace OnlineAccountsDaemon {
32
33 class ClientRegistryPrivate;
34 class ClientRegistry: public QObject
35 {
36 Q_OBJECT
37
38 public:
39 ~ClientRegistry();
40
41 static ClientRegistry *instance();
42
43 QString registerClient(const QDBusConnection &connection,
44 const QDBusMessage &message);
45 void registerClient(const QString &client);
46 void registerActiveClients(const QStringList &clients);
47 QStringList clients() const;
48 bool hasClients() const { return !clients().isEmpty(); }
49
50 QString clientSecurityContext(const QString &client) const;
51 pid_t clientPid(const QString &client) const;
52
53 Q_SIGNALS:
54 void hasClientsChanged();
55
56 private:
57 ClientRegistry();
58 Q_DECLARE_PRIVATE(ClientRegistry)
59 ClientRegistryPrivate *d_ptr;
60 };
61
62 } // namespace
63
64 #endif // ONLINE_ACCOUNTS_DAEMON_CLIENT_REGISTRY_H