@@ -39,25 +39,19 @@ LocalComponents.Page {
3939 forwardButtonSourceComponent: forwardButton
4040
4141 function indexToMethod(index) {
42− if (index === 1)
43− return UbuntuSecurityPrivacyPanel.Passcode;
44− else if (index === 0)
42+ if (index === 0 || index === 1)
4543 return UbuntuSecurityPrivacyPanel.Passphrase;
44+ else if (index === 2)
45+ return UbuntuSecurityPrivacyPanel.Passcode;
4646 else
4747 return UbuntuSecurityPrivacyPanel.Swipe;
4848 }
4949
50− function methodToIndex(method) {
51− if (method === UbuntuSecurityPrivacyPanel.Passcode)
52− return 1;
53− else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
54− return 0;
55− else
56− return 2;
57− }
58−
5950 Component.onCompleted: {
60− selector.currentIndex = methodToIndex(root.passwordMethod);
51+ if (root.password !== "") // the user has set a password as part of the previous page
52+ selector.currentIndex = 0;
53+ else
54+ selector.currentIndex = 1;
6155 }
6256
6357 Item {
@@ -97,7 +91,8 @@ LocalComponents.Page {
9791 height: childrenRect.height
9892
9993 // this is the order we want to display it; cf indexToMethod()
100− model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Swipe]
94+ model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passphrase,
95+ UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Swipe]
10196
10297 delegate: ListItem {
10398 id: itemDelegate
@@ -115,19 +110,16 @@ LocalComponents.Page {
115110 color: textColor
116111 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
117112 text: {
118− var method = modelData
119− var name = ""
120− var desc = ""
121− if (method === UbuntuSecurityPrivacyPanel.Swipe) {
122− return i18n.ctr("Label: Type of security method", "None");
123− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
124− name = i18n.ctr("Label: Type of security method", "Passcode");
125− desc = i18n.ctr("Label: Description of security method", "4 digits only");
126− } else {
127− name = i18n.ctr("Label: Type of security method", "Password");
128− desc = i18n.ctr("Label: Description of security method", "numbers and letters");
113+ switch (index) {
114+ case 0:
115+ return i18n.ctr("Label: Type of security method", "Device account password");
116+ case 1:
117+ return i18n.ctr("Label: Type of security method", "New password");
118+ case 2:
119+ return i18n.ctr("Label: Type of security method", "Passcode");
120+ case 3:
121+ return i18n.ctr("Label: Type of security method", "Swipe");
129122 }
130− return "%1 (%2)".arg(name).arg(desc);
131123 }
132124 }
133125
@@ -170,11 +162,14 @@ LocalComponents.Page {
170162 root.passwordMethod = method;
171163 print("Current method: " + root.passwordMethod);
172164
173− if (method === UbuntuSecurityPrivacyPanel.Passphrase) {
174− pageStack.load(Qt.resolvedUrl("password-set.qml"));
175− } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
165+ if (method === UbuntuSecurityPrivacyPanel.Passphrase) { // any password
166+ if (selector.currentIndex == 1)
167+ pageStack.load(Qt.resolvedUrl("password-set.qml")); // let the user choose a new password
168+ else
169+ pageStack.next(); // got the password already, go next page
170+ } else if (method === UbuntuSecurityPrivacyPanel.Passcode) { // passcode
176171 pageStack.load(Qt.resolvedUrl("passcode-set.qml"));
177− } else {
172+ } else { //swipe
178173 pageStack.next();
179174 }
180175 }