PasswordListPage.qml (2086B)
1 /* 2 * Copyright (C) 2019 Daniel Vrátil <dvratil@kde.org> 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 18 import QtQuick 2.2 19 import QtQml.Models 2.2 20 import Sailfish.Silica 1.0 21 import harbour.safe 0.1 22 import "../components" 23 24 Page { 25 id: passwordListPage 26 27 property var rootIndex: null 28 property alias model: delegateModel.model 29 property string currentPath: "" 30 31 32 signal folderSelected(var index, var name) 33 signal passwordRequested(var requester) 34 35 36 Connections { 37 target: model 38 onModelReset: app.pageStack.pop(passwordListPage, PageStackAction.Immediate) 39 } 40 41 SilicaListView { 42 id: listView 43 44 anchors.fill: parent 45 46 header: PageHeader { 47 id: pageHeader 48 width: parent.width 49 title: passwordListPage.currentPath === "" ? qsTr("Safe") : passwordListPage.currentPath 50 } 51 52 GlobalPullDownMenu { 53 currentIndex: passwordListPage.rootIndex 54 model: passwordListPage.model 55 } 56 57 model: DelegateModel { 58 id: delegateModel 59 60 rootIndex: passwordListPage.rootIndex 61 62 delegate: PasswordDelegate { 63 modelData: model 64 65 onFolderSelected: { 66 passwordListPage.folderSelected(delegateModel.modelIndex(index), model.name); 67 } 68 } 69 } 70 71 VerticalScrollDecorator { 72 flickable: listView 73 } 74 } 75 }