Friendiqa v0.2.2
This commit is contained in:
parent
ca6ae19a88
commit
93f08e604f
22 changed files with 345 additions and 91 deletions
|
@ -47,6 +47,7 @@ Flickable{
|
|||
id:messageSend
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
property var attachImageURLs: [];
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
|
@ -58,7 +59,8 @@ Flickable{
|
|||
|
||||
function attachImage(url){
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
|
||||
url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
|
@ -90,7 +92,7 @@ Flickable{
|
|||
|
||||
Column {
|
||||
id:messageColumn
|
||||
spacing: 2
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: titleField
|
||||
|
@ -99,14 +101,23 @@ Flickable{
|
|||
visible: messageSend.parentId === ""
|
||||
}
|
||||
|
||||
TextArea {
|
||||
id: bodyField
|
||||
width: parent.width
|
||||
height: 30*mm
|
||||
wrapMode: TextEdit.Wrap
|
||||
textFormat: TextEdit.PlainText
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius: 0.5*mm
|
||||
x:mm
|
||||
width: parent.width-2*mm
|
||||
height:Math.max(bodyField.contentHeight+2*mm,10*mm)
|
||||
TextArea {
|
||||
id: bodyField
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
textFormat: TextEdit.PlainText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing: 2
|
||||
CheckBox{
|
||||
|
@ -143,10 +154,9 @@ Flickable{
|
|||
text:"\u2713"
|
||||
onClicked: {if(urlTextEdit.text!=""){
|
||||
var start = bodyField.selectionStart;
|
||||
var end = bodyField.selectionEnd;
|
||||
var text = bodyField.getText(start,end);
|
||||
var text=bodyField.selectedText
|
||||
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
|
||||
bodyField.remove(start,end);
|
||||
bodyField.remove(start,bodyField.selectionEnd);
|
||||
bodyField.insert(start,text);}
|
||||
urlRectangle.visible=false}
|
||||
}
|
||||
|
@ -158,13 +168,11 @@ Flickable{
|
|||
BlueButton{id:permButton
|
||||
visible: (directmessage==1)?false:true
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/PermissionDialog.qml");
|
||||
var permissions = component.createObject(messageColumn);
|
||||
}}
|
||||
onClicked: { permissionDialog.visible=true;}
|
||||
}
|
||||
BlueButton {
|
||||
id: attachButton
|
||||
text: "\uf0c6"
|
||||
text: "\uf03e"
|
||||
visible:(directmessage==0)
|
||||
onClicked: {
|
||||
if (attachImageURLs.length>0){//Server currently accepts only one attachment
|
||||
|
@ -189,27 +197,26 @@ Flickable{
|
|||
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+"';iconSource:'"+contacts[i].profile_image+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
|
||||
}}
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageSend,"contactmenuOutput")
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
|
||||
contactlistObject.popup() }
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
onClicked: {
|
||||
var smileyarray=Smileyjs.smileys
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/SmileyDialog.qml");
|
||||
var smileydialog = component.createObject(messageColumn)
|
||||
}}
|
||||
onClicked: {smileyDialog.visible=true}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: cancelButton
|
||||
text: "\uf057"
|
||||
onClicked: {newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop(null)}
|
||||
onClicked: {
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop(null)
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
|
@ -224,7 +231,8 @@ Flickable{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
PermissionDialog{id:permissionDialog;x:mm;visible: false}
|
||||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,14 @@ Item {
|
|||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
if(text&&(newsStack.depth<2)){
|
||||
if (text.subject=="undefined"){text.subject=""}
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{bodyMessage:text.subject+"\n"+text.plaintext}}])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,6 +345,7 @@ Item {
|
|||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
|
||||
//print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth);
|
||||
|
|
|
@ -49,7 +49,7 @@ Rectangle{
|
|||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{smileyDialog.destroy()}
|
||||
onClicked:{smileyDialog.visible=false}
|
||||
}
|
||||
|
||||
TabView{
|
||||
|
@ -164,7 +164,8 @@ Rectangle{
|
|||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
bodyField.append(emoji.name+" ")
|
||||
//bodyField.append(emoji.name+" ")
|
||||
bodyField.insert(bodyField.cursorPosition,emoji.name+" ");
|
||||
smileyDialog.destroy()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue