Skip to content

Commit

Permalink
Merge pull request #2 from Emotyco/hotfix_0.1.1
Browse files Browse the repository at this point in the history
Hotfix 0.1.1
  • Loading branch information
kdebiec authored Jun 14, 2017
2 parents 138df4c + 4335887 commit 33ea141
Show file tree
Hide file tree
Showing 18 changed files with 96 additions and 66 deletions.
20 changes: 11 additions & 9 deletions GUI/LoginWindow/Bordered.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Rectangle
State {
name: "waiting_account_select"
PropertyChanges { target: mask; state: "invisible"}
StateChangeScript {script: {runStateHelper.setRunState("waiting_account_select")}}
StateChangeScript {script: {runStateHelper.setRunState("waiting_account_select"); getLocations()}}
},
State {
name: "running_ok"
Expand Down Expand Up @@ -81,7 +81,8 @@ Rectangle
}

function callbackFn(par) {
main.state = String(JSON.parse(par.response).data.runstate)
if(main.state != String(JSON.parse(par.response).data.runstate))
main.state = String(JSON.parse(par.response).data.runstate)
}

rsApi.request("/control/runstate/", JSON.stringify(jsonData), callbackFn)
Expand All @@ -93,7 +94,8 @@ Rectangle
}

function callbackFn(par) {
locationsModel.json = par.response
if(JSON.parse(par.response).callback_name == "bordered_control_locations")
locationsModel.json = par.response
}

rsApi.request("/control/locations/", JSON.stringify(jsonData), callbackFn)
Expand All @@ -110,7 +112,7 @@ Rectangle
passwordLogin.incorrect = jsonData.data.prev_is_bad;
if(jsonData.data.want_password) {
var jsonPass = { password: passwordLogin.text }
rsApi.request("/control/password/", JSON.stringify(jsonPass))
rsApi.request("/control/password/", JSON.stringify(jsonPass), function(){})
}
}
}
Expand Down Expand Up @@ -430,7 +432,7 @@ Rectangle
id: locationsModel.model.get(usernameLogin.selectedIndex).id
}

rsApi.request("/control/login/", JSON.stringify(jsonData))
rsApi.request("/control/login/", JSON.stringify(jsonData), function(){})
main.attemptLogin = true
}
else
Expand Down Expand Up @@ -496,7 +498,7 @@ Rectangle
id: locationsModel.model.get(usernameLogin.selectedIndex).id
}

rsApi.request("/control/login/", JSON.stringify(jsonData))
rsApi.request("/control/login/", JSON.stringify(jsonData), function(){})
main.attemptLogin = true
}
else
Expand Down Expand Up @@ -881,7 +883,7 @@ Rectangle
hidden_port: hiddenNode.checked ? port.text : ""
}

rsApi.request("/control/create_location/", JSON.stringify(jsonData))
rsApi.request("/control/create_location/", JSON.stringify(jsonData), function(){})
}
else {
if(username.text.length < 3)
Expand Down Expand Up @@ -929,7 +931,7 @@ Rectangle
hidden_port: hiddenNode.checked ? port.text : ""
}

rsApi.request("/control/create_location/", JSON.stringify(jsonData))
rsApi.request("/control/create_location/", JSON.stringify(jsonData), function(){})
}
else {
if(username.text.length < 3)
Expand Down Expand Up @@ -959,7 +961,7 @@ Rectangle
getRunState()

if (main.attemptLogin)
rsApi.request("/control/password/", "")
rsApi.request("/control/password/", "", function(){})
}
}

Expand Down
4 changes: 2 additions & 2 deletions GUI/MainWindow/ChatCardPeer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ DragTile {
onActiveFocusChanged: {
if(activeFocus) {
if(drag.chatId.length > 0)
rsApi.request("/chat/mark_chat_as_read/"+drag.chatId)
rsApi.request("/chat/mark_chat_as_read/"+drag.chatId, "", function(){})

footerView.elevation = 2
}
Expand All @@ -427,7 +427,7 @@ DragTile {
chat_id: drag.chatId,
msg: msgBox.text
}
rsApi.request("chat/send_message/", JSON.stringify(jsonData))
rsApi.request("chat/send_message/", JSON.stringify(jsonData), function(){})
drag.getChatMessages()
msgBox.text = ""
event.accepted = true
Expand Down
6 changes: 3 additions & 3 deletions GUI/MainWindow/ChatGxsCard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ DragTile {
distant_chat_hex: drag.chatId
}

rsApi.request("/chat/close_distant_chat/", JSON.stringify(jsonData))
rsApi.request("/chat/close_distant_chat/", JSON.stringify(jsonData), function(){})
}

function getChatMessages() {
Expand Down Expand Up @@ -585,7 +585,7 @@ DragTile {
onActiveFocusChanged: {
if(activeFocus) {
if(drag.chatId.length > 0)
rsApi.request("/chat/mark_chat_as_read/"+drag.chatId)
rsApi.request("/chat/mark_chat_as_read/"+drag.chatId, "", function(){})

footerView.elevation = 2
}
Expand All @@ -599,7 +599,7 @@ DragTile {
chat_id: drag.chatId,
msg: msgBox.text
}
rsApi.request("chat/send_message/", JSON.stringify(jsonData))
rsApi.request("chat/send_message/", JSON.stringify(jsonData), function(){})
drag.getChatMessages()
msgBox.text = ""
event.accepted = true
Expand Down
35 changes: 21 additions & 14 deletions GUI/MainWindow/ContactSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,20 @@ function cntcmp(left, right, searchText)
function mergeContactsUnread()
{
var jsonData = contactsData.data
var dataLen = jsonData.length
for ( var i=0; i<dataLen; ++i)
if(jsonData != null)
{
var el = jsonData[i]
var dataLen = jsonData.length
for ( var i=0; i<dataLen; ++i)
{
var el = jsonData[i]

var isGxsOnList = unreadMessages.hasOwnProperty(el.gxs_id)
var isGxsOnList = unreadMessages.hasOwnProperty(el.gxs_id)

if(isGxsOnList)
el['unread_count'] = unreadMessages[el.gxs_id]
else if(!isGxsOnList)
el['unread_count'] = ""
if(isGxsOnList)
el['unread_count'] = unreadMessages[el.gxs_id]
else if(!isGxsOnList)
el['unread_count'] = ""
}
}
}

Expand Down Expand Up @@ -93,13 +96,16 @@ function parseContacts(responseStr)
function mergeContactsStatus()
{
var jsonData = contactsData.data
var dataLen = jsonData.length
for ( var i=0; i<dataLen; ++i)
if(jsonData != null)
{
var el = jsonData[i]
var dataLen = jsonData.length
for ( var i=0; i<dataLen; i++)
{
var el = jsonData[i]

if(el.pgp_linked && statusData.hasOwnProperty(el.pgp_id))
el['state_string'] = statusData[el.pgp_id]
if(el.pgp_linked && statusData.hasOwnProperty(el.pgp_id))
el['state_string'] = statusData[el.pgp_id]
}
}
}

Expand Down Expand Up @@ -128,7 +134,8 @@ WorkerScript.onMessage = function(message)
else if(message.action === "searchContact")
sortFn = function cmp(l,r) { return cntcmp(l,r, message.sexp) }

contactsData.data.sort(sortFn)
if(contactsData.data != null)
contactsData.data.sort(sortFn)

WorkerScript.sendMessage(contactsData)
}
4 changes: 2 additions & 2 deletions GUI/MainWindow/CreateLobby.qml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ PopupBase {
pgp_signed: main.advmode ? checkBox.checked : true
}

rsApi.request("/chat/create_lobby", JSON.stringify(jsonData))
rsApi.request("/chat/create_lobby", JSON.stringify(jsonData), function(){})

dialog.close()
}
Expand Down Expand Up @@ -181,7 +181,7 @@ PopupBase {
pgp_signed: main.advmode ? checkBox.checked : true
}

rsApi.request("/chat/create_lobby", JSON.stringify(jsonData))
rsApi.request("/chat/create_lobby", JSON.stringify(jsonData), function(){})

dialog.close()
}
Expand Down
2 changes: 1 addition & 1 deletion GUI/MainWindow/DialogExit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ PopupBase {
var jsonData = {
auto_login: checkBox.checked,
}
rsApi.request("/settings/set_auto_login/", JSON.stringify(jsonData))
rsApi.request("/settings/set_auto_login/", JSON.stringify(jsonData), function(){})
}
}

Expand Down
4 changes: 2 additions & 2 deletions GUI/MainWindow/FriendListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Component {
gxs_id: model.gxs_id
}

rsApi.request("/identity/add_contact", JSON.stringify(jsonData))
rsApi.request("/identity/add_contact", JSON.stringify(jsonData), function(){})
}
}

Expand Down Expand Up @@ -231,7 +231,7 @@ Component {
gxs_id: model.gxs_id
}

rsApi.request("/identity/remove_contact", JSON.stringify(jsonData))
rsApi.request("/identity/remove_contact", JSON.stringify(jsonData), function(){})
})
}
}
Expand Down
5 changes: 2 additions & 3 deletions GUI/MainWindow/IdentityDetailsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Dialog {
own_opinion: own_opinion,
}

rsApi.request("/identity/set_opinion", JSON.stringify(jsonData))
rsApi.request("/identity/set_opinion", JSON.stringify(jsonData), function(){})
}

function setBanNode() {
Expand All @@ -113,7 +113,7 @@ Dialog {
bannned_node: bannned_node
}

rsApi.request("/identity/set_ban_node", JSON.stringify(jsonData))
rsApi.request("/identity/set_ban_node", JSON.stringify(jsonData), function(){})
}

onOpened: {
Expand All @@ -122,7 +122,6 @@ Dialog {
}

onRejected: {
console.log("hello")
if(!own)
setOwnOpinion()
if(!anonymous)
Expand Down
2 changes: 1 addition & 1 deletion GUI/MainWindow/LeftBar_Identites.qml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Rectangle {
gxs_id: model.own_gxs_id
}

rsApi.request("/identity/delete_identity", JSON.stringify(jsonData))
rsApi.request("/identity/delete_identity", JSON.stringify(jsonData), function(){})
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion GUI/MainWindow/NodeDetailsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Dialog {
dyn_dns: dyn_dns
}

rsApi.request("/peers/set_node_options", JSON.stringify(jsonData))
rsApi.request("/peers/set_node_options", JSON.stringify(jsonData), function(){})
}

onOpened: {
Expand Down
6 changes: 3 additions & 3 deletions GUI/MainWindow/PGPFriendDetailsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Dialog {
if(!own_sign)
jsonData.own_sign = own_sign_temp

rsApi.request("/peers/set_pgp_options", JSON.stringify(jsonData))
rsApi.request("/peers/set_pgp_options", JSON.stringify(jsonData), function(){})
}

onOpened: {
Expand Down Expand Up @@ -655,7 +655,7 @@ Dialog {
overflowMenu.close()

main.createChatCardPeer(model.name, model.location, model.peer_id, model.chat_id, "ChatCardPeer.qml")
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id)
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id, "", function(){})

scrollingDialog.close()
}
Expand Down Expand Up @@ -789,7 +789,7 @@ Dialog {
gxs_id: model.gxs_id
}

rsApi.request("/identity/add_contact", JSON.stringify(jsonData))
rsApi.request("/identity/add_contact", JSON.stringify(jsonData), function(){})

scrollingDialog.close()
}
Expand Down
4 changes: 2 additions & 2 deletions GUI/MainWindow/PeerListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Component {
overflowMenu.close()

main.createChatCardPeer(model.name, model.location, model.peer_id, model.chat_id, "ChatCardPeer.qml")
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id)
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id, "", function(){})
}
}

Expand Down Expand Up @@ -321,7 +321,7 @@ Component {

onClicked: {
main.createChatCardPeer(model.name, model.location, model.peer_id, model.chat_id, "ChatCardPeer.qml")
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id)
rsApi.request("/chat/mark_chat_as_read/"+model.chat_id, "", function(){})
}
}
}
Expand Down
12 changes: 8 additions & 4 deletions GUI/MainWindow/PgpListDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ Component {
property int unread_msgs: {
var msgs = 0

for(var i=0; i < locationsModel.model.count; i++)
{
msgs += locationsModel.model.get(i).unread_msgs
var jsonResp = JSON.parse(pgpIdModel.json)
for (var i = 0; i<jsonResp.data.length; i++) {
if(jsonResp.data[i].pgp_id==pgp)
for (var ii = 0; ii<jsonResp.data[i].locations.length; ii++) {
if(jsonResp.data[i].locations[ii].unread_msgs != 0)
msgs += jsonResp.data[i].locations[ii].unread_msgs
}
}

return msgs
Expand Down Expand Up @@ -209,7 +213,7 @@ Component {
overflowMenu.close()

removeDialog.show("Do you want to remove your friend?", function() {
rsApi.request("/peers/"+pgp+"/delete", "")
rsApi.request("/peers/"+pgp+"/delete", "", function(){})
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions GUI/MainWindow/RoomPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ Item{
onActiveFocusChanged: {
if(activeFocus) {
if(chatId.length > 0)
rsApi.request("/chat/mark_chat_as_read/"+chatId)
rsApi.request("/chat/mark_chat_as_read/"+chatId, "", function(){})

footerView.elevation = 2
}
Expand All @@ -419,7 +419,7 @@ Item{
msg: msgBox.text
}

rsApi.request("chat/send_message/", JSON.stringify(jsonData))
rsApi.request("chat/send_message/", JSON.stringify(jsonData), function(){})

getLobbyMessages()
contentm.positionViewAtEnd()
Expand Down
6 changes: 3 additions & 3 deletions GUI/MainWindow/SettingsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ Dialog {
advanced_mode: advmode
}

rsApi.request("/settings/set_advanced_mode/", JSON.stringify(jsonData))
rsApi.request("/settings/set_advanced_mode/", JSON.stringify(jsonData), function(){})

var jsonData2 = {
flickable_grid_mode: flickablemode
}

rsApi.request("/settings/set_flickable_grid_mode/", JSON.stringify(jsonData2))
rsApi.request("/settings/set_flickable_grid_mode/", JSON.stringify(jsonData2), function(){})

main.advmode = scrollingDialog.advmode
main.flickablemode = scrollingDialog.flickablemode
Expand Down Expand Up @@ -167,7 +167,7 @@ Dialog {
jsonData.external_port = extPort
}

rsApi.request("/peers/set_network_options", JSON.stringify(jsonData))
rsApi.request("/peers/set_network_options", JSON.stringify(jsonData), function(){})
}

JSONListModel {
Expand Down
Loading

0 comments on commit 33ea141

Please sign in to comment.