Changeset View
Changeset View
Standalone View
Standalone View
applets/kickoff/package/contents/ui/BaseView.qml
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | Copyright (C) 2011 Martin Gräßlin <mgraesslin@kde.org> | 2 | Copyright (C) 2011 Martin Gräßlin <mgraesslin@kde.org> | ||
3 | Copyright (C) 2012 Marco Martin <mart@kde.org> | 3 | Copyright (C) 2012 Marco Martin <mart@kde.org> | ||
4 | Copyright (C) 2015 Eike Hein <hein@kde.org> | 4 | Copyright (C) 2015-2018 Eike Hein <hein@kde.org> | ||
5 | 5 | | |||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | 9 | (at your option) any later version. | ||
10 | 10 | | |||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. | ||
15 | 15 | | |||
16 | You should have received a copy of the GNU General Public License along | 16 | You should have received a copy of the GNU General Public License along | ||
17 | with this program; if not, write to the Free Software Foundation, Inc., | 17 | with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | 19 | */ | ||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import org.kde.plasma.core 2.0 as PlasmaCore | 21 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 22 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | import org.kde.draganddrop 2.0 | 24 | import org.kde.draganddrop 2.0 | ||
25 | 25 | | |||
26 | 26 | | |||
27 | Item { | 27 | Item { | ||
28 | property alias model: kickoffListView.model | 28 | property alias model: baseView.model | ||
29 | property alias delegate: kickoffListView.delegate | 29 | property alias delegate: baseView.delegate | ||
30 | 30 | | |||
31 | property ListView listView: kickoffListView | 31 | property ListView listView: baseView.listView | ||
32 | 32 | | |||
33 | function decrementCurrentIndex() { | 33 | function decrementCurrentIndex() { | ||
34 | kickoffListView.decrementCurrentIndex(); | 34 | baseView.decrementCurrentIndex(); | ||
35 | } | 35 | } | ||
36 | 36 | | |||
37 | function incrementCurrentIndex() { | 37 | function incrementCurrentIndex() { | ||
38 | kickoffListView.incrementCurrentIndex(); | 38 | baseView.incrementCurrentIndex(); | ||
39 | } | 39 | } | ||
40 | 40 | | |||
41 | function activateCurrentIndex() { | 41 | function activateCurrentIndex() { | ||
42 | kickoffListView.currentItem.activate(); | 42 | baseView.currentItem.activate(); | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | function openContextMenu() { | 45 | function openContextMenu() { | ||
46 | kickoffListView.currentItem.openActionMenu(); | 46 | baseView.currentItem.openActionMenu(); | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | PlasmaExtras.ScrollArea { | | |||
50 | anchors.fill: parent | | |||
51 | | ||||
52 | ListView { | | |||
53 | id: kickoffListView | | |||
54 | | ||||
55 | interactive: contentHeight > height | | |||
56 | boundsBehavior: Flickable.StopAtBounds | | |||
57 | currentIndex: -1 | | |||
58 | keyNavigationWraps: true | | |||
59 | highlight: KickoffHighlight {} | | |||
60 | highlightMoveDuration : 0 | | |||
61 | highlightResizeDuration: 0 | | |||
62 | | ||||
63 | delegate: KickoffItem {} | | |||
64 | | ||||
65 | section { | | |||
66 | property: "group" | | |||
67 | criteria: ViewSection.FullString | | |||
68 | delegate: SectionDelegate {} | | |||
69 | } | | |||
70 | Connections { | 49 | Connections { | ||
71 | target: plasmoid | 50 | target: plasmoid | ||
51 | | ||||
72 | onExpandedChanged: { | 52 | onExpandedChanged: { | ||
73 | if (!expanded) { | 53 | if (!expanded) { | ||
74 | kickoffListView.currentIndex = -1; | 54 | baseView.currentIndex = -1; | ||
75 | } | | |||
76 | } | 55 | } | ||
77 | } | 56 | } | ||
78 | } | 57 | } | ||
58 | | ||||
59 | KickoffListView { | ||||
60 | id: baseView | ||||
61 | | ||||
62 | anchors.fill: parent | ||||
63 | | ||||
64 | currentIndex: -1 | ||||
65 | interactive: contentHeight > height | ||||
79 | } | 66 | } | ||
80 | } | 67 | } |