Friendiqa v0.3.1

This commit is contained in:
LubuWest 2018-07-20 21:15:54 +02:00
commit 2afa7cbe6b
29 changed files with 490 additions and 465 deletions

View file

@ -151,8 +151,8 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){print("message: "+message);
var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage);
function showMessage(header,message,rootwindow){
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';
var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput");

View file

@ -326,7 +326,7 @@ function favorite(login,favorite,newsid,rootwindow){
// toggle favorites
if(favorite){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
})}
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid, "POST",rootwindow,function (obj){
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
})}
}

View file

@ -82,15 +82,27 @@ else{
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self}
var attachmentList=[];try{if(newsitemobject.attachments){
var attachmentList=[];
try{if(newsitemobject.attachments){
var attachArray=newsitemobject.attachments;
for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){
attachmentList.push(attachArray[image])
for (var image in attachArray){
var attachhelper={mimetype:attachArray[image].mimetype}
var attachhelperstring=Qt.btoa(attachArray[image].url)
var helperstringposition=newsitemobject.text.indexOf(attachhelperstring);
if (helperstringposition>-1){attachhelper.url=newsitemobject.text.substring(newsitemobject.text.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length);
if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"}
else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"}
else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
}
else {attachhelper.url=attachArray[image].url}
attachmentList.push(attachhelper)
newsitemobject.text=newsitemobject.text.replace(attachhelper.url,"")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"")
}
}}catch(e){print("attachment "+e)}
}}catch(e){print("attachment "+e)}
newsitemobject.attachmentList=attachmentList;
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
var timestring="";
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}

View file

@ -39,6 +39,7 @@ function initDatabase(database) { // initialize the database object
var db =Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
print('initDatabase()'+database[0]+database[1]+database[2]+database[3])
db.transaction( function(tx) {
//var version=tx.executeSql('PRAGMA user_version');print(JSON.stringify(version.rows.item(0)))
tx.executeSql('CREATE TABLE IF NOT EXISTS imageData(username TEXT,id INT, created TEXT,edited TEXT, title TEXT, desc TEXT, album TEXT,filename TEXT, type TEXT, height INT, width INT, profile INT, link TEXT,location TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS config(server TEXT, username TEXT, password TEXT, imagestore TEXT, maxnews INT, timerInterval INT, newsViewType TEXT,isActive INT, permissions TEXT,maxContactAge INT,APIVersion TEXT,layout TEXT, addons TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS news(username TEXT, messagetype INT, text TEXT, created_at INT, in_reply_to_status_id INT, source TEXT, status_id INT, in_reply_to_user_id INT, geo TEXT,favorited TEXT, uid INT, statusnet_html TEXT, statusnet_conversation_id TEXT,friendica_activities TEXT, friendica_activities_self TEXT, attachments TEXT, friendica_owner TEXT)');
@ -356,9 +357,7 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
}
function processNews(api,data){
try{var newslist=JSON.parse(data);
} catch(e){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)};
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
}
@ -462,6 +461,7 @@ function processNews(api,data){
var newstabarray=["Conversations","Favorites","Timeline","DirectMessage"];
if (newstabarray.indexOf(newstab.newstabstatus)>-1){contacttimer.start()}
}
}