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> 00332 namespace KAuth 00333 { 00334 00370 class KDECORE_EXPORT ActionReply 00371 { 00372 class Private; 00373 Private * const d; 00374 00375 public: 00379 enum Type { 00380 KAuthError, 00381 HelperError, 00382 Success 00383 }; 00384 00385 static const ActionReply SuccessReply; 00386 static const ActionReply HelperErrorReply; 00387 00388 static const ActionReply NoResponderReply; 00389 static const ActionReply NoSuchActionReply; 00390 static const ActionReply InvalidActionReply; 00391 static const ActionReply AuthorizationDeniedReply; 00392 static const ActionReply UserCancelledReply; 00393 static const ActionReply HelperBusyReply; 00394 static const ActionReply DBusErrorReply; 00395 00399 enum Error { 00400 NoError = 0, 00401 NoResponder, 00402 NoSuchAction, 00403 InvalidAction, 00404 AuthorizationDenied, 00405 UserCancelled, 00406 HelperBusy, 00407 DBusError 00408 }; 00409 00411 ActionReply(); 00412 00424 ActionReply(Type type); 00425 00435 ActionReply(int errorCode); 00436 00438 ActionReply(const ActionReply &reply); 00439 00441 virtual ~ActionReply(); 00442 00451 void setData(const QVariantMap &data); 00452 00462 QVariantMap data() const; 00463 00476 void addData(const QString &key, const QVariant &value); 00477 00479 Type type() const; 00480 00496 void setType(Type type); 00497 00499 bool succeeded() const; 00500 00502 bool failed() const; 00503 00513 int errorCode() const; 00514 00527 void setErrorCode(int errorCode); 00528 00539 QString errorDescription() const; 00540 00549 void setErrorDescription(const QString &error); 00550 00559 QByteArray serialized() const; 00560 00569 static ActionReply deserialize(const QByteArray &data); 00570 00572 ActionReply &operator=(const ActionReply &reply); 00573 00589 bool operator==(const ActionReply &reply) const; 00590 00596 bool operator!=(const ActionReply &reply) const; 00597 00599 friend QDataStream &operator<<(QDataStream &, const ActionReply &); 00600 00602 friend QDataStream &operator>>(QDataStream &, ActionReply &); 00603 00604 }; 00605 00606 } // namespace Auth 00607 00608 #endif
KDE 4.7 API Reference