forked from lubuwest/Friendiqa
Version 0.002 with working Favorite Combobox
This commit is contained in:
parent
42de63fe63
commit
571c9046d0
42 changed files with 1948 additions and 814 deletions
|
@ -5,18 +5,22 @@ import QtQml 2.2
|
|||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.LocalStorage 2.0
|
||||
//import "../qml"
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Servicejs
|
||||
|
||||
Item{
|
||||
id:messageSend
|
||||
property var login
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property string attachImageURL: "";
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
// title: parentId !== "" ? qsTr("Reply to "+reply_to_user) : qsTr("New post")
|
||||
property var login
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property string attachImageURL: "";
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property string contact_allow:""
|
||||
property string contact_deny:""
|
||||
property string group_allow:""
|
||||
property string group_deny:""
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
xhr.url= login.server + "/api/statuses/update.xml";
|
||||
|
@ -46,7 +50,7 @@ Item{
|
|||
Column {
|
||||
id:messageColumn
|
||||
spacing: 2
|
||||
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: titleField
|
||||
width: parent.width
|
||||
|
@ -59,8 +63,13 @@ Item{
|
|||
width: parent.width
|
||||
height: 30*mm
|
||||
wrapMode: TextEdit.Wrap
|
||||
textFormat: TextEdit.RichText
|
||||
}
|
||||
CheckBox{
|
||||
|
||||
Row{
|
||||
|
||||
spacing: 2
|
||||
CheckBox{
|
||||
id:dmCheckbox
|
||||
text:"DM"
|
||||
enabled: false
|
||||
|
@ -70,18 +79,59 @@ CheckBox{
|
|||
else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0}
|
||||
}
|
||||
}
|
||||
|
||||
Button{
|
||||
text:qsTr("Url")
|
||||
onClicked: {
|
||||
if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
|
||||
else{urlTextEdit.text="";
|
||||
urlRectangle.visible=true}}
|
||||
}
|
||||
Rectangle{
|
||||
id:urlRectangle
|
||||
height:parent.height
|
||||
width:37*mm
|
||||
visible:false
|
||||
TextField{
|
||||
id:urlTextEdit
|
||||
width:30*mm
|
||||
height:parent.height
|
||||
}
|
||||
Button{
|
||||
anchors.left:urlTextEdit.right
|
||||
anchors.leftMargin:mm
|
||||
text:qsTr("\u2713")
|
||||
onClicked: {
|
||||
var start = bodyField.selectionStart;
|
||||
var end = bodyField.selectionEnd;
|
||||
var text = bodyField.getText(start,end);
|
||||
text = "<a href='"+urlTextEdit.text+"'>" + text + "</a>";
|
||||
bodyField.remove(start,end);
|
||||
bodyField.insert(start,text);
|
||||
urlRectangle.visible=false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing:2
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: {newsStack.pop()}
|
||||
}
|
||||
|
||||
Button{
|
||||
text:qsTr("Permissions")
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("qrc:/qml/PermissionDialog.qml");
|
||||
var sprite = component.createObject(messageColumn);
|
||||
if (sprite == null) { // Error Handling
|
||||
console.log("Error creating object"); }
|
||||
}}
|
||||
Button {
|
||||
id: attachButton
|
||||
text: qsTr("Attach")
|
||||
onClicked: {imageAttachmentDialog.open()}
|
||||
onClicked: {
|
||||
try{imageAttachment.visible=false;
|
||||
imageAttachment.opacity=0;imageAttachment.destroy()}catch(e){}
|
||||
imageAttachmentDialog.open()}
|
||||
}
|
||||
Button{
|
||||
id:contactButton
|
||||
|
@ -90,43 +140,49 @@ CheckBox{
|
|||
onClicked:{
|
||||
var contactitems="";
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i]+"'; onTriggered: bodyField.append(' @"+contacts[i]+"')}"
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.append(' @"+contacts[i].screen_name+"')}"
|
||||
}
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
|
||||
// print(menuString);
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageSend,"contactmenuOutput")
|
||||
contactlistObject.popup() }
|
||||
}
|
||||
|
||||
Button {
|
||||
id: sendButton
|
||||
text: qsTr("Send")
|
||||
onClicked: {
|
||||
print("login: "+login.server+login.username);
|
||||
if (directmessage==0){
|
||||
statusUpdate(titleField.text,bodyField.text,messageSend.parentId,attachImageURL.toString());}
|
||||
else {dmUpdate( titleField.text,bodyField.text,"",messageSend.reply_to_user) }
|
||||
newsStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing:2
|
||||
Button {
|
||||
id: cancelButton
|
||||
text: qsTr("Cancel")
|
||||
onClicked: {newsStack.pop()}
|
||||
}
|
||||
Button {
|
||||
id: sendButton
|
||||
text: qsTr("Send")
|
||||
onClicked: {
|
||||
//print("login: "+login.server+login.username);
|
||||
var title=titleField.text.replace("\"","\'");
|
||||
var body=bodyField.getText(0,bodyField.length);
|
||||
if (directmessage==0){
|
||||
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
|
||||
else {dmUpdate( title,body,"",messageSend.reply_to_user) }
|
||||
newsStack.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: imageAttachmentDialog
|
||||
title: "Please choose a picture"
|
||||
folder: shortcuts.pictures
|
||||
selectFolder: false
|
||||
onAccepted: {
|
||||
attachImageURL=imageAttachmentDialog.fileUrl;
|
||||
var imageAttachementObject=Qt.createQmlObject('import QtQuick 2.0; Image {source:"'+attachImageURL.toString()+'"; width: 30*mm; height: 30*mm;fillMode: Image.PreserveAspectFit}',messageColumn,"attachedImage");
|
||||
console.log("You chose: " + attachImageURL)
|
||||
id: imageAttachmentDialog
|
||||
title: "Please choose a picture"
|
||||
folder: shortcuts.pictures
|
||||
selectFolder: false
|
||||
onAccepted: {
|
||||
attachImageURL=imageAttachmentDialog.fileUrl;
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment;source:"'+attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit}',messageColumn,"attachedImage");
|
||||
//console.log("You chose: " + attachImageURL)
|
||||
|
||||
}
|
||||
onRejected: {
|
||||
console.log("Canceled")
|
||||
//console.log("Canceled")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue