forked from lubuwest/Friendiqa
version v0.6
This commit is contained in:
parent
bdc28e632e
commit
8482bde3ed
86 changed files with 7064 additions and 3208 deletions
|
@ -43,9 +43,9 @@ import "qrc:/qml/genericqml"
|
|||
Rectangle{
|
||||
color:"#EEEEEE"
|
||||
width:parent.width
|
||||
height: (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
id:messageSend
|
||||
visible:(newsSwipeview.stacktype!="Notifications")?true:false
|
||||
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
|
||||
property string parentId: ""
|
||||
property bool textfocus: false
|
||||
//property var parentObject:({})
|
||||
|
@ -61,14 +61,12 @@ Rectangle{
|
|||
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
||||
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
||||
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
reply_to_user=friend.screen_name;
|
||||
receiverLabel.text=friend.screen_name;
|
||||
}
|
||||
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1 && attachImageURLs.length==0)){
|
||||
attachImage(urls);
|
||||
|
@ -87,15 +85,13 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function attachImage(url){
|
||||
imageAttachment.source=url.toString();
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
newsBusy.running=true;
|
||||
try{newsBusy.running=true;}catch(e){conversationBusy.running=true}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
|
@ -116,7 +112,7 @@ Rectangle{
|
|||
};
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
newsBusy.running=true;
|
||||
|
@ -139,7 +135,7 @@ Rectangle{
|
|||
reply_to_user=newsitemobject.user.screen_name;
|
||||
parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state="";
|
||||
messageSend.state=null;
|
||||
reply_to_user="";
|
||||
parentId="";
|
||||
bodyField.text="";
|
||||
|
@ -152,6 +148,9 @@ Rectangle{
|
|||
Newsjs.listFriends(login,db,function(contacts){
|
||||
contactModel.clear();
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
if(contacts[i].description!="" &&contacts[i].description!=null){
|
||||
contacts[i].description=Qt.atob(contacts[i].description)
|
||||
}
|
||||
contactModel.append({"contact":contacts[i]})
|
||||
}
|
||||
contactSelector.visible=true
|
||||
|
@ -171,17 +170,36 @@ Rectangle{
|
|||
// anchors.fill: parent
|
||||
// contentHeight: messageColumn.height
|
||||
// boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
DropArea{
|
||||
anchors.fill: parent
|
||||
onDropped: {
|
||||
if (messageSend.state==""){messageSend.state="active"}
|
||||
if (drop.keys.includes('text/uri-list')){
|
||||
attachImageURLs.push(drop.text);
|
||||
attachImage(drop.text)}
|
||||
else if (drop.keys.includes('text/html')){
|
||||
bodyField.append(drop.html)}
|
||||
else if (drop.keys.includes('text/plain')){
|
||||
bodyField.append(drop.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
y:0.5*mm
|
||||
id:messageColumn
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
height: 11*mm+stackTypeDescription.height//implicitHeight
|
||||
Label{id:stackTypeDescription
|
||||
width: parent.width
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
}
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""
|
||||
visible:false
|
||||
|
@ -193,7 +211,7 @@ Rectangle{
|
|||
id: titleField
|
||||
x: 0.5*mm
|
||||
width: parent.width-mm
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: false//(parentId === "") && (bodyField.length>1)
|
||||
onVisibleChanged: if ((visible==true)&&(conversation==true)){
|
||||
|
@ -211,21 +229,22 @@ Rectangle{
|
|||
TextArea {
|
||||
id: bodyField
|
||||
property string contactprefix:""
|
||||
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family: "Noto Sans"
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
placeholderText: conversation?"": qsTr("What's on your mind?")
|
||||
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
|
||||
textFormat: TextEdit.RichText //TextEdit.PlainText
|
||||
onLineCountChanged: (conversation==true)?conversationView.contentY=conversationView.contentY+3*mm:newsView.contentY=newsView.contentY+3*mm
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
onActiveFocusChanged:{
|
||||
onActiveFocusChanged:{//print(placeholder)
|
||||
if (activeFocus==true){
|
||||
if (conversation==true){
|
||||
setParent(conversationModel.get(0).newsitemobject);
|
||||
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
|
||||
messageSend.state="conversation";
|
||||
conversationView.contentY=conversationView.contentY+20*mm
|
||||
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
|
||||
} else if (textfocus==false){
|
||||
messageSend.state="active";
|
||||
newsView.positionViewAtBeginning();
|
||||
|
@ -347,18 +366,18 @@ Rectangle{
|
|||
height: 12*mm
|
||||
x: 0.5*mm
|
||||
MButton{id:permButton
|
||||
visible: (newsSwipeview.stacktype!=="DirectMessages")
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
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: attachButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf03e"
|
||||
visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
|
||||
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)
|
||||
|
@ -376,23 +395,23 @@ Rectangle{
|
|||
MButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:hastagButton
|
||||
text: "\uf292"
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: cancelButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
if (textfocus==true){messageSend.destroy()}
|
||||
|
@ -409,21 +428,21 @@ Rectangle{
|
|||
}
|
||||
MButton {
|
||||
id: sendButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*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 (newsSwipeview.stacktype!=="DirectMessages"){
|
||||
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
|
||||
statusUpdate(title,body,parentId,attachImageURLs)}
|
||||
else {
|
||||
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
|
||||
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
|
||||
}
|
||||
if (conversation==true){
|
||||
newstab.newstabstatus=root.globaloptions.newsViewType; newsStack.pop(null)
|
||||
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +451,7 @@ Rectangle{
|
|||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted:{
|
||||
newsStack.replySignal.connect(setParent);
|
||||
root.replySignal.connect(setParent);
|
||||
root.directmessageSignal.connect(directmessagePrepare);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
|
@ -464,7 +483,7 @@ Rectangle{
|
|||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -482,6 +501,9 @@ Rectangle{
|
|||
PropertyChanges {
|
||||
target: bodyField; placeholderText:"";focus:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: stackTypeDescription; visible:false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue