cleaning comment and test
[qwp] / qml / qwp / content / SearchModel.qml
diff --git a/qml/qwp/content/SearchModel.qml b/qml/qwp/content/SearchModel.qml
new file mode 100644 (file)
index 0000000..6372572
--- /dev/null
@@ -0,0 +1,26 @@
+import QtQuick 1.0
+
+Item {
+    id: wrapper
+    property variant model: schModel
+    property string from : "en"
+    property string to : ""
+    property string phrase : "Qt"
+
+    property string mode : "everyone"
+    property int status: schModel.status
+    function reload() { schModel.reload(); }
+
+    XmlListModel {
+        id: schModel
+
+        source: "http://"+from+".wikipedia.org/w/api.php?action=opensearch&search="+phrase+"&limit=100&format=xml"
+        namespaceDeclarations: "declare default element namespace 'http://opensearch.org/searchsuggest2'; ";
+        query: "/SearchSuggestion/Section/Item"
+
+        XmlRole { name: "name"; query: "Text/string()" }
+        XmlRole { name: "statusText"; query: "Description/string()" }
+        XmlRole { name: "source"; query: "Url/string()" }
+        XmlRole { name: "userImage"; query: "Image/@source/string()" }
+    }
+}