@ -18,8 +18,8 @@
* along with this program . If not , see < http: / / w w w . g n u . o r g / l i c e n s e s / >
* /
import QtQuick 2.0
import QtQuick . Controls 1.2 as QtControls
import QtQuick 2.13
import QtQuick . Controls 2.13 as QQC2
import QtQuick . Layouts 1.0
import QtQuick . Dialogs 1.1
@ -45,90 +45,63 @@ ColumnLayout {
}
}
/ / T h i s i s j u s t f o r g e t t i n g t h e c o l u m n w i d t h
QtControls . CheckBox {
id: checkbox
visible: false
}
Kirigami . InlineMessage {
id: messageWidget
Layout.fillWidth: true
Layout.margins: Kirigami . Units . smallSpacing
type: Kirigami . MessageType . Warning
text: i18n ( "At least one time zone needs to be enabled. 'Local' was enabled automatically." )
showCloseButton: true
}
QtControls . TextField {
QQC2 . TextField {
id: filter
Layout.fillWidth: true
placeholderText: i18n ( "Search Time Zones" )
}
QtControls . TableView {
id: timeZoneView
signal toggleCurrent
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Keys.onSpacePressed: toggleCurrent ( )
QQC2 . ScrollView {
anchors.fill: parent
clip: true
Component.onCompleted: background . visible = true / / e n a b l e b o r d e r
model: TimeZoneFilterProxy {
sourceModel: timeZones
filterString: filter . text
}
ListView {
id: listView
focus: true / / k e y b o a r d n a v i g a t i o n
activeFocusOnTab: true / / k e y b o a r d n a v i g a t i o n
QtControls . TableViewColumn {
role: "checked"
width: checkbox . width
delegate:
QtControls . CheckBox {
id: checkBox
anchors.centerIn: parent
checked: styleData . value
activeFocusOnTab: false / / o n l y l e t t h e T a b l e V i e w a s a w h o l e g e t f o c u s
onClicked: {
/ / n e e d e d f o r m o d e l ' s s e t D a t a t o b e c a l l e d
model . checked = checked ;
}
model: TimeZoneFilterProxy {
sourceModel: timeZones
filterString: filter . text
}
Connections {
target: timeZoneView
onToggleCurrent: {
if ( styleData . row === timeZoneView . currentRow ) {
model . checked = ! checkBox . checked
}
}
delegate: QQC2 . CheckDelegate {
id: checkbox
focus: true / / k e y b o a r d n a v i g a t i o n
width: parent . width
text: ! city || city . indexOf ( "UTC" ) === 0 ? comment : comment ? i18n ( "%1, %2 (%3)" , city , region , comment ) : i18n ( "%1, %2" , city , region )
checked: model . checked
onToggled: {
model . checked = checkbox . checked
listView . currentIndex = index / / h i g h l i g h t
listView . forceActiveFocus ( ) / / k e y b o a r d n a v i g a t i o n
}
highlighted: ListView . isCurrentItem
}
resizable: false
movable: false
}
QtControls . TableViewColumn {
role: "city"
title: i18n ( "City" )
}
QtControls . TableViewColumn {
role: "region"
title: i18n ( "Region" )
}
QtControls . TableViewColumn {
role: "comment"
title: i18n ( "Comment" )
}
}
}
RowLayout {
Layout.fillWidth: true
QtControls . CheckBox {
QQC2 . CheckBox {
id: enableWheelCheckBox
text: i18n ( "Switch time zone with mouse wheel" )
}
}
}