Merge lp:~mikemc/ubuntuone-credentials/fix-qml-example into lp:ubuntuone-credentials

Proposed by Mike McCracken
Status: Merged
Approved by: Mike McCracken
Approved revision: 52
Merged at revision: 52
Proposed branch: lp:~mikemc/ubuntuone-credentials/fix-qml-example
Merge into: lp:ubuntuone-credentials
Diff against target: 92 lines (+11/-57)
1 file modified
qml-credentials-service/examples/embeddingMain.qml (+11/-57)
To merge this branch: bzr merge lp:~mikemc/ubuntuone-credentials/fix-qml-example
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+183523@code.launchpad.net

Commit message

- Fix example code for QML plugin to no longer try to show the CredentialsUI that doesn't exist anymore, and improve its comments to better explain the remaining API.

Description of the change

- Fix example code for QML plugin to no longer try to show the CredentialsUI that doesn't exist anymore, and improve its comments to better explain the remaining API.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml-credentials-service/examples/embeddingMain.qml'
2--- qml-credentials-service/examples/embeddingMain.qml 2013-07-12 19:41:22 +0000
3+++ qml-credentials-service/examples/embeddingMain.qml 2013-09-02 18:25:04 +0000
4@@ -12,59 +12,6 @@
5 spacing: units.gu(2)
6 anchors.fill: parent
7
8- add: Transition {
9- NumberAnimation { properties: "opacity"; easing.type: Easing.OutQuad; duration: 1000}
10- }
11-
12- Row {
13- anchors.left: parent.left
14- anchors.margins: units.gu(2)
15- spacing: units.gu(2)
16-
17- Switch {
18- id: showCredsUISwitch
19- checked: true
20- }
21-
22- Label {
23- id: label
24- color: "white"
25- text: "Show Creds UI"
26- anchors.verticalCenter: showCredsUISwitch.verticalCenter
27- }
28-
29- Label {
30- id: statusLabel
31- color: "white"
32- text: ""
33- anchors.verticalCenter: showCredsUISwitch.verticalCenter
34- }
35- }
36-
37- // Here is where we've embedded the UI for UbuntuOne login and register.
38- // Note that you must declare some width and height for the layout to work.
39-
40- CredentialsUI {
41- id: credsUI
42-
43- width: parent.width * 0.80
44- height: (parent.height - showCredsUISwitch.height) * 0.80
45- anchors.horizontalCenter: parent.horizontalCenter
46- visible: showCredsUISwitch.checked
47-
48- onUserCancelled: {
49- showCredsUISwitch.checked = false;
50- statusLabel.text = "Login/Register cancelled by user";
51- credsUI.resetUI();
52- }
53-
54- onSucceeded: {
55- showCredsUISwitch.checked = false;
56- statusLabel.text = "Login/Register succeeded";
57- credsUI.resetUI();
58- }
59- }
60-
61 Label {
62 id: infoLabel
63 text: "Press this button to check for credentials in local keyring:"
64@@ -97,8 +44,8 @@
65
66 } // Column
67
68- /* Below, an example of how to use the service without showing UI,
69- just to test if there is a local credential already, and sign a
70+ /* Here is the component that exposes the credentials API.
71+ You can use it to test if there is a local credential already, and sign a
72 url with it, if it does exist.*/
73
74 UbuntuOneCredentialsService {
75@@ -118,8 +65,15 @@
76 }
77
78 onCredentialsNotFound: {
79- infoLabel.text = "No Credentials Found.";
80- signUrl("http://server", "GET"); // xfail
81+ /* We could just report a generic error here, but to show what happens
82+ if you don't bother checking before you sign a URL, we
83+ sign a URL here, expecting it to fail. We'll then get
84+ onUrlSigningError(), with an error message saying
85+ something like "attempt to sign with no credentials in
86+ keyring". Note that "Keyring" is vestigial, we are not
87+ using the system keyring. */
88+
89+ signUrl("http://server", "GET");
90 }
91
92 onCredentialsDeleted: {

Subscribers

People subscribed via source and target branches

to all changes: