aboutsummaryrefslogtreecommitdiffstats
path: root/apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml
diff options
context:
space:
mode:
authorEgor Nemtsev <enemtsev@luxoft.com>2020-04-03 14:33:29 +0300
committerEgor Nemtsev <enemtsev@luxoft.com>2020-04-07 09:27:38 +0000
commit785b520d07d82193dee0573fffdbc1314b50f336 (patch)
tree6e97b050cc503ec95a84d9a182ef2db5a6cc0b21 /apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml
parentec183828f827220527266cf64d2d73b46cdb4d24 (diff)
[sysui, downloads] add pull down to refresh for categories
- update ToolsColumn to ListView to have Flickable component. Fix JSONModel to handle updates. Add pull down to refresh for categories column Fixes: AUTOSUITE-850 Change-Id: If4170c283002ea1e921582085e7ec2e50c0919be Reviewed-by: Grigorii Zimin <gzimin@luxoft.com>
Diffstat (limited to 'apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml')
-rw-r--r--apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml b/apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml
index 95dea832..65ab16c3 100644
--- a/apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml
+++ b/apps/com.pelagicore.downloads/controls/DownloadsToolsColumn.qml
@@ -44,14 +44,52 @@ Item {
property string serverUrl
signal toolClicked(int index)
+ signal refresh()
+
+ BusyIndicator {
+ id: busyIndicator
+
+ running: false
+ anchors.horizontalCenter: root.horizontalCenter
+ opacity: 0.0;
+ visible: opacity > 0.0
+ width: Sizes.dp(100); height: width
+ }
ToolsColumn {
id: toolsColumn
+ property bool refreshRequired: false
+
+ interactive: true
width: Sizes.dp(264)
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Sizes.dp(53)
onClicked: root.toolClicked(currentIndex)
+ onContentYChanged: {
+ if (atYBeginning) {
+ var d = Math.abs(contentY);
+ busyIndicator.opacity = d / busyIndicator.height;
+ if (d > busyIndicator.height) {
+ if (!busyIndicator.running) {
+ busyIndicator.running = true;
+ refreshRequired = true;
+ }
+ } else {
+ busyIndicator.running = false;
+ // if we drag back - no refresh
+ if (dragging)
+ refreshRequired = false;
+ }
+ }
+ }
+ onMovementEnded: {
+ busyIndicator.opacity = 0.0;
+ if (refreshRequired) {
+ refreshRequired = false;
+ refresh();
+ }
+ }
}
}