diff --git a/mobile/app/app.qrc b/mobile/app/app.qrc --- a/mobile/app/app.qrc +++ b/mobile/app/app.qrc @@ -1,7 +1,6 @@ package/contents/ui/Bookmarks.qml -package/contents/ui/Documents.qml package/contents/ui/main.qml package/contents/ui/MainView.qml package/contents/ui/OkularDrawer.qml diff --git a/mobile/app/package/contents/ui/Documents.qml b/mobile/app/package/contents/ui/Documents.qml deleted file mode 100644 --- a/mobile/app/package/contents/ui/Documents.qml +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2015 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, - * or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.1 -import QtQuick.Dialogs 1.3 -import QtQuick.Controls 1.3 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 2.0 as QQC2 -import org.kde.kirigami 2.0 as Kirigami -import org.kde.okular 2.0 as Okular -import Qt.labs.folderlistmodel 2.1 -import Qt.labs.platform 1.0 - -Item { - id: root - anchors.fill: parent - - property Item view: filesView - property alias contentY: filesView.contentY - property alias contentHeight: filesView.contentHeight - property alias model: filesView.model - - Item { - id: toolBarContent - width: root.width - height: searchField.height + Kirigami.Units.gridUnit - QQC2.TextField { - id: searchField - anchors.centerIn: parent - focus: true - } - } - - ColumnLayout { - z: 2 - visible: filesView.count == 0 - anchors { - fill: parent - margins: Kirigami.Units.gridUnit - } - Kirigami.Label { - text: i18n("No Documents found. To start to read, put some files in the Documents folder of your device.") - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - - ScrollView { - anchors { - top: toolBarContent.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - ListView { - id: filesView - anchors.fill: parent - - header: Kirigami.Label { - Layout.fillWidth: true - text: folderModel.folder - } - - model: FolderListModel { - id: folderModel - folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) - nameFilters: Okular.Okular.nameFilters - showDotAndDotDot: true - showDirs: false - } - - delegate: Kirigami.BasicListItem { - label: model.fileName - visible: model.fileName.indexOf(searchField.text) !== -1 - height: visible ? implicitHeight : 0 - onClicked: { - if (fileIsDir) { - ListView.view.model.folder = fileURL - return; - } - - documentItem.url = model.fileURL; - globalDrawer.close(); - applicationWindow().controlsVisible = false; - } - } - } - } -} diff --git a/mobile/app/package/contents/ui/Thumbnails.qml b/mobile/app/package/contents/ui/Thumbnails.qml --- a/mobile/app/package/contents/ui/Thumbnails.qml +++ b/mobile/app/package/contents/ui/Thumbnails.qml @@ -31,7 +31,7 @@ height: searchField.height TextField { id: searchField - enabled: documentItem ? documentItem.supportsSearch : false + enabled: documentItem ? documentItem.supportsSearching : false anchors.centerIn: parent onTextChanged: { if (text.length > 2) { diff --git a/mobile/app/package/contents/ui/main.qml b/mobile/app/package/contents/ui/main.qml --- a/mobile/app/package/contents/ui/main.qml +++ b/mobile/app/package/contents/ui/main.qml @@ -18,30 +18,39 @@ */ import QtQuick 2.1 -import QtQuick.Controls 1.3 +import QtQuick.Dialogs 1.3 as QQD import org.kde.okular 2.0 as Okular import org.kde.kirigami 2.0 as Kirigami Kirigami.AbstractApplicationWindow { id: fileBrowserRoot visible: true - /*TODO: port ResourceInstance - PlasmaExtras.ResourceInstance { - id: resourceInstance - uri: documentItem.path - }*/ - header: null - globalDrawer: Kirigami.OverlayDrawer { - edge: Qt.LeftEdge - contentItem: Documents { - implicitWidth: Kirigami.Units.gridUnit * 20 + globalDrawer: Kirigami.GlobalDrawer { + title: i18n("Okular") + titleIcon: "okular" + + QQD.FileDialog { + id: fileDialog + nameFilters: Okular.Okular.nameFilters + folder: "file://" + userPaths.documents + onAccepted: { + documentItem.url = fileDialog.fileUrl + } } + + actions: [ + Kirigami.Action { + text: i18n("Open...") + icon.name: "document-open" + onTriggered: { + fileDialog.open() + } + } + ] } - contextDrawer: OkularDrawer { - drawerOpen: false - } + contextDrawer: OkularDrawer {} title: documentItem.windowTitleForDocument Okular.DocumentItem { diff --git a/mobile/components/documentitem.cpp b/mobile/components/documentitem.cpp --- a/mobile/components/documentitem.cpp +++ b/mobile/components/documentitem.cpp @@ -55,6 +55,7 @@ void DocumentItem::setUrl(const QUrl & url) { + m_document->closeDocument(); //TODO: password QMimeDatabase db;