Changeset View
Changeset View
Standalone View
Standalone View
kcms/dateandtime/package/contents/ui/main.qml
- This file was added.
1 | /******************************************************************** | ||||
---|---|---|---|---|---|
2 | Copyright 2019 Tomaz Canabrava <tcanabrava@kde.org> | ||||
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; either version 2 of the License, or | ||||
7 | (at your option) any later version. | ||||
8 | | ||||
9 | This program is distributed in the hope that it will be useful, | ||||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | GNU General Public License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU General Public License | ||||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | *********************************************************************/ | ||||
17 | import QtQuick 2.12 | ||||
18 | import QtQuick.Layouts 1.13 | ||||
19 | import QtQuick.Controls 2.5 as QQC2 | ||||
20 | import QtQuick.Controls 1.4 as QQC1 // calendar | ||||
21 | | ||||
22 | import org.kde.kirigami 2.5 as Kirigami | ||||
23 | import org.kde.kcm 1.2 as KCM | ||||
24 | | ||||
25 | import org.kde.colorcorrect 0.1 as CC | ||||
26 | | ||||
27 | KCM.SimpleKCM { | ||||
28 | id: root | ||||
29 | ColumnLayout { | ||||
30 | QQC2.TabBar { | ||||
31 | id: tabBar | ||||
32 | Layout.fillWidth: true | ||||
33 | QQC2.TabButton { | ||||
34 | text: i18n("Date and Time") | ||||
35 | } | ||||
36 | QQC2.TabButton { | ||||
37 | text: i18n("Time Zones") | ||||
38 | } | ||||
39 | } | ||||
40 | | ||||
41 | StackLayout { | ||||
42 | currentIndex: tabBar.currentIndex | ||||
43 | | ||||
44 | // ---- Date and Time | ||||
45 | ColumnLayout { | ||||
46 | Layout.fillWidth: true | ||||
47 | Layout.fillHeight: true | ||||
48 | QQC2.CheckBox { | ||||
49 | Layout.fillWidth: true | ||||
50 | text: "Set date and time automatically" | ||||
51 | checked: kcm.ntpEnabled | ||||
52 | onCheckedChanged: kcm.ntpEnabled = checked | ||||
53 | } | ||||
54 | RowLayout { | ||||
55 | Layout.fillWidth: true | ||||
56 | QQC2.Label { | ||||
57 | text: i18n("Time Server") | ||||
58 | } | ||||
59 | QQC2.ComboBox { | ||||
60 | Layout.fillWidth: true | ||||
61 | model: kcm.ntpServers | ||||
62 | } | ||||
63 | } | ||||
64 | RowLayout { | ||||
65 | QQC1.Calendar { | ||||
66 | Layout.fillWidth: true | ||||
67 | Layout.fillHeight: true | ||||
68 | } | ||||
69 | Clock { | ||||
70 | Layout.fillWidth: true | ||||
71 | Layout.fillHeight: true | ||||
72 | } | ||||
73 | } | ||||
74 | } | ||||
75 | | ||||
76 | // ---- Time Zones | ||||
77 | ColumnLayout { | ||||
78 | Layout.fillWidth: true | ||||
79 | Layout.fillHeight: true | ||||
80 | QQC2.Label { | ||||
81 | Layout.fillWidth: true | ||||
82 | text: i18n("To change the local time zone, select your area from the list below.") | ||||
83 | } | ||||
84 | QQC2.Label { | ||||
85 | Layout.fillWidth: true | ||||
86 | text: i18n("Current local time zone:") | ||||
87 | } | ||||
88 | QQC2.TextField { | ||||
89 | Layout.fillWidth: true | ||||
90 | placeholderText: i18n("Search....") | ||||
91 | } | ||||
92 | | ||||
93 | /* This is not working as I tougth it would, it fails to be properly a scroll view. */ | ||||
94 | QQC2.ScrollView { | ||||
95 | id: bgObject | ||||
96 | Component.onCompleted: bgObject.background.visible = true | ||||
97 | Layout.fillWidth: true | ||||
98 | Layout.fillHeight: true | ||||
99 | clip: true | ||||
100 | | ||||
101 | /* If I uncommment this list view to show the time zones, the list is infinite =/ */ | ||||
102 | /* | ||||
103 | ListView { | ||||
104 | id: timeZonesList | ||||
105 | | ||||
106 | model: kcm.timeZoneList() | ||||
107 | highlight: Rectangle { color: "lightsteelblue" } | ||||
108 | focus: true | ||||
109 | | ||||
110 | delegate: MouseArea { | ||||
111 | width: timeZonesList.width | ||||
112 | height: childrenRect.height | ||||
113 | | ||||
114 | QQC2.Label { | ||||
115 | text: modelData | ||||
116 | } | ||||
117 | | ||||
118 | onClicked: { | ||||
119 | timeZonesList.currentIndex = index | ||||
120 | } | ||||
121 | } | ||||
122 | | ||||
123 | Component.onCompleted : { | ||||
124 | timeZonesList.currentIndex = -1 | ||||
125 | } | ||||
126 | } | ||||
127 | */ | ||||
128 | } | ||||
129 | } | ||||
130 | } | ||||
131 | } | ||||
132 | } |