From 1fb77446a7378368de5288ca9f57627ae2946d84 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 19 Apr 2018 16:36:57 +0200 Subject: [PATCH] Make it possible to disable the build of okularkirigami Summary: Some distros seem to have the option. BUG: 393119 Test Plan: Still builds, can disable build Reviewers: #okular, mart, aacid, lbeltrame Tags: #okular Differential Revision: https://phabricator.kde.org/D12352 --- CMakeLists.txt | 5 ++- mobile/app/package/contents/ui/Documents.qml | 35 ++++++++++++++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b8e1d498..14c49c893 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,7 +124,10 @@ add_definitions(-DQT_NO_URL_CAST_FROM_STRING) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core) -add_subdirectory( mobile ) +option(BUILD_OKULARKIRIGAMI "Builds the touch-friendly frontend" ON) +if (BUILD_OKULARKIRIGAMI) + add_subdirectory( mobile ) +endif() option(BUILD_COVERAGE "Build the project with gcov support" OFF) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") diff --git a/mobile/app/package/contents/ui/Documents.qml b/mobile/app/package/contents/ui/Documents.qml index 9c6b47d43..f0cd05ad2 100644 --- a/mobile/app/package/contents/ui/Documents.qml +++ b/mobile/app/package/contents/ui/Documents.qml @@ -18,10 +18,13 @@ */ 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 Qt.labs.folderlistmodel 2.1 +import Qt.labs.platform 1.0 Item { id: root @@ -43,17 +46,24 @@ Item { } } - Kirigami.Label { + ColumnLayout { z: 2 visible: filesView.count == 0 anchors { fill: parent margins: Kirigami.Units.gridUnit } - 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 + 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 + } + Button { + text: i18n("Open") +// FileDialog {} +// onClicked: + } } ScrollView { @@ -67,11 +77,17 @@ Item { id: filesView anchors.fill: parent + header: Kirigami.Label { + Layout.fillWidth: true + text: folderModel.folder + } + model: FolderListModel { id: folderModel - folder: userPaths.documents + folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) nameFilters: ["*.pdf", "*.txt", "*.chm", "*.epub"] - showDirs: false + showDotAndDotDot: true +// showDirs: false } delegate: Kirigami.BasicListItem { @@ -79,6 +95,11 @@ Item { visible: model.fileName.indexOf(searchField.text) !== -1 height: visible ? implicitHeight : 0 onClicked: { + if (fileIsDir) { + ListView.view.model.folder = fileURL + return; + } + documentItem.path = model.filePath; globalDrawer.close(); applicationWindow().controlsVisible = false;