Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/FolderView.qml
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Line(s) | 32 | Item { | |||
---|---|---|---|---|---|
97 | function makeUpButton() { | 97 | function makeUpButton() { | ||
98 | return Qt.createQmlObject("UpButtonItem {}", main); | 98 | return Qt.createQmlObject("UpButtonItem {}", main); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | Connections { | 101 | Connections { | ||
102 | target: root | 102 | target: root | ||
103 | 103 | | |||
104 | onIsPopupChanged: { | 104 | onIsPopupChanged: { | ||
105 | if (upButton == null && root.isPopup) { | 105 | if (upButton == null && root.useListViewMode) { | ||
106 | upButton = makeUpButton(); | 106 | upButton = makeUpButton(); | ||
107 | } else if (upButton != null) { | 107 | } else if (upButton != null) { | ||
108 | upButton.destroy(); | 108 | upButton.destroy(); | ||
109 | } | 109 | } | ||
110 | } | 110 | } | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | MouseEventListener { | 113 | MouseEventListener { | ||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 226 | onClicked: { | |||
233 | if (!hoveredItem || hoveredItem.blank || gridView.currentIndex == -1 || gridView.ctrlPressed || gridView.shiftPressed) { | 233 | if (!hoveredItem || hoveredItem.blank || gridView.currentIndex == -1 || gridView.ctrlPressed || gridView.shiftPressed) { | ||
234 | return; | 234 | return; | ||
235 | } | 235 | } | ||
236 | 236 | | |||
237 | var pos = mapToItem(hoveredItem.actionsOverlay, mouse.x, mouse.y); | 237 | var pos = mapToItem(hoveredItem.actionsOverlay, mouse.x, mouse.y); | ||
238 | 238 | | |||
239 | if (!(pos.x <= hoveredItem.actionsOverlay.width && pos.y <= hoveredItem.actionsOverlay.height)) { | 239 | if (!(pos.x <= hoveredItem.actionsOverlay.width && pos.y <= hoveredItem.actionsOverlay.height)) { | ||
240 | if (systemSettings.singleClick() || doubleClickInProgress) { | 240 | if (systemSettings.singleClick() || doubleClickInProgress) { | ||
241 | var func = root.isPopup && (mouse.button == Qt.LeftButton) && hoveredItem.isDir ? dir.cd : dir.run; | 241 | var func = root.useListViewMode && (mouse.button == Qt.LeftButton) && hoveredItem.isDir ? dir.cd : dir.run; | ||
242 | func(positioner.map(gridView.currentIndex)); | 242 | func(positioner.map(gridView.currentIndex)); | ||
243 | 243 | | |||
244 | hoveredItem = null; | 244 | hoveredItem = null; | ||
245 | } else { | 245 | } else { | ||
246 | doubleClickInProgress = true; | 246 | doubleClickInProgress = true; | ||
247 | doubleClickTimer.interval = systemSettings.doubleClickInterval(); | 247 | doubleClickTimer.interval = systemSettings.doubleClickInterval(); | ||
248 | doubleClickTimer.start(); | 248 | doubleClickTimer.start(); | ||
249 | } | 249 | } | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 312 | if (pressedItem != null && dir.isSelected(positioner.map(pressedItem.index))) { | |||
313 | dragX = mouse.x; | 313 | dragX = mouse.x; | ||
314 | dragY = mouse.y; | 314 | dragY = mouse.y; | ||
315 | dir.dragSelected(mouse.x, mouse.y); | 315 | dir.dragSelected(mouse.x, mouse.y); | ||
316 | dragX = -1; | 316 | dragX = -1; | ||
317 | dragY = -1; | 317 | dragY = -1; | ||
318 | clearPressState(); | 318 | clearPressState(); | ||
319 | } else { | 319 | } else { | ||
320 | // Disable rubberband in popup list view mode. | 320 | // Disable rubberband in popup list view mode. | ||
321 | if (root.isPopup) { | 321 | if (root.useListViewMode) { | ||
322 | return; | 322 | return; | ||
323 | } | 323 | } | ||
324 | 324 | | |||
325 | dir.pinSelection(); | 325 | dir.pinSelection(); | ||
326 | main.rubberBand = Qt.createQmlObject("import QtQuick 2.0; import org.kde.private.desktopcontainment.folder 0.1 as Folder;" | 326 | main.rubberBand = Qt.createQmlObject("import QtQuick 2.0; import org.kde.private.desktopcontainment.folder 0.1 as Folder;" | ||
327 | + "Folder.RubberBand { x: " + cPress.x + "; y: " + cPress.y + "; width: 0; height: 0; z: 99999; }", | 327 | + "Folder.RubberBand { x: " + cPress.x + "; y: " + cPress.y + "; width: 0; height: 0; z: 99999; }", | ||
328 | gridView.contentItem); | 328 | gridView.contentItem); | ||
329 | gridView.interactive = false; | 329 | gridView.interactive = false; | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 380 | GridView { | |||
400 | property variant cachedRectangleSelection: null | 400 | property variant cachedRectangleSelection: null | ||
401 | 401 | | |||
402 | currentIndex: -1 | 402 | currentIndex: -1 | ||
403 | 403 | | |||
404 | keyNavigationWraps: false | 404 | keyNavigationWraps: false | ||
405 | boundsBehavior: Flickable.StopAtBounds | 405 | boundsBehavior: Flickable.StopAtBounds | ||
406 | 406 | | |||
407 | cellWidth: { | 407 | cellWidth: { | ||
408 | if (root.isPopup) { | 408 | if (root.useListViewMode) { | ||
409 | return gridView.width; | 409 | return gridView.width; | ||
410 | } | 410 | } | ||
411 | 411 | | |||
412 | return iconSize + (4 * units.largeSpacing); | 412 | return iconSize + (4 * units.largeSpacing); | ||
413 | } | 413 | } | ||
414 | 414 | | |||
415 | cellHeight: { | 415 | cellHeight: { | ||
416 | if (root.isPopup) { | 416 | if (root.useListViewMode) { | ||
417 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | 417 | return Math.ceil((Math.max(theme.mSize(theme.defaultFont).height, iconSize) | ||
418 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | 418 | + Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | ||
419 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | 419 | listItemSvg.margins.top + listItemSvg.margins.bottom)) / 2) * 2; | ||
420 | } | 420 | } | ||
421 | 421 | | |||
422 | return (iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) | 422 | return (iconSize + (theme.mSize(theme.defaultFont).height * plasmoid.configuration.textLines) | ||
423 | + (3 * units.smallSpacing) + (2 * units.largeSpacing)); | 423 | + (3 * units.smallSpacing) + (2 * units.largeSpacing)); | ||
424 | } | 424 | } | ||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | |||||
549 | 549 | | |||
550 | onCachedRectangleSelectionChanged: { | 550 | onCachedRectangleSelectionChanged: { | ||
551 | if (cachedRectangleSelection) { | 551 | if (cachedRectangleSelection) { | ||
552 | dir.updateSelection(cachedRectangleSelection, gridView.ctrlPressed); | 552 | dir.updateSelection(cachedRectangleSelection, gridView.ctrlPressed); | ||
553 | } | 553 | } | ||
554 | } | 554 | } | ||
555 | 555 | | |||
556 | function makeIconSize() { | 556 | function makeIconSize() { | ||
557 | if (root.isPopup) { | 557 | if (root.useListViewMode) { | ||
558 | return units.iconSizes.small; | 558 | return units.iconSizes.small; | ||
559 | } | 559 | } | ||
560 | 560 | | |||
561 | return FolderTools.iconSizeFromTheme(plasmoid.configuration.iconSize); | 561 | return FolderTools.iconSizeFromTheme(plasmoid.configuration.iconSize); | ||
562 | } | 562 | } | ||
563 | 563 | | |||
564 | function updateSelection(modifier) { | 564 | function updateSelection(modifier) { | ||
565 | if (modifier & Qt.ShiftModifier) { | 565 | if (modifier & Qt.ShiftModifier) { | ||
▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 580 | function rectangleSelect(x, y, width, height) { | |||
645 | gridView.cachedRectangleSelection = indices; | 645 | gridView.cachedRectangleSelection = indices; | ||
646 | } | 646 | } | ||
647 | 647 | | |||
648 | Behavior on contentX { id: smoothX; enabled: false; SmoothedAnimation { velocity: 700 } } | 648 | Behavior on contentX { id: smoothX; enabled: false; SmoothedAnimation { velocity: 700 } } | ||
649 | Behavior on contentY { id: smoothY; enabled: false; SmoothedAnimation { velocity: 700 } } | 649 | Behavior on contentY { id: smoothY; enabled: false; SmoothedAnimation { velocity: 700 } } | ||
650 | 650 | | |||
651 | Keys.onReturnPressed: { | 651 | Keys.onReturnPressed: { | ||
652 | if (currentIndex != -1 && dir.hasSelection()) { | 652 | if (currentIndex != -1 && dir.hasSelection()) { | ||
653 | var func = root.isPopup ? dir.cd : dir.run; | 653 | var func = root.useListViewMode ? dir.cd : dir.run; | ||
654 | func(positioner.map(currentIndex)); | 654 | func(positioner.map(currentIndex)); | ||
655 | } | 655 | } | ||
656 | } | 656 | } | ||
657 | 657 | | |||
658 | Keys.onMenuPressed: { | 658 | Keys.onMenuPressed: { | ||
659 | // FIXME TODO: Correct popup position. | 659 | // FIXME TODO: Correct popup position. | ||
660 | return; | 660 | return; | ||
661 | 661 | | |||
▲ Show 20 Lines • Show All 310 Lines • ▼ Show 20 Line(s) | |||||
972 | } | 972 | } | ||
973 | 973 | | |||
974 | Component.onCompleted: { | 974 | Component.onCompleted: { | ||
975 | dir.requestRename.connect(rename); | 975 | dir.requestRename.connect(rename); | ||
976 | } | 976 | } | ||
977 | } | 977 | } | ||
978 | 978 | | |||
979 | Component.onCompleted: { | 979 | Component.onCompleted: { | ||
980 | if (upButton == null && root.isPopup) { | 980 | if (upButton == null && root.useListViewMode) { | ||
981 | upButton = makeUpButton(); | 981 | upButton = makeUpButton(); | ||
982 | } | 982 | } | ||
983 | } | 983 | } | ||
984 | } | 984 | } |