Unity 8
60-account.qml
1 /*
2  * Copyright (C) 2015-2016 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.4
18 import Ubuntu.Components 1.3
19 import AccountsService 0.1
20 import ".." as LocalComponents
21 
22 LocalComponents.Page {
23  objectName: "accountPage"
24  title: i18n.tr("Personalize Your Device")
25 
26  forwardButtonSourceComponent: forwardButton
27 
28  QtObject {
29  id: d
30  readonly property string validName: nameInput.text.trim()
31  }
32 
33  Column {
34  id: column
35  spacing: units.gu(1)
36  anchors {
37  fill: content
38  leftMargin: parent.leftMargin
39  rightMargin: parent.rightMargin
40  topMargin: customMargin
41  }
42 
43  // name
44  Label {
45  id: nameLabel
46  anchors.left: parent.left
47  anchors.right: parent.right
48  text: i18n.tr("Preferred Name")
49  color: textColor
50  font.weight: Font.Light
51  }
52 
53  LocalComponents.WizardTextField {
54  id: nameInput
55  objectName: "nameInput"
56  anchors.left: parent.left
57  anchors.right: parent.right
58  inputMethodHints: Qt.ImhNoPredictiveText
59  }
60  }
61 
62  Component {
63  id: forwardButton
64  LocalComponents.StackButton {
65  text: d.validName ? i18n.tr("Next") : i18n.tr("Skip")
66  onClicked: {
67  if (d.validName) {
68  AccountsService.realName = d.validName;
69  }
70  pageStack.next();
71  }
72  }
73  }
74 }