Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/policykit-agent/policykitlistener.h
- This file was added.
1 | #ifndef POLICYKITLISTENER_H | ||||
---|---|---|---|---|---|
2 | #define POLICYKITLISTENER_H | ||||
3 | | ||||
4 | /* This file is part of the KDE project | ||||
5 | Copyright (C) 2009 Jaroslav Reznik <jreznik@redhat.com> | ||||
6 | | ||||
7 | This program is free software; you can redistribute it and/or | ||||
8 | modify it under the terms of the GNU General Public | ||||
9 | License as published by the Free Software Foundation; either | ||||
10 | version 2 of the License, or (at your option) any later version. | ||||
11 | | ||||
12 | This library is distributed in the hope that it will be useful, | ||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | Library General Public License for more details. | ||||
16 | | ||||
17 | You should have received a copy of the GNU Library General Public License | ||||
18 | along with this library; see the file COPYING.LIB. If not, write to | ||||
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
20 | Boston, MA 02110-1301, USA. | ||||
21 | | ||||
22 | */ | ||||
23 | | ||||
24 | #include <QPointer> | ||||
25 | #include <QHash> | ||||
26 | | ||||
27 | #include <PolkitQt1/Agent/Listener> | ||||
28 | | ||||
29 | class AuthDialog; | ||||
30 | | ||||
31 | using namespace PolkitQt1::Agent; | ||||
32 | | ||||
33 | class PolicyKitListener : public Listener | ||||
34 | { | ||||
35 | Q_OBJECT | ||||
36 | Q_CLASSINFO("D-Bus Interface", "org.kde.Polkit1AuthAgent") | ||||
37 | public: | ||||
38 | PolicyKitListener(QObject *parent = 0); | ||||
39 | virtual ~PolicyKitListener(); | ||||
40 | | ||||
41 | public slots: | ||||
42 | void initiateAuthentication(const QString &actionId, | ||||
43 | const QString &message, | ||||
44 | const QString &iconName, | ||||
45 | const PolkitQt1::Details &details, | ||||
46 | const QString &cookie, | ||||
47 | const PolkitQt1::Identity::List &identities, | ||||
48 | PolkitQt1::Agent::AsyncResult* result) Q_DECL_OVERRIDE; | ||||
49 | bool initiateAuthenticationFinish() Q_DECL_OVERRIDE; | ||||
50 | void cancelAuthentication() Q_DECL_OVERRIDE; | ||||
51 | | ||||
52 | void tryAgain(); | ||||
53 | void finishObtainPrivilege(); | ||||
54 | | ||||
55 | void request(const QString &request, bool echo); | ||||
56 | void completed(bool gainedAuthorization); | ||||
57 | void showError(const QString &text); | ||||
58 | | ||||
59 | void setWIdForAction(const QString &action, qulonglong wID); | ||||
60 | | ||||
61 | private: | ||||
62 | QPointer<AuthDialog> m_dialog; | ||||
63 | QPointer<Session> m_session; | ||||
64 | bool m_inProgress; | ||||
65 | bool m_gainedAuthorization; | ||||
66 | bool m_wasCancelled; | ||||
67 | int m_numTries; | ||||
68 | PolkitQt1::Identity::List m_identities; | ||||
69 | PolkitQt1::Agent::AsyncResult* m_result; | ||||
70 | QString m_cookie; | ||||
71 | PolkitQt1::Identity m_selectedUser; | ||||
72 | QHash< QString, qulonglong > m_actionsToWID; | ||||
73 | | ||||
74 | private slots: | ||||
75 | void dialogAccepted(); | ||||
76 | void dialogCanceled(); | ||||
77 | void userSelected(const PolkitQt1::Identity &identity); | ||||
78 | }; | ||||
79 | | ||||
80 | #endif |