Merge lp:~mardy/account-plugins/mcloud-plugin-lp1587282 into lp:account-plugins
- mcloud-plugin-lp1587282
- Merge into trunk
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~mardy/account-plugins/mcloud-plugin-lp1587282 | ||||
Merge into: | lp:account-plugins | ||||
Diff against target: |
596 lines (+448/-2) 16 files modified
.bzrignore (+3/-0) Makefile.am (+12/-0) configure.ac (+25/-0) data/providers/mcloud.provider.in.in (+28/-0) data/providers/owncloud.provider.in.in (+13/-0) data/providers/vk.provider.in.in (+26/-0) debian/account-plugin-mcloud.install (+4/-0) debian/account-plugin-owncloud.install (+3/-0) debian/account-plugin-vk.install (+3/-0) debian/control (+23/-0) debian/rules (+4/-1) qml/Makefile.am (+5/-1) qml/mcloud/Main.qml (+6/-0) qml/owncloud/Main.qml (+27/-0) qml/owncloud/NewAccount.qml (+230/-0) qml/vk/Main.qml (+36/-0) |
||||
To merge this branch: | bzr merge lp:~mardy/account-plugins/mcloud-plugin-lp1587282 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Online Accounts | Pending | ||
Review via email: mp+296318@code.launchpad.net |
Commit message
Add account plugin for MCloud
Description of the change
Add account plugin for MCloud
- 166. By Alberto Mardegan
-
Merge from trunk
* debian/control:
Update package descriptions for all account plugins (LP: #1590786)
[ Alberto Mardegan ]
* Add account plugin for vk.com (LP: #1564883)
* Add ownCloud plugin (LP: #1570986)
[ Alberto Mardegan ]
* After the authentication, retrieve the username in Google, Facebook,
Flickr and Twitter plugins (LP: #1565772)
* debian/control, debian/libaccount- plugin- facebook. install,
debian/libaccount- plugin- flickr. install,
debian/libaccount- plugin- twitter. install:
add packages containing plugin modules.
* debian/account- plugin- facebook. install,
debian/account- plugin- flickr. install,
debian/account- plugin- twitter. install:
remove unneeded webkit-options files.
[ CI Train Bot ]
* No-change rebuild. - 167. By Alberto Mardegan
-
Update description
Unmerged revisions
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2016-04-05 10:03:39 +0000 | |||
3 | +++ .bzrignore 2016-06-02 12:13:37 +0000 | |||
4 | @@ -28,10 +28,13 @@ | |||
5 | 28 | /debian/account-plugin-google/ | 28 | /debian/account-plugin-google/ |
6 | 29 | /debian/account-plugin-icons/ | 29 | /debian/account-plugin-icons/ |
7 | 30 | /debian/account-plugin-identica/ | 30 | /debian/account-plugin-identica/ |
8 | 31 | /debian/account-plugin-mcloud/ | ||
9 | 32 | /debian/account-plugin-owncloud/ | ||
10 | 31 | /debian/account-plugin-sina/ | 33 | /debian/account-plugin-sina/ |
11 | 32 | /debian/account-plugin-sohu/ | 34 | /debian/account-plugin-sohu/ |
12 | 33 | /debian/account-plugin-tools/ | 35 | /debian/account-plugin-tools/ |
13 | 34 | /debian/account-plugin-twitter/ | 36 | /debian/account-plugin-twitter/ |
14 | 37 | /debian/account-plugin-vk/ | ||
15 | 35 | /debian/account-plugin-windows-live/ | 38 | /debian/account-plugin-windows-live/ |
16 | 36 | /debian/autoreconf.after | 39 | /debian/autoreconf.after |
17 | 37 | /debian/autoreconf.before | 40 | /debian/autoreconf.before |
18 | 38 | 41 | ||
19 | === modified file 'Makefile.am' | |||
20 | --- Makefile.am 2016-04-05 10:46:13 +0000 | |||
21 | +++ Makefile.am 2016-06-02 12:13:37 +0000 | |||
22 | @@ -89,9 +89,12 @@ | |||
23 | 89 | data/providers/identica.provider.in.in \ | 89 | data/providers/identica.provider.in.in \ |
24 | 90 | data/providers/linkedin.provider.in.in \ | 90 | data/providers/linkedin.provider.in.in \ |
25 | 91 | data/providers/instagram.provider.in.in \ | 91 | data/providers/instagram.provider.in.in \ |
26 | 92 | data/providers/mcloud.provider.in.in \ | ||
27 | 93 | data/providers/owncloud.provider.in.in \ | ||
28 | 92 | data/providers/sina.provider.in.in \ | 94 | data/providers/sina.provider.in.in \ |
29 | 93 | data/providers/sohu.provider.in.in \ | 95 | data/providers/sohu.provider.in.in \ |
30 | 94 | data/providers/twitter.provider.in.in \ | 96 | data/providers/twitter.provider.in.in \ |
31 | 97 | data/providers/vk.provider.in.in \ | ||
32 | 95 | data/providers/windows-live.provider.in.in | 98 | data/providers/windows-live.provider.in.in |
33 | 96 | 99 | ||
34 | 97 | providers_DATA = \ | 100 | providers_DATA = \ |
35 | @@ -132,6 +135,15 @@ | |||
36 | 132 | data/webkit-options/login.live.com.conf \ | 135 | data/webkit-options/login.live.com.conf \ |
37 | 133 | data/webkit-options/www.linkedin.com.conf | 136 | data/webkit-options/www.linkedin.com.conf |
38 | 134 | 137 | ||
39 | 138 | # Temporary until these bugs are fixed: | ||
40 | 139 | # https://bugs.launchpad.net/bugs/1567908 | ||
41 | 140 | # https://bugs.launchpad.net/bugs/1571587 | ||
42 | 141 | iconsdir = $(datadir)/icons/hicolor/32x32/apps | ||
43 | 142 | dist_icons_DATA = \ | ||
44 | 143 | data/icons/mcloud.png \ | ||
45 | 144 | data/icons/owncloud.png \ | ||
46 | 145 | data/icons/vk.png | ||
47 | 146 | |||
48 | 135 | dist_bin_SCRIPTS = \ | 147 | dist_bin_SCRIPTS = \ |
49 | 136 | tools/account-console | 148 | tools/account-console |
50 | 137 | 149 | ||
51 | 138 | 150 | ||
52 | === modified file 'configure.ac' | |||
53 | --- configure.ac 2016-04-05 10:03:39 +0000 | |||
54 | +++ configure.ac 2016-06-02 12:13:37 +0000 | |||
55 | @@ -228,6 +228,28 @@ | |||
56 | 228 | AC_SUBST(SOHU_CLIENT_ID, ["$sohu_client_id"]) | 228 | AC_SUBST(SOHU_CLIENT_ID, ["$sohu_client_id"]) |
57 | 229 | AC_SUBST(SOHU_CLIENT_SECRET, ["$sohu_client_secret"]) | 229 | AC_SUBST(SOHU_CLIENT_SECRET, ["$sohu_client_secret"]) |
58 | 230 | 230 | ||
59 | 231 | # Set Mcloud client id/secret | ||
60 | 232 | AC_ARG_WITH(mcloud-client-id, | ||
61 | 233 | [AS_HELP_STRING([--with-mcloud-client-id], | ||
62 | 234 | [Mcloud client id])], | ||
63 | 235 | [mcloud_client_id=$withval], | ||
64 | 236 | [mcloud_client_id="APP1ZtqoN3R0002"]) | ||
65 | 237 | AC_ARG_WITH(mcloud-client-secret, | ||
66 | 238 | [AS_HELP_STRING([--with-mcloud-client-secret], | ||
67 | 239 | [Mcloud client secret])], | ||
68 | 240 | [mcloud_client_secret=$withval], | ||
69 | 241 | [mcloud_client_secret="A70EFCDC91456349E7FDECF0A33574AC"]) | ||
70 | 242 | AC_SUBST(MCLOUD_CLIENT_ID, ["$mcloud_client_id"]) | ||
71 | 243 | AC_SUBST(MCLOUD_CLIENT_SECRET, ["$mcloud_client_secret"]) | ||
72 | 244 | |||
73 | 245 | # Set VK client id | ||
74 | 246 | AC_ARG_WITH(vk-client-id, | ||
75 | 247 | [AS_HELP_STRING([--with-vk-client-id], | ||
76 | 248 | [VK client ID])], | ||
77 | 249 | [vk_client_id=$withval], | ||
78 | 250 | [vk_client_id="5404010"]) | ||
79 | 251 | AC_SUBST(VK_CLIENT_ID, ["$vk_client_id"]) | ||
80 | 252 | |||
81 | 231 | # Set Windows Live client id | 253 | # Set Windows Live client id |
82 | 232 | AC_ARG_WITH(windows-live-client-id, | 254 | AC_ARG_WITH(windows-live-client-id, |
83 | 233 | [AS_HELP_STRING([--with-windows-live-client-id], | 255 | [AS_HELP_STRING([--with-windows-live-client-id], |
84 | @@ -244,9 +266,12 @@ | |||
85 | 244 | data/providers/identica.provider.in | 266 | data/providers/identica.provider.in |
86 | 245 | data/providers/linkedin.provider.in | 267 | data/providers/linkedin.provider.in |
87 | 246 | data/providers/instagram.provider.in | 268 | data/providers/instagram.provider.in |
88 | 269 | data/providers/mcloud.provider.in | ||
89 | 270 | data/providers/owncloud.provider.in | ||
90 | 247 | data/providers/sina.provider.in | 271 | data/providers/sina.provider.in |
91 | 248 | data/providers/sohu.provider.in | 272 | data/providers/sohu.provider.in |
92 | 249 | data/providers/twitter.provider.in | 273 | data/providers/twitter.provider.in |
93 | 274 | data/providers/vk.provider.in | ||
94 | 250 | data/providers/windows-live.provider.in | 275 | data/providers/windows-live.provider.in |
95 | 251 | Makefile | 276 | Makefile |
96 | 252 | po/Makefile.in | 277 | po/Makefile.in |
97 | 253 | 278 | ||
98 | === added directory 'data/icons' | |||
99 | === added file 'data/icons/mcloud.png' | |||
100 | 254 | Binary files data/icons/mcloud.png 1970-01-01 00:00:00 +0000 and data/icons/mcloud.png 2016-06-02 12:13:37 +0000 differ | 279 | Binary files data/icons/mcloud.png 1970-01-01 00:00:00 +0000 and data/icons/mcloud.png 2016-06-02 12:13:37 +0000 differ |
101 | === added file 'data/icons/owncloud.png' | |||
102 | 255 | Binary files data/icons/owncloud.png 1970-01-01 00:00:00 +0000 and data/icons/owncloud.png 2016-06-02 12:13:37 +0000 differ | 280 | Binary files data/icons/owncloud.png 1970-01-01 00:00:00 +0000 and data/icons/owncloud.png 2016-06-02 12:13:37 +0000 differ |
103 | === added file 'data/icons/vk.png' | |||
104 | 256 | Binary files data/icons/vk.png 1970-01-01 00:00:00 +0000 and data/icons/vk.png 2016-06-02 12:13:37 +0000 differ | 281 | Binary files data/icons/vk.png 1970-01-01 00:00:00 +0000 and data/icons/vk.png 2016-06-02 12:13:37 +0000 differ |
105 | === added file 'data/providers/mcloud.provider.in.in' | |||
106 | --- data/providers/mcloud.provider.in.in 1970-01-01 00:00:00 +0000 | |||
107 | +++ data/providers/mcloud.provider.in.in 2016-06-02 12:13:37 +0000 | |||
108 | @@ -0,0 +1,28 @@ | |||
109 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
110 | 2 | <provider id="mcloud"> | ||
111 | 3 | <name>MCloud</name> | ||
112 | 4 | <icon>mcloud</icon> | ||
113 | 5 | <translations>MCloud</translations> | ||
114 | 6 | <domains>.*10086\.cn</domains> | ||
115 | 7 | <plugin>generic-oauth</plugin> | ||
116 | 8 | <single-account>true</single-account> | ||
117 | 9 | <template> | ||
118 | 10 | <group name="auth"> | ||
119 | 11 | <setting name="method">oauth2</setting> | ||
120 | 12 | <setting name="mechanism">web_server</setting> | ||
121 | 13 | <group name="oauth2"> | ||
122 | 14 | <group name="web_server"> | ||
123 | 15 | <setting name="Host">caiyun.feixin.10086.cn</setting> | ||
124 | 16 | <setting name="AuthPath">authorize.jsp</setting> | ||
125 | 17 | <setting name="TokenPath">https://ose.caiyun.feixin.10086.cn/oauthApp/OAuth2/getToken</setting> | ||
126 | 18 | <setting name="RedirectUri">http://developer.ubuntu.com/en/</setting> | ||
127 | 19 | <setting name="ResponseType">code</setting> | ||
128 | 20 | <setting name="ClientId">@MCLOUD_CLIENT_ID@</setting> | ||
129 | 21 | <setting name="ClientSecret">@MCLOUD_CLIENT_SECRET@</setting> | ||
130 | 22 | <setting type="as" name="Scope">['nd_cloud']</setting> | ||
131 | 23 | <setting type="as" name="AllowedSchemes">['https', 'http']</setting> | ||
132 | 24 | </group> | ||
133 | 25 | </group> | ||
134 | 26 | </group> | ||
135 | 27 | </template> | ||
136 | 28 | </provider> | ||
137 | 0 | 29 | ||
138 | === added file 'data/providers/owncloud.provider.in.in' | |||
139 | --- data/providers/owncloud.provider.in.in 1970-01-01 00:00:00 +0000 | |||
140 | +++ data/providers/owncloud.provider.in.in 2016-06-02 12:13:37 +0000 | |||
141 | @@ -0,0 +1,13 @@ | |||
142 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
143 | 2 | <provider id="owncloud"> | ||
144 | 3 | <name>ownCloud</name> | ||
145 | 4 | <icon>owncloud.png</icon> | ||
146 | 5 | <translations>account-plugins</translations> | ||
147 | 6 | |||
148 | 7 | <template> | ||
149 | 8 | <group name="auth"> | ||
150 | 9 | <setting name="method">password</setting> | ||
151 | 10 | <setting name="mechanism">password</setting> | ||
152 | 11 | </group> | ||
153 | 12 | </template> | ||
154 | 13 | </provider> | ||
155 | 0 | 14 | ||
156 | === added file 'data/providers/vk.provider.in.in' | |||
157 | --- data/providers/vk.provider.in.in 1970-01-01 00:00:00 +0000 | |||
158 | +++ data/providers/vk.provider.in.in 2016-06-02 12:13:37 +0000 | |||
159 | @@ -0,0 +1,26 @@ | |||
160 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
161 | 2 | <provider id="vk"> | ||
162 | 3 | <name>VKontakte</name> | ||
163 | 4 | <icon>vk</icon> | ||
164 | 5 | <translations>account-plugins</translations> | ||
165 | 6 | <domains>.*vk\.com</domains> | ||
166 | 7 | |||
167 | 8 | <template> | ||
168 | 9 | <group name="auth"> | ||
169 | 10 | <setting name="method">oauth2</setting> | ||
170 | 11 | <setting name="mechanism">user_agent</setting> | ||
171 | 12 | <group name="oauth2"> | ||
172 | 13 | <group name="user_agent"> | ||
173 | 14 | <setting name="Host">oauth.vk.com</setting> | ||
174 | 15 | <setting name="AuthPath">authorize</setting> | ||
175 | 16 | <setting name="TokenPath">access_token</setting> | ||
176 | 17 | <setting name="RedirectUri">https://oauth.vk.com/blank.html</setting> | ||
177 | 18 | <setting name="ResponseType">token</setting> | ||
178 | 19 | <setting name="ClientId">@VK_CLIENT_ID@</setting> | ||
179 | 20 | <setting type="as" name="Scope">['offline']</setting> | ||
180 | 21 | <setting type="s" name="v">5.50</setting> | ||
181 | 22 | </group> | ||
182 | 23 | </group> | ||
183 | 24 | </group> | ||
184 | 25 | </template> | ||
185 | 26 | </provider> | ||
186 | 0 | 27 | ||
187 | === added file 'debian/account-plugin-mcloud.install' | |||
188 | --- debian/account-plugin-mcloud.install 1970-01-01 00:00:00 +0000 | |||
189 | +++ debian/account-plugin-mcloud.install 2016-06-02 12:13:37 +0000 | |||
190 | @@ -0,0 +1,4 @@ | |||
191 | 1 | usr/share/accounts/providers/mcloud.provider | ||
192 | 2 | usr/share/accounts/qml-plugins/mcloud/*.qml | ||
193 | 3 | usr/share/icons/hicolor/32x32/apps/mcloud.png | ||
194 | 4 | |||
195 | 0 | 5 | ||
196 | === added file 'debian/account-plugin-owncloud.install' | |||
197 | --- debian/account-plugin-owncloud.install 1970-01-01 00:00:00 +0000 | |||
198 | +++ debian/account-plugin-owncloud.install 2016-06-02 12:13:37 +0000 | |||
199 | @@ -0,0 +1,3 @@ | |||
200 | 1 | usr/share/accounts/providers/owncloud.provider | ||
201 | 2 | usr/share/accounts/qml-plugins/owncloud/*.qml | ||
202 | 3 | usr/share/icons/hicolor/32x32/apps/owncloud.png | ||
203 | 0 | 4 | ||
204 | === added file 'debian/account-plugin-vk.install' | |||
205 | --- debian/account-plugin-vk.install 1970-01-01 00:00:00 +0000 | |||
206 | +++ debian/account-plugin-vk.install 2016-06-02 12:13:37 +0000 | |||
207 | @@ -0,0 +1,3 @@ | |||
208 | 1 | usr/share/accounts/providers/vk.provider | ||
209 | 2 | usr/share/accounts/qml-plugins/vk/Main.qml | ||
210 | 3 | usr/share/icons/hicolor/32x32/apps/vk.png | ||
211 | 0 | 4 | ||
212 | === modified file 'debian/control' | |||
213 | --- debian/control 2016-04-05 10:52:46 +0000 | |||
214 | +++ debian/control 2016-06-02 12:13:37 +0000 | |||
215 | @@ -144,6 +144,29 @@ | |||
216 | 144 | Description: GNOME Control Center account plugin for single signon - Instagram | 144 | Description: GNOME Control Center account plugin for single signon - Instagram |
217 | 145 | GNOME Control Center account plugins for single signon | 145 | GNOME Control Center account plugins for single signon |
218 | 146 | 146 | ||
219 | 147 | Package: account-plugin-mcloud | ||
220 | 148 | Architecture: all | ||
221 | 149 | Depends: ${misc:Depends}, | ||
222 | 150 | ubuntu-system-settings-online-accounts, | ||
223 | 151 | Description: Account plugin for online accounts - mCloud | ||
224 | 152 | Online Accounts plugin provide the user interface to create accounts for | ||
225 | 153 | third party services. | ||
226 | 154 | |||
227 | 155 | Package: account-plugin-owncloud | ||
228 | 156 | Architecture: all | ||
229 | 157 | Depends: ${misc:Depends}, | ||
230 | 158 | ubuntu-system-settings-online-accounts, | ||
231 | 159 | Description: Account plugin for online accounts - ownCloud | ||
232 | 160 | Online Accounts plugin provide the user interface to create accounts for | ||
233 | 161 | third party services. | ||
234 | 162 | |||
235 | 163 | Package: account-plugin-vk | ||
236 | 164 | Architecture: all | ||
237 | 165 | Depends: ${misc:Depends}, | ||
238 | 166 | libaccount-plugin-generic-oauth | ubuntu-system-settings-online-accounts, | ||
239 | 167 | Description: GNOME Control Center account plugin for single signon - VKontakte | ||
240 | 168 | GNOME Control Center account plugins for single signon | ||
241 | 169 | |||
242 | 147 | Package: account-plugin-tools | 170 | Package: account-plugin-tools |
243 | 148 | Architecture: all | 171 | Architecture: all |
244 | 149 | Depends: ${misc:Depends}, | 172 | Depends: ${misc:Depends}, |
245 | 150 | 173 | ||
246 | === modified file 'debian/rules' | |||
247 | --- debian/rules 2015-07-23 14:10:26 +0000 | |||
248 | +++ debian/rules 2016-06-02 12:13:37 +0000 | |||
249 | @@ -21,7 +21,10 @@ | |||
250 | 21 | --with-linkedin-consumer-key="34gnzrg96iq5" \ | 21 | --with-linkedin-consumer-key="34gnzrg96iq5" \ |
251 | 22 | --with-linkedin-consumer-secret="BazRki2LE8eZtcqh" \ | 22 | --with-linkedin-consumer-secret="BazRki2LE8eZtcqh" \ |
252 | 23 | --with-instagram-client-id="01c3df41a2274a14882adea8e8ebbd46" \ | 23 | --with-instagram-client-id="01c3df41a2274a14882adea8e8ebbd46" \ |
254 | 24 | --with-instagram-client-secret="4751ccdc39c648719ea83cfb1c866c26" | 24 | --with-instagram-client-secret="4751ccdc39c648719ea83cfb1c866c26" \ |
255 | 25 | --with-mcloud-client-id="APP1ZtqoN3R0002" \ | ||
256 | 26 | --with-mcloud-client-secret="A70EFCDC91456349E7FDECF0A33574AC" \ | ||
257 | 27 | --with-vk-client-id="5402699" | ||
258 | 25 | 28 | ||
259 | 26 | override_dh_install: | 29 | override_dh_install: |
260 | 27 | rm -f debian/*/usr/lib/*/*/*.la | 30 | rm -f debian/*/usr/lib/*/*/*.la |
261 | 28 | 31 | ||
262 | === modified file 'qml/Makefile.am' | |||
263 | --- qml/Makefile.am 2013-06-07 11:56:25 +0000 | |||
264 | +++ qml/Makefile.am 2016-06-02 12:13:37 +0000 | |||
265 | @@ -2,4 +2,8 @@ | |||
266 | 2 | facebook/Main.qml \ | 2 | facebook/Main.qml \ |
267 | 3 | flickr/Main.qml \ | 3 | flickr/Main.qml \ |
268 | 4 | google/Main.qml \ | 4 | google/Main.qml \ |
270 | 5 | twitter/Main.qml | 5 | mcloud/Main.qml \ |
271 | 6 | owncloud/Main.qml \ | ||
272 | 7 | owncloud/NewAccount.qml \ | ||
273 | 8 | twitter/Main.qml \ | ||
274 | 9 | vk/Main.qml | ||
275 | 6 | 10 | ||
276 | === added directory 'qml/mcloud' | |||
277 | === added file 'qml/mcloud/Main.qml' | |||
278 | --- qml/mcloud/Main.qml 1970-01-01 00:00:00 +0000 | |||
279 | +++ qml/mcloud/Main.qml 2016-06-02 12:13:37 +0000 | |||
280 | @@ -0,0 +1,6 @@ | |||
281 | 1 | import Ubuntu.OnlineAccounts.Plugin 1.0 | ||
282 | 2 | |||
283 | 3 | OAuthMain { | ||
284 | 4 | creationComponent: OAuth { | ||
285 | 5 | } | ||
286 | 6 | } | ||
287 | 0 | 7 | ||
288 | === added directory 'qml/owncloud' | |||
289 | === added file 'qml/owncloud/Main.qml' | |||
290 | --- qml/owncloud/Main.qml 1970-01-01 00:00:00 +0000 | |||
291 | +++ qml/owncloud/Main.qml 2016-06-02 12:13:37 +0000 | |||
292 | @@ -0,0 +1,27 @@ | |||
293 | 1 | import QtQuick 2.0 | ||
294 | 2 | import Ubuntu.OnlineAccounts.Plugin 1.0 | ||
295 | 3 | |||
296 | 4 | Flickable { | ||
297 | 5 | id: root | ||
298 | 6 | |||
299 | 7 | property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0 | ||
300 | 8 | contentHeight: loader.item.height + keyboardSize | ||
301 | 9 | |||
302 | 10 | signal finished | ||
303 | 11 | |||
304 | 12 | Loader { | ||
305 | 13 | id: loader | ||
306 | 14 | anchors.fill: parent | ||
307 | 15 | sourceComponent: newAccountComponent | ||
308 | 16 | |||
309 | 17 | Connections { | ||
310 | 18 | target: loader.item | ||
311 | 19 | onFinished: root.finished() | ||
312 | 20 | } | ||
313 | 21 | } | ||
314 | 22 | |||
315 | 23 | Component { | ||
316 | 24 | id: newAccountComponent | ||
317 | 25 | NewAccount {} | ||
318 | 26 | } | ||
319 | 27 | } | ||
320 | 0 | 28 | ||
321 | === added file 'qml/owncloud/NewAccount.qml' | |||
322 | --- qml/owncloud/NewAccount.qml 1970-01-01 00:00:00 +0000 | |||
323 | +++ qml/owncloud/NewAccount.qml 2016-06-02 12:13:37 +0000 | |||
324 | @@ -0,0 +1,230 @@ | |||
325 | 1 | import QtQuick 2.0 | ||
326 | 2 | import Ubuntu.Components 1.3 | ||
327 | 3 | import Ubuntu.OnlineAccounts 0.1 | ||
328 | 4 | |||
329 | 5 | Item { | ||
330 | 6 | id: root | ||
331 | 7 | |||
332 | 8 | signal finished | ||
333 | 9 | |||
334 | 10 | anchors.margins: units.gu(1) | ||
335 | 11 | height: contents.height | ||
336 | 12 | |||
337 | 13 | property var __account: account | ||
338 | 14 | property string __host: "" | ||
339 | 15 | property bool __busy: false | ||
340 | 16 | property string __hostError: i18n.dtr("account-plugins", "Invalid host URL") | ||
341 | 17 | |||
342 | 18 | Column { | ||
343 | 19 | id: contents | ||
344 | 20 | anchors { left: parent.left; right: parent.right } | ||
345 | 21 | spacing: units.gu(1) | ||
346 | 22 | |||
347 | 23 | Label { | ||
348 | 24 | id: errorLabel | ||
349 | 25 | anchors { left: parent.left; right: parent.right } | ||
350 | 26 | font.bold: true | ||
351 | 27 | color: UbuntuColors.red | ||
352 | 28 | wrapMode: Text.Wrap | ||
353 | 29 | visible: !__busy && text != "" | ||
354 | 30 | } | ||
355 | 31 | |||
356 | 32 | Label { | ||
357 | 33 | anchors { left: parent.left; right: parent.right } | ||
358 | 34 | text: i18n.dtr("account-plugins", "URL:") | ||
359 | 35 | } | ||
360 | 36 | |||
361 | 37 | TextField { | ||
362 | 38 | id: urlField | ||
363 | 39 | anchors { left: parent.left; right: parent.right } | ||
364 | 40 | placeholderText: i18n.dtr("account-plugins", "http://example.org") | ||
365 | 41 | focus: true | ||
366 | 42 | enabled: !__busy | ||
367 | 43 | |||
368 | 44 | inputMethodHints: Qt.ImhUrlCharactersOnly | ||
369 | 45 | } | ||
370 | 46 | |||
371 | 47 | Label { | ||
372 | 48 | anchors { left: parent.left; right: parent.right } | ||
373 | 49 | text: i18n.dtr("account-plugins", "Username:") | ||
374 | 50 | } | ||
375 | 51 | |||
376 | 52 | TextField { | ||
377 | 53 | id: usernameField | ||
378 | 54 | anchors { left: parent.left; right: parent.right } | ||
379 | 55 | placeholderText: i18n.dtr("account-plugins", "Your username") | ||
380 | 56 | enabled: !__busy | ||
381 | 57 | inputMethodHints: Qt.ImhNoAutoUppercase + Qt.ImhNoPredictiveText + Qt.ImhPreferLowercase | ||
382 | 58 | |||
383 | 59 | KeyNavigation.tab: passwordField | ||
384 | 60 | } | ||
385 | 61 | |||
386 | 62 | Label { | ||
387 | 63 | anchors { left: parent.left; right: parent.right } | ||
388 | 64 | text: i18n.dtr("account-plugins", "Password:") | ||
389 | 65 | } | ||
390 | 66 | |||
391 | 67 | TextField { | ||
392 | 68 | id: passwordField | ||
393 | 69 | anchors { left: parent.left; right: parent.right } | ||
394 | 70 | placeholderText: i18n.dtr("account-plugins", "Your password") | ||
395 | 71 | echoMode: TextInput.Password | ||
396 | 72 | enabled: !__busy | ||
397 | 73 | |||
398 | 74 | inputMethodHints: Qt.ImhSensitiveData | ||
399 | 75 | Keys.onReturnPressed: login() | ||
400 | 76 | } | ||
401 | 77 | |||
402 | 78 | Row { | ||
403 | 79 | id: buttons | ||
404 | 80 | anchors { left: parent.left; right: parent.right } | ||
405 | 81 | height: units.gu(5) | ||
406 | 82 | spacing: units.gu(1) | ||
407 | 83 | Button { | ||
408 | 84 | id: btnCancel | ||
409 | 85 | text: i18n.dtr("account-plugins", "Cancel") | ||
410 | 86 | height: parent.height | ||
411 | 87 | width: (parent.width / 2) - 0.5 * parent.spacing | ||
412 | 88 | onClicked: finished() | ||
413 | 89 | } | ||
414 | 90 | Button { | ||
415 | 91 | id: btnContinue | ||
416 | 92 | text: i18n.dtr("account-plugins", "Continue") | ||
417 | 93 | color: UbuntuColors.green | ||
418 | 94 | height: parent.height | ||
419 | 95 | width: (parent.width / 2) - 0.5 * parent.spacing | ||
420 | 96 | onClicked: login() | ||
421 | 97 | enabled: !__busy | ||
422 | 98 | } | ||
423 | 99 | } | ||
424 | 100 | } | ||
425 | 101 | |||
426 | 102 | ActivityIndicator { | ||
427 | 103 | anchors.centerIn: parent | ||
428 | 104 | running: __busy | ||
429 | 105 | } | ||
430 | 106 | |||
431 | 107 | Credentials { | ||
432 | 108 | id: creds | ||
433 | 109 | caption: account.provider.id | ||
434 | 110 | acl: [ "unconfined" ] | ||
435 | 111 | storeSecret: true | ||
436 | 112 | onCredentialsIdChanged: root.credentialsStored() | ||
437 | 113 | } | ||
438 | 114 | |||
439 | 115 | AccountService { | ||
440 | 116 | id: globalAccountSettings | ||
441 | 117 | objectHandle: account.accountServiceHandle | ||
442 | 118 | autoSync: false | ||
443 | 119 | } | ||
444 | 120 | |||
445 | 121 | function login() { | ||
446 | 122 | __host = cleanUrl(urlField.text) | ||
447 | 123 | var username = usernameField.text | ||
448 | 124 | var password = passwordField.text | ||
449 | 125 | |||
450 | 126 | errorLabel.text = "" | ||
451 | 127 | __busy = true | ||
452 | 128 | var host = __host | ||
453 | 129 | var tryHttp = false | ||
454 | 130 | if (__host.indexOf("http") != 0) { | ||
455 | 131 | host = "https://" + __host | ||
456 | 132 | tryHttp = true | ||
457 | 133 | } | ||
458 | 134 | |||
459 | 135 | checkAccount(host, username, password, function cb(success) { | ||
460 | 136 | console.log("callback called: " + success) | ||
461 | 137 | if (success) { | ||
462 | 138 | saveData(host, username, password) | ||
463 | 139 | } else if (tryHttp) { | ||
464 | 140 | host = "http://" + __host | ||
465 | 141 | tryHttp = false | ||
466 | 142 | checkAccount(host, username, password, cb) | ||
467 | 143 | } else { | ||
468 | 144 | __busy = false | ||
469 | 145 | } | ||
470 | 146 | }) | ||
471 | 147 | } | ||
472 | 148 | |||
473 | 149 | function saveData(host, username, password) { | ||
474 | 150 | __host = host | ||
475 | 151 | var strippedHost = __host.replace(/^https?:\/\//, '') | ||
476 | 152 | account.updateDisplayName(username + '@' + strippedHost) | ||
477 | 153 | creds.userName = username | ||
478 | 154 | creds.secret = password | ||
479 | 155 | creds.sync() | ||
480 | 156 | } | ||
481 | 157 | |||
482 | 158 | function findChild(node, tagName) { | ||
483 | 159 | if (!node) return node; | ||
484 | 160 | var children = node.childNodes | ||
485 | 161 | for (var i = 0; i < children.length; i++) { | ||
486 | 162 | if (children[i].nodeName == tagName) { | ||
487 | 163 | return children[i] | ||
488 | 164 | } | ||
489 | 165 | } | ||
490 | 166 | return null | ||
491 | 167 | } | ||
492 | 168 | |||
493 | 169 | function checkAccount(host, username, password, callback) { | ||
494 | 170 | console.log("Trying host " + host + " as " + username + ':' + password) | ||
495 | 171 | var request = new XMLHttpRequest(); | ||
496 | 172 | request.onreadystatechange = function() { | ||
497 | 173 | if (request.readyState === XMLHttpRequest.DONE) { | ||
498 | 174 | console.log("response: " + request.responseText) | ||
499 | 175 | if (request.status == 200) { | ||
500 | 176 | var root = request.responseXML ? request.responseXML.documentElement : null | ||
501 | 177 | var metaElement = findChild(root, "meta") | ||
502 | 178 | var statusElement = findChild(metaElement, "status") | ||
503 | 179 | if (statusElement && statusElement.childNodes.length > 0 && | ||
504 | 180 | statusElement.childNodes[0].nodeValue == "ok") { | ||
505 | 181 | callback(true) | ||
506 | 182 | } else { | ||
507 | 183 | var statusCodeElement = findChild(metaElement, "statuscode") | ||
508 | 184 | var statusCode = (statusCodeElement && statusCodeElement.childNodes.length > 0) ? | ||
509 | 185 | statusCodeElement.childNodes[0].nodeValue : "999" | ||
510 | 186 | if (statusCode == "999") { | ||
511 | 187 | showError(__hostError) | ||
512 | 188 | } else { | ||
513 | 189 | showError(i18n.dtr("account-plugins", "Invalid username or password")) | ||
514 | 190 | } | ||
515 | 191 | callback(false) | ||
516 | 192 | } | ||
517 | 193 | } else { | ||
518 | 194 | showError(__hostError) | ||
519 | 195 | callback(false) | ||
520 | 196 | } | ||
521 | 197 | } | ||
522 | 198 | } | ||
523 | 199 | request.open("POST", host + "/ocs/v1.php/person/check", true); | ||
524 | 200 | request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | ||
525 | 201 | var body = "login=" + username + "&password=" + password | ||
526 | 202 | request.send(body); | ||
527 | 203 | } | ||
528 | 204 | |||
529 | 205 | function showError(message) { | ||
530 | 206 | if (!errorLabel.text) errorLabel.text = message | ||
531 | 207 | } | ||
532 | 208 | |||
533 | 209 | function credentialsStored() { | ||
534 | 210 | console.log("Credentials stored, id: " + creds.credentialsId) | ||
535 | 211 | if (creds.credentialsId == 0) return | ||
536 | 212 | |||
537 | 213 | globalAccountSettings.updateServiceEnabled(true) | ||
538 | 214 | globalAccountSettings.credentials = creds | ||
539 | 215 | globalAccountSettings.updateSettings({ | ||
540 | 216 | "host": __host | ||
541 | 217 | }) | ||
542 | 218 | account.synced.connect(finished) | ||
543 | 219 | account.sync() | ||
544 | 220 | __busy = false | ||
545 | 221 | } | ||
546 | 222 | |||
547 | 223 | // check host url for http | ||
548 | 224 | function cleanUrl(url) { | ||
549 | 225 | var host = url.trim() | ||
550 | 226 | // if the user typed trailing '/' or "index.php", strip that | ||
551 | 227 | return host.replace(/\/(index.php)?\/*$/, '') | ||
552 | 228 | } | ||
553 | 229 | |||
554 | 230 | } | ||
555 | 0 | 231 | ||
556 | === added directory 'qml/vk' | |||
557 | === added file 'qml/vk/Main.qml' | |||
558 | --- qml/vk/Main.qml 1970-01-01 00:00:00 +0000 | |||
559 | +++ qml/vk/Main.qml 2016-06-02 12:13:37 +0000 | |||
560 | @@ -0,0 +1,36 @@ | |||
561 | 1 | import Ubuntu.OnlineAccounts.Plugin 1.0 | ||
562 | 2 | |||
563 | 3 | OAuthMain { | ||
564 | 4 | creationComponent: OAuth { | ||
565 | 5 | function completeCreation(reply) { | ||
566 | 6 | console.log("Access token: " + reply.AccessToken) | ||
567 | 7 | var http = new XMLHttpRequest() | ||
568 | 8 | var url = "https://api.vk.com/method/users.get?access_token=" + reply.AccessToken + "&fields=nickname,first_name,last_name"; | ||
569 | 9 | http.open("GET", url, true); | ||
570 | 10 | http.onreadystatechange = function() { | ||
571 | 11 | if (http.readyState === 4){ | ||
572 | 12 | if (http.status == 200) { | ||
573 | 13 | console.log("ok") | ||
574 | 14 | console.log("response text: " + http.responseText) | ||
575 | 15 | var response = JSON.parse(http.responseText) | ||
576 | 16 | if (response.response && response.response.length > 0) { | ||
577 | 17 | var data = response.response[0] | ||
578 | 18 | var name = data.first_name + " " + data.last_name | ||
579 | 19 | if (data.nickname) { | ||
580 | 20 | name += " (" + data.nickname + ")" | ||
581 | 21 | } | ||
582 | 22 | account.updateDisplayName(name) | ||
583 | 23 | } | ||
584 | 24 | account.synced.connect(finished) | ||
585 | 25 | account.sync() | ||
586 | 26 | } else { | ||
587 | 27 | console.log("error: " + http.status) | ||
588 | 28 | cancel() | ||
589 | 29 | } | ||
590 | 30 | } | ||
591 | 31 | }; | ||
592 | 32 | |||
593 | 33 | http.send(null); | ||
594 | 34 | } | ||
595 | 35 | } | ||
596 | 36 | } |