Warning, /plasma/kscreen/plasmoid/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 Work sponsored by the LiMux project of the city of Munich: 0003 SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@broulik.de> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Layouts 1.15 0010 0011 import org.kde.plasma.plasmoid 2.0 0012 import org.kde.plasma.core as PlasmaCore 0013 import org.kde.kirigami 2.20 as Kirigami 0014 import org.kde.plasma.plasma5support 2.0 as P5Support 0015 import org.kde.kquickcontrolsaddons 2.0 0016 import org.kde.config as KConfig // KAuthorized.authorizeControlModule 0017 import org.kde.kcmutils // KCMLauncher 0018 import org.kde.private.kscreen 1.0 0019 0020 PlasmoidItem { 0021 id: root 0022 0023 // Only show if the user enabled presentation mode 0024 Plasmoid.status: presentationModeEnabled ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.PassiveStatus 0025 toolTipSubText: presentationModeEnabled ? i18n("Presentation mode is enabled") : "" 0026 0027 readonly property string kcmName: "kcm_kscreen" 0028 readonly property bool kcmAllowed: KConfig.KAuthorized.authorizeControlModule("kcm_kscreen") 0029 0030 readonly property bool presentationModeEnabled: presentationModeCookie > 0 0031 property int presentationModeCookie: -1 0032 0033 readonly property bool isLaptop: (pmSource.data["PowerDevil"] && pmSource.data["PowerDevil"]["Is Lid Present"]) ? true : false 0034 0035 P5Support.DataSource { 0036 id: pmSource 0037 engine: "powermanagement" 0038 connectedSources: ["PowerDevil", "Inhibitions"] 0039 0040 onSourceAdded: source => { 0041 disconnectSource(source); 0042 connectSource(source); 0043 } 0044 onSourceRemoved: source => { 0045 disconnectSource(source); 0046 } 0047 0048 readonly property var inhibitions: { 0049 var inhibitions = []; 0050 0051 var data = pmSource.data.Inhibitions; 0052 if (data) { 0053 for (var key in data) { 0054 if (key === "plasmashell" || key === "plasmoidviewer") { // ignore our own inhibition 0055 continue; 0056 } 0057 0058 inhibitions.push(data[key]); 0059 } 0060 } 0061 0062 return inhibitions; 0063 } 0064 } 0065 0066 PlasmaCore.Action { 0067 id: configureAction 0068 text: i18n("Configure Display Settingsā¦") 0069 icon.name: "preferences-desktop-display" 0070 visible: kcmAllowed 0071 onTriggered: KCMLauncher.openSystemSettings(kcmName) 0072 } 0073 Component.onCompleted: { 0074 Plasmoid.setInternalAction("configure", configureAction); 0075 } 0076 0077 fullRepresentation: ColumnLayout { 0078 spacing: 0 0079 Layout.preferredWidth: Kirigami.Units.gridUnit * 15 0080 0081 ScreenLayoutSelection { 0082 Layout.leftMargin: Kirigami.Units.smallSpacing 0083 Layout.fillWidth: true 0084 screenLayouts: Plasmoid.availableActions().filter(action => action.action !== OsdAction.NoAction) 0085 } 0086 0087 PresentationModeItem { 0088 Layout.fillWidth: true 0089 Layout.topMargin: Kirigami.Units.smallSpacing * 2 0090 Layout.leftMargin: Kirigami.Units.smallSpacing 0091 } 0092 0093 // compact the layout 0094 Item { 0095 Layout.fillHeight: true 0096 } 0097 } 0098 }