Warning, /office/klevernotes/src/contents/ui/textEditor/NotesMap.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 import QtQuick.Controls 2.15 as Controls
0007 
0008 import org.kde.kirigami 2.19 as Kirigami
0009 import org.kde.kirigamiaddons.formcard 1.0 as FormCard
0010 import org.kde.kitemmodels 1.0
0011 
0012 import "qrc:/contents/ui/textEditor/components/"
0013 
0014 Kirigami.Dialog {
0015     id: noteMap
0016 
0017     required property QtObject parser
0018 
0019     title: i18nc("@window:title","Linked notes map")
0020 
0021     background: Rectangle {
0022         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0023         Kirigami.Theme.inherit: false
0024         color: Kirigami.Theme.backgroundColor    
0025     }
0026 
0027     width: Kirigami.Units.gridUnit * 30
0028     height: layout.height + header.height + footer.height + verticalPadding * 2
0029     verticalPadding: Kirigami.Units.largeSpacing
0030 
0031     standardButtons: Controls.Dialog.NoButton
0032 
0033     ColumnLayout {
0034         id: layout
0035 
0036         spacing: 0
0037 
0038         FormCard.FormHeader {
0039             title: i18nc("@title, notes map section", "Existing notes")
0040             Layout.fillWidth: true
0041         }
0042 
0043         FormCard.FormCard {
0044             Layout.fillWidth: true
0045 
0046             Repeater {
0047                 model: existingLinks 
0048 
0049                 delegate: NotesMapEntry {
0050                     height: Kirigami.Units.gridUnit * 3
0051                     onClicked: {
0052                         if (headerExists) {
0053                             parser.headerInfo = [header, headerLevel.toString()]
0054                         }
0055                         const sidebar = applicationWindow().globalDrawer
0056                         const noteModelIndex = sidebar.treeModel.getNoteModelIndex(notePath)
0057                         sidebar.askForFocus(noteModelIndex)
0058                         noteMap.close()
0059                     }
0060                 }
0061             }
0062         }
0063 
0064         FormCard.FormHeader {
0065             title: i18nc("@title, notes map section", "Missing notes")
0066             Layout.fillWidth: true
0067         }
0068 
0069         FormCard.FormCard {
0070             Layout.fillWidth: true
0071 
0072             Repeater {
0073                 model: missingLinks 
0074 
0075                 delegate: NotesMapEntry {
0076                     height: Kirigami.Units.gridUnit * 3
0077                     onClicked: showPassiveNotification(i18nc("@notification, error message %1 is a path", "%1 doesn't exists", displayedPath))
0078                 } 
0079             }
0080         }
0081 
0082         KSortFilterProxyModel {
0083             id: missingLinks
0084 
0085             sourceModel: applicationWindow().noteMapper
0086             filterRoleName: "exists"
0087             filterString: "No"
0088             filterCaseSensitivity: Qt.CaseInsensitive
0089         }
0090 
0091         KSortFilterProxyModel {
0092             id: existingLinks
0093 
0094             sourceModel: applicationWindow().noteMapper
0095             filterRoleName: "exists"
0096             filterString: "Yes"
0097             filterCaseSensitivity: Qt.CaseInsensitive
0098         }
0099     }
0100 }
0101