Warning, /office/klevernotes/src/contents/ui/settings/GeneralTab.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2023 Louis Schul <schul9louis@gmail.com>
0003 
0004 import QtQuick 2.15
0005 import QtQuick.Layouts 1.15
0006 
0007 import org.kde.kirigami 2.19 as Kirigami
0008 import org.kde.kirigamiaddons.formcard 1.0 as FormCard
0009 
0010 import org.kde.Klever 1.0
0011 
0012 ColumnLayout {
0013     id: root
0014 
0015     Layout.fillWidth: true
0016     Layout.fillHeight: true
0017 
0018     FormCard.FormHeader {
0019         title: i18nc("@title, general storage settings, Storage as in 'the folder where all the notes will be stored'", "Storage")
0020         Layout.fillWidth: true
0021     }
0022 
0023     FormCard.FormCard {
0024         Layout.fillWidth: true
0025 
0026         FormCard.FormTextFieldDelegate {
0027             id: storageField
0028 
0029             text: Config.storagePath
0030             label: i18nc("@label:textbox, Storage as in 'the folder where all the notes will be stored'", "Storage path:")
0031 
0032             Layout.margins: 0
0033             Layout.fillWidth: true
0034             
0035             // workaround to make it readOnly
0036             onTextChanged: {
0037                 text = Config.storagePath
0038             }
0039 
0040             MouseArea {
0041                 anchors.fill: parent
0042                 onClicked: storageDialog.open()
0043             }
0044         }
0045     }
0046 
0047     FormCard.FormHeader {
0048         title: i18nc("@title, general sidebar settings", "Sidebar")
0049         Layout.fillWidth: true
0050     }
0051 
0052     FormCard.FormCard {
0053         Layout.fillWidth: true
0054 
0055         FormCard.FormTextFieldDelegate {
0056             id: newCategoryField
0057 
0058             property string name
0059             property bool isActive: false
0060 
0061             text: Config.defaultCategoryName
0062             label: i18nc("@label:textbox, the default note category name", "New Category name:")
0063 
0064             Layout.margins: 0
0065             Layout.fillWidth: true
0066 
0067             onNameChanged: if (isActive) {
0068                 text = name
0069                 Config.defaultCategoryName = name
0070                 isActive = false
0071                 name = ""
0072             }
0073 
0074             MouseArea {
0075                 anchors.fill: parent
0076                 onClicked: {
0077                     newCategoryField.isActive = true
0078                     updateName(newCategoryField.text, newCategoryField)
0079                 }
0080             }
0081         }
0082 
0083         FormCard.FormDelegateSeparator { above: newCategoryField; below: newGroupField }
0084 
0085         FormCard.FormTextFieldDelegate {
0086             id: newGroupField
0087 
0088             property string name
0089             property bool isActive: false
0090 
0091             text: Config.defaultGroupName
0092             label: i18nc("@label:textbox, the default note group name", "New Group name:")
0093 
0094             Layout.margins: 0
0095             Layout.fillWidth: true
0096 
0097             onNameChanged: if (isActive) {
0098                 text = name
0099                 Config.defaultGroupName = name
0100                 isActive = false
0101                 name = ""
0102             }
0103 
0104             MouseArea {
0105                 anchors.fill: parent
0106                 onClicked: {
0107                     newGroupField.isActive = true
0108                     updateName(newGroupField.text, newGroupField)
0109                 }
0110             }
0111         }
0112 
0113         FormCard.FormDelegateSeparator { above: newGroupField; below: newNoteField }
0114 
0115         FormCard.FormTextFieldDelegate {
0116             id: newNoteField
0117 
0118             property string name
0119             property bool isActive: false
0120 
0121             text: Config.defaultNoteName
0122             label: i18nc("@label:textbox, the default note name", "New Note name:")
0123 
0124             Layout.margins: 0
0125             Layout.fillWidth: true
0126 
0127             onNameChanged: if (isActive) {
0128                 text = name
0129                 Config.defaultNoteName = name
0130                 isActive = false
0131                 name = ""
0132             }
0133 
0134             MouseArea {
0135                 anchors.fill: parent
0136                 onClicked: {
0137                     newNoteField.isActive = true
0138                     updateName(newNoteField.text, newNoteField)
0139                 }
0140             }
0141         }
0142     }
0143 }