Version 0.002 code cleanup and event attending

This commit is contained in:
LubuWest 2017-01-29 17:26:09 +01:00
commit d8186978e7
42 changed files with 925 additions and 968 deletions

View file

@ -1,7 +1,4 @@
import QtQuick 2.0
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -20,10 +17,8 @@ Rectangle{
group_deny.push(groupModel.get(i).group.gid)
}
}
for (var j=0;j<contactModel.count;j++)
{//print("contact: "+JSON.stringify(contactModel.get(j).contact));
for (var j=0;j<contactModel.count;j++){
if (contactModel.get(j).contactstatus=="positive"){
print(JSON.stringify(contact_allow));
contact_allow.push(contactModel.get(j).contact.cid)
}
if (contactModel.get(j).contactstatus=="negative"){
@ -118,8 +113,8 @@ Rectangle{
property string groupstatus:"neutral"
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= "white"}}
color: "white"
border.color:"grey"
Text{
@ -153,9 +148,10 @@ Rectangle{
anchors.bottomMargin:1
text:qsTr("Save")
onClicked:{
updatePerms();
updatePerms();
var perms=[];
perms.push(contact_allow,contact_deny,group_allow,group_deny); Service.savePermissions(db,perms)
perms.push(contact_allow,contact_deny,group_allow,group_deny);
Service.savePermissions(db,perms)
}
}
BlueButton{
@ -163,16 +159,13 @@ Rectangle{
anchors.bottom: parent.bottom
anchors.bottomMargin:1
text:qsTr("Done")
onClicked:{//var group_allow=[];var group_deny=[];
//print("contacts: "+Helperjs.cleanArray(contact_allow))
onClicked:{updatePerms();
permissionDialog.destroy();
}
}
Component.onCompleted:{
Helperjs.readData(db,"contacts",login.username,function(contacts){
Helperjs.readData(db,"contacts",login.username,function(contacts){
for (var name in contacts){
var contactstatus="neutral";
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive";print(contacts[name].cid+" pos")}