Warning, /office/klevernotes/src/contents/ui/dialogs/NamingErrorDialog.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2022 Louis Schul <schul9louis@gmail.com>
0003
0004 import QtQuick 2.15
0005 import QtQuick.Controls 2.15 as Controls
0006
0007 import org.kde.kirigami 2.19 as Kirigami
0008
0009 Kirigami.PromptDialog {
0010 readonly property var useCaseTrad: {
0011 "category": i18nc("Name, as in 'A note category'", "category"),
0012 "group": i18nc("Name, as in 'A note group'", "group"),
0013 "note": i18n("Name, as in 'A note'", "note")
0014 }
0015
0016 property string error
0017 property string useCase
0018 property QtObject nameField
0019
0020 title: i18nc("@title:dialog, 'storage' as in 'the folder where all the notes will be stored'", "KleverNotes Storage")
0021 subtitle: setSubtitle()
0022
0023 showCloseButton: false
0024 closePolicy: Controls.Popup.NoAutoClose
0025 standardButtons: Kirigami.Dialog.Ok
0026
0027 onAccepted: {
0028 nameField.selectAll()
0029 }
0030
0031 function setSubtitle() {
0032 if (error === "dot") {
0033 return i18nc("@subtitle:dialog, %1 can be 'category' (a note category), 'group' (a note group) or 'note' (a note)", "Your %1 name starts with a dot, "+
0034 "this may cause problem and is therefore not allowed.\n"+
0035 "Please remove the dot or choose another name.", useCaseTrad[useCase.toLowerCase()])
0036 }
0037 else if (error === "exist") {
0038 return i18nc("@subtitle:dialog, %1 can be 'category' (a note category), 'group' (a note group) or 'note' (a note)", "This %1 already exist.\nPlease choose another name for it.\n", useCaseTrad[useCase.toLowerCase()])
0039 }
0040 }
0041 }