v0.6.4 contact search
This commit is contained in:
parent
66e5c33b00
commit
5032c78de1
57 changed files with 2218 additions and 2252 deletions
|
@ -36,60 +36,60 @@ import "qrc:/qml/genericqml"
|
|||
|
||||
Item {
|
||||
id: contactComponent
|
||||
height: 4.5*root.fontFactor*osSettings.systemFontSize//8*mm
|
||||
width: contactComponent.ListView.view.width//parent.width
|
||||
height: 5*root.fontFactor*osSettings.systemFontSize
|
||||
width: contactComponent.ListView.view.width
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width:parent.width
|
||||
height: parent.height//8*mm
|
||||
height: parent.height
|
||||
radius: 0.5*mm
|
||||
border.color: Material.backgroundDimColor// "grey"
|
||||
color: Material.backgroundColor//"white"
|
||||
border.color: Material.backgroundDimColor
|
||||
color: Material.backgroundColor
|
||||
Image {
|
||||
id: photoImage
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: 4*root.fontFactor*osSettings.systemFontSize//7*mm
|
||||
height:4*root.fontFactor*osSettings.systemFontSize//7*mm
|
||||
width: 4*root.fontFactor*osSettings.systemFontSize
|
||||
height:4*root.fontFactor*osSettings.systemFontSize
|
||||
source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
|
||||
}
|
||||
|
||||
Flow{
|
||||
width: wrapper.width-4*root.fontFactor*osSettings.systemFontSize//8*mm
|
||||
width: wrapper.width-4*root.fontFactor*osSettings.systemFontSize
|
||||
height: wrapper.height-mm
|
||||
anchors.left: photoImage.right
|
||||
anchors.margins: 1*mm
|
||||
//spacing: mm
|
||||
anchors.margins: 0.5*mm
|
||||
clip: true
|
||||
Label {
|
||||
id: namelabel
|
||||
width: Math.min(wrapper.width-(photoImage.width+mm),contentWidth)//wrapper.width-4
|
||||
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
|
||||
width: Math.min(wrapper.width-(photoImage.width+mm),contentWidth)
|
||||
height: 1.1*root.fontFactor*osSettings.bigFontSize
|
||||
text: contact.name
|
||||
elide: contentWidth>wrapper.width-4*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
|
||||
color: Material.secondaryTextColor//"#303030"
|
||||
color: Material.secondaryTextColor
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
}
|
||||
Label {
|
||||
id: screennamelabel
|
||||
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
|
||||
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
|
||||
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)
|
||||
height: 1.1*root.fontFactor*osSettings.bigFontSize
|
||||
text: "(@"+contact.screen_name+")"
|
||||
elide: contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
|
||||
color: Material.secondaryTextColor//"#303030"
|
||||
color: Material.secondaryTextColor
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
}
|
||||
Label {
|
||||
id: descriptionlabel
|
||||
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
|
||||
height: 2*root.fontFactor*osSettings.systemFontSize//2.5*mm
|
||||
width: wrapper.width-5*root.fontFactor*osSettings.systemFontSize
|
||||
height: wrapper.height-mm-1.1*root.fontFactor*osSettings.bigFontSize
|
||||
maximumLineCount:2
|
||||
text: Qt.atob(contact.description)!=""?contact.description:""
|
||||
elide:contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
|
||||
color: Material.secondaryTextColor//"#303030"
|
||||
elide:Text.ElideRight
|
||||
color: Material.secondaryTextColor
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,5 +53,5 @@ Rectangle{
|
|||
anchors.right: leftDrawer.right
|
||||
color: Material.dialogColor//"#EEEEEE"
|
||||
}
|
||||
Component.onCompleted: {opened();}
|
||||
//Component.onCompleted: {opened();}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ Item {
|
|||
onTriggered: {
|
||||
updatenews.setDatabase();
|
||||
updatenews.login();
|
||||
updatenews.setSyncAll(true)
|
||||
updatenews.startsync();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,67 +38,68 @@ import "qrc:/qml/genericqml"
|
|||
Rectangle{
|
||||
id:permissionDialog
|
||||
color: Material.backgroundColor
|
||||
// x: mm
|
||||
// x: mm
|
||||
width: parent.width-5*mm
|
||||
height:root.height/3
|
||||
function updatePerms(){
|
||||
for (var i=0;i<groupModel.count;i++)
|
||||
{if (groupModel.get(i).groupstatus=="positive"){
|
||||
group_allow.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
if (groupModel.get(i).groupstatus=="negative"){
|
||||
group_deny.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
}
|
||||
group_allow.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
if (groupModel.get(i).groupstatus=="negative"){
|
||||
group_deny.push(groupModel.get(i).group.gid)
|
||||
}
|
||||
}
|
||||
for (var j=0;j<contactModel.count;j++){
|
||||
if (contactModel.get(j).contactstatus=="positive"){
|
||||
contact_allow.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if (contactModel.get(j).contactstatus=="negative"){
|
||||
contact_deny.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
|
||||
{permButton.text="\uf09c"}
|
||||
else{permButton.text="\uf023"}
|
||||
}}
|
||||
if (contactModel.get(j).contactstatus=="positive"){
|
||||
contact_allow.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if (contactModel.get(j).contactstatus=="negative"){
|
||||
contact_deny.push(contactModel.get(j).contact.cid)
|
||||
}
|
||||
if ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))
|
||||
{permButton.text="\uf09c"}
|
||||
else{permButton.text="\uf023"}
|
||||
}
|
||||
}
|
||||
|
||||
Text{
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
color: Material.primaryTextColor
|
||||
text: qsTr("Friends")
|
||||
Text{ //cid not working in Friendica 02/2022
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
color: Material.primaryTextColor
|
||||
text: qsTr("Friends")
|
||||
}
|
||||
ListView {
|
||||
id: contactView
|
||||
x:0.5*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: contactModel
|
||||
delegate: contactItem
|
||||
}
|
||||
id: contactView
|
||||
x:0.5*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: contactModel
|
||||
delegate: contactItem
|
||||
}
|
||||
|
||||
ListModel{id: contactModel}
|
||||
Component{
|
||||
id:contactItem
|
||||
Rectangle{
|
||||
id:contactitemRect
|
||||
color: Material.backgroundColor
|
||||
width:contactView.width
|
||||
height: 5*mm
|
||||
radius: 0.5*mm
|
||||
property string contactstatus
|
||||
onContactstatusChanged:{
|
||||
if(contactstatus=="positive"){contactitemRect.color="light green"}
|
||||
else if (contactstatus=="negative"){contactitemRect.color= "red"}
|
||||
else{contactitemRect.color= Material.backgroundColor}}
|
||||
border.color:Material.frameColor
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
text:contact.screen_name
|
||||
}
|
||||
ListModel{id: contactModel}
|
||||
Component{
|
||||
id:contactItem
|
||||
Rectangle{
|
||||
id:contactitemRect
|
||||
color: Material.backgroundColor
|
||||
width:contactView.width
|
||||
height: 5*mm
|
||||
radius: 0.5*mm
|
||||
property string contactstatus
|
||||
onContactstatusChanged:{
|
||||
if(contactstatus=="positive"){contactitemRect.color="light green"}
|
||||
else if (contactstatus=="negative"){contactitemRect.color= "red"}
|
||||
else{contactitemRect.color= Material.backgroundColor}}
|
||||
border.color:Material.frameColor
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
text:contact.screen_name
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
|
@ -113,55 +114,55 @@ Rectangle{
|
|||
else{contactModel.set(index,{"contactstatus":"neutral"});
|
||||
contactstatus="neutral";
|
||||
}
|
||||
}}
|
||||
Component.onCompleted:{
|
||||
if (contactModel.get(index).contactstatus=="positive"){
|
||||
contactstatus="positive"
|
||||
}
|
||||
else if (contactModel.get(index).contactstatus=="negative"){
|
||||
contactstatus="negative"
|
||||
}
|
||||
else {contactstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
x:contactView.width+2*mm
|
||||
y:0.5*mm
|
||||
text: qsTr("Groups")
|
||||
}}
|
||||
Component.onCompleted:{
|
||||
if (contactModel.get(index).contactstatus=="positive"){
|
||||
contactstatus="positive"
|
||||
}
|
||||
else if (contactModel.get(index).contactstatus=="negative"){
|
||||
contactstatus="negative"
|
||||
}
|
||||
else {contactstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
x:contactView.width+2*mm
|
||||
y:0.5*mm
|
||||
text: qsTr("Groups")
|
||||
}
|
||||
ListView {
|
||||
id: groupView
|
||||
x:contactView.width+2*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: groupModel
|
||||
delegate: groupItem
|
||||
}
|
||||
id: groupView
|
||||
x:contactView.width+2*mm
|
||||
y:5.5*mm
|
||||
width: permissionDialog.width/2-2*mm
|
||||
height: permissionDialog.height-14*mm
|
||||
clip: true
|
||||
spacing: 1
|
||||
model: groupModel
|
||||
delegate: groupItem
|
||||
}
|
||||
|
||||
ListModel{id: groupModel}
|
||||
Component{
|
||||
id:groupItem
|
||||
Rectangle{
|
||||
id:groupitemRect
|
||||
width:groupView.width
|
||||
radius: 0.5*mm
|
||||
height: 5*mm
|
||||
property string groupstatus:"neutral"
|
||||
onGroupstatusChanged:
|
||||
{if(groupstatus=="positive"){groupitemRect.color="light green"}
|
||||
else if (groupstatus=="negative"){groupitemRect.color= "red"}
|
||||
else{groupitemRect.color= Material.backgroundColor}}
|
||||
color: Material.backgroundColor
|
||||
border.color: Material.frameColor
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
text:group.groupname
|
||||
}
|
||||
MouseArea{
|
||||
ListModel{id: groupModel}
|
||||
Component{
|
||||
id:groupItem
|
||||
Rectangle{
|
||||
id:groupitemRect
|
||||
width:groupView.width
|
||||
radius: 0.5*mm
|
||||
height: 5*mm
|
||||
property string groupstatus:"neutral"
|
||||
onGroupstatusChanged:
|
||||
{if(groupstatus=="positive"){groupitemRect.color="light green"}
|
||||
else if (groupstatus=="negative"){groupitemRect.color= "red"}
|
||||
else{groupitemRect.color= Material.backgroundColor}}
|
||||
color: Material.backgroundColor
|
||||
border.color: Material.frameColor
|
||||
Text{
|
||||
color: Material.primaryTextColor
|
||||
text:group.groupname
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
if(groupModel.get(index).groupstatus=="neutral"){
|
||||
|
@ -170,55 +171,56 @@ Rectangle{
|
|||
else if (groupModel.get(index).groupstatus=="positive"){
|
||||
groupModel.set(index,{"groupstatus":"negative"});
|
||||
groupstatus="negative"}
|
||||
else{groupModel.set(index,{"groupstatus":"neutral"})
|
||||
groupstatus="neutral"}
|
||||
else{groupModel.set(index,{"groupstatus":"neutral"})
|
||||
groupstatus="neutral"}
|
||||
}}
|
||||
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
|
||||
groupstatus="positive"
|
||||
}
|
||||
else if (groupModel.get(index).groupstatus=="negative"){
|
||||
groupstatus="negative"
|
||||
}
|
||||
else {groupstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
MButton{
|
||||
x:0.5*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\uf0c7"
|
||||
onClicked:{
|
||||
Component.onCompleted:{ if (groupModel.get(index).groupstatus=="positive"){
|
||||
groupstatus="positive"
|
||||
}
|
||||
else if (groupModel.get(index).groupstatus=="negative"){
|
||||
groupstatus="negative"
|
||||
}
|
||||
else {groupstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
MButton{
|
||||
x:0.5*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\uf0c7"
|
||||
onClicked:{
|
||||
updatePerms();
|
||||
var perms=[];
|
||||
perms.push(contact_allow,contact_deny,group_allow,group_deny);
|
||||
Service.savePermissions(db,perms)
|
||||
}
|
||||
}
|
||||
MButton{
|
||||
x:contactView.width+2*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\u2713"
|
||||
onClicked:{updatePerms();
|
||||
permissionDialog.visible=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
MButton{
|
||||
x:contactView.width+2*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\u2713"
|
||||
onClicked:{
|
||||
updatePerms();
|
||||
permissionDialog.visible=false;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
Helperjs.readData(db,"contacts",login.username,function(contacts){
|
||||
Component.onCompleted:{
|
||||
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"}
|
||||
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
|
||||
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
|
||||
}},"isFriend",1,"name");
|
||||
var contactstatus="neutral";
|
||||
if (contact_allow.indexOf(contacts[name].cid)>-1){contactstatus="positive"}
|
||||
else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"}
|
||||
contactModel.append({"contact":contacts[name],"contactstatus":contactstatus})
|
||||
}},"isFriend",1,"name");
|
||||
|
||||
Helperjs.readData(db,"groups",login.username,function(owngroups){
|
||||
Helperjs.readData(db,"groups",login.username,function(owngroups){
|
||||
for (var number in owngroups){
|
||||
var groupstatus= "neutral";
|
||||
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
|
||||
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
|
||||
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
|
||||
}});
|
||||
}
|
||||
var groupstatus= "neutral";
|
||||
if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"}
|
||||
else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"}
|
||||
groupModel.append({"group":owngroups[number],"groupstatus":groupstatus})
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ Rectangle {
|
|||
id:searchComponent
|
||||
color: Material.backgroundColor
|
||||
radius:0.5*mm
|
||||
property bool selfdestroying:false
|
||||
/* anchors.left: parent.left
|
||||
anchors.leftMargin:mm
|
||||
anchors.top:parent.top
|
||||
|
@ -54,7 +55,10 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
cursorVisible: false
|
||||
onEditingFinished:{ if (displayText!=""){search(displayText)};searchComponent.destroy()}
|
||||
onAccepted:{
|
||||
if (displayText!=""){search(displayText)};
|
||||
if(selfdestroying){searchComponent.destroy()}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: searchText.forceActiveFocus()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue