Warning, /plasma/plasma-desktop/applets/kicker/package/contents/ui/SideBarSection.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013-2014 Eike Hein <hein@kde.org>
0003
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.15
0008
0009 import org.kde.draganddrop 2.0
0010 import org.kde.kirigami 2.20 as Kirigami
0011
0012 DropArea {
0013 id: root
0014
0015 width: Kirigami.Units.iconSizes.medium
0016 height: contentHeight
0017
0018 anchors.horizontalCenter: parent.horizontalCenter
0019
0020 property int contentHeight: model ? (model.count * Kirigami.Units.iconSizes.medium) + ((model.count - 1) * flow.spacing) : 0
0021
0022 property alias model: repeater.model
0023
0024 onDragMove: event => {
0025 if (flow.animating) {
0026 return;
0027 }
0028
0029 var above = flow.childAt(event.x, event.y);
0030
0031 if (above && above !== kicker.dragSource && dragSource.parent == flow) {
0032 repeater.model.moveRow(dragSource.itemIndex, above.itemIndex);
0033 }
0034
0035 }
0036
0037 Flow {
0038 id: flow
0039
0040 anchors.fill: parent
0041
0042 property bool animating: false
0043 property int animationDuration: resetAnimationDurationTimer.interval
0044
0045 move: Transition {
0046 SequentialAnimation {
0047 PropertyAction { target: flow; property: "animating"; value: true }
0048
0049 NumberAnimation {
0050 duration: flow.animationDuration
0051 properties: "x, y"
0052 easing.type: Easing.OutQuad
0053 }
0054
0055 PropertyAction { target: flow; property: "animating"; value: false }
0056 }
0057 }
0058
0059 spacing: (2 * Kirigami.Units.smallSpacing)
0060
0061 Repeater {
0062 id: repeater
0063
0064 delegate: SideBarItem {}
0065
0066 onCountChanged: {
0067 flow.animationDuration = 0;
0068 resetAnimationDurationTimer.start();
0069 }
0070 }
0071 }
0072
0073 Timer {
0074 id: resetAnimationDurationTimer
0075
0076 interval: 150
0077 repeat: false
0078
0079 onTriggered: {
0080 flow.animationDuration = interval - 20;
0081 }
0082 }
0083 }