This commit is contained in:
LubuWest 2018-10-01 21:17:54 +02:00
commit 09e8b8d097
49 changed files with 1720 additions and 825 deletions

View file

@ -65,7 +65,6 @@ Item {
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
else{
Service.updateView(newstab.newstabstatus)
root.contactLoadType="news";
}
}
}
@ -81,7 +80,9 @@ Item {
function showNews(newsToShow){
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){}
try{
if (newsStack.depth>1){newsStack.pop()}
}catch(e){}
newsBusy.running=false;
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
@ -94,10 +95,6 @@ Item {
function showConversation(conversationIndex,newsitemobject){
//newsBusy.running=true;
root.contactLoadType="conversation";
newsStack.conversationIndex= conversationIndex;
//print(newsitemobject.id);
if(newsitemobject.messagetype==0){
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
@ -117,10 +114,8 @@ Item {
}
function showContact(contact){
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if (component.status== Component.Ready){
var contactDetails = component.createObject(newstab,{"contact": contact})
}
newstab.newstabstatus="Contact";
newsStack.push({item:"qrc:/qml/newsqml/ContactPage.qml",properties:{"contact": contact}});
}
function search(term){//print("Search "+term)
@ -134,7 +129,6 @@ Item {
xhr.clearParams();
xhr.setParam("q",term)
xhr.get();}
//newsSearch.visible=false;
newsView.anchors.topMargin=7*mm
}
@ -174,7 +168,6 @@ Item {
StackView{
id: newsStack
anchors.fill:parent
property int conversationIndex: 0
property string updateMethodNews: "refresh"
property var allchats: ({})
initialItem:Rectangle {
@ -284,17 +277,9 @@ Item {
id: searchButton
text: "\uf002"
onClicked: {
//if (newsSearch.visible==false){
newsView.anchors.topMargin=18*mm;
newsView.anchors.topMargin=18*mm;
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
//searchItem.forceActiveFocus()
// newsSearch.visible=true}
//else{
// newsSearch.visible=false;
// newsView.anchors.topMargin=7*mm;
//}
var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
}
}
@ -327,7 +312,7 @@ Item {
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
root.contactLoadType="news";
//root.contactLoadType="news";
Service.updateView(newstab.newstabstatus)
}
}
@ -358,32 +343,21 @@ Item {
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},lastnews_id)}
else if(newstab.newstabstatus=="Contact"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
newsWorker.sendMessage(msg);
},newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
// Newsjs.newsfromdb(root.db,root.login.username, function(news){
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
// newsWorker.sendMessage(msg);
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
else{
newsStack.appendNews=true;
//newsStack.appendNews=true;
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
xhr.get()
}}
}
}
}
// Rectangle{
// id: newsSearch
// color: "#FFFAFA"
// y:8*mm
// width:root.width
// height: 8*mm
// //visible:false
// Search{
// anchors.fill: parent
// anchors.margins: mm
// }
// }
ListView {
id: newsView
@ -398,11 +372,9 @@ Item {
delegate: Newsitem{}
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
onDragEnded:{if(contentY<-5*mm){
root.contactLoadType="news";
var onlynew=true;
var onlynew=true;
Service.updateView(newstab.newstabstatus)
}}
//Component.onCompleted: currentIndex=count
}
ListModel{id: newsModel}
@ -447,6 +419,7 @@ Item {
Component.onCompleted: {
root.messageSignal.connect(onFriendsMessages);
root.directmessageSignal.connect(onDirectMessage);
root.contactdetailsSignal.connect(showContact);
root.newsSignal.connect(showNews);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);