Add a skeleton for a RecentFiles page

This commit is contained in:
Renaud Casenave-Péré 2021-12-09 14:06:03 +01:00
parent 87b498c404
commit 0cbbe6d24a
2 changed files with 90 additions and 1 deletions

View file

@ -4,7 +4,7 @@ import "pages/" as Pages
ApplicationWindow
{
initialPage: Component { Pages.FirstPage { } }
initialPage: Component { Pages.RecentFiles { } }
cover: Qt.resolvedUrl("cover/CoverPage.qml")
allowedOrientations: defaultAllowedOrientations
}

89
qml/pages/RecentFiles.qml Normal file
View file

@ -0,0 +1,89 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Pickers 1.0
Page {
id: recentFiles
allowedOrientations: Orientation.All
SilicaListView {
id: listView
anchors.fill:parent
header: PageHeader {
title: qsTr("Recent Files")
}
model: ListModel {
ListElement { filename: "org.org"; datetime: "8 oct 2020"}
}
delegate: ListItem {
id: recentFileItem
anchors {
left: parent.left
right: parent.right
}
contentHeight: Theme.itemSizeSmall
Label {
id: filename
text: model.filename
anchors {
top: parent.top
left: parent.left
}
anchors.leftMargin: Theme.horizontalPageMargin
font.pixelSize: Theme.fontSizeLarge
}
Label {
id: datetime
text: model.datetime
anchors {
bottom: parent.bottom
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
font.pixelSize: Theme.fontSizeTiny
}
menu: ContextMenu {
MenuItem {
text: qsTr("Remove from list")
}
MenuItem {
text: qsTr("Delete file")
}
}
}
ViewPlaceholder {
id: placeholder
enabled: listView.count == 0
text: qsTr("Pull down to open a file")
}
PullDownMenu {
MenuItem {
text: qsTr("Open file...")
onClicked: pageStack.push(contentPickerPage)
}
}
PushUpMenu {
MenuItem {
text: qsTr("Scroll to top")
onClicked: scrollToTop()
}
}
Component {
id: contentPickerPage
ContentPickerPage {
title: qsTr("Open file")
}
}
}
}