2018-02-19 22:36:00 +01:00
|
|
|
// This file is part of Friendiqa
|
2018-11-09 22:06:13 +01:00
|
|
|
// https://git.friendi.ca/lubuwest/Friendiqa
|
2020-05-24 21:14:23 +02:00
|
|
|
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
2018-02-19 22:36:00 +01:00
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// In addition, as a special exception, the copyright holders give
|
|
|
|
// permission to link the code of portions of this program with the
|
|
|
|
// OpenSSL library under certain conditions as described in each
|
|
|
|
// individual source file, and distribute linked combinations including
|
|
|
|
// the two.
|
|
|
|
//
|
|
|
|
// You must obey the GNU General Public License in all respects for all
|
|
|
|
// of the code used other than OpenSSL. If you modify file(s) with this
|
|
|
|
// exception, you may extend this exception to your version of the
|
|
|
|
// file(s), but you are not obligated to do so. If you do not wish to do
|
|
|
|
// so, delete this exception statement from your version. If you delete
|
|
|
|
// this exception statement from all source files in the program, then
|
|
|
|
// also delete it here.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2017-01-26 21:55:31 +01:00
|
|
|
// message.qml
|
|
|
|
// message with buttons
|
2023-07-27 21:52:16 +02:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Window 2.0;
|
|
|
|
import QtQuick.Dialogs 6.4;
|
|
|
|
//import Qt.labs.platform 6.3 as Platform
|
|
|
|
import io.qt.examples.texteditor 1.0;
|
2017-01-26 21:55:31 +01:00
|
|
|
import "qrc:/js/helper.js" as Helperjs
|
2017-03-25 23:36:14 +01:00
|
|
|
import "qrc:/js/smiley.js" as Smileyjs
|
2019-06-25 20:59:10 +02:00
|
|
|
import "qrc:/js/news.js" as Newsjs
|
2017-01-26 21:55:31 +01:00
|
|
|
import "qrc:/qml/genericqml"
|
2023-02-09 21:39:43 +01:00
|
|
|
import "qrc:/qml/newsqml"
|
2017-03-25 23:36:14 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
Window{
|
|
|
|
color: osSettings.backgroundColor
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height//messageColumn.height+2*mm
|
|
|
|
id: messageSend
|
|
|
|
property bool wideScreen : width>height
|
|
|
|
// visible: conversation || (newstab.newstabstatus!="Search")?true:false
|
2017-01-26 21:55:31 +01:00
|
|
|
property string parentId: ""
|
2023-07-27 21:52:16 +02:00
|
|
|
//property bool textfocus: false
|
|
|
|
//property bool conversation: false
|
2017-01-26 21:55:31 +01:00
|
|
|
property string reply_to_user:""
|
2023-07-27 21:52:16 +02:00
|
|
|
property string windowstate:""
|
2018-04-22 21:12:40 +02:00
|
|
|
property alias bodyMessage: bodyField.text
|
2023-02-09 21:39:43 +01:00
|
|
|
property var media_ids:[]
|
2017-01-26 21:55:31 +01:00
|
|
|
property var contacts: []
|
|
|
|
property var groups: []
|
2019-12-10 21:12:32 +01:00
|
|
|
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
|
|
|
|
property var contact_deny:login.hasOwnProperty("permissions")?login.permissions[1]:[]
|
|
|
|
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
|
|
|
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
// function directmessagePrepare(friend){
|
|
|
|
// messageSend.state="active";
|
|
|
|
// reply_to_user=friend.screen_name;
|
|
|
|
// receiverLabel.text=friend.screen_name;
|
|
|
|
// }
|
2019-06-25 20:59:10 +02:00
|
|
|
|
|
|
|
function sendUrls(urls){
|
2023-07-27 21:52:16 +02:00
|
|
|
attachImage(urls);
|
|
|
|
messageSend.state="active";
|
2019-06-25 20:59:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function sendtext(text){
|
|
|
|
if(text){
|
|
|
|
if (text.subject=="undefined"){text.subject=""}
|
|
|
|
if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".gif")>-1){
|
|
|
|
text.plaintext="<a href="+text.plaintext+"><img src="+text.plaintext+"></a>"}
|
|
|
|
bodyField.text=text.subject+"\n"+text.plaintext;
|
|
|
|
messageSend.state="active";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function attachImage(url){
|
2023-02-09 21:39:43 +01:00
|
|
|
if(url!=""){
|
|
|
|
imageUploadDialog.visible=true;
|
|
|
|
imageUploadDialog.attachImage(url)
|
|
|
|
}
|
2019-06-25 20:59:10 +02:00
|
|
|
}
|
2017-05-11 22:15:34 +02:00
|
|
|
|
2023-02-09 21:39:43 +01:00
|
|
|
function statusUpdate(title,status,in_reply_to_status_id) {
|
2023-07-27 21:52:16 +02:00
|
|
|
print("status: "+status);
|
2018-07-01 15:09:21 +02:00
|
|
|
//xhr.url= login.server + "/api/statuses/update.json";
|
2022-03-13 21:22:08 +01:00
|
|
|
try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
|
2023-05-24 21:40:26 +02:00
|
|
|
xhr.setAccount(login);
|
2023-02-09 21:39:43 +01:00
|
|
|
xhr.setApi("/api/statuses/update");
|
|
|
|
xhr.setParam("source", "Friendiqa");
|
2023-07-27 21:52:16 +02:00
|
|
|
xhr.setParam("status", status);
|
|
|
|
if (parentId!="") {xhr.setParam("in_reply_to_status_id", in_reply_to_status_id)};
|
2023-02-09 21:39:43 +01:00
|
|
|
if (title!=="") {xhr.setParam("title", title)};
|
2023-07-27 21:52:16 +02:00
|
|
|
// 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))};
|
2023-02-09 21:39:43 +01:00
|
|
|
if (media_ids.length>0) {
|
|
|
|
xhr.setParam("media_ids", media_ids.join());
|
|
|
|
}
|
|
|
|
xhr.post();
|
2023-05-24 21:40:26 +02:00
|
|
|
Newsjs.storeHashtags(login,db,status,root);
|
|
|
|
media_ids=[]
|
2023-07-27 21:52:16 +02:00
|
|
|
messageSend.close()
|
2021-05-12 21:41:34 +02:00
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
|
2023-02-09 21:39:43 +01:00
|
|
|
function dmUpdate(title,text,replyto,screen_name) {
|
2019-06-25 20:59:10 +02:00
|
|
|
newsBusy.running=true;
|
2023-05-24 21:40:26 +02:00
|
|
|
xhr.setAccount(login);
|
2018-07-01 15:09:21 +02:00
|
|
|
xhr.setApi("/api/direct_messages/new");
|
2017-01-26 21:55:31 +01:00
|
|
|
xhr.setParam("text", text);
|
|
|
|
xhr.setParam("screen_name", screen_name);
|
|
|
|
if (parentId!="") {xhr.setParam("replyto", replyto)};
|
|
|
|
xhr.post();
|
2023-07-27 21:52:16 +02:00
|
|
|
messageSend.close()
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
// function setParent(newsitemobject){
|
|
|
|
// if (newsitemobject!=""){
|
|
|
|
// messageSend.state="conversation"
|
|
|
|
// messageSend.reply_to_user=newsitemobject.user.screen_name;
|
|
|
|
// messageSend.parentId=newsitemobject.id
|
|
|
|
// } else {
|
|
|
|
// messageSend.state=null;
|
|
|
|
// messageSend.reply_to_user="";
|
|
|
|
// messageSend.parentId="";
|
|
|
|
// bodyField.text="";
|
|
|
|
// }
|
|
|
|
// }
|
2019-06-25 20:59:10 +02:00
|
|
|
|
2022-03-01 21:59:21 +01:00
|
|
|
function contactmenu(letter){
|
2019-06-25 20:59:10 +02:00
|
|
|
Newsjs.listFriends(login,db,function(contacts){
|
2019-12-10 21:12:32 +01:00
|
|
|
contactModel.clear();
|
2019-06-25 20:59:10 +02:00
|
|
|
for (var i=0;i<contacts.length;i++){
|
2021-05-12 21:41:34 +02:00
|
|
|
if(contacts[i].description!="" &&contacts[i].description!=null){
|
|
|
|
contacts[i].description=Qt.atob(contacts[i].description)
|
|
|
|
}
|
2019-12-10 21:12:32 +01:00
|
|
|
contactModel.append({"contact":contacts[i]})
|
2019-06-25 20:59:10 +02:00
|
|
|
}
|
2019-12-10 21:12:32 +01:00
|
|
|
contactSelector.visible=true
|
2022-03-13 21:22:08 +01:00
|
|
|
},letter);
|
2019-06-25 20:59:10 +02:00
|
|
|
}
|
2020-11-25 21:40:17 +01:00
|
|
|
|
2022-03-01 21:59:21 +01:00
|
|
|
function hashtagmenu(){
|
2020-11-25 21:40:17 +01:00
|
|
|
Newsjs.listHashtags(login,db,function(tags){
|
|
|
|
tagModel.clear();
|
|
|
|
for (var i=0;i<tags.length;i++){
|
2022-03-13 21:22:08 +01:00
|
|
|
tagModel.append({"tag":tags[i]})
|
2020-11-25 21:40:17 +01:00
|
|
|
}
|
|
|
|
tagSelector.visible=true
|
2022-03-13 21:22:08 +01:00
|
|
|
});
|
2020-11-25 21:40:17 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
|
|
|
|
Action {
|
|
|
|
id: quitAction
|
|
|
|
shortcut: StandardKey.Quit
|
|
|
|
onTriggered: messageSend.close()
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: copyAction
|
|
|
|
shortcut: StandardKey.Copy
|
|
|
|
onTriggered: bodyField.copy()
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: cutAction
|
|
|
|
shortcut: StandardKey.Cut
|
|
|
|
onTriggered: bodyField.cut()
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: pasteAction
|
|
|
|
shortcut: StandardKey.Paste
|
|
|
|
onTriggered: bodyField.paste()
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: boldAction
|
|
|
|
shortcut: StandardKey.Bold
|
|
|
|
onTriggered: document.bold = !document.bold
|
|
|
|
}
|
|
|
|
|
|
|
|
Action {
|
|
|
|
id: italicAction
|
|
|
|
shortcut: StandardKey.Italic
|
|
|
|
onTriggered: document.italic = !document.italic
|
|
|
|
}
|
|
|
|
|
2021-05-12 21:41:34 +02:00
|
|
|
DropArea{
|
|
|
|
anchors.fill: parent
|
|
|
|
onDropped: {
|
2023-07-27 21:52:16 +02:00
|
|
|
//if (messageSend.state==""){messageSend.state="active"}
|
2021-05-12 21:41:34 +02:00
|
|
|
if (drop.keys.includes('text/uri-list')){
|
2023-02-09 21:39:43 +01:00
|
|
|
var droptext = drop.text.replace(/(\r\n|\n|\r)/gm, ",");
|
|
|
|
imageUploadDialog.visible=true;
|
2023-07-27 21:52:16 +02:00
|
|
|
attachImage(droptext)}
|
2021-05-12 21:41:34 +02:00
|
|
|
else if (drop.keys.includes('text/html')){
|
|
|
|
bodyField.append(drop.html)}
|
|
|
|
else if (drop.keys.includes('text/plain')){
|
|
|
|
bodyField.append(drop.text)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-09 21:39:43 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
ScrollView{
|
|
|
|
width: messageSend.width-root.fontFactor*osSettings.bigFontSize
|
|
|
|
height: parent.height
|
|
|
|
clip:true
|
|
|
|
Column {
|
|
|
|
y:0.5*mm
|
|
|
|
id:messageColumn
|
|
|
|
spacing: 0.5*mm
|
|
|
|
width: messageSend.width-2*root.fontFactor*osSettings.bigFontSize
|
|
|
|
TextArea{
|
|
|
|
id:receiverLabel
|
|
|
|
x: mm
|
|
|
|
width: parent.width-2*mm
|
|
|
|
font.pointSize: osSettings.bigFontSize
|
|
|
|
placeholderText:qsTr("to:")
|
|
|
|
text: ""
|
|
|
|
visible:false
|
|
|
|
onTextChanged: {
|
|
|
|
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
|
2023-02-09 21:39:43 +01:00
|
|
|
}
|
2019-12-10 21:12:32 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
TextField {
|
|
|
|
id: titleField
|
|
|
|
x: mm
|
|
|
|
width: parent.width
|
|
|
|
font.pointSize: osSettings.systemFontSize
|
|
|
|
placeholderText: qsTr("Title (optional)")
|
|
|
|
placeholderTextColor: osSettings.secondaryTextColor
|
|
|
|
visible: false
|
|
|
|
background: Rectangle{
|
|
|
|
color: osSettings.backgroundDimColor
|
|
|
|
radius: 0.5*mm
|
|
|
|
}
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
// Rectangle{
|
|
|
|
// color: osSettings.backgroundColor
|
|
|
|
// radius: 0.5*mm
|
|
|
|
// x:mm
|
|
|
|
// width: parent.width-2*mm
|
|
|
|
// height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
|
2019-12-10 21:12:32 +01:00
|
|
|
|
2022-03-13 21:22:08 +01:00
|
|
|
TextArea {
|
|
|
|
id: bodyField
|
|
|
|
property string contactprefix:""
|
|
|
|
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
|
2023-07-27 21:52:16 +02:00
|
|
|
//anchors.fill: parent
|
|
|
|
x:mm
|
|
|
|
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
|
|
|
|
width: parent.width
|
|
|
|
background: Rectangle{
|
|
|
|
color: osSettings.backgroundDimColor
|
|
|
|
radius: 0.5*mm
|
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
font.pointSize: osSettings.systemFontSize
|
|
|
|
font.family: "Noto Sans"
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
selectByMouse: true
|
2023-07-27 21:52:16 +02:00
|
|
|
persistentSelection: true
|
|
|
|
placeholderText: (qsTr("What's on your mind?")+placeholder)
|
|
|
|
placeholderTextColor: osSettings.secondaryTextColor
|
|
|
|
textFormat: TextEdit.MarkdownText
|
2022-03-13 21:22:08 +01:00
|
|
|
onLinkActivated:{Qt.openUrlExternally(link)}
|
2023-07-27 21:52:16 +02:00
|
|
|
|
2022-03-13 21:22:08 +01:00
|
|
|
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}
|
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
MouseArea {
|
|
|
|
acceptedButtons: Qt.RightButton
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: contextMenu.open()
|
|
|
|
}
|
2017-01-26 21:55:31 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
Menu {
|
|
|
|
id: contextMenu
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Copy")
|
|
|
|
enabled: bodyField.selectedText
|
|
|
|
action: copyAction
|
|
|
|
//onTriggered: bodyField.copy()
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Cut")
|
|
|
|
enabled: bodyField.selectedText
|
|
|
|
action: cutAction
|
|
|
|
//onTriggered: bodyField.cut()
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Paste")
|
|
|
|
enabled: bodyField.canPaste
|
|
|
|
action: pasteAction
|
|
|
|
//onTriggered: bodyField.paste()
|
|
|
|
}
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Text")
|
|
|
|
enabled: bodyField.selectedText
|
|
|
|
onTriggered: print(bodyField.getFormattedText(bodyField.selectionStart,bodyField.selectionEnd))
|
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
DocumentHandler { id: document
|
|
|
|
document: bodyField.textDocument
|
|
|
|
cursorPosition: bodyField.cursorPosition
|
|
|
|
selectionStart: bodyField.selectionStart
|
|
|
|
selectionEnd: bodyField.selectionEnd
|
|
|
|
property alias bold: document.font.bold
|
|
|
|
property alias italic: document.font.italic
|
|
|
|
property alias strikeout: document.font.strikeout
|
|
|
|
//onError: function (message) { errorDialog.text = message errorDialog.open() }
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
ListView{
|
|
|
|
id:contactSelector
|
|
|
|
visible: false
|
|
|
|
z:3
|
|
|
|
x:2*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
|
|
|
|
height: messageSend.height/2
|
|
|
|
model:contactModel
|
|
|
|
function processContactSelection(contact){
|
|
|
|
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
|
|
|
|
contact.screen_name=contact.screen_name+"+"+contacts.cid
|
|
|
|
}
|
|
|
|
if (newsSwipeview.stacktype=='DirectMessages'){
|
|
|
|
receiverLabel.text=contact.screen_name;
|
|
|
|
reply_to_user=contact.screen_name
|
|
|
|
} else {
|
|
|
|
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
|
|
|
|
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
|
|
|
|
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
|
|
|
|
}
|
|
|
|
//receiverLabel.text=contact.screen_name;
|
|
|
|
contactSelector.visible=false
|
|
|
|
}
|
|
|
|
delegate: ContactComponent { }
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
ListModel{id:contactModel}
|
2020-11-25 21:40:17 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
ListView{
|
|
|
|
id: tagSelector
|
|
|
|
visible: false
|
|
|
|
z:3
|
|
|
|
x:2*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
|
|
|
|
height: messageSend.height/2
|
|
|
|
model:tagModel
|
|
|
|
clip: true
|
|
|
|
spacing: 0
|
|
|
|
function processTagSelection(hashtag){
|
|
|
|
bodyField.insert(bodyField.cursorPosition, hashtag+" ");
|
|
|
|
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
|
|
|
|
tagSelector.visible=false
|
|
|
|
}
|
|
|
|
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
|
2019-06-25 20:59:10 +02:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
ListModel{id:tagModel}
|
|
|
|
Row{
|
|
|
|
id:formatRow
|
|
|
|
visible: wideScreen
|
|
|
|
spacing: mm
|
|
|
|
height: 3.5*root.fontFactor*osSettings.bigFontSize
|
|
|
|
x: 0.5*mm
|
|
|
|
MButton {
|
|
|
|
id: boldButton
|
|
|
|
text: "\uf032" // icon-bold
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Bold")
|
|
|
|
focusPolicy: Qt.NoFocus
|
|
|
|
// Don't want to close the virtual keyboard when this is clicked.
|
|
|
|
// focusPolicy: Qt.NoFocus
|
|
|
|
// checkable: true
|
|
|
|
// checked: document.bold
|
|
|
|
onClicked: {
|
|
|
|
document.bold = !document.bold;
|
|
|
|
bodyField.forceActiveFocus()
|
2023-02-09 21:39:43 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
}
|
|
|
|
MButton {
|
|
|
|
id: italicButton
|
|
|
|
text: "\uf033" // icon-italic
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Italic")
|
|
|
|
focusPolicy: Qt.NoFocus
|
|
|
|
// focusPolicy: Qt.NoFocus
|
|
|
|
// checkable: true
|
|
|
|
// checked: document.italic
|
|
|
|
onClicked: {document.italic = !document.italic;bodyField.forceActiveFocus()}
|
|
|
|
}
|
2019-06-25 20:59:10 +02:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
MButton {
|
|
|
|
id: liststyleButton
|
|
|
|
text: "\uf03a" // icon-align-justify
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Create list")
|
|
|
|
// focusPolicy: Qt.NoFocus
|
|
|
|
// checkable: true
|
|
|
|
// checked: document.alignment == Qt.AlignJustify
|
|
|
|
onClicked: {document.liststyle = !document.liststyle;bodyField.forceActiveFocus()}
|
|
|
|
}
|
|
|
|
MButton {
|
|
|
|
id: codeblockButton
|
|
|
|
text: "\uf121" // icon-code
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Format as code")
|
|
|
|
// focusPolicy: Qt.NoFocus
|
|
|
|
// checkable: true
|
|
|
|
// checked: document.alignment == Qt.AlignJustify
|
|
|
|
onClicked: {document.codeblock = !document.codeblock;bodyField.forceActiveFocus()}
|
|
|
|
}
|
|
|
|
MButton {
|
|
|
|
id: plainButton
|
|
|
|
text: bodyField.textFormat==TextEdit.PlainText?qsTr("Rendered"):qsTr("MD") // icon-code
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Show Markdown code")
|
|
|
|
// focusPolicy: Qt.NoFocus
|
|
|
|
// checkable: true
|
|
|
|
// checked: document.alignment == Qt.AlignJustify
|
|
|
|
onClicked: {
|
|
|
|
if(bodyField.textFormat==TextEdit.PlainText){
|
|
|
|
bodyField.textFormat=TextEdit.MarkdownText;}
|
|
|
|
else {bodyField.textFormat=TextEdit.PlainText}
|
|
|
|
bodyField.forceActiveFocus()
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2020-11-25 21:40:17 +01:00
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
PermissionDialog{id:permissionDialog;x:mm;visible: false}
|
|
|
|
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
|
|
|
MessageImageUploadDialog{id:imageUploadDialog;visible: false}
|
|
|
|
Row{
|
|
|
|
id:buttonRow
|
|
|
|
visible: true
|
|
|
|
spacing: mm
|
|
|
|
height: 3.5*root.fontFactor*osSettings.bigFontSize
|
|
|
|
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:smileyButton
|
|
|
|
text: "\uf118"
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Insert smiley")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
|
|
|
}
|
|
|
|
|
|
|
|
MButton{
|
|
|
|
id:hastagButton
|
|
|
|
text: "\uf292"
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Insert previous hashtag")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
|
|
|
}
|
|
|
|
MButton{
|
|
|
|
id:imagesButton
|
|
|
|
visible:(newsSwipeview.stacktype!="DirectMessages")
|
|
|
|
text: "\uf03e"
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Insert images")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
onClicked: {
|
|
|
|
if (imageUploadDialog.visible==false){
|
|
|
|
imageUploadDialog.visible=true;
|
|
|
|
imageUploadDialog.attach()
|
|
|
|
}
|
|
|
|
else{imageUploadDialog.visible=false}}
|
|
|
|
}
|
|
|
|
|
|
|
|
MButton {
|
|
|
|
id: cancelButton
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Cancel message")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
text: "\uf057"
|
|
|
|
onClicked: {messageSend.close()}
|
|
|
|
}
|
|
|
|
MButton {
|
|
|
|
id: formatButton
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Format message")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
text: "\uf031"
|
|
|
|
onClicked: {formatRow.visible?formatRow.visible=false:formatRow.visible=true}
|
|
|
|
}
|
|
|
|
MButton {
|
|
|
|
id: sendButton
|
|
|
|
ToolTip.visible: pressed || hovered
|
|
|
|
ToolTip.text: qsTr("Send message")
|
|
|
|
height: 3*root.fontFactor*osSettings.bigFontSize
|
|
|
|
width: 3*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 (windowstate=="directmessage"){
|
|
|
|
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
|
|
|
|
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
|
|
|
|
|
|
|
|
}else {
|
|
|
|
body=body.replace(/\*\*/g,"__")
|
|
|
|
statusUpdate(title,body,parentId)
|
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2020-11-25 21:40:17 +01:00
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Component.onCompleted:{
|
2023-07-27 21:52:16 +02:00
|
|
|
if(parentId!="" &&reply_to_user!=""){
|
|
|
|
receiverLabel.text=reply_to_user;
|
|
|
|
}
|
|
|
|
// root.replySignal.connect(setParent);
|
|
|
|
// root.directmessageSignal.connect(directmessagePrepare);
|
2022-03-13 21:22:08 +01:00
|
|
|
root.uploadSignal.connect(sendUrls);
|
|
|
|
root.sendtextSignal.connect(sendtext);
|
2023-07-27 21:52:16 +02:00
|
|
|
// if (textfocus==true){bodyField.forceActiveFocus()}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2019-12-10 21:12:32 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
StateGroup{
|
|
|
|
state: windowstate
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "active"
|
|
|
|
PropertyChanges {
|
|
|
|
target: messageColumn; height: implicitHeight
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: titleField; visible: true
|
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
|
2023-07-27 21:52:16 +02:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "directmessage"
|
|
|
|
PropertyChanges {
|
|
|
|
target: messageColumn; height: implicitHeight
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: formatRow; visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: titleField; visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: receiverLabel; visible: true;
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: imagesButton; visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: formatButton; visible: false
|
|
|
|
} },
|
|
|
|
|
|
|
|
State {
|
|
|
|
name: "reply"
|
|
|
|
PropertyChanges {
|
|
|
|
target: messageColumn; height: implicitHeight
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: titleField; visible: false
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: bodyField; placeholderText:"";focus:true
|
|
|
|
}
|
2022-03-13 21:22:08 +01:00
|
|
|
}
|
2023-07-27 21:52:16 +02:00
|
|
|
]
|
|
|
|
}
|
2018-07-01 15:09:21 +02:00
|
|
|
}
|