Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindesktop/package/contents/ui/main.qml
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 54 | QQC2.TextField { | |||
---|---|---|---|---|---|
58 | leftPadding: Kirigami.Units.largeSpacing | 58 | leftPadding: Kirigami.Units.largeSpacing | ||
59 | topPadding: 0 | 59 | topPadding: 0 | ||
60 | bottomPadding: 0 | 60 | bottomPadding: 0 | ||
61 | 61 | | |||
62 | Layout.fillWidth: true | 62 | Layout.fillWidth: true | ||
63 | 63 | | |||
64 | Layout.alignment: Qt.AlignVCenter | 64 | Layout.alignment: Qt.AlignVCenter | ||
65 | 65 | | |||
66 | text: model.display | 66 | text: !!model && model.display | ||
67 | 67 | | |||
68 | readOnly: true | 68 | readOnly: true | ||
69 | 69 | | |||
70 | onEditingFinished: { | 70 | onEditingFinished: { | ||
71 | readOnly = true; | 71 | readOnly = true; | ||
72 | Qt.callLater(kcm.desktopsModel.setDesktopName, model.Id, text); | 72 | Qt.callLater(kcm.desktopsModel.setDesktopName, model.Id, text); | ||
73 | } | 73 | } | ||
74 | } | 74 | } | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | actions: [ | 77 | actions: [ | ||
78 | Kirigami.Action { | 78 | Kirigami.Action { | ||
79 | enabled: !model.IsMissing | 79 | enabled: !!model && !model.IsMissing | ||
80 | iconName: "edit-rename" | 80 | iconName: "edit-rename" | ||
81 | tooltip: i18nc("@info:tooltip", "Rename") | 81 | tooltip: i18nc("@info:tooltip", "Rename") | ||
82 | onTriggered: { | 82 | onTriggered: { | ||
83 | nameField.readOnly = false; | 83 | nameField.readOnly = false; | ||
84 | nameField.selectAll(); | 84 | nameField.selectAll(); | ||
85 | nameField.forceActiveFocus(); | 85 | nameField.forceActiveFocus(); | ||
86 | } | 86 | } | ||
87 | }, | 87 | }, | ||
88 | Kirigami.Action { | 88 | Kirigami.Action { | ||
89 | enabled: !model.IsMissing | 89 | enabled: !!model && !model.IsMissing && !kcm.isNumberImmutable | ||
meven: Is it really necessary to have `!!` ? | |||||
I had qml warnings stating that model is null, so I added this check. crossi: I had qml warnings stating that model is null, so I added this check. | |||||
90 | iconName: "edit-delete-remove" | 90 | iconName: "edit-delete-remove" | ||
91 | tooltip: i18nc("@info:tooltip", "Remove") | 91 | tooltip: i18nc("@info:tooltip", "Remove") | ||
92 | onTriggered: kcm.desktopsModel.removeDesktop(model.Id) | 92 | onTriggered: kcm.desktopsModel.removeDesktop(model.Id) | ||
93 | }] | 93 | }] | ||
94 | } | 94 | } | ||
95 | } | 95 | } | ||
96 | 96 | | |||
97 | header: ColumnLayout { | 97 | header: ColumnLayout { | ||
98 | id: messagesLayout | 98 | id: messagesLayout | ||
99 | 99 | | |||
100 | spacing: Kirigami.Units.largeSpacing | 100 | spacing: Kirigami.Units.largeSpacing | ||
101 | 101 | | |||
102 | Kirigami.InlineMessage { | 102 | Kirigami.InlineMessage { | ||
103 | Layout.fillWidth: true | 103 | Layout.fillWidth: true | ||
104 | 104 | | |||
105 | type: Kirigami.MessageType.Error | 105 | type: Kirigami.MessageType.Error | ||
106 | 106 | | |||
107 | text: kcm.desktopsModel.error | 107 | text: kcm.desktopsModel.error | ||
108 | 108 | | |||
109 | visible: kcm.desktopsModel.error != "" | 109 | visible: kcm.desktopsModel.error !== "" | ||
110 | } | 110 | } | ||
111 | 111 | | |||
112 | Kirigami.InlineMessage { | 112 | Kirigami.InlineMessage { | ||
113 | Layout.fillWidth: true | 113 | Layout.fillWidth: true | ||
114 | 114 | | |||
115 | type: Kirigami.MessageType.Information | 115 | type: Kirigami.MessageType.Information | ||
116 | 116 | | |||
117 | text: i18n("Virtual desktops have been changed outside this settings application. Saving now will overwrite the changes.") | 117 | text: i18n("Virtual desktops have been changed outside this settings application. Saving now will overwrite the changes.") | ||
Show All 18 Lines | 134 | delegate: Kirigami.DelegateRecycler { | |||
136 | 136 | | |||
137 | sourceComponent: desktopsListItemComponent | 137 | sourceComponent: desktopsListItemComponent | ||
138 | } | 138 | } | ||
139 | } | 139 | } | ||
140 | 140 | | |||
141 | footer: ColumnLayout { | 141 | footer: ColumnLayout { | ||
142 | RowLayout { | 142 | RowLayout { | ||
143 | QQC2.Button { | 143 | QQC2.Button { | ||
144 | enabled: !kcm.isNumberImmutable | ||||
144 | text: i18nc("@action:button", "Add") | 145 | text: i18nc("@action:button", "Add") | ||
145 | icon.name: "list-add" | 146 | icon.name: "list-add" | ||
146 | 147 | | |||
147 | onClicked: kcm.desktopsModel.createDesktop(i18n("New Desktop")) | 148 | onClicked: kcm.desktopsModel.createDesktop(i18n("New Desktop")) | ||
148 | } | 149 | } | ||
149 | 150 | | |||
150 | Item { // Spacer | 151 | Item { // Spacer | ||
151 | Layout.fillWidth: true | 152 | Layout.fillWidth: true | ||
152 | } | 153 | } | ||
153 | 154 | | |||
154 | QQC2.SpinBox { | 155 | QQC2.SpinBox { | ||
155 | id: rowsSpinBox | 156 | id: rowsSpinBox | ||
156 | 157 | | |||
157 | from: 1 | 158 | from: 1 | ||
158 | to: 20 | 159 | to: 20 | ||
159 | editable: true | 160 | editable: true | ||
161 | enabled: !kcm.isRowsImmutable | ||||
160 | 162 | | |||
161 | textFromValue: function(value, locale) { return i18np("1 Row", "%1 Rows", value)} | 163 | textFromValue: function(value, locale) { return i18np("1 Row", "%1 Rows", value)} | ||
162 | valueFromText: function(text, locale) { return parseInt(text, 10); } | 164 | valueFromText: function(text, locale) { return parseInt(text, 10); } | ||
163 | 165 | | |||
164 | onValueModified: kcm.desktopsModel.rows = value | 166 | onValueModified: kcm.desktopsModel.rows = value | ||
165 | } | 167 | } | ||
166 | } | 168 | } | ||
167 | 169 | | |||
168 | Kirigami.FormLayout { | 170 | Kirigami.FormLayout { | ||
169 | 171 | | |||
170 | QQC2.CheckBox { | 172 | QQC2.CheckBox { | ||
171 | id: navWraps | 173 | id: navWraps | ||
172 | 174 | | |||
173 | Kirigami.FormData.label: i18n("Options:") | 175 | Kirigami.FormData.label: i18n("Options:") | ||
174 | 176 | | |||
175 | text: i18n("Navigation wraps around") | 177 | text: i18n("Navigation wraps around") | ||
176 | enabled: !kcm.virtualDesktopsSettings.isImmutable("rollOverDesktops") | 178 | enabled: !kcm.virtualDesktopsSettings.isImmutable("rollOverDesktops") | ||
177 | checked: kcm.virtualDesktopsSettings.rollOverDesktops | 179 | checked: kcm.virtualDesktopsSettings.rollOverDesktops | ||
178 | onToggled: kcm.virtualDesktopsSettings.rollOverDesktops = checked | 180 | onToggled: kcm.virtualDesktopsSettings.rollOverDesktops = checked | ||
179 | } | 181 | } | ||
180 | 182 | | |||
181 | RowLayout { | 183 | RowLayout { | ||
182 | Layout.fillWidth: true | 184 | Layout.fillWidth: true | ||
185 | enabled: !kcm.animationsModel.isImmutable | ||||
183 | 186 | | |||
184 | QQC2.CheckBox { | 187 | QQC2.CheckBox { | ||
185 | id: animationEnabled | 188 | id: animationEnabled | ||
186 | // Let it elide but don't make it push the ComboBox away from it | 189 | // Let it elide but don't make it push the ComboBox away from it | ||
187 | Layout.fillWidth: true | 190 | Layout.fillWidth: true | ||
188 | Layout.maximumWidth: implicitWidth | 191 | Layout.maximumWidth: implicitWidth | ||
189 | 192 | | |||
190 | text: i18n("Show animation when switching:") | 193 | text: i18n("Show animation when switching:") | ||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
Is it really necessary to have !! ?