Advertisement
Guest User

Untitled

a guest
Feb 24th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. import QtQuick 2.0
  2. import Sailfish.Silica 1.0
  3. import QtSparql 1.0
  4.  
  5.  
  6. Page {
  7. id: page
  8.  
  9. SilicaFlickable {
  10. id: flickable
  11. anchors.fill: parent
  12. PullDownMenu {
  13. MenuItem {
  14. text: "Options"
  15. onClicked: pageStack.push(Qt.resolvedUrl("Options.qml"))
  16. }
  17. }
  18. contentHeight: column.height
  19.  
  20.  
  21. Column {
  22. id: column
  23.  
  24. width: page.width
  25. spacing: Theme.paddingLarge
  26. PageHeader {
  27. title: "Search"
  28. }
  29.  
  30. SearchField {
  31. id:searchField
  32. width: parent.width
  33. placeholderText: "Search"
  34.  
  35. Timer {
  36. id: searchTimer;
  37. interval: 700; running: false; repeat: false
  38. onTriggered: {
  39. queryModel.query = "select ?name where "+
  40. "{ ?url fts:match '" + searchField.text + "'; nfo:fileName ?name"+
  41. " }";
  42. }
  43. }
  44.  
  45. onTextChanged: {
  46. doSearch();
  47.  
  48. }
  49. function doSearch() {
  50. searchTimer.restart();
  51. }
  52. }
  53.  
  54. SilicaListView {
  55. id: contactsView
  56. width: parent.width
  57. height: parent.height
  58.  
  59. model: SparqlListModel {
  60. id: queryModel
  61. connection: SparqlConnection { id:sparqlConnection; objectName:"sparqlConnection"; driver:"QTRACKER_DIRECT" }
  62. }
  63.  
  64. delegate: Item {
  65. width: ListView.view.width
  66. height: Theme.itemSizeSmall
  67.  
  68. Label {
  69. anchors.left: Theme.paddingMedium
  70. text: "Filename: " + name
  71. }
  72. }
  73.  
  74. VerticalScrollDecorator {}
  75.  
  76. }
  77. }
  78. }
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement