Debian Codegraph @

online-accounts/lib/qt/LomiriOnlineAccounts/error.h

raw symbols SCIP
1 /*
2 * This file is part of libOnlineAccounts
3 *
4 * Copyright (C) 2015 Canonical Ltd.
5 *
6 * Contact: Alberto Mardegan <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License version 3, as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef ONLINE_ACCOUNTS_ERROR_H
22 #define ONLINE_ACCOUNTS_ERROR_H
23
24 #include <QString>
25
26 #include "global.h"
27
28 namespace OnlineAccounts {
29
30 class ONLINE_ACCOUNTS_EXPORT Error
31 {
32 public:
33 enum Code {
34 NoError = 0,
35 NoAccount, /* Account got removed or disabled */
36 WrongType, /* For instance, using a PasswordReply to handle an OAuth
37 reply */
38 UserCanceled, /* The user dismissed the authentication prompt */
39 PermissionDenied,
40 InteractionRequired,
41 };
42
43 Error(): m_code(NoError) {}
44 Error(Code code, const QString &text): m_code(code), m_text(text) {}
45
46 bool isValid() const { return m_code != NoError; }
47
48 Code code() const { return m_code; }
49 QString text() const { return m_text; }
50
51 private:
52 Code m_code;
53 QString m_text;
54 };
55
56 } // namespace
57
58 #endif // ONLINE_ACCOUNTS_ERROR_H