Polkit-Qt-1  0.95.0
polkitqt1-subject.h
1 /*
2  * This file is part of the PolKit1-qt project
3  * Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef POLKITQT1_SUBJECT_H
22 #define POLKITQT1_SUBJECT_H
23 
24 #include "polkitqt1-export.h"
25 
26 #include <QtCore/QObject>
27 #include <QtCore/QSharedData>
28 
29 typedef struct _PolkitSubject PolkitSubject;
30 typedef struct _PolkitUnixProcess PolkitUnixProcess;
31 typedef struct _PolkitSystemBusName PolkitSystemBusName;
32 
40 namespace PolkitQt1
41 {
42 
55 class POLKITQT1_EXPORT Subject
56 {
57 public:
58  Subject();
59  Subject(const Subject &other);
60  ~Subject();
61 
62  Subject &operator=(const Subject &other);
63 
64  bool isValid() const;
65 
71  QString toString() const;
72 
80  static Subject fromString(const QString &string);
81 
89  PolkitSubject *subject() const;
90 
91 protected:
92  Subject(PolkitSubject *subject);
93 
94  void setSubject(PolkitSubject *subject);
95 
96 private:
97  class Data;
98  QExplicitlySharedDataPointer< Data > d;
99 };
100 
114 class POLKITQT1_EXPORT UnixProcessSubject : public Subject
115 {
116 public:
123  explicit UnixProcessSubject(qint64 pid);
124 
131  UnixProcessSubject(qint64 pid, quint64 startTime);
132 
140  explicit UnixProcessSubject(PolkitUnixProcess *process);
141 
147  qint64 pid() const;
148 
154  qint64 startTime() const;
155 
161  qint64 uid() const;
162 
168  void setPid(qint64 pid);
169 };
170 
179 class POLKITQT1_EXPORT SystemBusNameSubject : public Subject
180 {
181 public:
187  explicit SystemBusNameSubject(const QString &name);
188 
196  explicit SystemBusNameSubject(PolkitSystemBusName *pkSystemBusName);
197 
203  QString name() const;
204 
210  void setName(const QString &name);
211 };
212 
224 class POLKITQT1_EXPORT UnixSessionSubject : public Subject
225 {
226 public:
232  explicit UnixSessionSubject(const QString &sessionId);
233 
241  explicit UnixSessionSubject(qint64 pid);
242 
250  explicit UnixSessionSubject(PolkitSystemBusName *pkUnixSession);
251 
257  QString sessionId() const;
258 
264  void setSessionId(const QString &sessionId);
265 };
266 
267 }
268 
269 #endif
A class for representing a UNIX process.
Definition: polkitqt1-subject.h:114
This class represents PolicyKit subjects.
Definition: polkitqt1-subject.h:55
Contains Macros for exporting symbols.
Namespace wrapping Polkit-Qt classes.
Definition: listeneradapter.cpp:26
A class for representing unix session.
Definition: polkitqt1-subject.h:224
A class for representing a process owning a unique name on the system bus.
Definition: polkitqt1-subject.h:179