• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

signonerror.h

00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  *
00006  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
00007  * Contact: Alberto Mardegan <alberto.mardegan@nokia.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  */
00028 #ifndef SIGNONERROR_H
00029 #define SIGNONERROR_H
00030 
00031 
00032 #ifdef SIGNON_INTERNAL
00033     #include <QObject>
00034 #endif
00035 
00036 #include <QMetaType>
00037 #include <QString>
00038 
00039 #include <SignOn/libsignoncommon.h>
00040 
00041 namespace SignOn {
00042 
00049     class SIGNON_EXPORT Error
00050 #ifdef SIGNON_INTERNAL
00051     : public QObject { Q_OBJECT
00052 #else
00053     {
00054 #endif
00055     public:
00062         enum ErrorType {
00063             Unknown = 1,               
00065             InternalServer = 2,        
00066             InternalCommunication = 3, 
00067             PermissionDenied = 4,      
00069             EncryptionFailure,         
00070             AuthServiceErr = 100,           /* Placeholder to rearrange enumeration
00071                                              - AuthService specific */
00072             MethodNotKnown,            
00073             ServiceNotAvailable,       
00074             InvalidQuery,              
00075             IdentityErr = 200,              /* Placeholder to rearrange enumeration
00076                                              - Identity specific */
00077             MethodNotAvailable,        
00078             IdentityNotFound,          
00080             StoreFailed,               
00081             RemoveFailed,              
00082             SignOutFailed,             
00083             IdentityOperationCanceled, 
00084             CredentialsNotAvailable,   
00085             ReferenceNotFound,         
00086             AuthSessionErr = 300,      /* Placeholder to rearrange enumeration
00087                                              - AuthSession/AuthPluginInterface specific */
00088             MechanismNotAvailable,     
00089             MissingData,               
00091             InvalidCredentials,        
00093             NotAuthorized,             
00094             WrongState,                
00096             OperationNotSupported,     
00098             NoConnection,              
00099             Network,                   
00100             Ssl,                       
00101             Runtime,                   
00102             SessionCanceled,           
00103             TimedOut,                  
00104             UserInteraction,           
00105             OperationFailed,           
00106             EncryptionFailed,          
00107             TOSNotAccepted,            
00108             ForgotPassword,            
00109             MethodOrMechanismNotAllowed, 
00110             IncorrectDate,             
00111             UserErr = 400                   /* Placeholder to rearrange enumeration
00112                                              - User space specific */
00113         };
00114 
00118         Error() : m_type((int)Unknown), m_message(QString()) { registerType(); }
00119 
00125         Error(const Error &src) :
00126 #ifdef SIGNON_INTERNAL
00127             QObject(),
00128 #endif
00129             m_type(src.type()), m_message(src.message()) {}
00130 
00136         Error(int type, const QString &message = QString()) : m_type(type), m_message(message)
00137             { registerType(); }
00138 
00143         Error &operator=(const Error &src)
00144             { m_type = src.type(); m_message = src.message(); return *this; }
00145 
00149         virtual ~Error() {}
00150 
00158         void setType(int type) { m_type = type; }
00159 
00164         void setMessage(const QString &message) { m_message = message; }
00165 
00169         int type() const { return m_type; }
00170 
00174         QString message() const { return m_message; }
00175 
00176     private:
00177         void registerType()
00178             { qRegisterMetaType<Error>("SignOn::Error"); }
00179 
00180     private:
00181         int m_type;
00182         QString m_message;
00183     };
00184 
00185 } //namespace SignOn
00186 
00187 Q_DECLARE_METATYPE(SignOn::Error)
00188 
00189 #endif // SIGNONERROR_H

Generated on Wed Jul 13 2011 22:08:28 by  doxygen 1.7.1