Warning, /plasma/discover/discover/qml/DiscoverPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick
0008 import org.kde.kirigami as Kirigami
0009 
0010 Kirigami.ScrollablePage {
0011     id: root
0012 
0013     Kirigami.Theme.colorSet: Kirigami.Theme.View
0014     Kirigami.Theme.inherit: false
0015 
0016     property bool compact: root.width < Kirigami.Units.gridUnit * 28 || !applicationWindow().wideScreen
0017 
0018     Shortcut {
0019         sequences: [ StandardKey.MoveToNextPage ]
0020         enabled: root.isCurrentPage
0021         onActivated: {
0022             root.flickable.contentY = Math.min(root.flickable.contentHeight - root.flickable.height,
0023                                                root.flickable.contentY + root.flickable.height);
0024         }
0025     }
0026 
0027     Shortcut {
0028         sequences: [ StandardKey.MoveToPreviousPage ]
0029         enabled: root.isCurrentPage
0030         onActivated: {
0031             root.flickable.contentY = Math.max(0, root.flickable.contentY - root.flickable.height);
0032         }
0033     }
0034 
0035     Shortcut {
0036         sequences: [ StandardKey.Cancel ]
0037         enabled: root.isCurrentPage && applicationWindow().pageStack.depth > 1
0038         onActivated: {
0039             applicationWindow().pageStack.pop()
0040         }
0041     }
0042 
0043     Shortcut {
0044         sequences: [ StandardKey.Refresh ]
0045         enabled: root.isCurrentPage && root.supportsRefreshing
0046         onActivated: {
0047             if (root.supportsRefreshing) {
0048                 root.refreshing = true
0049             }
0050         }
0051     }
0052 
0053     Keys.onPressed: event => {
0054         const readableCharacters = /\w+/;
0055         if (event.text.length > 0 && event.modifiers === Qt.NoModifier && event.text.match(readableCharacters)) {
0056             window.globalDrawer.suggestSearchText(event.text)
0057         }
0058     }
0059 }