accounts-qt: Accounts/auth-data.cpp Source File

accounts-qt 1.12

- Main Page
- Related Pages
- Classes
- Files

- File List

auth-data.cpp
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /*
3 * This file is part of libaccounts-qt
4 *
5 * Copyright (C) 2012 Canonical Ltd.
6 *
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 */
23
24 #include "auth-data.h"
25 #include "utils.h"
26
27 #undef signals
28 #include <libaccounts-glib/ag-auth-data.h>
29 #include <QtDebug>
30 #include <QtGlobal>
31
32
33 using namespace Accounts;
34
35 namespace Accounts {
46 }; // namespace
47
48 AuthData::AuthData(AgAuthData *authData):
49 m_authData(ag_auth_data_ref(authData))
50 {
51 }
52
57 AuthData::AuthData(const AuthData &other):
58 m_authData(ag_auth_data_ref(other.m_authData))
59 {
60 }
61
65 AuthData::~AuthData()
66 {
67 ag_auth_data_unref(m_authData);
68 m_authData = 0;
69 }
70
74 uint AuthData::credentialsId() const
75 {
76 return ag_auth_data_get_credentials_id(m_authData);
77 }
78
84 QString AuthData::method() const
85 {
86 return UTF8(ag_auth_data_get_method(m_authData));
87 }
88
94 QString AuthData::mechanism() const
95 {
96 return UTF8(ag_auth_data_get_mechanism(m_authData));
97 }
98
104 QVariantMap AuthData::parameters() const
105 {
106 GVariant *glibParameters;
107
108 glibParameters = ag_auth_data_get_login_parameters(m_authData, NULL);
109 if (glibParameters == 0) return QVariantMap();
110
111 QVariant variant = gVariantToQVariant(glibParameters);
112 if (!variant.isValid()) return QVariantMap();
113
114 return variant.toMap();
115 }
Accounts::AuthData::~AuthData
virtual ~AuthData()
Destructor.
Definition: auth-data.cpp:65
Accounts::AuthData
Information for account authentication.
Definition: auth-data.h:49
Accounts::AuthData::method
QString method() const
Get the authentication method which must be used when logging in with this account.
Definition: auth-data.cpp:84
Accounts::AuthData::credentialsId
uint credentialsId() const
Definition: auth-data.cpp:74
Accounts::AuthData::mechanism
QString mechanism() const
Get the authentication mechanism which must be used when logging in with this account.
Definition: auth-data.cpp:94
Accounts::AuthData::parameters
QVariantMap parameters() const
Get the dictionary of authentication parameters which must be used when logging in with this account...
Definition: auth-data.cpp:104
Accounts::AuthData::AuthData
AuthData(const AuthData &other)
Copy constructor.
Definition: auth-data.cpp:48