new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
47 changed files with 1424 additions and 825 deletions
|
@ -61,13 +61,6 @@ Rectangle{
|
|||
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
||||
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
||||
|
||||
// onReply_to_userChanged: {
|
||||
// if (reply_to_user!=""){
|
||||
// print("reply "+reply_to_user)
|
||||
// //receiverLabel.visible=true
|
||||
// receiverLabel.text=reply_to_user
|
||||
// }
|
||||
// }
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
|
@ -98,9 +91,6 @@ Rectangle{
|
|||
|
||||
function attachImage(url){
|
||||
imageAttachment.source=url.toString();
|
||||
// var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
// 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) {
|
||||
|
@ -125,6 +115,7 @@ Rectangle{
|
|||
}
|
||||
};
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
|
@ -166,6 +157,16 @@ Rectangle{
|
|||
contactSelector.visible=true
|
||||
},letter);
|
||||
}
|
||||
|
||||
function hashtagmenu(){//print("letter "+letter)
|
||||
Newsjs.listHashtags(login,db,function(tags){
|
||||
tagModel.clear();
|
||||
for (var i=0;i<tags.length;i++){
|
||||
tagModel.append({"tag":tags[i]})
|
||||
}
|
||||
tagSelector.visible=true
|
||||
});
|
||||
}
|
||||
// Flickable{
|
||||
// anchors.fill: parent
|
||||
// contentHeight: messageColumn.height
|
||||
|
@ -177,46 +178,16 @@ Rectangle{
|
|||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
|
||||
// Row{
|
||||
// x: 0.5*mm
|
||||
// Label{
|
||||
// id:toLabel
|
||||
// width: 7*mm
|
||||
// height: 6*mm
|
||||
// topPadding: 1.5* mm
|
||||
// font.pixelSize: 3*mm
|
||||
// text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:"):""
|
||||
// visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
// }
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
//x: 8*mm
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""//newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
|
||||
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
//onLengthChanged: contactmenu(text)
|
||||
//onPreeditTextChanged: contactmenu(text)
|
||||
// onActiveFocusChanged:{
|
||||
// if (activeFocus==true){contactmenu("")}
|
||||
// }
|
||||
onTextChanged: {
|
||||
//print (text)
|
||||
contactmenu(text)}
|
||||
// MouseArea{
|
||||
// anchors.fill: parent
|
||||
// onClicked:{print("receiverlabel")
|
||||
// if(newsSwipeview.stacktype=="DirectMessages"){
|
||||
// contactmenu();
|
||||
|
||||
// }}
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""
|
||||
visible:false
|
||||
onTextChanged: {
|
||||
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: titleField
|
||||
|
@ -309,6 +280,24 @@ Rectangle{
|
|||
}
|
||||
ListModel{id:contactModel}
|
||||
|
||||
ListView{
|
||||
id: tagSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:8*mm
|
||||
width: parent.width-9*mm
|
||||
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)}
|
||||
}
|
||||
ListModel{id:tagModel}
|
||||
|
||||
Item{
|
||||
id:imageAttachment;
|
||||
|
@ -351,54 +340,6 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
// Row{
|
||||
// spacing: 2
|
||||
// width: parent.width
|
||||
// CheckBox{
|
||||
// id:dmCheckbox
|
||||
// text:"DM"
|
||||
// enabled: false
|
||||
// checked: (directmessage==1)?true:false
|
||||
// onClicked:{
|
||||
// if(dmCheckbox.checkedState==Qt.Checked){directmessage=1}
|
||||
// else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0}
|
||||
// }
|
||||
// }
|
||||
|
||||
// Button{
|
||||
// text:"\uf0c1"
|
||||
// height:8*mm
|
||||
// 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
|
||||
// }
|
||||
// Button{
|
||||
// anchors.left:urlTextEdit.right
|
||||
// anchors.leftMargin:mm
|
||||
// height:8*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{
|
||||
id:buttonRow
|
||||
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
||||
|
@ -440,6 +381,14 @@ Rectangle{
|
|||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:hastagButton
|
||||
text: "\uf292"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: cancelButton
|
||||
height: 6*mm
|
||||
|
@ -483,8 +432,6 @@ Rectangle{
|
|||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted:{
|
||||
//parentId=conversationModel.get(conversationModel.count-1).newsitemobject.id
|
||||
//if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
newsStack.replySignal.connect(setParent);
|
||||
root.directmessageSignal.connect(directmessagePrepare);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
|
@ -492,48 +439,34 @@ Rectangle{
|
|||
if (textfocus==true){bodyField.forceActiveFocus()}
|
||||
}
|
||||
|
||||
states: [ State {
|
||||
name: "active"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
}
|
||||
// PropertyChanges {
|
||||
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
// }
|
||||
},
|
||||
State {
|
||||
name: "conversation"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
|
||||
// PropertyChanges {
|
||||
// target: receiverLabel; visible:true; text:qsTr("to")+": "+ conversationModel.get(0).newsitemobject.user.name
|
||||
// }
|
||||
|
||||
// PropertyChanges {
|
||||
// target: messageSend; reply_to_user: conversationModel.get(0).newsitemobject.user.screen_name
|
||||
// }
|
||||
|
||||
// PropertyChanges {
|
||||
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
|
||||
// }
|
||||
},
|
||||
states: [
|
||||
State {
|
||||
name: "active"
|
||||
PropertyChanges {
|
||||
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:(newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
},
|
||||
|
||||
State {
|
||||
name: "reply"
|
||||
|
@ -552,4 +485,3 @@ Rectangle{
|
|||
}
|
||||
]
|
||||
}
|
||||
//}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue