KDECore
kauthactionreply.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_REPLY_H 00022 #define ACTION_REPLY_H 00023 00024 #include <QtCore/QString> 00025 #include <QtCore/QVariant> 00026 #include <QtCore/QMap> 00027 #include <QtCore/QDataStream> 00028 00029 #include <kdecore_export.h> 00328 namespace KAuth 00329 { 00330 00366 class KDECORE_EXPORT ActionReply 00367 { 00368 class Private; 00369 Private * const d; 00370 00371 public: 00375 enum Type { 00376 KAuthError, 00377 HelperError, 00378 Success 00379 }; 00380 00381 static const ActionReply SuccessReply; 00382 static const ActionReply HelperErrorReply; 00383 00384 static const ActionReply NoResponderReply; 00385 static const ActionReply NoSuchActionReply; 00386 static const ActionReply InvalidActionReply; 00387 static const ActionReply AuthorizationDeniedReply; 00388 static const ActionReply UserCancelledReply; 00389 static const ActionReply HelperBusyReply; 00390 static const ActionReply DBusErrorReply; 00391 00395 enum Error { 00396 NoError = 0, 00397 NoResponder, 00398 NoSuchAction, 00399 InvalidAction, 00400 AuthorizationDenied, 00401 UserCancelled, 00402 HelperBusy, 00403 DBusError 00404 }; 00405 00407 ActionReply(); 00408 00420 ActionReply(Type type); 00421 00431 ActionReply(int errorCode); 00432 00434 ActionReply(const ActionReply &reply); 00435 00437 virtual ~ActionReply(); 00438 00447 void setData(const QVariantMap &data); 00448 00458 QVariantMap data() const; 00459 00472 void addData(const QString &key, const QVariant &value); 00473 00475 Type type() const; 00476 00492 void setType(Type type); 00493 00495 bool succeeded() const; 00496 00498 bool failed() const; 00499 00509 int errorCode() const; 00510 00523 void setErrorCode(int errorCode); 00524 00535 QString errorDescription() const; 00536 00545 void setErrorDescription(const QString &error); 00546 00555 QByteArray serialized() const; 00556 00565 static ActionReply deserialize(const QByteArray &data); 00566 00568 ActionReply &operator=(const ActionReply &reply); 00569 00585 bool operator==(const ActionReply &reply) const; 00586 00592 bool operator!=(const ActionReply &reply) const; 00593 00595 friend QDataStream &operator<<(QDataStream &, const ActionReply &); 00596 00598 friend QDataStream &operator>>(QDataStream &, ActionReply &); 00599 00600 }; 00601 00602 } // namespace Auth 00603 00604 #endif
KDE 4.6 API Reference