/usr/share/u1db-qt/examples/u1db-qt-example-6.qml is in libu1db-qt5-examples 0.1.5+14.04.20140313-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | /*
* Copyright (C) 2013 Canonical, Ltd.
*
* Authors:
* Kevin Wright <kevin.wright@canonical.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import U1db 1.0 as U1db
import Ubuntu.Components 0.1
Item {
width: units.gu(45)
height: units.gu(80)
U1db.Database {
id: aDatabase
path: "aDatabase6"
}
U1db.Document {
id: aDocument1
database: aDatabase
docId: 'helloworld'
create: true
contents:{"hello": { "world": [ { "message": "Hello World" } ] } }
}
U1db.Index{
database: aDatabase
id: by_helloworld
expression: ["hello.world.message"]
}
U1db.Query{
id: aQuery
index: by_helloworld
query: [{"message":"Hel*"}]
}
U1db.Synchronizer{
id: aSynchronizer
source: aDatabase
targets: [{remote:true},
{remote:true,
ip:"127.0.0.1",
port: 7777,
name:"example1.u1db",
resolve_to_source:true},
{remote:"OK"}]
synchronize: false
}
MainView {
id: u1dbView
width: units.gu(45)
height: units.gu(80)
anchors.top: parent.top;
Tabs {
id: tabs
anchors.fill: parent
Tab {
objectName: "Tab1"
title: i18n.tr("Hello U1Db!")
page: Page {
id: helloPage
Rectangle {
width: units.gu(45)
height: units.gu(40)
anchors.top: parent.top;
border.width: 1
Text {
id: sourceLabel
anchors.top: parent.top;
font.bold: true
text: "aDatabase6 Contents"
}
ListView {
id: sourceListView
width: units.gu(45)
height: units.gu(35)
anchors.top: sourceLabel.bottom;
model: aQuery
delegate: Text {
wrapMode: Text.WordWrap
x: 6; y: 77
text: {
text: "(" + index + ") '" + contents.message + "'"
}
}
}
}
Rectangle {
id: lowerRectangle
width: units.gu(45)
height: units.gu(35)
anchors.bottom: parent.bottom;
border.width: 1
Text {
id: errorsLabel
anchors.top: parent.top;
font.bold: true
text: "Log:"
}
ListView {
parent: lowerRectangle
width: units.gu(45)
height: units.gu(30)
anchors.top: errorsLabel.bottom;
model: aSynchronizer
delegate:Text {
width: units.gu(40)
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
text: {
text: sync_output
}
}
}
Button{
parent: lowerRectangle
anchors.bottom: parent.bottom;
text: "Sync"
onClicked: aSynchronizer.synchronize = true
anchors.left: parent.left
anchors.right: parent.right
}
}
}
}
}
}
}
|