Warning, /graphics/koko/src/qml/PlacesPage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: (C) 2021 Mikel Johnson <mikel5764@gmail.com>
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.15 as Kirigami
0011 
0012 Kirigami.ScrollablePage {
0013     id: page
0014 
0015     leftPadding: 0
0016     rightPadding: 0
0017 
0018     actions: [
0019         Kirigami.Action {
0020             visible: Kirigami.Settings.isMobile && root.width <= applicationWindow().wideScreenWidth
0021             icon.name: "configure"
0022             text: i18n("Configureā€¦")
0023             onTriggered: applicationWindow().openSettingsPage();
0024         }
0025     ]
0026 
0027     component PlaceHeading : Kirigami.Heading {
0028         topPadding: Kirigami.Units.largeSpacing
0029         leftPadding: Kirigami.Units.gridUnit
0030         Layout.fillWidth: true
0031         level: 1
0032     }
0033 
0034     component PlaceItem : QQC2.ItemDelegate {
0035         id: item
0036         property string filter
0037         property string query
0038         Layout.fillWidth: true
0039         Accessible.role: Accessible.MenuItem
0040         height: implicitHeight
0041         contentItem: Column {
0042             Kirigami.Icon {
0043                 source: item.icon.name
0044                 width: height
0045                 height: Kirigami.Units.iconSizes.huge
0046                 anchors.horizontalCenter: parent.horizontalCenter
0047             }
0048             QQC2.Label {
0049                 text: item.text
0050                 anchors.horizontalCenter: parent.horizontalCenter
0051             }
0052         }
0053         onClicked: {
0054             applicationWindow().filterBy(filter, query);
0055         }
0056     }
0057 
0058     component PlaceItemContainer : QQC2.ScrollView {
0059         default property alias rowChildren: row.data
0060         QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
0061         Layout.fillWidth: true
0062         leftPadding: Kirigami.Units.gridUnit
0063 
0064         Row {
0065             id: row
0066         }
0067         DragHandler {
0068             yAxis.enabled: false
0069         }
0070     }
0071 
0072     ColumnLayout {
0073         PlaceItemContainer {
0074             PlaceItem {
0075                 icon.name: "folder-cloud"
0076                 text: i18n("Network")
0077                 filter: "Remote"
0078                 query: "remote:/"
0079             }
0080             PlaceItem {
0081                 icon.name: "user-trash"
0082                 text: i18n("Trash")
0083                 filter: "Trash"
0084                 query: "trash:/"
0085             }
0086         }
0087         PlaceHeading {
0088             text: i18n("Pinned Folders")
0089         }
0090         PlaceItemContainer {
0091             Repeater {
0092                 model: kokoConfig.savedFolders
0093                 PlaceItem {
0094                     icon.name: "folder"
0095                     text: {
0096                         var str = modelData;
0097                         if (str.endsWith("/")) {
0098                             str = str.slice(0, -1);
0099                         }
0100                         return str.split("/")[str.split("/").length-1];
0101                     }
0102                     filter: "Folders"
0103                     query: modelData
0104                 }
0105             }
0106         }
0107         PlaceHeading {
0108             text: i18n("Locations")
0109         }
0110         PlaceItemContainer {
0111             PlaceItem {
0112                 text: i18n("Countries")
0113                 icon.name: "applications-internet" // HACK: tag-places is not colorful :/
0114                 filter: "Countries"
0115             }
0116             PlaceItem {
0117                 text: i18n("States")
0118                 icon.name: "applications-internet"
0119                 filter: "States"
0120             }
0121             PlaceItem {
0122                 text: i18n("Cities")
0123                 icon.name: "applications-internet"
0124                 filter: "Cities"
0125             }
0126         }
0127         PlaceHeading {
0128             text: i18n("Time")
0129         }
0130         PlaceItemContainer {
0131             PlaceItem {
0132                 text: i18n("Years")
0133                 icon.name: "office-calendar" // view-calendar is not colorful
0134                 filter: "Years"
0135             }
0136             PlaceItem {
0137                 text: i18n("Months")
0138                 icon.name: "office-calendar"
0139                 filter: "Months"
0140             }
0141             PlaceItem {
0142                 text: i18n("Weeks")
0143                 icon.name: "office-calendar"
0144                 filter: "Weeks"
0145             }
0146             PlaceItem {
0147                 text: i18n("Days")
0148                 icon.name: "office-calendar"
0149                 filter: "Days"
0150             }
0151         }
0152         PlaceHeading {
0153             text: i18n("Tags")
0154             visible: applicationWindow().tags.length > 0
0155         }
0156         PlaceItemContainer {
0157             Repeater {
0158                 model: applicationWindow().tags
0159                 PlaceItem {
0160                     icon.name: "tag"
0161                     text: modelData
0162                     filter: "Tags"
0163                     query: modelData
0164                 }
0165             }
0166         }
0167     }
0168 }