53 lines
1.5 KiB
QML
53 lines
1.5 KiB
QML
import QtQuick 2.0
|
|
import Sailfish.Silica 1.0
|
|
|
|
Page {
|
|
id: page
|
|
|
|
SilicaFlickable {
|
|
anchors.fill: parent
|
|
contentHeight: column.height
|
|
|
|
Column {
|
|
id: column
|
|
width: parent.width
|
|
|
|
PageHeader { title: "Cerca" }
|
|
|
|
SearchField {
|
|
id: searchField
|
|
width: parent.width
|
|
placeholderText: "Titolo o autore…"
|
|
EnterKey.enabled: text.length > 0
|
|
EnterKey.onClicked: search()
|
|
}
|
|
|
|
Button {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
text: "Cerca"
|
|
enabled: searchField.text.length > 0
|
|
onClicked: search()
|
|
}
|
|
|
|
Label {
|
|
x: Theme.horizontalPageMargin
|
|
width: parent.width - 2 * Theme.horizontalPageMargin
|
|
text: "La ricerca usa il motore del server (OPDS search)."
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
wrapMode: Text.Wrap
|
|
}
|
|
}
|
|
}
|
|
|
|
function search() {
|
|
var base = appSettings.baseUrl
|
|
var query = searchField.text.trim()
|
|
if (base.length === 0 || query.length === 0)
|
|
return
|
|
var url = base + "/opds/search?query=" + encodeURIComponent(query)
|
|
pageStack.push(Qt.resolvedUrl("FeedPage.qml"),
|
|
{ feedUrl: url, pageTitle: "Risultati: " + query })
|
|
}
|
|
}
|