mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-09 09:35:32 -04:00
Implemented certificate link handling
Move content of qml directory to parent directory src Message notification take care of plurar/singular Fix compilation of service for non-android linux AddTrustedNode.qml show node details for confirmation before adding Added TrustedNodeDetails.qml to show nodes details TrustedNodesView.qml show node details on click Qml app added minimal infrastructure to delegate link handling Removed unused icons
This commit is contained in:
parent
f6d44f1a46
commit
d2598dd437
37 changed files with 326 additions and 115 deletions
51
retroshare-qml-app/src/JSONListModel.qml
Normal file
51
retroshare-qml-app/src/JSONListModel.qml
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* JSONListModel - a QML ListModel with JSON and JSONPath support
|
||||
*
|
||||
* Copyright (c) 2012 Romain Pokrzywka (KDAB) (romain@kdab.com)
|
||||
* Licensed under the MIT licence (http://opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import "jsonpath.js" as JSONPath
|
||||
|
||||
Item {
|
||||
property string source: ""
|
||||
property string json: ""
|
||||
property string query: ""
|
||||
|
||||
property ListModel model : ListModel { id: jsonModel }
|
||||
property alias count: jsonModel.count
|
||||
|
||||
onSourceChanged: {
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", source);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == XMLHttpRequest.DONE)
|
||||
json = xhr.responseText;
|
||||
}
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
onJsonChanged: updateJSONModel()
|
||||
onQueryChanged: updateJSONModel()
|
||||
|
||||
function updateJSONModel() {
|
||||
jsonModel.clear();
|
||||
|
||||
if ( json === "" )
|
||||
return;
|
||||
|
||||
var objectArray = parseJSONString(json, query);
|
||||
for ( var key in objectArray ) {
|
||||
var jo = objectArray[key];
|
||||
jsonModel.append( jo );
|
||||
}
|
||||
}
|
||||
|
||||
function parseJSONString(jsonString, jsonPathQuery) {
|
||||
var objectArray = JSON.parse(jsonString);
|
||||
if ( jsonPathQuery !== "" )
|
||||
objectArray = JSONPath.jsonPath(objectArray, jsonPathQuery);
|
||||
|
||||
return objectArray;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue