Warning, /pim/kube/framework/qml/ListView.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
0003 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsystems.com>
0004 *
0005 * This program is free software; you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation; either version 2 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License along
0016 * with this program; if not, write to the Free Software Foundation, Inc.,
0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019
0020 import QtQuick 2.15
0021 import QtQuick.Controls 2
0022 import org.kube.framework 1.0 as Kube
0023
0024 ListView {
0025 id: root
0026 property Item mouseProxy: scrollHelper
0027 property int availableWidth: scrollBar.visible ? width - scrollBar.width: width
0028 implicitHeight: contentHeight
0029
0030 clip: true
0031 ScrollBar.vertical: Kube.ScrollBar { id: scrollBar }
0032 highlightMoveDuration: 100
0033
0034 add: Transition {
0035 // FIXME Even though we handle interrupted transitions in the displaced handler,
0036 // we still occasionally end up with invisible items (e.g. when starting into the inbound view)
0037 // NumberAnimation { property: "opacity"; from: 0.1; to: 1.0; duration: 100 }
0038 }
0039
0040 displaced: Transition {
0041 //FIXME This causes some delegates to be invisible every now and then (no idea why)
0042 // NumberAnimation { properties: "x,y"; duration: 50 }
0043 //Handle interrupted add transitions
0044 NumberAnimation { property: "opacity"; to: 1.0; }
0045 }
0046
0047 Keys.onPressed: {
0048 if (event.matches(StandardKey.MoveToNextLine)) {
0049 incrementCurrentIndex()
0050 } else if (event.matches(StandardKey.MoveToPreviousLine)) {
0051 decrementCurrentIndex()
0052 }
0053 }
0054
0055 Kube.ScrollHelper {
0056 id: scrollHelper
0057 flickable: root
0058 anchors.fill: root
0059 }
0060
0061 onAtYEndChanged: {
0062 //The fetchMore logic doesn't work in the inbound view (not sure why, it should).
0063 //However, this does pretty much the same and works.
0064 if (atYEnd && model && typeof model.tryFetchMore === "function") {
0065 model.tryFetchMore()
0066 }
0067 }
0068 }
0069