Warning, /plasma/plasma-desktop/kcms/runners/plasmasearch/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2022 Alexander Lohnau <alexander.lohnau@gmx.de>
0003
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15 as QQC2
0009 import QtQuick.Layouts 1.1
0010
0011 import org.kde.config
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.kcmutils as KCMUtils
0014 import org.kde.newstuff 1.91 as NewStuff
0015
0016 KCMUtils.ScrollViewKCM {
0017 id: root
0018
0019 implicitWidth: Kirigami.Units.gridUnit * 32
0020 implicitHeight: Kirigami.Units.gridUnit * 18
0021
0022 actions: [
0023 Kirigami.Action {
0024 icon.name: "configure"
0025 text: i18n("Configure KRunner…")
0026 onTriggered: kcm.showKRunnerKCM()
0027 },
0028 NewStuff.Action {
0029 text: i18n("Get New Plugins…")
0030 visible: KAuthorized.authorize(KAuthorized.GHNS)
0031 configFile: "krunner.knsrc"
0032 onEntryEvent: (entry, event) => {
0033 if (event === NewStuff.Engine.StatusChangedEvent) {
0034 kcm.reloadPlugin()
0035 }
0036 }
0037 }
0038 ]
0039
0040 header: ColumnLayout {
0041 spacing: Kirigami.Units.smallSpacing
0042
0043 QQC2.Label {
0044 text: i18n("Enable or disable plugins (used in KRunner, Application Launcher, and the Overview effect). Mark plugins as favorites and arrange them in order you want to see them.")
0045 textFormat: Text.PlainText
0046 wrapMode: Text.WordWrap
0047 Layout.fillWidth: true
0048 }
0049
0050 Kirigami.SearchField {
0051 id: searchField
0052 Layout.fillWidth: true
0053 }
0054 }
0055
0056 view: KCMUtils.PluginSelector {
0057 id: pluginSelector
0058 sourceModel: kcm.model
0059 query: searchField.text
0060 delegate: Item { // Needed to avoid visual glitches in ListItemDragHandle
0061 id: delegateItem
0062 width: pluginSelector.width
0063 implicitHeight: pluginDelegate.implicitHeight
0064 // PluginDelegate must either be a direct delegate, or have a model explicitly set
0065 // "model: model" would just be a binding loop, so we store the model in a property of the
0066 // direct delegate Item and access it from PluginDelegate
0067 property var modelObject: model
0068 property bool isFavorite: model.category === kcm.favoriteCategory
0069 KCMUtils.PluginDelegate {
0070 id: pluginDelegate
0071 model: delegateItem.modelObject
0072 width: pluginSelector.width
0073 property var drag: Kirigami.ListItemDragHandle {
0074 property int dropNewIndex
0075 listItem: pluginDelegate
0076 listView: pluginSelector
0077 // Moving the rows now would cause a model reset and we could not drag an entry multiple rows up/down
0078 onMoveRequested: (oldIndex, newIndex) => (dropNewIndex = newIndex)
0079 onDropped: () => kcm.movePlugin(model.metaData, dropNewIndex)
0080 }
0081 Component.onCompleted: {
0082 if (isFavorite) {
0083 leading = drag
0084 }
0085 }
0086 additionalActions: [
0087 Kirigami.Action {
0088 displayHint: Kirigami.DisplayHint.IconOnly
0089 text: isFavorite ? i18n("Remove from favorites") : i18n("Add to favorites")
0090 icon.name: isFavorite ? "starred-symbolic": "non-starred-symbolic"
0091 onTriggered: isFavorite ? kcm.removeFromFavorites(model.metaData) : kcm.addToFavorites(model.metaData)
0092 }
0093 ]
0094 onConfigTriggered: kcm.showKCM(model.config, [], model.metaData)
0095 highlighted: false
0096 }
0097 }
0098 }
0099 }