Warning, /plasma/kwin/src/kcms/scripts/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas <kok3rs@gmail.com>
0003     SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick
0009 import QtQuick.Layouts
0010 
0011 import org.kde.config
0012 import org.kde.kirigami 2 as Kirigami
0013 import org.kde.newstuff as NewStuff
0014 import org.kde.kcmutils as KCMUtils
0015 
0016 KCMUtils.ScrollViewKCM {
0017     implicitWidth: Kirigami.Units.gridUnit * 22
0018     implicitHeight: Kirigami.Units.gridUnit * 20
0019 
0020     actions: [
0021         Kirigami.Action {
0022             icon.name: "document-import"
0023             text: i18n("Install from File…")
0024             onTriggered: kcm.importScript()
0025         },
0026         NewStuff.Action {
0027             text: i18nc("@action:button get new KWin scripts", "Get New…")
0028             visible: KAuthorized.authorize(KAuthorized.GHNS)
0029             configFile: "kwinscripts.knsrc"
0030             onEntryEvent: (entry, event) => {
0031                 if (event === NewStuff.Engine.StatusChangedEvent) {
0032                     kcm.onGHNSEntriesChanged()
0033                 }
0034             }
0035         }
0036     ]
0037 
0038     header: ColumnLayout {
0039         spacing: Kirigami.Units.smallSpacing
0040 
0041         Kirigami.InlineMessage {
0042             Layout.fillWidth: true
0043             visible: kcm.errorMessage || kcm.infoMessage
0044             type: kcm.errorMessage ? Kirigami.MessageType.Error : Kirigami.MessageType.Information
0045             text: kcm.errorMessage || kcm.infoMessage
0046         }
0047 
0048         Kirigami.SearchField {
0049             Layout.fillWidth: true
0050             id: searchField
0051         }
0052     }
0053 
0054     view: KCMUtils.PluginSelector {
0055         id: selector
0056         sourceModel: kcm.model
0057         query: searchField.text
0058 
0059         delegate: KCMUtils.PluginDelegate {
0060             onConfigTriggered: kcm.configure(model.config)
0061             additionalActions: [
0062                 Kirigami.Action {
0063                     enabled: kcm.canDeleteEntry(model.metaData)
0064                     icon.name: kcm.pendingDeletions.indexOf(model.metaData) === -1 ? "delete" : "edit-undo"
0065                     text: i18nc("@info:tooltip", "Delete…")
0066                     displayHint: Kirigami.DisplayHint.IconOnly
0067 
0068                     onTriggered: kcm.togglePendingDeletion(model.metaData)
0069                 }
0070             ]
0071         }
0072     }
0073 }