KDECore
Polkit1Backend.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com> 00003 * Copyright (C) 2009 Radek Novacek <rnovacek@redhat.com> 00004 * Copyright (C) 2009-2010 Dario Freddi <drf@kde.org> 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2.1 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program; if not, write to the 00018 * Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . 00020 */ 00021 00022 #ifndef POLKIT1BACKEND_H 00023 #define POLKIT1BACKEND_H 00024 00025 #include "AuthBackend.h" 00026 00027 #include <QtCore/QHash> 00028 #include <QtCore/QEventLoop> 00029 #include <QtCore/QStringList> 00030 00031 #include <PolkitQt1/Authority> 00032 00033 class QByteArray; 00034 00035 namespace KAuth 00036 { 00037 00038 class Polkit1Backend : public AuthBackend 00039 { 00040 Q_OBJECT 00041 Q_INTERFACES(KAuth::AuthBackend) 00042 00043 public: 00044 Polkit1Backend(); 00045 virtual ~Polkit1Backend(); 00046 virtual void setupAction(const QString&); 00047 virtual void preAuthAction(const QString& action, QWidget* parent); 00048 virtual Action::AuthStatus authorizeAction(const QString&); 00049 virtual Action::AuthStatus actionStatus(const QString&); 00050 virtual QByteArray callerID() const; 00051 virtual bool isCallerAuthorized(const QString &action, QByteArray callerID); 00052 virtual bool actionExists(const QString& action); 00053 00054 private Q_SLOTS: 00055 void checkForResultChanged(); 00056 void updateCachedActions(const PolkitQt1::ActionDescription::List &actions); 00057 00058 private: 00059 QHash<QString, Action::AuthStatus> m_cachedResults; 00060 QStringList m_knownActions; 00061 bool m_flyingActions; 00062 }; 00063 00064 class PolkitResultEventLoop : public QEventLoop 00065 { 00066 Q_OBJECT 00067 public: 00068 PolkitResultEventLoop(QObject* parent = 0); 00069 virtual ~PolkitResultEventLoop(); 00070 00071 PolkitQt1::Authority::Result result() const; 00072 00073 public Q_SLOTS: 00074 void requestQuit(const PolkitQt1::Authority::Result &result); 00075 00076 private: 00077 PolkitQt1::Authority::Result m_result; 00078 }; 00079 00080 } // namespace Auth 00081 00082 #endif
KDE 4.6 API Reference