- Main Page
- Related Pages
- Classes
- Files

- File List

signonerror.h
1 /*
2 * This file is part of signon
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation.
5 *
6 * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 */
28 #ifndef SIGNONERROR_H
29 #define SIGNONERROR_H
30
31
32 #ifdef SIGNON_INTERNAL
33 #include <QObject>
34 #endif
35
36 #include <QMetaType>
37 #include <QString>
38
39 #include <SignOn/libsignoncommon.h>
40
41 namespace SignOn {
42
49 class SIGNON_EXPORT Error
50 #ifdef SIGNON_INTERNAL
51 : public QObject { Q_OBJECT
52 #else
53 {
54 #endif
55 public:
64 enum ErrorType {
65 Unknown = 1,
67 InternalServer = 2,
68 InternalCommunication = 3,
70 PermissionDenied = 4,
72 EncryptionFailure,
74 AuthServiceErr = 100, /* Placeholder to rearrange enumeration
75 - AuthService specific */
76 MethodNotKnown,
78 ServiceNotAvailable,
80 InvalidQuery,
81 IdentityErr = 200, /* Placeholder to rearrange enumeration
82 - Identity specific */
83 MethodNotAvailable,
84 IdentityNotFound,
86 StoreFailed,
87 RemoveFailed,
88 SignOutFailed,
89 IdentityOperationCanceled,
91 CredentialsNotAvailable,
92 ReferenceNotFound,
94 AuthSessionErr = 300, /* Placeholder to rearrange enumeration
95 - AuthSession/AuthPluginInterface
96 specific */
97 MechanismNotAvailable,
99 MissingData,
101 InvalidCredentials,
103 NotAuthorized,
104 WrongState,
106 OperationNotSupported,
108 NoConnection,
109 Network,
110 Ssl,
111 Runtime,
113 SessionCanceled,
114 TimedOut,
115 UserInteraction,
116 OperationFailed,
117 EncryptionFailed,
119 TOSNotAccepted,
120 ForgotPassword,
122 MethodOrMechanismNotAllowed,
124 IncorrectDate,
125 UserErr = 400 /* Placeholder to rearrange enumeration
126 - User space specific */
127 };
128
132 Error() : m_type((int)Unknown), m_message(QString()) { registerType(); }
133
139 Error(const Error &src) :
140 #ifdef SIGNON_INTERNAL
141 QObject(),
142 #endif
143 m_type(src.type()), m_message(src.message()) {}
144
150 Error(int type, const QString &message = QString()):
151 m_type(type), m_message(message) { registerType(); }
152
157 Error &operator=(const Error &src)
158 { m_type = src.type(); m_message = src.message(); return *this; }
159
163 virtual ~Error() {}
164
172 void setType(int type) { m_type = type; }
173
178 void setMessage(const QString &message) { m_message = message; }
179
183 int type() const { return m_type; }
184
188 QString message() const { return m_message; }
189
190 private:
191 inline void registerType();
192
193 private:
194 int m_type;
195 QString m_message;
196 };
197
198 } //namespace SignOn
199
200 Q_DECLARE_METATYPE(SignOn::Error)
201
202 void SignOn::Error::registerType() {
203 qRegisterMetaType<SignOn::Error>("SignOn::Error");
204 }
205
206 #endif // SIGNONERROR_H
SignOn::Error::CredentialsNotAvailable
Definition: signonerror.h:91
SignOn::Error::Network
Definition: signonerror.h:109
SignOn::Error::IncorrectDate
Definition: signonerror.h:124
SignOn::Error::setMessage
void setMessage(const QString &message)
Sets the error message.
Definition: signonerror.h:178
SignOn::Error::message
QString message() const
Definition: signonerror.h:188
SignOn::Error::UserInteraction
Definition: signonerror.h:115
SignOn::Error::Error
Error()
Constructor.
Definition: signonerror.h:132
SignOn::Error::Error
Error(const Error &src)
Copy constructor.
Definition: signonerror.h:139
SignOn::Error::SignOutFailed
Definition: signonerror.h:88
SignOn::Error::NoConnection
Definition: signonerror.h:108
SignOn::Error::setType
void setType(int type)
Sets the type of the error.
Definition: signonerror.h:172
SignOn::Error::SessionCanceled
Definition: signonerror.h:113
SignOn::Error::Error
Error(int type, const QString &message=QString())
For convenience constructor.
Definition: signonerror.h:150
SignOn::Error::StoreFailed
Definition: signonerror.h:86
SignOn::Error::NotAuthorized
Definition: signonerror.h:103
SignOn::Error::~Error
virtual ~Error()
Destructor.
Definition: signonerror.h:163
SignOn::Error::InvalidQuery
Definition: signonerror.h:80
SignOn::Error::MethodNotAvailable
Definition: signonerror.h:83
SignOn::Error::Ssl
Definition: signonerror.h:110
SignOn::Error::type
int type() const
Definition: signonerror.h:183
SignOn::Error::ErrorType
ErrorType
Error codes for all the Signon by default supported errors.
Definition: signonerror.h:64
SignOn::Error::TOSNotAccepted
Definition: signonerror.h:119
SignOn::Error::TimedOut
Definition: signonerror.h:114
SignOn::Error::OperationFailed
Definition: signonerror.h:116
SignOn::Error
definition for Signon error handling.
Definition: signonerror.h:49
SignOn::Error::operator=
Error & operator=(const Error &src)
Assignment operator.
Definition: signonerror.h:157
SignOn::Error::RemoveFailed
Definition: signonerror.h:87