Warning, /plasma/kdeplasma-addons/applets/notes/package/contents/ui/configAppearance.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15 as QQC2
0009 import QtQuick.Layouts 1.15
0010 
0011 import org.kde.kcmutils as KCM
0012 import org.kde.plasma.core as PlasmaCore
0013 import org.kde.kirigami 2.20 as Kirigami
0014 import org.kde.ksvg 1.0 as KSvg
0015 import org.kde.plasma.components 3.0 as PlasmaComponents3
0016 import org.kde.kirigami 2.5 as Kirigami
0017 import org.kde.kcmutils as KCM
0018 
0019 KCM.GridViewKCM {
0020     property string cfg_color
0021     property alias cfg_fontSize: fontSizeSpinBox.value
0022 
0023     header: Kirigami.FormLayout {
0024         QQC2.SpinBox {
0025             id: fontSizeSpinBox
0026 
0027             implicitWidth: Kirigami.Units.gridUnit * 3
0028             from: 4
0029             to: 128
0030             textFromValue: function (value) {
0031                 return i18n("%1pt", value)
0032             }
0033             valueFromText: function (text) {
0034                 return parseInt(text)
0035             }
0036 
0037             Kirigami.FormData.label: i18n("Text font size:")
0038         }
0039     }
0040 
0041     view.model: ["white", "black", "red", "orange", "yellow", "green", "blue", "pink", "translucent", "translucent-light"]
0042     view.currentIndex: view.model.indexOf(cfg_color)
0043     view.onCurrentIndexChanged: cfg_color = view.model[view.currentIndex]
0044 
0045     view.delegate: KCM.GridDelegate {
0046         id: delegate
0047         thumbnailAvailable: true
0048         thumbnail: KSvg.SvgItem {
0049             anchors.fill: parent
0050             anchors.margins: Kirigami.Units.largeSpacing
0051 
0052             imagePath: "widgets/notes"
0053             elementId: modelData + "-notes"
0054 
0055             QQC2.Label {
0056                 anchors.fill: parent
0057                 horizontalAlignment: Text.AlignHCenter
0058                 verticalAlignment: Text.AlignVCenter
0059 
0060                 text: {
0061                     switch (modelData) {
0062                     case "white": return i18n("A white sticky note")
0063                     case "black": return i18n("A black sticky note")
0064                     case "red": return i18n("A red sticky note")
0065                     case "orange": return i18n("An orange sticky note")
0066                     case "yellow": return i18n("A yellow sticky note")
0067                     case "green": return i18n("A green sticky note")
0068                     case "blue": return i18n("A blue sticky note")
0069                     case "pink": return i18n("A pink sticky note")
0070                     case "translucent": return i18n("A transparent sticky note")
0071                     case "translucent-light": return i18n("A transparent sticky note with light text")
0072                     }
0073                 }
0074                 textFormat: Text.PlainText
0075                 elide: Text.ElideRight
0076                 wrapMode: Text.WordWrap
0077 
0078                 //this is deliberately _NOT_ the theme color as we are over a known bright background
0079                 //an unknown colour over a known colour is a bad move as you end up with white on yellow
0080                 color: {
0081                     if (modelData === "black" || modelData === "translucent-light") {
0082                         return "#dfdfdf"
0083                     } else {
0084                         return "#202020"
0085                     }
0086                 }
0087             }
0088         }
0089         onClicked: {
0090             cfg_color = modelData
0091         }
0092     }
0093 }