|
56.1.25
by Harald Sitter
License headers++ |
1 |
/*
|
2 |
Copyright © 2010 Harald Sitter <apachelogger@ubuntu.com>
|
|
3 |
||
4 |
This program is free software; you can redistribute it and/or
|
|
5 |
modify it under the terms of the GNU General Public License as
|
|
6 |
published by the Free Software Foundation; either version 2 of
|
|
7 |
the License or (at your option) version 3 or any later version
|
|
8 |
accepted by the membership of KDE e.V. (or its successor approved
|
|
9 |
by the membership of KDE e.V.), which shall act as a proxy
|
|
10 |
defined in Section 14 of version 3 of the license.
|
|
11 |
||
12 |
This program is distributed in the hope that it will be useful,
|
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
GNU General Public License for more details.
|
|
16 |
||
17 |
You should have received a copy of the GNU General Public License
|
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 |
*/
|
|
20 |
||
|
56.1.16
by Harald Sitter
Majore refactor towards saner api structure |
21 |
#include "Account.h"
|
22 |
||
|
76
by Harald Sitter
More sanity for the api -- off to bed commit (technically I already am ;)) |
23 |
#include <qjson/qobjecthelper.h>
|
24 |
||
25 |
#include "CouchDB.h"
|
|
26 |
#include "Subscription.h"
|
|
27 |
||
|
136
by Harald Sitter
formatting++ |
28 |
namespace UbuntuOne |
29 |
{
|
|
|
156
by Harald Sitter
namespace indention ... spec does not define whether namespaces are indented or not, so general rule of indention is supposedly to be applied |
30 |
namespace Api |
31 |
{
|
|
32 |
||
33 |
class AccountPrivate |
|
34 |
{
|
|
35 |
public:
|
|
36 |
virtual ~AccountPrivate() {} |
|
37 |
||
38 |
CouchDB *m_couchdb; |
|
39 |
QString m_couchdbRoot; |
|
40 |
QString m_email; |
|
41 |
QString m_firstName; |
|
42 |
qulonglong m_id; |
|
43 |
QString m_lastName; |
|
44 |
QString m_nickname; |
|
45 |
QString m_openid; |
|
46 |
Subscription *m_subscription; |
|
47 |
QString m_username; |
|
48 |
};
|
|
49 |
||
50 |
Account::Account(QObject *parent) : |
|
51 |
QObject(parent), |
|
52 |
d_ptr(new AccountPrivate) |
|
53 |
{
|
|
54 |
Q_D(Account); |
|
55 |
||
56 |
d->m_couchdb = new CouchDB(this); |
|
57 |
d->m_subscription = new Subscription(this); |
|
58 |
}
|
|
59 |
||
60 |
Account::~Account() |
|
61 |
{
|
|
62 |
delete d_ptr; |
|
63 |
}
|
|
64 |
||
65 |
CouchDB *Account::couchdb() const |
|
66 |
{
|
|
67 |
Q_D(const Account); |
|
68 |
||
69 |
return d->m_couchdb; |
|
70 |
}
|
|
71 |
||
72 |
void Account::setCouchdb(const QVariantMap &couchdb) |
|
73 |
{
|
|
74 |
QJson::QObjectHelper::qvariant2qobject(couchdb, |
|
75 |
this->couchdb()); |
|
76 |
}
|
|
77 |
||
78 |
QString Account::couchdbRoot() const |
|
79 |
{
|
|
80 |
Q_D(const Account); |
|
81 |
||
82 |
return d->m_couchdbRoot; |
|
83 |
}
|
|
84 |
||
85 |
void Account::setCouchdbRoot(const QString &couchdbRoot) |
|
86 |
{
|
|
87 |
Q_D(Account); |
|
88 |
||
89 |
d->m_couchdbRoot = couchdbRoot; |
|
90 |
}
|
|
91 |
||
92 |
QString Account::email() const |
|
93 |
{
|
|
94 |
Q_D(const Account); |
|
95 |
||
96 |
return d->m_email; |
|
97 |
}
|
|
98 |
||
99 |
void Account::setEmail(const QString &email) |
|
100 |
{
|
|
101 |
Q_D(Account); |
|
102 |
||
103 |
d->m_email = email; |
|
104 |
}
|
|
105 |
||
106 |
QString Account::firstName() const |
|
107 |
{
|
|
108 |
Q_D(const Account); |
|
109 |
||
110 |
return d->m_firstName; |
|
111 |
}
|
|
112 |
||
113 |
void Account::setFirstName(const QString &firstName) |
|
114 |
{
|
|
115 |
Q_D(Account); |
|
116 |
||
117 |
d->m_firstName = firstName; |
|
118 |
}
|
|
119 |
||
120 |
qulonglong Account::id() const |
|
121 |
{
|
|
122 |
Q_D(const Account); |
|
123 |
||
124 |
return d->m_id; |
|
125 |
}
|
|
126 |
||
127 |
void Account::setId(const qulonglong &id) |
|
128 |
{
|
|
129 |
Q_D(Account); |
|
130 |
||
131 |
d->m_id = id; |
|
132 |
}
|
|
133 |
||
134 |
QString Account::lastName() const |
|
135 |
{
|
|
136 |
Q_D(const Account); |
|
137 |
||
138 |
return d->m_lastName; |
|
139 |
}
|
|
140 |
||
141 |
void Account::setLastName(const QString &lastName) |
|
142 |
{
|
|
143 |
Q_D(Account); |
|
144 |
||
145 |
d->m_lastName = lastName; |
|
146 |
}
|
|
147 |
||
148 |
QString Account::nickname() const |
|
149 |
{
|
|
150 |
Q_D(const Account); |
|
151 |
||
152 |
return d->m_nickname; |
|
153 |
}
|
|
154 |
||
155 |
void Account::setNickname(const QString &nickname) |
|
156 |
{
|
|
157 |
Q_D(Account); |
|
158 |
||
159 |
d->m_nickname = nickname; |
|
160 |
}
|
|
161 |
||
162 |
QString Account::openid() const |
|
163 |
{
|
|
164 |
Q_D(const Account); |
|
165 |
||
166 |
return d->m_openid; |
|
167 |
}
|
|
168 |
||
169 |
void Account::setOpenid(const QString &openid) |
|
170 |
{
|
|
171 |
Q_D(Account); |
|
172 |
||
173 |
d->m_openid = openid; |
|
174 |
}
|
|
175 |
||
176 |
Subscription *Account::subscription() const |
|
177 |
{
|
|
178 |
Q_D(const Account); |
|
179 |
||
180 |
return d->m_subscription; |
|
181 |
}
|
|
182 |
||
183 |
void Account::setSubscription(const QVariantMap &subscription) |
|
184 |
{
|
|
185 |
QJson::QObjectHelper::qvariant2qobject(subscription, |
|
186 |
this->subscription()); |
|
187 |
}
|
|
188 |
||
189 |
QString Account::username() const |
|
190 |
{
|
|
191 |
Q_D(const Account); |
|
192 |
||
193 |
return d->m_username; |
|
194 |
}
|
|
195 |
||
196 |
void Account::setUsername(const QString &username) |
|
197 |
{
|
|
198 |
Q_D(Account); |
|
199 |
||
200 |
d->m_username = username; |
|
201 |
}
|
|
202 |
||
203 |
||
204 |
} // namespace Api |
|
|
56.1.16
by Harald Sitter
Majore refactor towards saner api structure |
205 |
} // namespace UbuntuOne |