v0.6.4 contact search

This commit is contained in:
LubuWest 2022-03-01 21:59:21 +01:00
commit 5032c78de1
57 changed files with 2218 additions and 2252 deletions

View file

@ -49,7 +49,6 @@ Rectangle{
BusyIndicator{
id: newsBusy
//visible: false
anchors.horizontalCenter: parent.horizontalCenter
anchors.top:parent.top
anchors.topMargin: 2*mm
@ -60,10 +59,8 @@ Rectangle{
}
function newstypeHandling(newstype){
newsBusy.running=true;
try{newsBusy.running=true}catch(e){print(e)};
replySignal("");
//messagesend.state="";
//newsModel.clear();
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
@ -75,7 +72,7 @@ Rectangle{
case "conversation":
newsStack.updateMethodNews="conversation";
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
Newsjs.chatsfromdb(root.db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
@ -105,7 +102,7 @@ Rectangle{
newsBusy.running=false;
var leftoffset=(osSettings.osType=="Android")?2*root.fontFactor*osSettings.bigFontSize:0
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-(leftoffset+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize});
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-(leftoffset+mm),height: 1.5*root.fontFactor*osSettings.systemFontSize,selfdestroying:true});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
@ -147,20 +144,19 @@ Rectangle{
function showNews(newsToShow){
try{if (rootstackView.depth>1){rootstackView.pop()}}catch(e){}
newsBusy.running=false;
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+JSON.stringify(newsToShow))
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
newsWorker.sendMessage(msg);
//newsStack.appendNews=false
if(newsToShow.length>0){
var currentTime= new Date()
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
newsWorker.sendMessage(msg);
}
}
function search(term){
if (term!=""){
//newstab.newstabstatus="Search";
newstabstatus="Search";
newsBusy.running=true;
newsStack.updateMethodNews="refresh";
@ -179,10 +175,12 @@ Rectangle{
try{var oldnewsitemobject=newsModel.get(newsModel.count-1).newsitemobject;
if(oldnewsitemobject.hasOwnProperty("lastcomment")){
var lastnews_id=oldnewsitemobject.lastcomment.created_at;
//var lastconv_id=oldnewsitemobject.lastcomment.statusnet_conversation_id
}else{
var lastnews_id=oldnewsitemobject.created_at;
//var lastconv_id=oldnewsitemobject.statusnet_conversation_id
}
} catch(e){print(e);var lastnews_id=99999999999999 }
} catch(e){print(e);var lastnews_id=99999999999999}
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
@ -192,14 +190,19 @@ Rectangle{
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline" ){
if(newsSwipeview.stacktype!="Home"|| newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline" ){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
else if(newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var currentconversations=[];
for (let c=0;c<newsModel.count;c++){
currentconversations.push(parseInt(newsModel.get(c).newsitemobject.statusnet_conversation_id))
}
Newsjs.chatsfromdb(root.db,root.login, messagetype,currentconversations,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
@ -252,7 +255,6 @@ Rectangle{
Service.updateView("Replies")
}
replySignal("")
//Service.updateView(newstab.newstabstatus)
}
}
}
@ -301,7 +303,6 @@ Rectangle{
property string viewtype: "news"
width: parent.width
height: parent.height-3*mm
//anchors.fill: parent
anchors.margins: 0.5*mm
clip: true
spacing: 0
@ -355,11 +356,11 @@ Rectangle{
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
Newsjs.chatsfromdb(db,root.login,0,[],function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
} else {print("newstab.newstabstatus "+newstab.newstabstatus)
Service.updateView(newstab.newstabstatus)
}
});
@ -424,7 +425,7 @@ Rectangle{
root.searchSignal.connect(search);
try{newsModel.clear()} catch(e){}
swipeIndicator.visible=true;
//newsSwipeview.height=rootstack.height//-12*mm;
//newsSwipeview.height=rootstack.height
//newsSwipeview.y=5*mm;
//rootStackItem.state=""
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
@ -438,9 +439,8 @@ Rectangle{
default:messagetype=0;
}
//if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews);
})
@ -451,5 +451,4 @@ Rectangle{
showNews(dbnews)
})}
}
//}
}