Polkit-Qt-1  0.95.0
polkitqt1-agent-session.h
1 /*
2  * This file is part of the PolKit1-qt project
3  * Copyright (C) 2009 Radek Novacek <rnovacek@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_AGENT_SESSION_H
22 #define POLKITQT1_AGENT_SESSION_H
23 
24 #include <QtCore/QObject>
25 #include "polkitqt1-identity.h"
26 
27 typedef struct _GSimpleAsyncResult GSimpleAsyncResult;
28 typedef struct _PolkitAgentSession PolkitAgentSession;
29 
30 namespace PolkitQt1
31 {
32 
41 namespace Agent
42 {
43 
48 class POLKITQT1_EXPORT AsyncResult
49 {
50 public:
51  explicit AsyncResult(GSimpleAsyncResult *result);
52  virtual ~AsyncResult();
53 
57  void setCompleted();
58 
65  void setError(const QString &text);
66 
67 private:
68  class Private;
69  Private * const d;
70 };
71 
80 class POLKITQT1_EXPORT Session : public QObject
81 {
82  Q_OBJECT
83  Q_DISABLE_COPY(Session)
84 public:
93  Session(const PolkitQt1::Identity& identity, const QString &cookie, AsyncResult *result = 0, QObject *parent = 0);
94 
103  explicit Session(PolkitAgentSession *pkAgentSession, QObject *parent = 0);
104 
108  ~Session();
109 
115  void initiate();
116 
122  void setResponse(const QString &response);
123 
128  void cancel();
129 
135  AsyncResult *result();
136 
137 Q_SIGNALS:
144  void completed(bool gainedAuthorization);
145 
153  void request(const QString &request, bool echo);
154 
161  void showError(const QString &text);
162 
169  void showInfo(const QString &text);
170 
171 private:
172  class Private;
173  Private * const d;
174 };
175 
176 }
177 
178 }
179 
180 #endif // SESSION_H
Definition: polkitqt1-agent-session.h:80
Abstract class representing identities.
Definition: polkitqt1-identity.h:59
Namespace wrapping Polkit-Qt classes.
Definition: listeneradapter.cpp:26
Namespace wrapping Polkit-Qt Agent classes.