Warning, /frameworks/kirigami/examples/multiplatformnotesapp/NotesGeneral.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Layouts 1.15
0009 import QtQuick.Controls 2.15 as QQC2
0010 import org.kde.kirigami 2.20 as Kirigami
0011 
0012 Kirigami.ApplicationWindow {
0013     id: root
0014 
0015     property string currentFile
0016 
0017     pageStack.initialPage: iconView
0018 
0019     Kirigami.ScrollablePage {
0020         id: iconView
0021         title: "Notes"
0022         actions.contextualActions: [
0023             Kirigami.Action {
0024                 id: sortAction
0025                 icon.name: "view-sort-ascending-symbolic"
0026                 tooltip: "Sort Ascending"
0027             }
0028         ]
0029         background: Rectangle {
0030             color: Kirigami.Theme.backgroundColor
0031         }
0032 
0033         GridView {
0034             id: view
0035             model: 100
0036             cellWidth: Kirigami.Units.gridUnit * 9
0037             cellHeight: cellWidth
0038             currentIndex: -1
0039             highlightMoveDuration: 0
0040             highlight: Rectangle {
0041                 color: Kirigami.Theme.highlightColor
0042             }
0043             delegate: MouseArea {
0044                 width: view.cellWidth
0045                 height: view.cellHeight
0046                 Kirigami.Icon {
0047                     source: "text-plain"
0048                     anchors {
0049                         fill: parent
0050                         margins: Kirigami.Units.gridUnit
0051                     }
0052                     QQC2.Label {
0053                         anchors {
0054                             top: parent.bottom
0055                             horizontalCenter: parent.horizontalCenter
0056                         }
0057                         text: "File " + modelData
0058                     }
0059                 }
0060                 onClicked: {
0061                     view.currentIndex = index;
0062                     root.currentFile = "File " + modelData;
0063                     if (root.pageStack.depth < 2) {
0064                         root.pageStack.push(editorComponent);
0065                     }
0066                     root.pageStack.currentIndex = 1
0067                 }
0068             }
0069         }
0070     }
0071 
0072     Component {
0073         id: editorComponent
0074         Kirigami.ScrollablePage {
0075             id: editor
0076             title: root.currentFile
0077             actions {
0078                 main: Kirigami.Action {
0079                     id: shareAction
0080                     icon.name: "document-share"
0081                     text: "Share..."
0082                     tooltip: "Share this document with your device"
0083                     checkable: true
0084                     onCheckedChanged: sheet.sheetOpen = checked;
0085                 }
0086                 contextualActions: [
0087                     Kirigami.Action {
0088                         icon.name: "format-text-bold-symbolic"
0089                         tooltip: "Bold"
0090                     },
0091                     Kirigami.Action {
0092                         icon.name: "format-text-underline-symbolic"
0093                         tooltip: "Underline"
0094                     },
0095                     Kirigami.Action {
0096                         icon.name: "format-text-italic-symbolic"
0097                         tooltip: "Italic"
0098                     }
0099                 ]
0100             }
0101             background: Rectangle {
0102                 color: Kirigami.Theme.backgroundColor
0103                 Rectangle {
0104                     anchors.fill: parent
0105                     color: "yellow"
0106                     opacity: 0.2
0107                 }
0108             }
0109 
0110             Kirigami.OverlaySheet {
0111                 id: sheet
0112                 onSheetOpenChanged: shareAction.checked = sheetOpen
0113                 ListView {
0114                     implicitWidth: Kirigami.Units.gridUnit * 30
0115                     model: ListModel {
0116                         ListElement {
0117                             title: "Share with phone \"Nokia 3310\""
0118                             description: "You selected this phone 12 times before. It's currently connected via bluetooth"
0119                             buttonText: "Push Sync"
0120                         }
0121                         ListElement {
0122                             title: "Share with phone \"My other Nexus5\""
0123                             description: "You selected this phone 0 times before. It's currently connected to your laptop via Wifi"
0124                             buttonText: "Push Sync"
0125                         }
0126                         ListElement {
0127                             title: "Share with NextCloud"
0128                             description: "You currently do not have a server set up for sharing and storing notes from Katie. If you want to set one up click here"
0129                             buttonText: "Setup…"
0130                         }
0131                         ListElement {
0132                             title: "Send document via email"
0133                             description: "This will send the document as an attached file to your own email for later sync"
0134                             buttonText: "Send As Email"
0135                         }
0136                     }
0137                     header: Kirigami.AbstractListItem {
0138                         height: Kirigami.Units.gridUnit * 6
0139                         hoverEnabled: false
0140                         RowLayout {
0141                             Kirigami.Icon {
0142                                 source: "documentinfo"
0143                                 width: Kirigami.Units.iconSizes.large
0144                                 height: width
0145                             }
0146                             QQC2.Label {
0147                                 Layout.fillWidth: true
0148                                 Layout.minimumWidth: 0
0149                                 wrapMode: Text.WordWrap
0150                                 text: "This document has already automatically synced with your phone \"Dancepartymeister 12\". If you want to sync with another device or do further actions you can do that here"
0151                             }
0152                         }
0153                     }
0154                     delegate: Kirigami.AbstractListItem {
0155                         height: Kirigami.Units.gridUnit * 6
0156                         hoverEnabled: false
0157                         //TODO: bug in overlaysheet
0158                         rightPadding: Kirigami.Units.gridUnit * 1.5
0159                         RowLayout {
0160                             ColumnLayout {
0161                                 Layout.fillWidth: true
0162                                 Layout.minimumWidth: 0
0163                                 QQC2.Label {
0164                                     wrapMode: Text.WordWrap
0165                                     text: model.title
0166                                 }
0167                                 QQC2.Label {
0168                                     Layout.fillWidth: true
0169                                     Layout.minimumWidth: 0
0170                                     wrapMode: Text.WordWrap
0171                                     text: model.description
0172                                 }
0173                             }
0174                             QQC2.Button {
0175                                 text: model.buttonText
0176                                 onClicked: sheet.close()
0177                             }
0178                         }
0179                     }
0180                 }
0181             }
0182             QQC2.TextArea {
0183                 background: Item {}
0184                 wrapMode: TextEdit.WordWrap
0185                 selectByMouse: true
0186                 text: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sollicitudin, lorem at semper pretium, tortor nisl pellentesque risus, eget eleifend odio ipsum ac mi. Donec justo ex, elementum vitae gravida vel, pretium ac lacus. Duis non metus ac enim viverra auctor in non nunc. Sed sit amet luctus nisi. Proin justo nulla, vehicula eget porta sit amet, aliquet vitae dolor. Mauris sed odio auctor, tempus ipsum ac, placerat enim. Ut in dolor vel ante dictum auctor.
0187 
0188     Praesent blandit rhoncus augue. Phasellus consequat luctus pulvinar. Pellentesque rutrum laoreet dolor, sit amet pellentesque tellus mattis sed. Sed accumsan cursus tortor. Morbi et risus dolor. Nullam facilisis ipsum justo, nec sollicitudin mi pulvinar ac. Nulla facilisi. Donec maximus turpis eget mollis laoreet. Phasellus vel mauris et est mattis auctor eget sit amet turpis. Aliquam dignissim euismod purus, eu efficitur neque fermentum eu. Suspendisse potenti. Praesent mattis ex vitae neque rutrum tincidunt. Etiam placerat leo viverra pulvinar tincidunt.
0189 
0190     Proin vel rutrum massa. Proin volutpat aliquet dapibus. Maecenas aliquet elit eu venenatis venenatis. Ut elementum, lacus vel auctor auctor, velit massa elementum ligula, quis elementum ex nisi aliquam mauris. Nulla facilisi. Pellentesque aliquet egestas venenatis. Donec iaculis ultrices laoreet. Vestibulum cursus rhoncus sollicitudin.
0191 
0192     Proin quam libero, bibendum eget sodales id, gravida quis enim. Duis fermentum libero vitae sapien hendrerit, in tincidunt tortor semper. Nullam quam nisi, feugiat sed rutrum vitae, dignissim quis risus. Ut ultricies pellentesque est, ut gravida massa convallis sed. Ut placerat dui non felis interdum, id malesuada nulla ornare. Phasellus volutpat purus placerat velit porta tristique. Donec molestie leo in turpis bibendum pharetra. Fusce fermentum diam vitae neque laoreet, sed aliquam leo sollicitudin.
0193 
0194     Ut facilisis massa arcu, eu suscipit ante varius sed. Morbi augue leo, mattis eu tempor vitae, condimentum sed urna. Curabitur ac blandit orci. Vestibulum quis consequat nunc. Proin imperdiet commodo imperdiet. Aenean mattis augue et imperdiet ultricies. Ut id feugiat nulla, et sollicitudin dui. Etiam scelerisque ligula ac euismod hendrerit. Integer in quam nibh. Pellentesque risus massa, porttitor quis fermentum eu, dictum varius magna. Morbi euismod bibendum lacus efficitur pretium. Phasellus elementum porttitor enim nec dictum. Morbi et augue laoreet, convallis quam quis, egestas quam.`
0195             }
0196         }
0197     }
0198 }