bugfixes reply in Friendica 3/2022 and image download

This commit is contained in:
LubuWest 2022-03-13 21:22:08 +01:00
parent 4ffae4ac31
commit 48a904b8c0
15 changed files with 909 additions and 855 deletions

View file

@ -1,3 +1,8 @@
## v0.6.5
* Fix reply in Friendica 3/2022 version due to API bug
* Image downloads work again
* Some additional emojis
## v0.6.4 ## v0.6.4
@ -5,7 +10,6 @@
* Filter contacts * Filter contacts
* many new emojis * many new emojis
* Replaced Favorite button with Reply button due to buggy Favourite API * Replaced Favorite button with Reply button due to buggy Favourite API
* View newsitem on website (works only in coversation view)
* Rebuild contacts handling due to buggy Contacts API * Rebuild contacts handling due to buggy Contacts API
* Removed permissions for new messages due to buggy Contacts API * Removed permissions for new messages due to buggy Contacts API
* Sync all accounts in background (not only active) * Sync all accounts in background (not only active)

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.4" android:versionCode="30" android:installLocation="auto"> <manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.5" android:versionCode="31" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

View file

@ -224,7 +224,7 @@ void XHR::getlist()
XHR::setUrl(m_filelist.at(dlindex));} XHR::setUrl(m_filelist.at(dlindex));}
else { else {
XHR::setUrl(m_filelist.at(dlindex));} XHR::setUrl(m_filelist.at(dlindex));}
//qDebug() << "start download" << m_url; qDebug() << "start download" << m_url;
XHR::download(); XHR::download();
} else {dlindex=0;m_downloadtype="";m_contactlist.clear();m_filelist.clear();} } else {dlindex=0;m_downloadtype="";m_contactlist.clear();m_filelist.clear();}
} }
@ -293,6 +293,7 @@ void XHR::onReplySuccess()
void XHR::onRequestFinished() void XHR::onRequestFinished()
{ {
// Save the file here // Save the file here
//qDebug() << "buffer " << buffer;
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);} if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);}
else if (m_downloadtype=="picturelist") { else if (m_downloadtype=="picturelist") {
QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer); QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer);

View file

@ -59,7 +59,7 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
//print(api+JSON.stringify(login)+Qt.atob(login.password)); //print(api+JSON.stringify(login)+Qt.atob(login.password));
if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) { if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {
} else if(xhrequest.readyState === XMLHttpRequest.DONE) { } else if(xhrequest.readyState === XMLHttpRequest.DONE) {
try{ if (xhrequest.responseText!=""){ try{ if (xhrequest.responseText!=""){print (xhrequest.responseText)
callback(xhrequest.responseText) callback(xhrequest.responseText)
}else{//print("API:\n" +api+" NO RESPONSE"); }else{//print("API:\n" +api+" NO RESPONSE");
//showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow) //showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow)

View file

@ -54,7 +54,8 @@ function dataRequest(login,photo,database,xhr,rootwindow) {
// check if image exist and call download function // check if image exist and call download function
Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photo.id, rootwindow, function (image){ Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photo.id, rootwindow, function (image){
if(image==""){currentimageno=currentimageno+1}else{ if(image=="" || typeof(image)=="undefined"){currentimageno=currentimageno+1}else{
try{ try{
var obj = JSON.parse(image); var obj = JSON.parse(image);
if (obj.hasOwnProperty('status')){ if (obj.hasOwnProperty('status')){
@ -109,6 +110,30 @@ function dataRequest(login,photo,database,xhr,rootwindow) {
} }
}) })
}} catch (e){ }} catch (e){
var helpfilename=photo.filename.substring(0,photo.filename.lastIndexOf("."));
var filesuffix="";
if (photo.type=="image/jpeg"){filesuffix=".jpg"}
else if (photo.type=="image/png"){filesuffix=".png"}
else {filesuffix=""}
if (helpfilename==""){// check if file has any filename
photo.filename=photo["id"]+filesuffix;
}
else{photo.filename=helpfilename+filesuffix}
var link="";
xhr.setUrl(Qt.resolvedUrl(photo.thumb));
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setFilename(login.imagestore+'albums/'+photo.album+"/"+photo["filename"]);
xhr.setDownloadtype("picture");
xhr.download();
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from imageData where id = "'+photo["id"]+'"');
if(result.rows.length === 1) {// use update
result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+photo.id+'", created="'+photo.created+'", edited="'+photo.edited+'", profile="0", link="'+photo["thumb"]+'", filename="'+photo.filename+'",title="", desc="'+photo.desc+'", type="'+photo.type+'", width="0", height="0", album="'+photo.album+'", location="file://'+login.imagestore+'albums/'+photo.album+'/" where id="'+photo["id"]+'"');
} else {// use insert print('... does not exists, create it')
result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,photo.id,photo.created,photo.edited,'', photo.desc, photo.album, photo.filename, photo.type, '', '',0,photo["thumb"],'file://'+login.imagestore+'albums/'+photo.album+"/"]);
}
})
print("Data retrieval failure! "+ e+obj); print("Data retrieval failure! "+ e+obj);
} }
}}) }})

View file

@ -344,19 +344,19 @@ function deleteNews(login,database,newsid,messagetype,rootwindow,callback){
})} })}
function retweetNews(login,database,newsid,rootwindow,callback){ function retweetNews(login,database,newsid,rootwindow,callback){
Helperjs.friendicaPostRequest(login,"/api/statuses/retweet?id="+newsid,"","POST", rootwindow,function (obj){ Helperjs.friendicaPostRequest(login,"/api/v1/statuses/"+newsid+"/reblog","","POST", rootwindow,function (obj){
var answer=JSON.parse(obj); var answer=JSON.parse(obj);
if(answer.hasOwnProperty('status'))//('error' in answer.status) if(answer.hasOwnProperty('status'))//('error' in answer.status)
{Helperjs.showMessage("Repost",answer.status.code,rootwindow);} {Helperjs.showMessage("Repost",answer.status.code,rootwindow);}
else{Helperjs.showMessage("Repost",answer.text,rootwindow)} else{Helperjs.showMessage("Repost",answer.content,rootwindow)}
}) })
} }
function favorite(login,favorited,newsid,rootwindow){ function favorite(login,favorited,newsid,rootwindow){
// toggle favorites // toggle favorites
if(favorited){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){ if(favorited){ Helperjs.friendicaPostRequest(login,"/api/v1/statuses/"+newsid+"/bookmark","","POST", rootwindow,function (obj){
})} })}
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){ else {Helperjs.friendicaPostRequest(login,"/api/v1/statuses/"+newsid+"/unbookmark","","POST",rootwindow,function (obj){
})} })}
} }

View file

@ -455,7 +455,7 @@ function processNews(api,data){
usermessages.push(newslist.status); usermessages.push(newslist.status);
newslist=usermessages; newslist=usermessages;
} }
if (data==""){newsBusy.running=false} if (data=="" || api=="/api/v1/statuses"){print("data "+data); newsBusy.running=false}
else if (typeof(newslist)=='undefined'){ else if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
} }

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,7 @@ Page{
font.pointSize: osSettings.systemFontSize font.pointSize: osSettings.systemFontSize
color:Material.primaryTextColor color:Material.primaryTextColor
wrapMode: Text.WrapAtWordBoundaryOrAnywhere wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.6.4 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+ text: "<b>Friendiqa v0.6.5 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+ "Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+ "Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+ "Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+

View file

@ -95,7 +95,7 @@ Page {
//x:3*mm //x:3*mm
//y:8*mm //y:8*mm
width: conversationList.width//-4*mm width: conversationList.width//-4*mm
height:conversationList.height//-20*mm height:conversationList.height-root.fontFactor*osSettings.bigFontSize//-20*mm
clip: true clip: true
spacing: 0 spacing: 0
footer: MessageSend{conversation:true} footer: MessageSend{conversation:true}

View file

@ -89,27 +89,37 @@ Rectangle{
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) { function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
//xhr.url= login.server + "/api/statuses/update.json"; //xhr.url= login.server + "/api/statuses/update.json";
try{newsBusy.running=true;}catch(e){conversationBusy.running=true} try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server); xhr.setUrl(login.server);
xhr.setApi("/api/statuses/update"); if (in_reply_to_status_id==""){
xhr.clearParams(); xhr.setApi("/api/statuses/update");
xhr.setParam("source", "Friendiqa"); xhr.clearParams();
xhr.setParam("htmlstatus", status); xhr.setParam("source", "Friendiqa");
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)}; xhr.setParam("htmlstatus", status);
if (title!=="") {xhr.setParam("title", title)}; if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))}; if (title!=="") {xhr.setParam("title", title)};
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))}; if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))}; if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
if (attachImageURL.length>0) { if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
for (var image in attachImageURL){ if (attachImageURL.length>0) {
xhr.setImageFileParam("media", attachImageURL[image]); for (var image in attachImageURL){
xhr.setImageFileParam("angle", rotator.angle.toString()); xhr.setImageFileParam("media", attachImageURL[image]);
xhr.setImageFileParam("angle", rotator.angle.toString());
}
} }
}; xhr.post();
xhr.post(); Newsjs.storeHashtags(login,db,status,root)
Newsjs.storeHashtags(login,db,status,root) }else {
xhr.setApi("/api/v1/statuses");
xhr.clearParams();
xhr.setParam("status", status);
xhr.setParam("in_reply_to_id", in_reply_to_status_id);
xhr.post();
Newsjs.storeHashtags(login,db,status,root)
messageSend.destroy()
}
} }
function dmUpdate(title,text,replyto,screen_name,attachImageURL) { function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
@ -124,7 +134,7 @@ Rectangle{
if (parentId!="") {xhr.setParam("replyto", replyto)}; if (parentId!="") {xhr.setParam("replyto", replyto)};
//if (title!=="") {xhr.setParam("title", title)}; //if (title!=="") {xhr.setParam("title", title)};
xhr.post(); xhr.post();
} }
function setParent(newsitemobject){ function setParent(newsitemobject){
if (newsitemobject!=""){ if (newsitemobject!=""){
@ -151,22 +161,22 @@ Rectangle{
contactModel.append({"contact":contacts[i]}) contactModel.append({"contact":contacts[i]})
} }
contactSelector.visible=true contactSelector.visible=true
},letter); },letter);
} }
function hashtagmenu(){ function hashtagmenu(){
Newsjs.listHashtags(login,db,function(tags){ Newsjs.listHashtags(login,db,function(tags){
tagModel.clear(); tagModel.clear();
for (var i=0;i<tags.length;i++){ for (var i=0;i<tags.length;i++){
tagModel.append({"tag":tags[i]}) tagModel.append({"tag":tags[i]})
} }
tagSelector.visible=true tagSelector.visible=true
}); });
} }
// Flickable{ // Flickable{
// anchors.fill: parent // anchors.fill: parent
// contentHeight: messageColumn.height // contentHeight: messageColumn.height
// boundsBehavior: Flickable.StopAtBounds // boundsBehavior: Flickable.StopAtBounds
DropArea{ DropArea{
anchors.fill: parent anchors.fill: parent
onDropped: { onDropped: {
@ -182,342 +192,349 @@ Rectangle{
} }
} }
} }
Column { Column {
y:0.5*mm y:0.5*mm
id:messageColumn id:messageColumn
spacing: 0.5*mm spacing: 0.5*mm
width: parent.width
height: 2.6*root.fontFactor*osSettings.bigFontSize+stackTypeDescription.height
Label{id:stackTypeDescription
width: parent.width width: parent.width
height: 2.6*root.fontFactor*osSettings.bigFontSize+stackTypeDescription.height horizontalAlignment:Text.AlignHCenter
Label{id:stackTypeDescription text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
width: parent.width font.pointSize: osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter }
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):"" TextArea{
font.pointSize: osSettings.bigFontSize id:receiverLabel
} width: messageColumn.width
TextArea{ font.pointSize: osSettings.bigFontSize
id:receiverLabel placeholderText:qsTr("to:")
width: messageColumn.width text: ""
font.pointSize: osSettings.bigFontSize visible:false
placeholderText:qsTr("to:") onTextChanged: {
text: "" if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
visible:false }
onTextChanged: {
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
}
TextField { TextField {
id: titleField id: titleField
x: 0.5*mm x: 0.5*mm
width: parent.width-mm width: parent.width-mm
font.pointSize: osSettings.systemFontSize font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Title (optional)") placeholderText: qsTr("Title (optional)")
visible: false//(parentId === "") && (bodyField.length>1) visible: false//(parentId === "") && (bodyField.length>1)
onVisibleChanged: if ((visible==true)&&(conversation==true)){ onVisibleChanged: if ((visible==true)&&(conversation==true)){
conversationView.contentY=conversationView.contentY+titleField.height conversationView.contentY=conversationView.contentY+titleField.height
} }
} }
Rectangle{ Rectangle{
color: Material.backgroundColor color: Material.backgroundColor
radius: 0.5*mm radius: 0.5*mm
visible:(conversation || (newsSwipeview.stacktype!="Notifications")) visible:(conversation || (newsSwipeview.stacktype!="Notifications"))
x:mm x:mm
width: parent.width-2*mm width: parent.width-2*mm
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize) height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
TextArea { TextArea {
id: bodyField id: bodyField
property string contactprefix:"" property string contactprefix:""
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):"" property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
anchors.fill: parent anchors.fill: parent
font.pointSize: osSettings.systemFontSize font.pointSize: osSettings.systemFontSize
font.family: "Noto Sans" font.family: "Noto Sans"
wrapMode: Text.Wrap wrapMode: Text.Wrap
selectByMouse: true selectByMouse: true
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder) placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
textFormat: TextEdit.RichText textFormat: TextEdit.RichText
onLineCountChanged: { onLineCountChanged: {
if (messageSend.ListView.view==null){
if (newsitem.ListView.view==null){}
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize}
}
if(conversation==true){
conversationView.contentY=conversationView.contentY+root.fontFactor*osSettings.systemFontSize
}
else{
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize
}
}
onLinkActivated:{Qt.openUrlExternally(link)}
onActiveFocusChanged:{
if (activeFocus==true){
if (messageSend.ListView.view==null){ if (messageSend.ListView.view==null){
if (newsitem.ListView.view==null){} if (newsitem.ListView.view==null){}
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize} else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2}
} }
if(conversation==true){ else if (conversation==true){
conversationView.contentY=conversationView.contentY+root.fontFactor*osSettings.systemFontSize if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
messageSend.state="conversation";
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
} else if (textfocus==false){
messageSend.state="active";
newsView.positionViewAtBeginning();
} }
else{ else{
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
} };
} }
onLinkActivated:{Qt.openUrlExternally(link)} }
onActiveFocusChanged:{ onTextChanged:{
if (activeFocus==true){ if (text!=""){
if (messageSend.ListView.view==null){ var plaintext=getText(0,cursorPosition)
if (newsitem.ListView.view==null){} var regex1 = /@[a-z]+/;var regex2 = /\![a-z]+/;var regex3 = /\s/;
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2} if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
} var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
else if (conversation==true){ contactprefix="@";
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);} contactmenu(letter.toString())
messageSend.state="conversation"; } else if( regex2.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) ){
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){} var letter=(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)).match(/[a-z]+/);
} else if (textfocus==false){ contactprefix="!";
messageSend.state="active"; contactmenu(letter.toString())
newsView.positionViewAtBeginning(); }else {contactSelector.visible=false}
} }else{contactSelector.visible=false}
else{ }
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
};
}
}
onTextChanged:{
if (text!=""){
var plaintext=getText(0,cursorPosition)
var regex1 = /@[a-z]+/;var regex2 = /\![a-z]+/;var regex3 = /\s/;
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="@";
contactmenu(letter.toString())
} else if( regex2.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) ){
var letter=(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)).match(/[a-z]+/);
contactprefix="!";
contactmenu(letter.toString())
}else {contactSelector.visible=false}
}else{contactSelector.visible=false}
}
}
} }
}
ListView{ ListView{
id:contactSelector id:contactSelector
visible: false visible: false
z:3 z:3
x:2*root.fontFactor*osSettings.bigFontSize//8*mm x:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
height: messageSend.height/2 height: messageSend.height/2
model:contactModel model:contactModel
function processContactSelection(contact){ function processContactSelection(contact){
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){ if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
contact.screen_name=contact.screen_name+"+"+contacts.cid contact.screen_name=contact.screen_name+"+"+contacts.cid
} }
if (newsSwipeview.stacktype=='DirectMessages'){ if (newsSwipeview.stacktype=='DirectMessages'){
receiverLabel.text=contact.screen_name; receiverLabel.text=contact.screen_name;
reply_to_user=contact.screen_name reply_to_user=contact.screen_name
} else { } else {
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition); bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" "); bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1 bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
} }
//receiverLabel.text=contact.screen_name; //receiverLabel.text=contact.screen_name;
contactSelector.visible=false contactSelector.visible=false
} }
delegate: ContactComponent { } delegate: ContactComponent { }
} }
ListModel{id:contactModel} ListModel{id:contactModel}
ListView{ ListView{
id: tagSelector id: tagSelector
visible: false visible: false
z:3 z:3
x:2*root.fontFactor*osSettings.bigFontSize//8*mm x:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
height: messageSend.height/2 height: messageSend.height/2
model:tagModel model:tagModel
clip: true clip: true
spacing: 0 spacing: 0
function processTagSelection(hashtag){ function processTagSelection(hashtag){
bodyField.insert(bodyField.cursorPosition, hashtag+" "); bodyField.insert(bodyField.cursorPosition, hashtag+" ");
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1 bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
tagSelector.visible=false tagSelector.visible=false
} }
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)} delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
} }
ListModel{id:tagModel} ListModel{id:tagModel}
Item{ Item{
id:imageAttachment; id:imageAttachment;
property alias source:realimage.source property alias source:realimage.source
//property alias angle:rotator.angle //property alias angle:rotator.angle
visible: source!="" visible: source!=""
width: 45*mm width: 45*mm
height: 45*mm; height: 45*mm;
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
attachImageURLs.splice(attachImageURLs.indexOf(source),1); attachImageURLs.splice(attachImageURLs.indexOf(source),1);
imageAttachment.source="" imageAttachment.source=""
} }
} }
Image{id:realimage Image{id:realimage
source:""; source:"";
x:2*mm; x:2*mm;
width: 45*mm; width: 45*mm;
height: source==""?0:45*mm; height: source==""?0:45*mm;
fillMode: Image.PreserveAspectFit; fillMode: Image.PreserveAspectFit;
transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0} transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0}
} }
Rectangle{ Rectangle{
width: 5*mm width: 5*mm
height: 5*mm height: 5*mm
visible: imageAttachment.source!="" visible: imageAttachment.source!=""
anchors.bottom: imageAttachment.bottom anchors.bottom: imageAttachment.bottom
anchors.right: imageAttachment.right anchors.right: imageAttachment.right
color: "black" color: "black"
opacity: 0.5 opacity: 0.5
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"} Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
MouseArea{ MouseArea{
anchors.fill:parent; anchors.fill:parent;
onClicked:{ onClicked:{
rotator.angle+=90; rotator.angle+=90;
}
}
}
}
Row{
id:buttonRow
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
spacing: mm
height: 2.5*root.fontFactor*osSettings.bigFontSize//12*mm
x: 0.5*mm
// MButton{id:permButton //Permissions not working in Friendica 02/2022
// visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
// height: 2*root.fontFactor*osSettings.bigFontSize
// width: 2*root.fontFactor*osSettings.bigFontSize
// text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
// onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
// }
MButton {
id: attachButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf03e"
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
onClicked: {
if (attachImageURLs.length>0){//Server currently accepts only one attachment
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
}
else{
root.imagePicking=false;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',root,"imagePicker");
imagePicker.pickImage()
}
}
}
MButton{
id:smileyButton
text: "\uf118"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
}
MButton{
id:hastagButton
text: "\uf292"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
}
MButton {
id: cancelButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf057"
onClicked: {
if (textfocus==true){messageSend.destroy()}
else{
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
}
}
}
MButton {
id: sendButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
statusUpdate(title,body,parentId,attachImageURLs)
}else {
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
}
if (conversation==true){
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
}
} }
} }
} }
PermissionDialog{id:permissionDialog;x:mm;visible: false} }
SmileyDialog{id:smileyDialog;x:mm;visible: false}
Row{
id:buttonRow
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
spacing: mm
height: 2.5*root.fontFactor*osSettings.bigFontSize//12*mm
x: 0.5*mm
// MButton{id:permButton //Permissions not working in Friendica 02/2022
// visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
// height: 2*root.fontFactor*osSettings.bigFontSize
// width: 2*root.fontFactor*osSettings.bigFontSize
// text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
// onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
// }
MButton {
id: attachButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf03e"
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
onClicked: {
if (attachImageURLs.length>0){//Server currently accepts only one attachment
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
}
else{
root.imagePicking=false;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',root,"imagePicker");
imagePicker.pickImage()
}
}
}
MButton{
id:smileyButton
text: "\uf118"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
}
MButton{
id:hastagButton
text: "\uf292"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
}
MButton {
id: cancelButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf057"
onClicked: {
if (textfocus==true){messageSend.destroy()}
else{
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
attachImage("");
attachImageURLs.pop();
}
}
}
MButton {
id: sendButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
if (parentId!=""){
statusUpdate(title,dmbody,parentId,attachImageURLs)
}else{
statusUpdate(title,body,parentId,attachImageURLs)}
}else {
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
}
if (conversation==true){
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
}
}
}
}
PermissionDialog{id:permissionDialog;x:mm;visible: false}
SmileyDialog{id:smileyDialog;x:mm;visible: false}
}
Component.onCompleted:{
root.replySignal.connect(setParent);
root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
if (textfocus==true){bodyField.forceActiveFocus()}
} }
Component.onCompleted:{
root.replySignal.connect(setParent);
root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
if (textfocus==true){bodyField.forceActiveFocus()}
}
states: [ states: [
State { State {
name: "active" name: "active"
PropertyChanges { PropertyChanges {
target: messageColumn; height: implicitHeight target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
}
PropertyChanges {
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
}
},
State {
name: "conversation"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
}
},
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
PropertyChanges {
target: stackTypeDescription; visible:false
}
} }
] PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
}
PropertyChanges {
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
}
},
State {
name: "conversation"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
}
},
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: attachButton; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
PropertyChanges {
target: stackTypeDescription; visible:false
}
}
]
} }

View file

@ -48,7 +48,7 @@ Rectangle{
MouseArea {anchors.fill:parent; MouseArea {anchors.fill:parent;
onClicked:{ onClicked:{
rootstackView.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype}); rootstackView.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": Qt.resolvedUrl(attachment.url),"mimetype": attachment.mimetype});
} }
} }
} }

View file

@ -29,8 +29,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtMultimedia 5.8 import QtMultimedia 5.15
import QtQuick 2.9 import QtQuick 2.11
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"

View file

@ -129,7 +129,8 @@ Item {
font.pointSize: 0.6*osSettings.systemFontSize font.pointSize: 0.6*osSettings.systemFontSize
font.family: "Noto Sans" font.family: "Noto Sans"
horizontalAlignment: Label.AlignRight horizontalAlignment: Label.AlignRight
text: (newsitemobject.in_reply_to_status_id!="null"&&newsitemobject.in_reply_to_status_id!=null)?" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name:" " //text: (newsitemobject.in_reply_to_status_id!="null"&&newsitemobject.in_reply_to_status_id!=null)?" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name:" "
text: (newsitemobject.reply_user!=false&&typeof(newsitemobject.reply_user)!="undefined")?" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name:" "
} }
} }
} }
@ -330,31 +331,31 @@ Item {
}} }}
} }
// CheckBox { CheckBox {
// id:favoritedCheckbox id:favoritedCheckbox
// visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3)) visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
// width: newsitem.width/5 width: newsitem.width/5
// height: parent.height height: parent.height
// indicator:Rectangle{ indicator:Rectangle{
// implicitWidth: newsitem.width/5 implicitWidth: newsitem.width/5
// implicitHeight:root.fontFactor*osSettings.bigFontSize implicitHeight:root.fontFactor*osSettings.bigFontSize
// color:"transparent" color:"transparent"
// Text{ Text{
// anchors.centerIn: parent anchors.centerIn: parent
// font.pointSize: osSettings.systemFontSize font.pointSize: osSettings.systemFontSize
// font.family:fontAwesome.name font.family:fontAwesome.name
// color: favoritedCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor color: favoritedCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
// text:"\uf005" text:"\uf005"
// } }
// } }
// checked:(newsitemobject.favorited>0) checked:(newsitemobject.favorited>0)
// onClicked:{ onClicked:{
// if(favoritedCheckbox.checkState==Qt.Checked){ if(favoritedCheckbox.checkState==Qt.Checked){
// Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1} Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
// else if(favoritedCheckbox.checkState==Qt.Unchecked){ else if(favoritedCheckbox.checkState==Qt.Unchecked){
// Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0} Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
// } }
// } }
Rectangle{ Rectangle{
width: newsitem.width/5 width: newsitem.width/5
height: parent.height height: parent.height

View file

@ -58,16 +58,16 @@ StackView{
if(albums.indexOf(fotorectangle.newimages[i].album)==-1){ if(albums.indexOf(fotorectangle.newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums"; filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(fotorectangle.newimages[i].album)} filesystem.makeDir(fotorectangle.newimages[i].album)}
ownimagelist.push(root.login.server+"/api/friendica/photo?photo_id="+fotorectangle.newimages[i].id);
//ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+fotorectangle.newimages[i].id);
} }
Imagejs.dataRequest(login,fotorectangle.newimages[0],db,xhr,fotorectangle); //Imagejs.dataRequest(login,fotorectangle.newimages[0],db,xhr,fotorectangle);
}) })
// xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setLogin(login.username+":"+Qt.atob(login.password));
// xhr.setImagedir(login.imagestore); xhr.setImagedir(login.imagestore);
// xhr.setFilelist(ownimagelist); print("ownimagelist "+JSON.stringify(ownimagelist))
// xhr.setDownloadtype("picturelist"); xhr.setFilelist(ownimagelist);
// xhr.getlist(); xhr.setDownloadtype("picturelist");
xhr.getlist();
newImagesProgress.visible=true newImagesProgress.visible=true
} }
} }
@ -78,7 +78,7 @@ StackView{
fotorectangle.newimages=[];fotorectangle.currentimageno=0 fotorectangle.newimages=[];fotorectangle.currentimageno=0
}else{ }else{
// download next image // download next image
Imagejs.dataRequest(login,fotorectangle.newimages[currentimageno],db,xhr,fotorectangle) //Imagejs.dataRequest(login,fotorectangle.newimages[currentimageno],db,xhr,fotorectangle)
} }
} }
@ -95,8 +95,8 @@ StackView{
} }
function onError(data,url,api,code){ function onError(data,url,api,code){
if(data=="picturelist"){ if(data=="picturelist"){
var requestid=url.substring(url.lastIndexOf("=")+1); // var requestid=api.substring(api.lastIndexOf("=")+1);
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle); // Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle);
fotorectangle.currentimageno=fotorectangle.currentimageno+1 fotorectangle.currentimageno=fotorectangle.currentimageno+1
} else if (data=="picture"){ } else if (data=="picture"){
Helperjs.deleteData(root.db,"imageData",root.login.username,function(){ Helperjs.deleteData(root.db,"imageData",root.login.username,function(){