Warning, /plasma/plasma-sdk/plasmoidviewer/qmlpackages/shell/contents/views/SdkButtons.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2013 Antonis Tsiapaliokas <kok3rs@gmail.com>
0003 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004 *
0005 * SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Layouts
0010
0011 import org.kde.kirigami 2.20 as Kirigami
0012 import org.kde.plasma.core as PlasmaCore
0013 import org.kde.plasma.components 3.0 as PlasmaComponents
0014 import org.kde.plasma.extras 2.0 as PlasmaExtras
0015
0016 FloatingToolBar {
0017 id: root
0018
0019 property Item containment
0020
0021 signal formFactor(int formFactorType)
0022 signal location(int locationType)
0023 signal requestScreenshot()
0024
0025 function triggerAppletInternalAction(name: string) {
0026 const applets = containment?.plasmoid.applets;
0027 if (applets) {
0028 const applet = applets[0];
0029 const action = applet?.internalAction(name);
0030 action?.trigger();
0031 }
0032 }
0033
0034 contentItem: RowLayout {
0035 spacing: Kirigami.Units.smallSpacing
0036
0037 PlasmaComponents.Button {
0038 id: refreshButton
0039 icon.name: "view-refresh"
0040 onClicked: root.triggerAppletInternalAction("remove")
0041 }
0042
0043 PlasmaComponents.Button {
0044 id: formFactorMenuButton
0045 text: i18n("FormFactors")
0046 onClicked: formFactorMenu.open()
0047 }
0048
0049 PlasmaExtras.Menu {
0050 id: formFactorMenu
0051 visualParent: formFactorMenuButton
0052 PlasmaExtras.MenuItem {
0053 text: i18n("Planar")
0054 onClicked: root.formFactor(PlasmaCore.Types.Planar)
0055 }
0056 PlasmaExtras.MenuItem {
0057 text: i18n("Vertical")
0058 onClicked: root.formFactor(PlasmaCore.Types.Vertical)
0059 }
0060 PlasmaExtras.MenuItem {
0061 text: i18n("Horizontal")
0062 onClicked: root.formFactor(PlasmaCore.Types.Horizontal)
0063 }
0064 PlasmaExtras.MenuItem {
0065 text: i18n("Mediacenter")
0066 onClicked: root.formFactor(PlasmaCore.Types.MediaCenter)
0067 }
0068 PlasmaExtras.MenuItem {
0069 text: i18n("Application")
0070 onClicked: root.formFactor(PlasmaCore.Types.Application)
0071 }
0072 }
0073
0074 PlasmaComponents.Button {
0075 id: locationMenuButton
0076 text: i18n("Location")
0077 onClicked: locationMenu.open()
0078 }
0079
0080 PlasmaComponents.Button {
0081 id: screenshotButton
0082 icon.name: "ksnapshot"
0083 onClicked: root.requestScreenshot()
0084 }
0085
0086 PlasmaExtras.Menu {
0087 id: locationMenu
0088 visualParent: locationMenuButton
0089 PlasmaExtras.MenuItem {
0090 text: i18n("Floating")
0091 onClicked: root.location(PlasmaCore.Types.Floating)
0092 }
0093 PlasmaExtras.MenuItem {
0094 text: i18n("Desktop")
0095 onClicked: root.location(PlasmaCore.Types.Desktop)
0096 }
0097 PlasmaExtras.MenuItem {
0098 text: i18n("Fullscreen")
0099 onClicked: root.location(PlasmaCore.Types.FullScreen)
0100 }
0101 PlasmaExtras.MenuItem {
0102 text: i18n("Top Edge")
0103 onClicked: root.location(PlasmaCore.Types.TopEdge)
0104 }
0105 PlasmaExtras.MenuItem {
0106 text: i18n("Bottom Edge")
0107 onClicked: root.location(PlasmaCore.Types.BottomEdge)
0108 }
0109 PlasmaExtras.MenuItem {
0110 text: i18n("Left Edge")
0111 onClicked: root.location(PlasmaCore.Types.LeftEdge)
0112 }
0113 PlasmaExtras.MenuItem {
0114 text: i18n("Right Edge")
0115 onClicked: root.location(PlasmaCore.Types.RightEdge)
0116 }
0117 }
0118
0119 PlasmaComponents.Button {
0120 id: configButton
0121 icon.name: "configure"
0122 onClicked: root.triggerAppletInternalAction("configure")
0123 }
0124
0125 PlasmaComponents.Button {
0126 text: i18n("Configure Containment")
0127 onClicked: {
0128 const containment = root.containment?.plasmoid;
0129 const action = containment?.internalAction("configure");
0130 action?.trigger();
0131 }
0132 }
0133
0134 PlasmaComponents.Button {
0135 icon.name: "view-hidden"
0136 onClicked: {
0137 root.visible = false;
0138 }
0139 }
0140 }
0141 }