Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderView.qml
Show First 20 Lines • Show All 235 Lines • ▼ Show 20 Line(s) | 235 | if (mouse.buttons & Qt.BackButton) { | |||
---|---|---|---|---|---|
236 | if (root.isPopup && dir.resolvedUrl != dir.resolve(plasmoid.configuration.url)) { | 236 | if (root.isPopup && dir.resolvedUrl != dir.resolve(plasmoid.configuration.url)) { | ||
237 | doBack(); | 237 | doBack(); | ||
238 | } | 238 | } | ||
239 | 239 | | |||
240 | return; | 240 | return; | ||
241 | } | 241 | } | ||
242 | 242 | | |||
243 | if (childAt(mouse.x, mouse.y) != editor) { | 243 | if (childAt(mouse.x, mouse.y) != editor) { | ||
244 | editor.targetItem = null; | 244 | editor.commit(); | ||
245 | } | 245 | } | ||
246 | 246 | | |||
247 | pressX = mouse.x; | 247 | pressX = mouse.x; | ||
248 | pressY = mouse.y; | 248 | pressY = mouse.y; | ||
249 | 249 | | |||
250 | if (!hoveredItem || hoveredItem.blank) { | 250 | if (!hoveredItem || hoveredItem.blank) { | ||
251 | if (!gridView.ctrlPressed) { | 251 | if (!gridView.ctrlPressed) { | ||
252 | dir.clearSelection(); | 252 | dir.clearSelection(); | ||
▲ Show 20 Lines • Show All 878 Lines • ▼ Show 20 Line(s) | 1130 | } else { | |||
1131 | scrollArea.focus = true; | 1131 | scrollArea.focus = true; | ||
1132 | } | 1132 | } | ||
1133 | } | 1133 | } | ||
1134 | 1134 | | |||
1135 | Keys.onPressed: { | 1135 | Keys.onPressed: { | ||
1136 | switch(event.key) { | 1136 | switch(event.key) { | ||
1137 | case Qt.Key_Return: | 1137 | case Qt.Key_Return: | ||
1138 | case Qt.Key_Enter: | 1138 | case Qt.Key_Enter: | ||
1139 | dir.rename(positioner.map(targetItem.index), text); | 1139 | commit(); | ||
1140 | targetItem = null; | | |||
1141 | break; | 1140 | break; | ||
1142 | case Qt.Key_Escape: | 1141 | case Qt.Key_Escape: | ||
1143 | targetItem = null; | 1142 | targetItem = null; | ||
1144 | break; | 1143 | break; | ||
1145 | case Qt.Key_Home: | 1144 | case Qt.Key_Home: | ||
1146 | editor.select(0, 0); | 1145 | editor.select(0, 0); | ||
1147 | break; | 1146 | break; | ||
1148 | case Qt.Key_End: | 1147 | case Qt.Key_End: | ||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 1213 | } else { | |||
1223 | } | 1222 | } | ||
1224 | } | 1223 | } | ||
1225 | 1224 | | |||
1226 | var xy = getXY(); | 1225 | var xy = getXY(); | ||
1227 | x = xy[0]; | 1226 | x = xy[0]; | ||
1228 | y = xy[1]; | 1227 | y = xy[1]; | ||
1229 | } | 1228 | } | ||
1230 | 1229 | | |||
1230 | function commit() { | ||||
1231 | if (targetItem) { | ||||
1232 | dir.rename(positioner.map(targetItem.index), text); | ||||
1233 | targetItem = null; | ||||
1234 | } | ||||
1235 | } | ||||
1231 | } | 1236 | } | ||
1232 | 1237 | | |||
1233 | Component.onCompleted: { | 1238 | Component.onCompleted: { | ||
1234 | dir.requestRename.connect(rename); | 1239 | dir.requestRename.connect(rename); | ||
1235 | } | 1240 | } | ||
1236 | } | 1241 | } | ||
1237 | 1242 | | |||
1238 | Component.onCompleted: { | 1243 | Component.onCompleted: { | ||
1239 | if (backButton == null && root.useListViewMode) { | 1244 | if (backButton == null && root.useListViewMode) { | ||
1240 | backButton = makeBackButton(); | 1245 | backButton = makeBackButton(); | ||
1241 | } | 1246 | } | ||
1242 | } | 1247 | } | ||
1243 | } | 1248 | } |