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

@ -32,8 +32,8 @@
// message.qml
// message with buttons
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
//import QtQuick.Dialogs 1.2
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/qml/genericqml"
@ -41,8 +41,8 @@ import "qrc:/qml/genericqml"
Rectangle{
color:"white"
width:root.width-5*mm
height:root.height-12*mm
// width:root.width-5*mm
// height:root.height-12*mm
//anchors.fill: parent
property string parentId: ""
property string reply_to_user:""
@ -69,7 +69,7 @@ Rectangle{
xhr.setApi("/api/statuses/update");
xhr.clearParams();
xhr.setParam("source", "Friendiqa");
xhr.setParam("status", status);
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))};
@ -94,14 +94,11 @@ Rectangle{
}
Flickable{
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
anchors.fill: parent
contentHeight: messageColumn.height
boundsBehavior: Flickable.StopAtBounds
id:messageSend
Column {
id:messageColumn
spacing: 0.5*mm
width: parent.width
@ -124,13 +121,15 @@ Rectangle{
font.pixelSize: 3*mm
wrapMode: Text.Wrap
selectByMouse: true
textFormat: TextEdit.PlainText
textFormat: TextEdit.RichText //TextEdit.PlainText
onLinkActivated:{Qt.openUrlExternally(link)}
}
}
Row{
spacing: 2
width: parent.width
CheckBox{
id:dmCheckbox
text:"DM"
@ -142,38 +141,38 @@ Rectangle{
}
}
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
Rectangle{
id:urlRectangle
BlueButton{
text:"\uf0c1"
onClicked: {
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
else{urlTextEdit.text="";
urlRectangle.visible=true}}
}
}
Rectangle{
id:urlRectangle
height: 7*mm //parent.height
width:parent.width-2*mm
visible:false
TextField{
id:urlTextEdit
width:parent.width-7*mm
height:parent.height
width:37*mm
visible:false
TextField{
id:urlTextEdit
width:30*mm
height:parent.height
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
BlueButton{
anchors.left:urlTextEdit.right
anchors.leftMargin:mm
text:"\u2713"
onClicked: {if(urlTextEdit.text!=""){
var start = bodyField.selectionStart;
var text=bodyField.selectedText
if(text.lastIndexOf(".jpg")>-1 || text.lastIndexOf(".jpeg")>-1 || text.lastIndexOf(".png")>-1){text="<img src="+text+">"}
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
bodyField.remove(start,bodyField.selectionEnd);
bodyField.insert(start,text);}
urlRectangle.visible=false}
}
}
Row{
spacing:2
BlueButton{id:permButton
@ -208,7 +207,7 @@ Rectangle{
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
}
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert("+bodyField.cursorPosition+",' @"+contacts[i].screen_name+" ')}"
}}
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
@ -234,10 +233,11 @@ Rectangle{
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getText(0,bodyField.length);
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
statusUpdate(title,body,parentId,attachImageURLs)}
else {dmUpdate(title,dmbody,parentId,reply_to_user) }
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
}
}