Remove the internal file navigation from the global drawer

Summary: Instead include an "open" item.

Test Plan: opened a file

Reviewers: #okular, mart, aacid

Reviewed By: mart

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D12884
remotes/origin/gsoc2018_typewriter
Aleix Pol 8 years ago
parent 93645d1f9d
commit 600e72100b
  1. 1
      mobile/app/app.qrc
  2. 106
      mobile/app/package/contents/ui/Documents.qml
  3. 2
      mobile/app/package/contents/ui/Thumbnails.qml
  4. 37
      mobile/app/package/contents/ui/main.qml
  5. 1
      mobile/components/documentitem.cpp

@ -1,7 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>package/contents/ui/Bookmarks.qml</file>
<file>package/contents/ui/Documents.qml</file>
<file>package/contents/ui/main.qml</file>
<file>package/contents/ui/MainView.qml</file>
<file>package/contents/ui/OkularDrawer.qml</file>

@ -1,106 +0,0 @@
/*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* 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;
}
}
}
}
}

@ -31,7 +31,7 @@ ThumbnailsBase {
height: searchField.height
TextField {
id: searchField
enabled: documentItem ? documentItem.supportsSearch : false
enabled: documentItem ? documentItem.supportsSearching : false
anchors.centerIn: parent
onTextChanged: {
if (text.length > 2) {

@ -18,7 +18,7 @@
*/
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
@ -26,22 +26,31 @@ 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 {

@ -55,6 +55,7 @@ DocumentItem::~DocumentItem()
void DocumentItem::setUrl(const QUrl & url)
{
m_document->closeDocument();
//TODO: password
QMimeDatabase db;

Loading…
Cancel
Save