import QtQuick 2.0 import Sailfish.Silica 1.0 Page { id: page // The effective value will be restricted by ApplicationWindow.allowedOrientations allowedOrientations: Orientation.All SilicaListView { id: taskList model: ListModel { id: model} anchors.fill: parent header: PageHeader { title: "Maniphest Tasks"} delegate: ListItem { id: myDelegate menu: contextMenu Label { id: label text: "T" + taskID + " | " + status + " | " + priorityName color: priorityColor } Label { anchors.top: label.bottom text: title font.pixelSize: Theme.fontSizeSmall wrapMode: Text.WordWrap } Component { id: contextMenu ContextMenu { MenuItem { text: "Open" onClicked: Qt.openUrlExternally(settings.phab_url + "/T" + taskID) } } } } Component.onCompleted: { var xhr = new XMLHttpRequest; xhr.open("POST", settings.phab_url + "/api/maniphest.search"); xhr.onreadystatechange = function() { if (xhr.readyState === XMLHttpRequest.DONE) { var data = JSON.parse(xhr.responseText); model.clear(); //console.log(JSON.stringify(data)) // var list = data["result"]; // For maniphest.query var list = data["result"]["data"]; // For maniphest.search for (var i in list) { //console.log(i) model.append({ taskID: list[i]["id"], title: list[i]["fields"]["name"], priorityColor: list[i]["fields"]["priority"]["color"], priorityName: list[i]["fields"]["priority"]["name"], status: list[i]["fields"]["status"]["name"], }); } } } // xhr.send("api.token="+settings.api_token+"&order=order-priority&status=status-open"); // For maniphest.query xhr.send("api.token="+settings.api_token+"&order=order-priority&queryKey=open"); // For maniphest.search console.log("So, you should see something by now?") } VerticalScrollDecorator {} } }