Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.0
- import Sailfish.Silica 1.0
- import QtSparql 1.0
- Page {
- id: page
- SilicaFlickable {
- id: flickable
- anchors.fill: parent
- PullDownMenu {
- MenuItem {
- text: "Options"
- onClicked: pageStack.push(Qt.resolvedUrl("Options.qml"))
- }
- }
- contentHeight: column.height
- Column {
- id: column
- width: page.width
- spacing: Theme.paddingLarge
- PageHeader {
- title: "Search"
- }
- SearchField {
- id:searchField
- width: parent.width
- placeholderText: "Search"
- Timer {
- id: searchTimer;
- interval: 700; running: false; repeat: false
- onTriggered: {
- queryModel.query = "select ?name where "+
- "{ ?url fts:match '" + searchField.text + "'; nfo:fileName ?name"+
- " }";
- }
- }
- onTextChanged: {
- doSearch();
- }
- function doSearch() {
- searchTimer.restart();
- }
- }
- SilicaListView {
- id: contactsView
- width: parent.width
- height: parent.height
- model: SparqlListModel {
- id: queryModel
- connection: SparqlConnection { id:sparqlConnection; objectName:"sparqlConnection"; driver:"QTRACKER_DIRECT" }
- }
- delegate: Item {
- width: ListView.view.width
- height: Theme.itemSizeSmall
- Label {
- anchors.left: Theme.paddingMedium
- text: "Filename: " + name
- }
- }
- VerticalScrollDecorator {}
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement