KDECore
kauthaction.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2008 Nicola Gigante <nicola.gigante@gmail.com> 00003 * Copyright (C) 2009 Dario Freddi <drf@kde.org> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Lesser General Public License as published by 00007 * the Free Software Foundation; either version 2.1 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public License 00016 * along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . 00019 */ 00020 00021 #ifndef ACTION_H 00022 #define ACTION_H 00023 00024 #include <QtCore/QString> 00025 #include <QtCore/QVariant> 00026 #include <QtCore/QHash> 00027 00028 #include <kdecore_export.h> 00029 00030 #include "kauthactionreply.h" 00031 00032 namespace KAuth 00033 { 00034 00035 class ActionWatcher; 00036 00069 class KDECORE_EXPORT Action 00070 { 00071 class Private; 00072 Private * const d; 00073 00074 public: 00078 enum AuthStatus { 00079 Denied, 00080 Error, 00081 Invalid, 00082 Authorized, 00083 AuthRequired, 00084 UserCancelled 00085 }; 00086 00094 Action(); 00095 00097 Action(const Action &action); 00098 00103 Action(const QString &name); 00104 00112 Action(const QString &name, const QString &details); 00113 00115 ~Action(); 00116 00118 Action &operator=(const Action &action); 00119 00131 bool operator==(const Action &action) const; 00132 00140 bool operator!=(const Action &action) const; 00141 00151 QString name() const; 00152 00161 void setName(const QString &name); 00162 00170 void setDetails(const QString &details); 00171 00180 QString details() const; 00181 00206 bool isValid() const; 00207 00220 QString helperID() const; 00221 00237 void setHelperID(const QString &id); 00238 00252 bool hasHelper() const; 00253 00265 ActionWatcher *watcher(); 00266 00275 void setArguments(const QVariantMap &arguments); 00276 00285 QVariantMap arguments() const; 00286 00299 void addArgument(const QString &key, const QVariant &value); 00300 00320 AuthStatus authorize() const; 00321 00346 AuthStatus earlyAuthorize() const; 00347 00363 AuthStatus status() const; 00364 00395 ActionReply execute() const; 00396 00406 ActionReply execute(const QString &helperID) const; 00407 00408 void setExecutesAsync(bool async); 00409 bool executesAsync() const; 00410 00440 static bool executeActions(const QList<Action> &actions, QList<Action> *deniedActions, const QString &helperId); 00441 00451 static bool executeActions(const QList<Action> &actions, QList<Action> *deniedActions, const QString &helperId, 00452 QWidget *parent); 00453 00465 void stop(); 00466 00476 void stop(const QString &helperID); 00477 00492 void setParentWidget(QWidget *parent); 00493 00501 QWidget *parentWidget() const; 00502 }; 00503 00504 } // namespace Auth 00505 00506 #endif
KDE 4.6 API Reference