Warning, /plasma/libplasma/examples/applets/notes/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
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 import org.kde.kirigami as Kirigami
0011 import org.kde.ksvg as KSvg
0012 import org.kde.plasma.core as PlasmaCore
0013 import org.kde.plasma.plasmoid
0014 import org.kde.plasma.components as PlasmaComponents
0015
0016 PlasmoidItem {
0017 // this isn't a frameSVG, the default SVG margins take up around 7% of the frame size, so we use that
0018 readonly property real horizontalMargins: width * 0.07
0019 readonly property real verticalMargins: height * 0.07
0020
0021 Layout.minimumWidth: Kirigami.Units.gridUnit * 8
0022 Layout.minimumHeight: Kirigami.Units.gridUnit * 8
0023
0024 Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
0025
0026 onExternalData: (mimetype, data) => {
0027 if (mimetype === "text/plain") {
0028 noteText.text = data;
0029 }
0030 }
0031
0032 KSvg.SvgItem {
0033 anchors.fill: parent
0034
0035 imagePath: "widgets/notes"
0036 elementId: "yellow-notes"
0037
0038 PlasmaComponents.TextArea {
0039 id: noteText
0040
0041 anchors {
0042 fill: parent
0043 leftMargin: horizontalMargins
0044 rightMargin: horizontalMargins
0045 topMargin: verticalMargins
0046 bottomMargin: verticalMargins
0047 }
0048
0049 background: null
0050 color: Qt.alpha("black", 0.8)
0051 font.pointSize: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.3)
0052 wrapMode: TextEdit.Wrap
0053
0054 text: Plasmoid.configuration.Text
0055 onEditingFinished: {
0056 Plasmoid.configuration.Text = text;
0057 }
0058 }
0059 }
0060 }