Changeset View
Changeset View
Standalone View
Standalone View
mobile/app/package/contents/ui/Documents.qml
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU General Public | 14 | * You should have received a copy of the GNU General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Dialogs 1.3 | ||||
21 | import QtQuick.Controls 1.3 | 22 | import QtQuick.Controls 1.3 | ||
23 | import QtQuick.Layouts 1.0 | ||||
22 | import QtQuick.Controls 2.0 as QQC2 | 24 | import QtQuick.Controls 2.0 as QQC2 | ||
23 | import org.kde.kirigami 2.0 as Kirigami | 25 | import org.kde.kirigami 2.0 as Kirigami | ||
24 | import Qt.labs.folderlistmodel 2.1 | 26 | import Qt.labs.folderlistmodel 2.1 | ||
27 | import Qt.labs.platform 1.0 | ||||
25 | 28 | | |||
26 | Item { | 29 | Item { | ||
27 | id: root | 30 | id: root | ||
28 | anchors.fill: parent | 31 | anchors.fill: parent | ||
29 | 32 | | |||
30 | property Item view: filesView | 33 | property Item view: filesView | ||
31 | property alias contentY: filesView.contentY | 34 | property alias contentY: filesView.contentY | ||
32 | property alias contentHeight: filesView.contentHeight | 35 | property alias contentHeight: filesView.contentHeight | ||
33 | property alias model: filesView.model | 36 | property alias model: filesView.model | ||
34 | 37 | | |||
35 | Item { | 38 | Item { | ||
36 | id: toolBarContent | 39 | id: toolBarContent | ||
37 | width: root.width | 40 | width: root.width | ||
38 | height: searchField.height + Kirigami.Units.gridUnit | 41 | height: searchField.height + Kirigami.Units.gridUnit | ||
39 | QQC2.TextField { | 42 | QQC2.TextField { | ||
40 | id: searchField | 43 | id: searchField | ||
41 | anchors.centerIn: parent | 44 | anchors.centerIn: parent | ||
42 | focus: true | 45 | focus: true | ||
43 | } | 46 | } | ||
44 | } | 47 | } | ||
45 | 48 | | |||
46 | Kirigami.Label { | 49 | ColumnLayout { | ||
47 | z: 2 | 50 | z: 2 | ||
48 | visible: filesView.count == 0 | 51 | visible: filesView.count == 0 | ||
49 | anchors { | 52 | anchors { | ||
50 | fill: parent | 53 | fill: parent | ||
51 | margins: Kirigami.Units.gridUnit | 54 | margins: Kirigami.Units.gridUnit | ||
52 | } | 55 | } | ||
56 | Kirigami.Label { | ||||
53 | text: i18n("No Documents found. To start to read, put some files in the Documents folder of your device.") | 57 | text: i18n("No Documents found. To start to read, put some files in the Documents folder of your device.") | ||
54 | wrapMode: Text.WordWrap | 58 | wrapMode: Text.WordWrap | ||
55 | horizontalAlignment: Text.AlignHCenter | 59 | horizontalAlignment: Text.AlignHCenter | ||
56 | verticalAlignment: Text.AlignVCenter | 60 | verticalAlignment: Text.AlignVCenter | ||
57 | } | 61 | } | ||
62 | Button { | ||||
63 | text: i18n("Open") | ||||
64 | // FileDialog {} | ||||
65 | // onClicked: | ||||
66 | } | ||||
lbeltrame: This, and all the changes in Document.qml are unrelated. | |||||
67 | } | ||||
58 | 68 | | |||
59 | ScrollView { | 69 | ScrollView { | ||
60 | anchors { | 70 | anchors { | ||
61 | top: toolBarContent.bottom | 71 | top: toolBarContent.bottom | ||
62 | left: parent.left | 72 | left: parent.left | ||
63 | right: parent.right | 73 | right: parent.right | ||
64 | bottom: parent.bottom | 74 | bottom: parent.bottom | ||
65 | } | 75 | } | ||
66 | ListView { | 76 | ListView { | ||
67 | id: filesView | 77 | id: filesView | ||
68 | anchors.fill: parent | 78 | anchors.fill: parent | ||
69 | 79 | | |||
80 | header: Kirigami.Label { | ||||
81 | Layout.fillWidth: true | ||||
82 | text: folderModel.folder | ||||
83 | } | ||||
84 | | ||||
70 | model: FolderListModel { | 85 | model: FolderListModel { | ||
71 | id: folderModel | 86 | id: folderModel | ||
72 | folder: userPaths.documents | 87 | folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation) | ||
73 | nameFilters: ["*.pdf", "*.txt", "*.chm", "*.epub"] | 88 | nameFilters: ["*.pdf", "*.txt", "*.chm", "*.epub"] | ||
74 | showDirs: false | 89 | showDotAndDotDot: true | ||
90 | // showDirs: false | ||||
75 | } | 91 | } | ||
76 | 92 | | |||
77 | delegate: Kirigami.BasicListItem { | 93 | delegate: Kirigami.BasicListItem { | ||
78 | label: model.fileName | 94 | label: model.fileName | ||
79 | visible: model.fileName.indexOf(searchField.text) !== -1 | 95 | visible: model.fileName.indexOf(searchField.text) !== -1 | ||
80 | height: visible ? implicitHeight : 0 | 96 | height: visible ? implicitHeight : 0 | ||
81 | onClicked: { | 97 | onClicked: { | ||
98 | if (fileIsDir) { | ||||
99 | ListView.view.model.folder = fileURL | ||||
100 | return; | ||||
101 | } | ||||
102 | | ||||
82 | documentItem.path = model.filePath; | 103 | documentItem.path = model.filePath; | ||
83 | globalDrawer.close(); | 104 | globalDrawer.close(); | ||
84 | applicationWindow().controlsVisible = false; | 105 | applicationWindow().controlsVisible = false; | ||
85 | } | 106 | } | ||
86 | } | 107 | } | ||
87 | } | 108 | } | ||
88 | } | 109 | } | ||
89 | } | 110 | } |
This, and all the changes in Document.qml are unrelated.