Changeset View
Changeset View
Standalone View
Standalone View
applets/weather/package/contents/ui/config/ConfigUnits.qml
Context not available. | |||||
21 | 21 | | |||
---|---|---|---|---|---|
22 | import org.kde.plasma.private.weather 1.0 | 22 | import org.kde.plasma.private.weather 1.0 | ||
23 | 23 | | |||
24 | import ".." // DisplayUnits | ||||
24 | 25 | | |||
25 | ColumnLayout { | 26 | ColumnLayout { | ||
26 | id: unitsConfigPage | 27 | id: unitsConfigPage | ||
27 | 28 | | |||
28 | signal configurationChanged | 29 | signal configurationChanged | ||
29 | 30 | | |||
30 | function saveConfig() { | 31 | DisplayUnits { id: displayUnits } | ||
31 | var config = {}; | | |||
32 | 32 | | |||
33 | config.temperatureUnitId = | 33 | function saveConfig() { | ||
34 | plasmoid.configuration.temperatureUnitId = | ||||
34 | TemperatureUnitListModel.unitIdForListIndex(temperatureComboBox.currentIndex); | 35 | TemperatureUnitListModel.unitIdForListIndex(temperatureComboBox.currentIndex); | ||
35 | config.pressureUnitId = | 36 | plasmoid.configuration.pressureUnitId = | ||
36 | PressureUnitListModel.unitIdForListIndex(pressureComboBox.currentIndex); | 37 | PressureUnitListModel.unitIdForListIndex(pressureComboBox.currentIndex); | ||
37 | config.windSpeedUnitId = | 38 | plasmoid.configuration.windSpeedUnitId = | ||
38 | WindSpeedUnitListModel.unitIdForListIndex(windSpeedComboBox.currentIndex); | 39 | WindSpeedUnitListModel.unitIdForListIndex(windSpeedComboBox.currentIndex); | ||
39 | config.visibilityUnitId = | 40 | plasmoid.configuration.visibilityUnitId = | ||
40 | VisibilityUnitListModel.unitIdForListIndex(visibilityComboBox.currentIndex); | 41 | VisibilityUnitListModel.unitIdForListIndex(visibilityComboBox.currentIndex); | ||
41 | | ||||
42 | plasmoid.nativeInterface.saveConfig(config); | | |||
43 | plasmoid.nativeInterface.configChanged(); | | |||
44 | } | 42 | } | ||
45 | 43 | | |||
46 | Component.onCompleted: { | 44 | Component.onCompleted: { | ||
47 | var config = plasmoid.nativeInterface.configValues(); | | |||
48 | | ||||
49 | temperatureComboBox.currentIndex = | 45 | temperatureComboBox.currentIndex = | ||
50 | TemperatureUnitListModel.listIndexForUnitId(config.temperatureUnitId); | 46 | TemperatureUnitListModel.listIndexForUnitId(displayUnits.temperatureUnitId); | ||
51 | pressureComboBox.currentIndex = | 47 | pressureComboBox.currentIndex = | ||
52 | PressureUnitListModel.listIndexForUnitId(config.pressureUnitId); | 48 | PressureUnitListModel.listIndexForUnitId(displayUnits.pressureUnitId); | ||
53 | windSpeedComboBox.currentIndex = | 49 | windSpeedComboBox.currentIndex = | ||
54 | WindSpeedUnitListModel.listIndexForUnitId(config.windSpeedUnitId); | 50 | WindSpeedUnitListModel.listIndexForUnitId(displayUnits.speedUnitId); | ||
55 | visibilityComboBox.currentIndex = | 51 | visibilityComboBox.currentIndex = | ||
56 | VisibilityUnitListModel.listIndexForUnitId(config.visibilityUnitId); | 52 | VisibilityUnitListModel.listIndexForUnitId(displayUnits.visibilityUnitId); | ||
57 | } | 53 | } | ||
58 | 54 | | |||
59 | 55 | | |||
Context not available. |