forked from lubuwest/Friendiqa
version v0.6.7 with moderation
This commit is contained in:
parent
5f8edccdfe
commit
48a70b8395
46 changed files with 2106 additions and 1026 deletions
|
@ -38,20 +38,20 @@ import "qrc:/js/helper.js" as Helperjs
|
|||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
import "qrc:/qml/newsqml"
|
||||
|
||||
Rectangle{
|
||||
color:Material.dialogColor
|
||||
width:parent.width
|
||||
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+2*mm:0
|
||||
height: messageColumn.height+2*mm
|
||||
id:messageSend
|
||||
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
|
||||
visible:conversation || (newstab.newstabstatus!="Search")?true:false
|
||||
property string parentId: ""
|
||||
property bool textfocus: false
|
||||
property bool conversation: false
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
property var attachImageURLs: [];
|
||||
property var media_ids:[]
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
|
||||
|
@ -66,11 +66,8 @@ Rectangle{
|
|||
}
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1 && attachImageURLs.length==0)){
|
||||
attachImage(urls);
|
||||
attachImageURLs.push(urls);
|
||||
messageSend.state="active";
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
|
@ -84,48 +81,36 @@ Rectangle{
|
|||
}
|
||||
|
||||
function attachImage(url){
|
||||
imageAttachment.source=url.toString();
|
||||
if(url!=""){
|
||||
imageUploadDialog.visible=true;
|
||||
imageUploadDialog.attachImage(url)
|
||||
}
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
function statusUpdate(title,status,in_reply_to_status_id) {
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
//if (in_reply_to_status_id==""){
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.setParam("htmlstatus", status);
|
||||
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
|
||||
if (title!=="") {xhr.setParam("title", title)};
|
||||
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
|
||||
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
|
||||
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
|
||||
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
|
||||
if (attachImageURL.length>0) {
|
||||
for (var image in attachImageURL){
|
||||
xhr.setImageFileParam("media", attachImageURL[image]);
|
||||
xhr.setImageFileParam("angle", rotator.angle.toString());
|
||||
}
|
||||
}
|
||||
xhr.post();
|
||||
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()
|
||||
// }
|
||||
messageSend.destroy()
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.setParam("htmlstatus", status);
|
||||
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
|
||||
if (title!=="") {xhr.setParam("title", title)};
|
||||
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
|
||||
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
|
||||
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
|
||||
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
|
||||
if (media_ids.length>0) {
|
||||
xhr.setParam("media_ids", media_ids.join());
|
||||
}
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
function dmUpdate(title,text,replyto,screen_name) {
|
||||
newsBusy.running=true;
|
||||
//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/new");
|
||||
|
@ -133,7 +118,6 @@ Rectangle{
|
|||
xhr.setParam("text", text);
|
||||
xhr.setParam("screen_name", screen_name);
|
||||
if (parentId!="") {xhr.setParam("replyto", replyto)};
|
||||
//if (title!=="") {xhr.setParam("title", title)};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
|
@ -147,8 +131,6 @@ Rectangle{
|
|||
messageSend.reply_to_user="";
|
||||
messageSend.parentId="";
|
||||
bodyField.text="";
|
||||
attachImageURLs.pop();
|
||||
imageAttachment.source=""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,9 +165,9 @@ Rectangle{
|
|||
onDropped: {
|
||||
if (messageSend.state==""){messageSend.state="active"}
|
||||
if (drop.keys.includes('text/uri-list')){
|
||||
var droptext = drop.text.replace(/(\r\n|\n|\r)/gm, "");
|
||||
attachImageURLs.push(droptext);
|
||||
attachImage(droptext)}
|
||||
var droptext = drop.text.replace(/(\r\n|\n|\r)/gm, ",");
|
||||
imageUploadDialog.visible=true;
|
||||
attachImage(droptext)}
|
||||
else if (drop.keys.includes('text/html')){
|
||||
bodyField.append(drop.html)}
|
||||
else if (drop.keys.includes('text/plain')){
|
||||
|
@ -204,7 +186,35 @@ Rectangle{
|
|||
horizontalAlignment:Text.AlignHCenter
|
||||
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
width: root.fontFactor*osSettings.bigFontSize
|
||||
height:stackTypeDescription.height
|
||||
anchors.left: stackTypeDescription.left
|
||||
anchors.leftMargin: 2*root.fontFactor*osSettings.bigFontSize
|
||||
visible: newsSwipeview.currentIndex!=0
|
||||
text:"\uf053"
|
||||
fontColor: Material.hintTextColor
|
||||
border.color: "transparent"
|
||||
color:"transparent"
|
||||
radius:0
|
||||
onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex-1}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
width: root.fontFactor*osSettings.bigFontSize
|
||||
height:stackTypeDescription.height
|
||||
anchors.right: stackTypeDescription.right
|
||||
anchors.rightMargin: 2*root.fontFactor*osSettings.bigFontSize
|
||||
visible: newsSwipeview.currentIndex!=newsSwipeview.length-1
|
||||
text:"\uf054"
|
||||
fontColor: Material.hintTextColor
|
||||
border.color: "transparent"
|
||||
color:"transparent"
|
||||
radius:0
|
||||
onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex+1}
|
||||
}
|
||||
}
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width
|
||||
|
@ -222,7 +232,7 @@ Rectangle{
|
|||
width: parent.width-mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: false//(parentId === "") && (bodyField.length>1)
|
||||
visible: false
|
||||
onVisibleChanged: if ((visible==true)&&(conversation==true)){
|
||||
conversationView.contentY=conversationView.contentY+titleField.height
|
||||
}
|
||||
|
@ -263,8 +273,9 @@ Rectangle{
|
|||
onActiveFocusChanged:{
|
||||
if (activeFocus==true){
|
||||
if (messageSend.ListView.view==null){
|
||||
if (newsitem.ListView.view==null){}
|
||||
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2}
|
||||
if ((typeof newsitem == 'undefined') || (newsitem.ListView.view==null)){}
|
||||
else {
|
||||
newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2}
|
||||
}
|
||||
else if (conversation==true){
|
||||
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
|
||||
|
@ -272,7 +283,7 @@ Rectangle{
|
|||
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
|
||||
} else if (textfocus==false){
|
||||
messageSend.state="active";
|
||||
newsView.positionViewAtBeginning();
|
||||
messageSend.ListView.view.positionViewAtBeginning();
|
||||
}
|
||||
else{
|
||||
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
|
||||
|
@ -301,8 +312,8 @@ Rectangle{
|
|||
id:contactSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
|
||||
x:2*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
|
||||
height: messageSend.height/2
|
||||
model:contactModel
|
||||
function processContactSelection(contact){
|
||||
|
@ -328,8 +339,8 @@ Rectangle{
|
|||
id: tagSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
|
||||
x:2*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
|
||||
height: messageSend.height/2
|
||||
model:tagModel
|
||||
clip: true
|
||||
|
@ -343,52 +354,11 @@ Rectangle{
|
|||
}
|
||||
ListModel{id:tagModel}
|
||||
|
||||
Item{
|
||||
id:imageAttachment;
|
||||
property alias source:realimage.source
|
||||
//property alias angle:rotator.angle
|
||||
visible: source!=""
|
||||
width: 45*mm
|
||||
height: 45*mm;
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
attachImageURLs.splice(attachImageURLs.indexOf(source),1);
|
||||
imageAttachment.source=""
|
||||
}
|
||||
}
|
||||
Image{id:realimage
|
||||
source:"";
|
||||
x:2*mm;
|
||||
width: 45*mm;
|
||||
height: source==""?0:45*mm;
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0}
|
||||
|
||||
}
|
||||
Rectangle{
|
||||
width: 5*mm
|
||||
height: 5*mm
|
||||
visible: imageAttachment.source!=""
|
||||
anchors.bottom: imageAttachment.bottom
|
||||
anchors.right: imageAttachment.right
|
||||
color: "black"
|
||||
opacity: 0.5
|
||||
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
|
||||
MouseArea{
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
rotator.angle+=90;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
id:buttonRow
|
||||
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
||||
visible:false
|
||||
spacing: mm
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize//12*mm
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
x: 0.5*mm
|
||||
|
||||
// MButton{id:permButton //Permissions not working in Friendica 02/2022
|
||||
|
@ -398,25 +368,6 @@ Rectangle{
|
|||
// 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:(newsSwipeview.stacktype!="DirectMessages")
|
||||
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
|
||||
|
@ -433,6 +384,19 @@ Rectangle{
|
|||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||
}
|
||||
MButton{
|
||||
id:imagesButton
|
||||
visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
text: "\uf03e"
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {
|
||||
if (imageUploadDialog.visible==false){
|
||||
imageUploadDialog.visible=true;
|
||||
imageUploadDialog.attach()
|
||||
}
|
||||
else{imageUploadDialog.visible=false}}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: cancelButton
|
||||
|
@ -445,10 +409,11 @@ Rectangle{
|
|||
bodyField.text="";
|
||||
messageSend.state="";
|
||||
permissionDialog.visible=false;
|
||||
smileyDialog.visible=false;
|
||||
imageUploadDialog.visible=false;
|
||||
receiverLabel.visible=false;
|
||||
reply_to_user="";
|
||||
attachImage("");
|
||||
attachImageURLs.pop();
|
||||
media_ids=[]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,9 +428,9 @@ Rectangle{
|
|||
var dmbody=bodyField.getText(0,bodyField.length);
|
||||
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
|
||||
if (parentId!=""){
|
||||
statusUpdate(title,dmbody,parentId,attachImageURLs)
|
||||
statusUpdate(title,dmbody,parentId)
|
||||
}else{
|
||||
statusUpdate(title,body,parentId,attachImageURLs)}
|
||||
statusUpdate(title,body,parentId)}
|
||||
}else {
|
||||
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
|
||||
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
|
||||
|
@ -478,6 +443,7 @@ Rectangle{
|
|||
}
|
||||
PermissionDialog{id:permissionDialog;x:mm;visible: false}
|
||||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
MessageImageUploadDialog{id:imageUploadDialog;visible: false}
|
||||
}
|
||||
Component.onCompleted:{
|
||||
root.replySignal.connect(setParent);
|
||||
|
@ -497,7 +463,7 @@ Rectangle{
|
|||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
PropertyChanges {
|
||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue