summaryrefslogtreecommitdiffstats
path: root/qt/src/qdbusbus.h
blob: 0240e65fa7204c40522bbe40fcb1f06895ce4f45 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* -*- C++ -*-
 *
 * Copyright (C) 2006 Trolltech AS. All rights reserved.
 *    Author: Thiago Macieira <thiago.macieira@trolltech.com>
 *
 * 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.
 *
 */

/*
 * This file was generated by dbusidl2cpp version 0.3
 * when processing input file -
 *
 * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
 *
 * This file has been hand-edited! Be careful when re-generating it!
 *
 */

#ifndef QDBUSBUS_H
#define QDBUSBUS_H

#include <QtCore/qstringlist.h>

#include "qdbusabstractinterface.h"
#include "qdbusreply.h"

class QDBusConnection;
class QString;
class QByteArray;

/*
 * Proxy class for interface org.freedesktop.DBus
 */
class QDBUS_EXPORT QDBusBusService: public QDBusAbstractInterface
{
    Q_OBJECT
    friend class QDBusConnection;
    static inline const char *staticInterfaceName();

    explicit QDBusBusService(QDBusAbstractInterfacePrivate *p);

    ~QDBusBusService();

public:
    // taken out of http://dbus.freedesktop.org/doc/dbus-specification.html
    // update if the standard updates
    enum RequestNameOption {
        QueueName = 0x0,
        AllowReplacingName = 0x1,
        ReplaceExistingName = 0x2,
        DoNotQueueName = 0x4
    };
    Q_DECLARE_FLAGS(RequestNameOptions, RequestNameOption)

    enum RequestNameReply {
        PrimaryOwnerReply = 1,
        InQueueReply = 2,
        NameExistsReply = 3,
        AlreadyOwnerReply = 4
    };

    enum ReleaseNameReply {
        NameReleasedReply = 1,
        NameNonExistentReply = 2,
        NotOwnerReply = 3
    };

    enum StartServiceReply {
        Success = 1,
        AlreadyRunning = 2
    };    

#ifndef Q_QDOC
    // D-Bus names
public: // METHODS
    QDBusReply<QString> Hello();
    QDBusReply<void> ReloadConfig();

    QDBusReply<QStringList> ListNames();
        
    QDBusReply<bool> NameHasOwner(const QString &service);
    QDBusReply<QString> GetNameOwner(const QString &name);
    QDBusReply<ReleaseNameReply> ReleaseName(const QString &service);    
    QDBusReply<RequestNameReply> RequestName(const QString &service, RequestNameOptions flags);
    QDBusReply<QStringList> ListQueuedOwners(const QString &service);

    QDBusReply<void> AddMatch(const QString &rule);
    QDBusReply<void> RemoveMatch(const QString &rule);

    QDBusReply<QByteArray> GetConnectionSELinuxSecurityContext(const QString &service);
    QDBusReply<uint> GetConnectionUnixProcessID(const QString &service);
    QDBusReply<uint> GetConnectionUnixUser(const QString &service);

    QDBusReply<StartServiceReply> StartServiceByName(const QString &name, uint flags);

Q_SIGNALS: // SIGNALS
    void NameAcquired(const QString &service);
    void NameLost(const QString &service);
    void NameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
#endif

    // Qt-style naming    
public Q_SLOTS:
    QDBusReply<QString> hello()
    { return Hello(); }
    QDBusReply<void> reloadConfig()
    { return ReloadConfig(); }

    QDBusReply<QStringList> listNames()
    { return ListNames(); }
        
    QDBusReply<bool> nameHasOwner(const QString &serviceName)
    { return NameHasOwner(serviceName); }
    QDBusReply<QString> nameOwner(const QString &name)
    { return GetNameOwner(name); }
    QDBusReply<ReleaseNameReply> releaseName(const QString &serviceName)
    { return ReleaseName(serviceName); }
    QDBusReply<RequestNameReply> requestName(const QString &serviceName, RequestNameOptions flags = QueueName)
    { return RequestName(serviceName, flags); }
    QDBusReply<QStringList> listQueuedOwners(const QString &serviceName)
    { return ListQueuedOwners(serviceName); }

    QDBusReply<void> addMatch(const QString &rule)
    { return AddMatch(rule); }
    QDBusReply<void> removeMatch(const QString &rule)
    { return RemoveMatch(rule); }

    QDBusReply<QByteArray> connectionSELinuxSecurityContext(const QString &serviceName)
    { return GetConnectionSELinuxSecurityContext(serviceName); }
    QDBusReply<uint> connectionUnixProcessID(const QString &serviceName)
    { return GetConnectionUnixProcessID(serviceName); }
    QDBusReply<uint> connectionUnixUser(const QString &serviceName)
    { return GetConnectionUnixUser(serviceName); }

    QDBusReply<StartServiceReply> startServiceByName(const QString &name, uint flags)
    { return StartServiceByName(name, flags); }

Q_SIGNALS:
    void nameAcquired(const QString &service);
    void nameLost(const QString &service);
    void nameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
};

Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusBusService::RequestNameOptions)

#endif