v0.6.1 Flatpak preparation and update on start for Linux
This commit is contained in:
parent
30bc7df431
commit
ee851789ee
|
@ -401,22 +401,22 @@ function requestConversation(login,database,newsid,contacts,rootwindow,callback)
|
|||
callback(news,newContacts)
|
||||
})}
|
||||
|
||||
function conversationfromdb(database,user,conversationId,callback){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
db.transaction( function(tx) {
|
||||
var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND statusnet_conversation_id="'+conversationId+'" ORDER BY created_at ASC');
|
||||
var newsArray=[];
|
||||
var allcontacts=getAllContacts(database,user);
|
||||
for(var i = 0; i < newsrs.rows.length; i++) {
|
||||
newsArray.push(newsrs.rows.item(i));
|
||||
newsArray[i].statusnet_html=Qt.atob(newsArray[i].statusnet_html);
|
||||
newsArray[i].text=Qt.atob(newsArray[i].text);
|
||||
newsArray[i].id=newsArray[i].status_id;
|
||||
newsArray[i]=fetchUsersForNews(database,user,newsArray[i],allcontacts);
|
||||
if (helpernews.attachments!="" && newsArray[i].attachments!==null){newsArray[i].attachments=JSON.parse(Qt.atob(newsArray[i].attachments))};
|
||||
}
|
||||
callback(newsArray)})
|
||||
}
|
||||
//function conversationfromdb(database,user,conversationId,callback){
|
||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
// db.transaction( function(tx) {
|
||||
// var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND statusnet_conversation_id="'+conversationId+'" ORDER BY created_at ASC');
|
||||
// var newsArray=[];
|
||||
// var allcontacts=getAllContacts(database,user);
|
||||
// for(var i = 0; i < newsrs.rows.length; i++) {
|
||||
// newsArray.push(newsrs.rows.item(i));
|
||||
// newsArray[i].statusnet_html=Qt.atob(newsArray[i].statusnet_html);
|
||||
// newsArray[i].text=Qt.atob(newsArray[i].text);
|
||||
// newsArray[i].id=newsArray[i].status_id;
|
||||
// newsArray[i]=fetchUsersForNews(database,user,newsArray[i],allcontacts);
|
||||
// if (helpernews.attachments!="" && newsArray[i].attachments!==null){newsArray[i].attachments=JSON.parse(Qt.atob(newsArray[i].attachments))};
|
||||
// }
|
||||
// callback(newsArray)})
|
||||
//}
|
||||
|
||||
function requestFavorites(login,database,contacts,rootwindow,callback){
|
||||
Helperjs.friendicaRequest(login,"/api/favorites",rootwindow, function (obj){
|
||||
|
@ -451,27 +451,18 @@ function chatsfromdb(database,login,messagetype,callback,stop_time){
|
|||
var newsrs=tx.executeSql('select * from news WHERE username="'+login.username+'" AND statusnet_conversation_id="'+conversations[j] +'" AND messagetype="'+messagetype+'" ORDER BY created_at ASC');
|
||||
//print(JSON.stringify(newsrs.rows.item(0))+JSON.stringify(newsrs.rows.item(1)))
|
||||
var helpernews=newsrs.rows.item(0);
|
||||
helpernews.newscount=newsrs.rows.length;
|
||||
helpernews=fetchUsersForNews(database,login.username,helpernews,allcontacts);
|
||||
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
|
||||
helpernews.text=Qt.atob(helpernews.text);
|
||||
helpernews.id=helpernews.status_id;
|
||||
helpernews.friendica_author=objFromArray(allcontacts,"url",helpernews.friendica_owner);
|
||||
if (helpernews.attachments!="" && helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
|
||||
helpernews=cleanhelpernews(database,login.username,helpernews,allcontacts)
|
||||
helpernews.currentconversation=[];
|
||||
for (var h = 0;h<newsrs.rows.length;h++){
|
||||
var helpernews2=newsrs.rows.item(h);
|
||||
if(helpernews.id!=helpernews2.status_id){
|
||||
helpernews2.newscount=0;
|
||||
helpernews2=fetchUsersForNews(database,login.username,helpernews2,allcontacts);
|
||||
helpernews2.statusnet_html=Qt.atob(helpernews2.statusnet_html);
|
||||
helpernews2.text=Qt.atob(helpernews2.text);//print(h+" "+helpernews2.text)
|
||||
helpernews2.id=helpernews2.status_id;
|
||||
helpernews2.friendica_author=objFromArray(allcontacts,"url",helpernews2.friendica_owner);
|
||||
if (helpernews2.attachments!="" && helpernews2.attachments!==null){helpernews2.attachments=JSON.parse(Qt.atob(helpernews2.attachments))};
|
||||
helpernews2=cleanhelpernews(database,login.username,helpernews2,allcontacts)
|
||||
helpernews.currentconversation.push(helpernews2)
|
||||
}
|
||||
}
|
||||
|
||||
helpernews.newscount=newsrs.rows.length;
|
||||
newsArray.push(helpernews);
|
||||
}
|
||||
callback(newsArray,lastid);
|
||||
|
@ -496,12 +487,17 @@ function allchatsfromdb(database,user,callback){
|
|||
for(var j = 0; j< conversationIds.length; j++) {
|
||||
var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND statusnet_conversation_id="'+conversationIds[j] +'" ORDER BY created_at ASC');
|
||||
var helpernews=newsrs.rows.item(0);
|
||||
//helpernews.newscount=newsrs.rows.length;
|
||||
helpernews=fetchUsersForNews(database,user,helpernews,allcontacts);
|
||||
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
|
||||
helpernews.text=Qt.atob(helpernews.text);
|
||||
helpernews.id=helpernews.status_id;helpernews.friendica_author=objFromArray(allcontacts,"url",helpernews.friendica_owner);
|
||||
if (helpernews.attachments!="" && helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
|
||||
var helpernews=cleanhelpernews(database,user,helpernews,allcontacts)
|
||||
helpernews.currentconversation=[];
|
||||
for (var h = 0;h<newsrs.rows.length;h++){
|
||||
var helpernews2=newsrs.rows.item(h);
|
||||
if(helpernews.id!=helpernews2.status_id){
|
||||
helpernews2.newscount=0;
|
||||
helpernews2=cleanhelpernews(database,user,helpernews2,allcontacts)
|
||||
helpernews.currentconversation.push(helpernews2)
|
||||
}
|
||||
}
|
||||
|
||||
newsArray.push(helpernews);
|
||||
countArray.push(newsrs.rows.length)
|
||||
}
|
||||
|
@ -520,19 +516,34 @@ function oldchatfromdb(database,user,conversationId,lastpost,allcontacts,callbac
|
|||
// var countArray=[];
|
||||
//var allcontacts=getAllContacts(database,user);
|
||||
var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND statusnet_conversation_id="'+conversationId +'" AND status_id<'+lastpost+' ORDER BY created_at ASC');
|
||||
if(newsrs.rows.length>0){var helpernews=newsrs.rows.item(0);
|
||||
if(newsrs.rows.length>0){
|
||||
var helpernews=newsrs.rows.item(0);
|
||||
var helpernews=cleanhelpernews(database,user,helpernews,allcontacts)
|
||||
helpernews.currentconversation=[];
|
||||
for (var h = 0;h<newsrs.rows.length;h++){
|
||||
var helpernews2=newsrs.rows.item(h);
|
||||
if(helpernews.id!=helpernews2.status_id){
|
||||
helpernews2.newscount=0;
|
||||
helpernews2=cleanhelpernews(database,user,helpernews2,allcontacts)
|
||||
helpernews.currentconversation.push(helpernews2)
|
||||
}
|
||||
}
|
||||
|
||||
var newscount=newsrs.rows.length;
|
||||
helpernews=fetchUsersForNews(database,user,helpernews,allcontacts);
|
||||
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
|
||||
helpernews.text=Qt.atob(helpernews.text);
|
||||
helpernews.id=helpernews.status_id;helpernews.friendica_author=objFromArray(allcontacts,"url",helpernews.friendica_owner);
|
||||
if (helpernews.attachments!="" && helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
|
||||
callback(helpernews,newscount);}
|
||||
// var conversationobject={news:helpernews,newscount:newscount};
|
||||
// return conversationobject;
|
||||
})}
|
||||
|
||||
|
||||
function cleanhelpernews(database,user,helpernews,allcontacts){
|
||||
helpernews=fetchUsersForNews(database,user,helpernews,allcontacts);
|
||||
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
|
||||
helpernews.text=Qt.atob(helpernews.text);
|
||||
helpernews.id=helpernews.status_id;
|
||||
helpernews.friendica_author=objFromArray(allcontacts,"url",helpernews.friendica_owner);
|
||||
if (helpernews.attachments!="" && helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
|
||||
return helpernews
|
||||
}
|
||||
|
||||
|
||||
function getAllContacts(database,user){
|
||||
|
|
|
@ -301,6 +301,7 @@ StackView{id:rootstackView
|
|||
var IntentReceiverQml = component.createObject(root);
|
||||
}
|
||||
else if (osSettings.osType=="Linux"){
|
||||
newstypeSignal("refresh")
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/LinuxSync.qml");
|
||||
var LinuxSyncQml = component.createObject(root);
|
||||
}
|
||||
|
|
|
@ -175,8 +175,9 @@ Rectangle{
|
|||
onDropped: {
|
||||
if (messageSend.state==""){messageSend.state="active"}
|
||||
if (drop.keys.includes('text/uri-list')){
|
||||
attachImageURLs.push(drop.text);
|
||||
attachImage(drop.text)}
|
||||
var droptext = drop.text.replace(/(\r\n|\n|\r)/gm, "");
|
||||
attachImageURLs.push(droptext);
|
||||
attachImage(droptext)}
|
||||
else if (drop.keys.includes('text/html')){
|
||||
bodyField.append(drop.html)}
|
||||
else if (drop.keys.includes('text/plain')){
|
||||
|
|
|
@ -178,20 +178,20 @@ Rectangle{
|
|||
default:messagetype=0;
|
||||
}
|
||||
//if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
|
||||
if(newstabstatus=="Timeline"){
|
||||
if(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"){
|
||||
else if(newstabstatus=="Conversations"){
|
||||
else if(newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
//else if (newstab.newstabstatus=="Notifications"){}
|
||||
else if (newstabstatus=="Notifications"){}
|
||||
else{
|
||||
else if (newstab.newstabstatus=="Notifications" || newstabstatus=="Notifications"){}
|
||||
else{print("no conversations or timeline "+newstabstatus);
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
|
|
|
@ -205,7 +205,8 @@ Rectangle{
|
|||
if (drop.keys.includes('text/uri-list')){
|
||||
var urllist=drop.text.split('\n');
|
||||
for(var i=0;i< urllist.length;i++){
|
||||
attachImage(urllist[i])
|
||||
var droptext = urllist[i].replace(/(\r\n|\n|\r)/gm, "");
|
||||
attachImage(droptext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue