v.0.5
This commit is contained in:
parent
63dfb9b197
commit
d48847d183
135 changed files with 8879 additions and 3693 deletions
|
@ -31,7 +31,7 @@
|
|||
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls 2.4
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
@ -43,7 +43,7 @@ Rectangle {
|
|||
ListView {
|
||||
id: contactView
|
||||
x:mm
|
||||
y:8*mm
|
||||
y:9*mm
|
||||
width: contactList.width-4*mm
|
||||
height:contactList.height-10*mm
|
||||
clip: true
|
||||
|
@ -90,35 +90,48 @@ Rectangle {
|
|||
y: mm
|
||||
spacing:4
|
||||
|
||||
BlueButton{
|
||||
MButton{
|
||||
id:photobutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text: "\uf03e" // "Photos"
|
||||
//font.pixelSize: 3*mm
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{print(createdAtDate + " contact.created_at"+contact.created_at)
|
||||
onClicked:{
|
||||
rootstack.currentIndex=2;
|
||||
bar.currentIndex=2;
|
||||
fotostab.phototabstatus="Contact";
|
||||
currentIndex=2;
|
||||
fotostab.active=true;
|
||||
|
||||
//fotostab.active=true;
|
||||
fotoSignal(root.login,contact) ;
|
||||
newsStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
MButton{
|
||||
id:dmbutton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked:{
|
||||
currentIndex=0;
|
||||
directmessageSignal(contact.screen_name)
|
||||
rootstack.currentIndex=0;
|
||||
newsSwipeview.currentIndex=2;
|
||||
directmessageSignal(contact)
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
MButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
text:"\uf073"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked:{
|
||||
currentIndex=3;
|
||||
rootstack.currentIndex=3;
|
||||
bar.currentIndex=3;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
eventSignal(contact);
|
||||
newsStack.pop()
|
||||
|
@ -179,14 +192,16 @@ Rectangle {
|
|||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
MButton {
|
||||
id: closeButton
|
||||
width:10*mm
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
//font.pixelSize: 3*mm
|
||||
onClicked: {
|
||||
newsStack.pop()
|
||||
}
|
||||
|
|
|
@ -31,9 +31,10 @@
|
|||
|
||||
// ConversationView with button
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls 2.4
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/qml/newsqml"
|
||||
|
||||
Rectangle {
|
||||
id:conversationList
|
||||
|
@ -56,7 +57,7 @@ Rectangle {
|
|||
height:conversationList.height-10*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: footerReply
|
||||
footer: MessageSend{conversation:true}//footerReply
|
||||
model: conversationModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
@ -89,68 +90,70 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Component { id:footerReply
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
color:"lightgrey"
|
||||
width:conversationView.width
|
||||
height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius:0.5*mm
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin:mm
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
width:parent.width-12*mm
|
||||
height:Math.max( replyText.contentHeight,5*mm)
|
||||
// Component { id:footerReply
|
||||
// Rectangle{
|
||||
// border.color: "#EEEEEE"
|
||||
// border.width: 1
|
||||
// color:"lightgrey"
|
||||
// width:conversationView.width
|
||||
// height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
||||
// Rectangle{
|
||||
// color: "white"
|
||||
// radius:0.5*mm
|
||||
// anchors.left: parent.left
|
||||
// anchors.leftMargin:mm
|
||||
// anchors.top:parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// width:parent.width-12*mm
|
||||
// height:Math.max( replyText.contentHeight,5*mm)
|
||||
|
||||
TextInput {
|
||||
id: replyText
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode: Text.Wrap
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
onHeightChanged: conversationView.contentY+=4.5*mm
|
||||
}
|
||||
}
|
||||
// TextInput {
|
||||
// id: replyText
|
||||
// font.pixelSize: 3*mm
|
||||
// wrapMode: Text.Wrap
|
||||
// anchors.fill: parent
|
||||
// selectByMouse: true
|
||||
// onHeightChanged: conversationView.contentY+=4.5*mm
|
||||
// }
|
||||
// }
|
||||
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
text: "\uf1d9"
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:mm
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
color:"white"
|
||||
onClicked: { try{
|
||||
var body=replyText.getText(0,replyText.length);
|
||||
newsBusy.running=true;
|
||||
replyText.text=""
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
if (conversationModel.get(0).newsitemobject.messagetype==0){
|
||||
// Button {
|
||||
// id: sendButton
|
||||
// height: 8*mm
|
||||
// width:8*mm
|
||||
// text: "\uf1d9"
|
||||
// anchors.right: parent.right
|
||||
// anchors.rightMargin:mm
|
||||
// anchors.top:parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// //color:"white"
|
||||
// onClicked: { try{
|
||||
// var body=replyText.getText(0,replyText.length);
|
||||
// newsBusy.running=true;
|
||||
// replyText.text=""
|
||||
// xhr.clearParams();
|
||||
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
// if (conversationModel.get(0).newsitemobject.messagetype==0){
|
||||
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.setParam("status", body);
|
||||
xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)}
|
||||
else {//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/direct_messages/new");
|
||||
xhr.setParam("text", body);
|
||||
xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name);
|
||||
xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id)
|
||||
}
|
||||
xhr.post();
|
||||
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// //xhr.url= login.server + "/api/statuses/update.json";
|
||||
// xhr.setUrl(login.server);
|
||||
// xhr.setApi("/api/statuses/update");
|
||||
// xhr.setParam("source", "Friendiqa");
|
||||
// xhr.setParam("status", body);
|
||||
// xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)}
|
||||
// else {//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
// xhr.setUrl(login.server);
|
||||
// xhr.setApi("/api/direct_messages/new");
|
||||
// xhr.setParam("text", body);
|
||||
// xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name);
|
||||
// xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id)
|
||||
// }
|
||||
// xhr.post();
|
||||
// } catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -161,9 +164,10 @@ Rectangle {
|
|||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
MButton {
|
||||
id: closeButton
|
||||
width:10*mm
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -31,24 +31,28 @@
|
|||
|
||||
// message.qml
|
||||
// message with buttons
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 2.4
|
||||
//import QtQuick.Dialogs 1.2
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
||||
Rectangle{
|
||||
color:"white"
|
||||
// width:root.width-5*mm
|
||||
// height:root.height-12*mm
|
||||
//anchors.fill: parent
|
||||
color:"#EEEEEE"
|
||||
width:parent.width
|
||||
height: (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
id:messageSend
|
||||
visible:(newsSwipeview.stacktype!="Notifications")?true:false
|
||||
property string parentId: ""
|
||||
//property var parentObject:({})
|
||||
property bool conversation: false
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
property var attachImageURLs: [];
|
||||
property int directmessage: 0;
|
||||
//property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property var contact_allow:login.permissions[0]
|
||||
|
@ -56,14 +60,48 @@ Rectangle{
|
|||
property var group_allow:login.permissions[2]
|
||||
property var group_deny:login.permissions[3]
|
||||
|
||||
function attachImage(url){ print("attachImage "+url)
|
||||
onReply_to_userChanged: {
|
||||
if (reply_to_user!=""){
|
||||
receiverLabel.visible=true
|
||||
}
|
||||
}
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
reply_to_user=friend.screen_name;
|
||||
receiverLabel.text=qsTr("to:")+ " "+ friend.screen_name;
|
||||
}
|
||||
|
||||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1 && attachImageURLs.length==0)){
|
||||
attachImage(urls);
|
||||
attachImageURLs.push(urls);
|
||||
messageSend.state="active";
|
||||
}
|
||||
}
|
||||
|
||||
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){
|
||||
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) {
|
||||
//xhr.url= login.server + "/api/statuses/update.json";
|
||||
newsBusy.running=true;
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/statuses/update");
|
||||
|
@ -81,6 +119,7 @@ Rectangle{
|
|||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
newsBusy.running=true;
|
||||
//xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
|
@ -93,103 +132,193 @@ Rectangle{
|
|||
xhr.post();
|
||||
}
|
||||
|
||||
Flickable{
|
||||
anchors.fill: parent
|
||||
contentHeight: messageColumn.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
id:messageSend
|
||||
function setParent(newsitemobject){
|
||||
//print("Newsobject "+newsitemobject.id+ " "+JSON.stringify(newsitemobject.user));
|
||||
if (newsitemobject!=""){
|
||||
messageSend.state="conversation"
|
||||
reply_to_user=newsitemobject.user.screen_name;
|
||||
receiverLabel.text=qsTr("to:")+ " "+ newsitemobject.user.screen_name;
|
||||
parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state=""
|
||||
reply_to_user="";
|
||||
receiverLabel.text=qsTr("to:");
|
||||
parentId="";
|
||||
bodyField.text="";
|
||||
attachImageURLs.pop();
|
||||
try{imageAttachment.destroy()}catch(e){}
|
||||
}
|
||||
}
|
||||
|
||||
function contactmenu(letter){
|
||||
Newsjs.listFriends(login,db,function(contacts){
|
||||
var contactitems="";
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
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+
|
||||
"'; onTriggered:{if (newsSwipeview.stacktype=='DirectMessages'){reply_to_user='"+
|
||||
contacts[i].screen_name+"'} else {bodyField.insert("+
|
||||
bodyField.cursorPosition+",' "+contacts[i].screen_name.substring(1)+" ');bodyField.cursorPosition=bodyField.cursorPosition+"+contacts[i].screen_name.length+"}}}"
|
||||
//}
|
||||
}
|
||||
var menuString="import QtQuick.Controls 2.4; Menu {width:40*mm; font.pixelSize: 3*mm; "+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput");
|
||||
if (contacts.length>0){contactlistObject.popup()}
|
||||
},letter);
|
||||
}
|
||||
// Flickable{
|
||||
// anchors.fill: parent
|
||||
// contentHeight: messageColumn.height
|
||||
// boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
Column {
|
||||
y:0.5*mm
|
||||
id:messageColumn
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
Label{
|
||||
id:receiverLabel
|
||||
x: 0.5*mm
|
||||
width: parent.width-mm
|
||||
font.pixelSize: 3*mm
|
||||
text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
|
||||
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{}
|
||||
}
|
||||
}
|
||||
TextField {
|
||||
id: titleField
|
||||
width: parent.width
|
||||
x: 0.5*mm
|
||||
width: parent.width-mm
|
||||
font.pixelSize: 3*mm
|
||||
placeholderText: qsTr("Title (optional)")
|
||||
visible: parentId === ""
|
||||
visible: false//(parentId === "") && (bodyField.length>1)
|
||||
onVisibleChanged: if ((visible==true)&&(conversation==true)){
|
||||
conversationView.contentY=conversationView.contentY+titleField.height
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius: 0.5*mm
|
||||
x:mm
|
||||
width: parent.width-2*mm
|
||||
height:Math.max(bodyField.contentHeight+2*mm,10*mm)
|
||||
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
|
||||
TextArea {
|
||||
id: bodyField
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.family: "Noto Sans"
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
placeholderText: conversation?"": qsTr("What's on your mind?")
|
||||
textFormat: TextEdit.RichText //TextEdit.PlainText
|
||||
onLineCountChanged: (conversation==true)?conversationView.contentY=conversationView.contentY+3*mm:newsView.contentY=newsView.contentY+3*mm
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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}
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
text:"\uf0c1"
|
||||
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
|
||||
}
|
||||
BlueButton{
|
||||
anchors.left:urlTextEdit.right
|
||||
anchors.leftMargin: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}
|
||||
onActiveFocusChanged:{
|
||||
if (activeFocus==true){
|
||||
if (conversation==true){
|
||||
setParent(conversationModel.get(0).newsitemobject);
|
||||
messageSend.state="conversation"
|
||||
} else{
|
||||
messageSend.state="active"
|
||||
}
|
||||
}
|
||||
}
|
||||
Row{
|
||||
spacing:2
|
||||
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: { permissionDialog.visible=true;}
|
||||
onTextChanged:{
|
||||
if (text!=""){
|
||||
//print(getText(bodyField.cursorPosition-2,bodyField.cursorPosition) +" preedit: "+ preeditText+cursorPosition);
|
||||
var regex1 = /@[a-z]/;var regex2 = /![a-z]/;
|
||||
//print(text.substring(cursorPosition-2,cursorPosition));
|
||||
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
|
||||
if (regex1.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText) || regex2.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText)){
|
||||
var letter=(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)).match(/[a-z]/);
|
||||
contactmenu(letter)
|
||||
}
|
||||
}}
|
||||
}
|
||||
BlueButton {
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
spacing: mm
|
||||
height: 12*mm
|
||||
MButton{id:permButton
|
||||
visible: (newsSwipeview.stacktype!=="DirectMessages")
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
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
|
||||
text: "\uf03e"
|
||||
visible:(directmessage==0)
|
||||
visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||
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)
|
||||
}
|
||||
else{
|
||||
// root.imagePicking=true;
|
||||
root.imagePicking=false;
|
||||
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
|
||||
'attachImage(imageUrl)}}',root,"imagePicker");
|
||||
|
@ -197,55 +326,102 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
id:contactButton
|
||||
text:"\uf234"
|
||||
visible:(directmessage==0)
|
||||
onClicked:{
|
||||
var contactitems="";
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
if(contacts[i].network=="dfrn"){
|
||||
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+"'; onTriggered: bodyField.insert("+bodyField.cursorPosition+",' @"+contacts[i].screen_name+" ')}"
|
||||
}}
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
|
||||
contactlistObject.popup() }
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
MButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
onClicked: {smileyDialog.visible=true}
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
MButton {
|
||||
id: cancelButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop(null)
|
||||
bodyField.text="";
|
||||
messageSend.state="";
|
||||
permissionDialog.visible=false;
|
||||
receiverLabel.visible=false;
|
||||
reply_to_user="";
|
||||
attachImage("");
|
||||
attachImageURLs.pop();
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
}
|
||||
MButton {
|
||||
id: sendButton
|
||||
height: 6*mm
|
||||
width: 7*mm
|
||||
text: "\uf1d9"
|
||||
onClicked: {
|
||||
var title=titleField.text.replace("\"","\'");
|
||||
var body=bodyField.getFormattedText(0,bodyField.length);
|
||||
var dmbody=bodyField.getText(0,bodyField.length);
|
||||
if (directmessage==0){
|
||||
if (newsSwipeview.stacktype!=="DirectMessages"){
|
||||
statusUpdate(title,body,parentId,attachImageURLs)}
|
||||
else {dmUpdate(title,dmbody,parentId,reply_to_user) }
|
||||
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
|
||||
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=login.newsViewType; newsStack.pop(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PermissionDialog{id:permissionDialog;x:mm;visible: false}
|
||||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
}
|
||||
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);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
|
||||
// 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
|
||||
// }
|
||||
} ]
|
||||
}
|
||||
//}
|
||||
|
|
579
source-android/qml/newsqml/NewsStack.qml
Normal file
579
source-android/qml/newsqml/NewsStack.qml
Normal file
|
@ -0,0 +1,579 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
StackView{
|
||||
id: newsStack
|
||||
anchors.fill: parent
|
||||
property string updateMethodNews: "refresh"
|
||||
property var allchats: ({})
|
||||
signal replySignal(var newsobject)
|
||||
property int lastnewsid:0
|
||||
|
||||
function newstypeHandling(newstype){
|
||||
newsBusy.running=true;
|
||||
replySignal("");
|
||||
//messagesend.state="";
|
||||
newsModel.clear();
|
||||
switch(newstype){
|
||||
case "timeline":
|
||||
newstab.newstabstatus="Timeline";
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
break;
|
||||
case "conversation":
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
break;
|
||||
case "favorites":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Favorites";
|
||||
Service.updateView("Favorites");
|
||||
break;
|
||||
case "replies":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Replies";
|
||||
Service.updateView("Replies");
|
||||
break;
|
||||
case "publictimeline":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline");
|
||||
break;
|
||||
case "groupnews":
|
||||
newsStack.updateMethodNews="refresh";
|
||||
Service.showGroups();
|
||||
break;
|
||||
case "search":
|
||||
newsView.anchors.topMargin=7*mm;
|
||||
newsBusy.running=false;
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
var searchItem = component.createObject(newsStack,{y:mm,width:root.width,height: 5*mm});
|
||||
break;
|
||||
case "refresh":
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Directmessage"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{
|
||||
if (newsStack.depth>1){newsStack.pop()}
|
||||
}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+JSON.stringify(newsToShow))
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
//newsStack.appendNews=false
|
||||
}
|
||||
|
||||
function showContact(contact){ //print(JSON.stringify(contact));
|
||||
//newstab.newstabstatus="Contact";
|
||||
newsStack.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact});
|
||||
}
|
||||
|
||||
function search(term){//print("Search "+term)
|
||||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
newsStack.updateMethodNews="refresh";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{
|
||||
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
}
|
||||
onSuccess:{
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
replySignal("")
|
||||
//Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialItem: Rectangle {
|
||||
id:newslistRectangle
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
// Button{
|
||||
// id:newstabstatusButton
|
||||
// anchors.top: parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// height: 8*mm
|
||||
// text: qsTr(newstab.newstabstatus)
|
||||
// visible: newsStack.parent.stacktype=="standard"
|
||||
// onClicked: {print(newsStack.parent.stacktype);
|
||||
// newstabmenu.popup(2*mm,6*mm)
|
||||
// }
|
||||
|
||||
// Menu{id:newstabmenu
|
||||
// width: 40*mm
|
||||
|
||||
// delegate:MenuItem{
|
||||
// contentItem: Text{
|
||||
// font.pixelSize: 3.5*mm
|
||||
// text:parent.text
|
||||
// }
|
||||
// background: Rectangle {
|
||||
// implicitWidth: 40*mm; implicitHeight: 5*mm
|
||||
// color: "#ffffff"
|
||||
// border.color: "grey"
|
||||
// }
|
||||
// }
|
||||
// Action {
|
||||
// text: qsTr("Timeline")
|
||||
// onTriggered: {
|
||||
|
||||
// }
|
||||
// Action {
|
||||
// text: qsTr("Conversations")
|
||||
// onTriggered:{
|
||||
// //newsModel.clear();
|
||||
// newstab.newstabstatus="Conversations";
|
||||
// Newsjs.chatsfromdb(db,root.login,function(news){showNews(news)})
|
||||
// }
|
||||
// }
|
||||
// Action {
|
||||
// text: qsTr("Favorites")
|
||||
// onTriggered:{
|
||||
// newsStack.updateMethodNews="refresh";
|
||||
// newstab.newstabstatus="Favorites";
|
||||
// Service.updateView("Favorites")
|
||||
// }
|
||||
// }
|
||||
// Action {
|
||||
// text: qsTr("Replies")
|
||||
// onTriggered:{
|
||||
// newsStack.updateMethodNews="refresh";
|
||||
// newstab.newstabstatus="Replies";
|
||||
// Service.updateView("Replies")
|
||||
// }
|
||||
// }
|
||||
// Action {
|
||||
// text: qsTr("Public timeline")
|
||||
// onTriggered:{
|
||||
// newsStack.updateMethodNews="refresh";
|
||||
// newstab.newstabstatus="Public Timeline";
|
||||
// Service.updateView("Public Timeline")
|
||||
// }
|
||||
// }
|
||||
|
||||
//// Action {
|
||||
//// text: qsTr("Direct Messages")
|
||||
//// onTriggered:{
|
||||
//// newsStack.updateMethodNews="refresh";
|
||||
//// newstab.newstabstatus="Direct Messages";
|
||||
//// Service.updateView("Direct Messages")
|
||||
//// }
|
||||
//// }
|
||||
//// Action {
|
||||
//// text: qsTr("Notifications")
|
||||
//// onTriggered:{
|
||||
//// newsStack.updateMethodNews="refresh";
|
||||
//// newstab.newstabstatus="Notifications";
|
||||
//// Service.updateView("Notifications")
|
||||
//// }
|
||||
//// }
|
||||
// Action {
|
||||
|
||||
// text: qsTr("Group news")
|
||||
// onTriggered:
|
||||
// {
|
||||
// newsStack.updateMethodNews="refresh";
|
||||
// Service.showGroups();
|
||||
// }
|
||||
// }
|
||||
// Action {
|
||||
|
||||
// text: qsTr("Settings")
|
||||
// onTriggered:
|
||||
// {
|
||||
// leftDrawer.open()
|
||||
// }
|
||||
// }
|
||||
|
||||
// Action {
|
||||
// text: qsTr("Quit")
|
||||
// onTriggered:{
|
||||
// Service.cleanNews(root.db,function(){
|
||||
// Service.cleanContacts(root.login,root.db,function(){
|
||||
// Qt.quit()})
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Row{
|
||||
// spacing: mm
|
||||
// anchors.top: parent.top
|
||||
// anchors.topMargin: 0.5*mm
|
||||
// anchors.right: parent.right
|
||||
|
||||
// Button {
|
||||
// id: searchButton
|
||||
// height: 8*mm
|
||||
// text: "\uf002"
|
||||
// visible: newsStack.parent.stacktype=="standard"
|
||||
// onClicked: {
|
||||
// newsView.anchors.topMargin=18*mm;
|
||||
// var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
// var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
|
||||
// }
|
||||
// }
|
||||
|
||||
// Button {
|
||||
// id: newMessageButton
|
||||
// text: "\uf040"
|
||||
// height: 8*mm
|
||||
// onClicked: {
|
||||
// var groups=[];
|
||||
// Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
|
||||
// groups=groupobject
|
||||
// });
|
||||
// newstab.newstabstatus="SendMessage";
|
||||
// Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
|
||||
// newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login})
|
||||
// },"isFriend",1);
|
||||
// }
|
||||
// }
|
||||
// BlueButton {
|
||||
// id: quitButton
|
||||
// text: "\uf08b"
|
||||
// onClicked: {Service.cleanNews(root.db,function(){
|
||||
// Service.cleanContacts(root.login,root.db,function(){
|
||||
// Qt.quit() })
|
||||
// })}
|
||||
// }
|
||||
// Button {
|
||||
// id: update
|
||||
// height: 8*mm
|
||||
// text: "\uf021"
|
||||
// onClicked: {
|
||||
// if (newstab.newstabstatus=="Timeline"){
|
||||
// newsStack.updateMethodNews="append"
|
||||
// } else {newsStack.updateMethodNews="refresh"}
|
||||
// //root.contactLoadType="news";
|
||||
// if (newsStack.parent.stacktype=="standard"){
|
||||
// Service.updateView(newstab.newstabstatus)
|
||||
// }
|
||||
// else if (newsStack.parent.stacktype=="directmessage"){
|
||||
// Service.updateView("Direct Messages")
|
||||
// }
|
||||
// else if (newsStack.parent.stacktype=="notifications"){
|
||||
// Service.updateView("Notifications")
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
Component { id:footerComponent
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:newsView.width
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{
|
||||
var currentTime= new Date();
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
// else if(newstab.newstabstatus=="Contact"){
|
||||
// Newsjs.newsfromdb(root.db,root.login, function(news){
|
||||
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
// newsWorker.sendMessage(msg);
|
||||
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
else{
|
||||
//newsStack.appendNews=true;
|
||||
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
|
||||
xhr.get()
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Label{
|
||||
// text:qsTr(stacktype)
|
||||
// font.pixelSize: 3* mm
|
||||
// anchors.horizontalCenter: parent.horizontalCenter
|
||||
// anchors.margins: mm
|
||||
// }
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
property real oldContentY:0
|
||||
property bool viewdragged: false
|
||||
anchors.fill: parent
|
||||
anchors.margins: mm
|
||||
//anchors.topMargin: 6*mm
|
||||
// anchors.leftMargin: mm; anchors.rightMargin: mm
|
||||
// anchors.bottomMargin: mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
header: MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()}
|
||||
footer: footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
onDragStarted: oldContentY=contentY
|
||||
onDragEnded: {
|
||||
if(verticalOvershoot<-5*mm){
|
||||
viewdragged=true
|
||||
}
|
||||
else{
|
||||
if((contentY-oldContentY)>15*mm){
|
||||
swipeIndicator.visible=false;
|
||||
newsSwipeview.height=rootStackItem.height;
|
||||
newsSwipeview.y=0;
|
||||
rootStackItem.state="fullscreen"
|
||||
}
|
||||
else if ((contentY-oldContentY)<-15*mm){
|
||||
swipeIndicator.visible=true;
|
||||
newsSwipeview.height=rootStackItem.height-12*mm;
|
||||
newsSwipeview.y=5*mm;
|
||||
rootStackItem.state=""
|
||||
}
|
||||
}
|
||||
}
|
||||
onViewdraggedChanged: {
|
||||
if (viewdragged){
|
||||
var onlynew=true;
|
||||
newsBusy.running=true;
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
}
|
||||
} else {
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="DirectMessages"){
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Notifications"){
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
viewdragged=false
|
||||
}}
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
WorkerScript {
|
||||
id: newsWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
}
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
property alias text: noticeText.text
|
||||
color:"white"
|
||||
border.color:"grey"
|
||||
z:1
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom:parent.bottom
|
||||
anchors.bottomMargin: 2*mm
|
||||
width: noticeText.width+2*mm
|
||||
height: noticeText.height+2*mm
|
||||
visible: (downloadNotice.text!="")
|
||||
|
||||
Text{
|
||||
id:noticeText
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.pixelSize: 2*mm
|
||||
text:""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
//print(newsSwipeview.stacktype);
|
||||
root.newstypeSignal.connect(newstypeHandling);
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.contactdetailsSignal.connect(showContact);
|
||||
root.newsSignal.connect(showNews);
|
||||
|
||||
try{newsModel.clear()} catch(e){}
|
||||
swipeIndicator.visible=true;
|
||||
newsSwipeview.height=rootStackItem.height-12*mm;
|
||||
newsSwipeview.y=5*mm;
|
||||
rootStackItem.state=""
|
||||
|
||||
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
// xhr.setUrl(login.server);
|
||||
// if((newsStack.parent.stacktype=="standard") && (root.news.length>0)){
|
||||
// showNews(root.news)
|
||||
// }
|
||||
//else{
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if((login.newsViewType=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else{Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,37 +29,16 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls 2.3 as QC2
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.4
|
||||
//import QtQuick.Controls.Styles 2.3
|
||||
import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
//import QtQuick.Dialogs 1.3
|
||||
import "qrc:/qml/newsqml"
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
||||
|
||||
import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
Connections{
|
||||
target:newstab
|
||||
onNewstabstatusChanged:{
|
||||
newstabstatusButton.text= qsTr(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{
|
||||
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
}
|
||||
onSuccess:{
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
Service.processNews(api,data);
|
||||
}
|
||||
}
|
||||
|
||||
// Connections{
|
||||
// target:xhr
|
||||
|
@ -80,43 +59,18 @@ Item {
|
|||
// }
|
||||
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {
|
||||
onTriggered: {//print("Contacttimer "+JSON.stringify(root.news));
|
||||
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
|
||||
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
|
||||
Newsjs.storeNews(login,db,root.news,root)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function showNews(newsToShow){
|
||||
try{
|
||||
if (newsStack.depth>1){newsStack.pop()}
|
||||
}catch(e){}
|
||||
newsBusy.running=false;
|
||||
var currentTime= new Date();
|
||||
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
|
||||
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
//newsStack.appendNews=false
|
||||
}
|
||||
|
||||
|
||||
|
||||
function showConversation(conversationIndex,newsitemobject){
|
||||
if(newsitemobject.messagetype==0){
|
||||
if(newsitemobject.messagetype==0 || newsitemobject.messagetype==3){
|
||||
xhr.clearParams();
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
|
@ -134,31 +88,12 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function showContact(contact){
|
||||
newstab.newstabstatus="Contact";
|
||||
newsStack.push({item:"qrc:/qml/newsqml/ContactPage.qml",properties:{"contact": contact}});
|
||||
}
|
||||
|
||||
function search(term){//print("Search "+term)
|
||||
if (term!=""){
|
||||
newstab.newstabstatus="Search";
|
||||
newsBusy.running=true;
|
||||
newsStack.updateMethodNews="refresh";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/search");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("q",term)
|
||||
xhr.get();}
|
||||
newsView.anchors.topMargin=7*mm
|
||||
}
|
||||
|
||||
|
||||
function onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
Newsjs.newsfromdb(db,root.login.username, function(dbnews){
|
||||
Newsjs.newsfromdb(db,root.login.username, 0,function(dbnews){
|
||||
if (dbnews.length==0){
|
||||
Newsjs.newsfromdb(db,login.username,function(forumnews){
|
||||
Newsjs.newsfromdb(db,login.username,0,function(forumnews){
|
||||
showNews(forumnews)
|
||||
},friend.url)
|
||||
}
|
||||
|
@ -166,303 +101,84 @@ Item {
|
|||
},friend.id)
|
||||
}
|
||||
|
||||
function onDirectMessage(friend){
|
||||
//newstab.newstabstatus="SendMessage" ,"login":login ,
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1, "login":root.login}});
|
||||
}
|
||||
|
||||
function sendUrls(urls){print(root.currentIndex==0);
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"attachImageURLs":urls}})
|
||||
Label{
|
||||
text:"\uf0c9 "
|
||||
font.pixelSize: 5* mm
|
||||
anchors.left: parent.left
|
||||
anchors.margins: mm
|
||||
color: "#B0BEC5"
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
leftDrawer.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
if(text&&(newsStack.depth<2)){
|
||||
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>"}
|
||||
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"bodyMessage":text.subject+"\n"+text.plaintext}})
|
||||
}
|
||||
Label{
|
||||
text:qsTr(newsSwipeview.stacktype)
|
||||
font.pixelSize: 3* mm
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.margins: 2*mm
|
||||
}
|
||||
SwipeView{
|
||||
id: newsSwipeview
|
||||
property string stacktype:"Home"
|
||||
currentIndex: 0
|
||||
width: parent.width
|
||||
height: parent.height-6*mm
|
||||
y: 5*mm
|
||||
function onDirectMessage(friend){currentIndex=2}
|
||||
|
||||
StackView{
|
||||
id: newsStack
|
||||
anchors.fill:parent
|
||||
property string updateMethodNews: "refresh"
|
||||
property var allchats: ({})
|
||||
initialItem:Rectangle {
|
||||
id:newslistRectangle
|
||||
y:1
|
||||
color: "white"
|
||||
|
||||
BlueButton{
|
||||
id:newstabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
text: qsTr(newstab.newstabstatus)
|
||||
onClicked: {newstabmenu.popup(2*mm,6*mm)}
|
||||
|
||||
QC2.Menu{id:newstabmenu
|
||||
width: 40*mm
|
||||
|
||||
delegate:QC2.MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3.5*mm
|
||||
text:parent.text
|
||||
}
|
||||
background: Rectangle {
|
||||
implicitWidth: 40*mm; implicitHeight: 5*mm
|
||||
color: "#ffffff"
|
||||
border.color: "grey"
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Timeline")
|
||||
onTriggered: {
|
||||
newstab.newstabstatus="Timeline";
|
||||
//newsModel.clear();
|
||||
try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)}}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
//newsModel.clear();
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Favorites")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Favorites";
|
||||
Service.updateView("Favorites")
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Replies")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Replies";
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Public timeline")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Public Timeline";
|
||||
Service.updateView("Public Timeline")
|
||||
}
|
||||
}
|
||||
|
||||
QC2.Action {
|
||||
text: qsTr("Direct Messages")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Direct Messages";
|
||||
Service.updateView("Direct Messages")
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Notifications")
|
||||
onTriggered:{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
newstab.newstabstatus="Notifications";
|
||||
Service.updateView("Notifications")
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
|
||||
text: qsTr("Group news")
|
||||
onTriggered:
|
||||
{
|
||||
newsStack.updateMethodNews="refresh";
|
||||
Service.showGroups();
|
||||
}
|
||||
}
|
||||
QC2.Action {
|
||||
text: qsTr("Quit")
|
||||
onTriggered:{
|
||||
Service.cleanNews(root.db,function(){
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
Qt.quit()})
|
||||
})
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
PropertyAnimation { properties: "height";
|
||||
easing.type: Easing.InOutQuad
|
||||
duration: 1000
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
spacing: mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
|
||||
BlueButton {
|
||||
id: searchButton
|
||||
text: "\uf002"
|
||||
onClicked: {
|
||||
newsView.anchors.topMargin=18*mm;
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
|
||||
var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm});
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: newMessageButton
|
||||
text: "\uf040"
|
||||
onClicked: {
|
||||
var groups=[];
|
||||
Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){
|
||||
groups=groupobject
|
||||
});
|
||||
newstab.newstabstatus="SendMessage";
|
||||
Helperjs.readData(root.db,"contacts",root.login.username,function(friends){
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login})
|
||||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
// BlueButton {
|
||||
// id: quitButton
|
||||
// text: "\uf08b"
|
||||
// onClicked: {Service.cleanNews(root.db,function(){
|
||||
// Service.cleanContacts(root.login,root.db,function(){
|
||||
// Qt.quit() })
|
||||
// })}
|
||||
// }
|
||||
BlueButton {
|
||||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
onCurrentIndexChanged: {
|
||||
switch(currentIndex){
|
||||
case 0: stacktype="Home";break;
|
||||
case 1: stacktype="Replies";break;
|
||||
case 2: stacktype="DirectMessages";break;
|
||||
case 3: stacktype="Notifications";break;
|
||||
default: stacktype="Home";
|
||||
}
|
||||
}
|
||||
|
||||
//anchors.fill: parent
|
||||
Loader{
|
||||
id: friendstimeline
|
||||
source:(newsSwipeview.currentIndex==0)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Home"
|
||||
}
|
||||
Component { id:footerComponent
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:newsView.width
|
||||
height:6*mm
|
||||
Text{
|
||||
font.pixelSize: 1.5*mm
|
||||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{
|
||||
var currentTime= new Date();
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
// else if(newstab.newstabstatus=="Contact"){
|
||||
// Newsjs.newsfromdb(root.db,root.login.username, function(news){
|
||||
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
// newsWorker.sendMessage(msg);
|
||||
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
else{
|
||||
//newsStack.appendNews=true;
|
||||
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
|
||||
xhr.get()
|
||||
}}
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id: replies
|
||||
//property string stacktype:"Replies"
|
||||
source:(newsSwipeview.currentIndex==1)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Replies"
|
||||
}
|
||||
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 7*root.mm
|
||||
anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm
|
||||
anchors.bottomMargin: 1*root.mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
//onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing");
|
||||
onDragEnded:{if(contentY<-5*mm){
|
||||
var onlynew=true;
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}}
|
||||
Loader{
|
||||
id: directmessages
|
||||
property var friend:({})
|
||||
source:(newsSwipeview.currentIndex==2)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="DirectMessages"
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
WorkerScript {
|
||||
id: newsWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: newsView.horizontalCenter
|
||||
anchors.top:newsView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
}
|
||||
Rectangle{
|
||||
id:downloadNotice
|
||||
property alias text: noticeText.text
|
||||
color:"white"
|
||||
border.color:"grey"
|
||||
z:1
|
||||
anchors.horizontalCenter: newsView.horizontalCenter
|
||||
anchors.bottom:newsView.bottom
|
||||
anchors.bottomMargin: 2*mm
|
||||
width: noticeText.width+2*mm
|
||||
height: noticeText.height+2*mm
|
||||
visible: (downloadNotice.text!="")
|
||||
|
||||
Text{
|
||||
id:noticeText
|
||||
color: "grey"
|
||||
anchors.centerIn: parent
|
||||
width: contentWidth
|
||||
height: contentHeight
|
||||
font.pixelSize: 2*mm
|
||||
text:""
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.messageSignal.connect(onFriendsMessages);
|
||||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.contactdetailsSignal.connect(showContact);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
// xhr.setUrl(login.server);
|
||||
if(root.news.length>0){showNews(root.news)}
|
||||
else{ newstab.newstabstatus=login.newsViewType;
|
||||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
showNews(dbnews);
|
||||
})}
|
||||
}
|
||||
Loader{
|
||||
id: notifications
|
||||
//property string stacktype:"Notifications"
|
||||
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
|
||||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage);}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
id: swipeIndicator
|
||||
count: newsSwipeview.count
|
||||
currentIndex: newsSwipeview.currentIndex
|
||||
|
||||
anchors.bottom: newsSwipeview.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick.Controls 2.4
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -62,7 +62,7 @@ Item {
|
|||
Rectangle{
|
||||
width:newsitem.width
|
||||
height:newsitem.height-1
|
||||
color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
|
||||
Row{id:toprow
|
||||
Column {
|
||||
|
@ -102,8 +102,7 @@ Item {
|
|||
Label {
|
||||
id:messageTypeLabel
|
||||
color: "grey"
|
||||
text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source
|
||||
} else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"}
|
||||
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
|
||||
font.pixelSize: 1.5*mm
|
||||
}
|
||||
Label {
|
||||
|
@ -117,6 +116,7 @@ Item {
|
|||
id:replytoLabel
|
||||
color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
font.family: "Noto Sans"
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||
}catch(e){" "}
|
||||
|
@ -160,6 +160,7 @@ Item {
|
|||
linkColor: "light green"
|
||||
id: itemMessage
|
||||
textFormat: Text.RichText
|
||||
font.family: "Noto Sans"
|
||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||
width: newsitem.width-8*mm-2
|
||||
height: implicitHeight
|
||||
|
@ -178,7 +179,6 @@ Item {
|
|||
}}
|
||||
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||
|
@ -191,8 +191,7 @@ Item {
|
|||
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
|
||||
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,9 +288,9 @@ Item {
|
|||
CheckBox{
|
||||
id:likeCheckbox
|
||||
width:10*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
|
||||
checked:(friendica_activities.self.liked==1)?true:false
|
||||
style: CheckBoxStyle {
|
||||
//style: CheckBoxStyle {
|
||||
indicator: Rectangle{
|
||||
implicitWidth: 10*mm
|
||||
implicitHeight:3*mm
|
||||
|
@ -299,11 +298,11 @@ Item {
|
|||
anchors.centerIn: parent
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family:fontAwesome.name
|
||||
color:control.checked?"black": "grey"
|
||||
text:control.checked?"\uf118"+"!":"\uf118"
|
||||
color:likeCheckbox.checked?"black": "grey"
|
||||
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
onClicked: {
|
||||
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 }
|
||||
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.friendica_activities.self.liked=1}}
|
||||
|
@ -311,9 +310,9 @@ Item {
|
|||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
width:10*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
|
||||
checked: (friendica_activities.self.disliked==1)?true:false
|
||||
style: CheckBoxStyle {
|
||||
//style: CheckBoxStyle {
|
||||
indicator: Rectangle{
|
||||
implicitWidth: 10*mm
|
||||
implicitHeight:3*mm
|
||||
|
@ -321,11 +320,11 @@ Item {
|
|||
anchors.centerIn: parent
|
||||
font.pixelSize: 2.5*mm
|
||||
font.family:fontAwesome.name
|
||||
color:control.checked?"black": "grey"
|
||||
text: control.checked?"\uf119"+"!":"\uf119"
|
||||
color:dislikeCheckbox.checked?"black": "grey"
|
||||
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
onClicked: {
|
||||
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
||||
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.friendica_activities.self.disliked=1}}
|
||||
|
@ -333,20 +332,20 @@ Item {
|
|||
|
||||
CheckBox {
|
||||
id:favoritedCheckbox
|
||||
visible:(newsitemobject.messagetype==0)
|
||||
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
|
||||
width: 10*mm
|
||||
style: CheckBoxStyle {
|
||||
//style: CheckBoxStyle {
|
||||
indicator:Rectangle{
|
||||
x:4*mm
|
||||
width: 3*mm
|
||||
implicitHeight:4*mm
|
||||
Text{
|
||||
color: control.checked?"black":"grey"
|
||||
color: favoritedCheckbox.checked?"black":"grey"
|
||||
font.pixelSize: 2.5*mm
|
||||
text:"\uf005"
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
checked:(newsitemobject.favorited>0)
|
||||
onClicked:{
|
||||
if(favoritedCheckbox.checkedState==Qt.Checked){
|
||||
|
@ -401,21 +400,29 @@ Item {
|
|||
|
||||
Menu {
|
||||
id:newsmenu
|
||||
MenuItem {
|
||||
width: 30*mm
|
||||
delegate: MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3*mm
|
||||
text: parent.text
|
||||
}
|
||||
}
|
||||
Action{
|
||||
text: qsTr("Reply")
|
||||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
|
||||
replySignal(newsitemobject)
|
||||
//newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("DM")
|
||||
onTriggered: {
|
||||
root.directmessageSignal(newsitemobject.user.screen_name);
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Repost")
|
||||
onTriggered: {
|
||||
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
|
||||
|
@ -423,7 +430,7 @@ Item {
|
|||
})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Conversation")
|
||||
onTriggered: {
|
||||
conversationsymbol.color="black";
|
||||
|
@ -435,24 +442,31 @@ Item {
|
|||
|
||||
Menu{
|
||||
title: qsTr("Attending")
|
||||
MenuItem{
|
||||
width: 20*mm
|
||||
delegate: MenuItem{
|
||||
contentItem: Text{
|
||||
font.pixelSize: 3*mm
|
||||
text: parent.text
|
||||
}
|
||||
}
|
||||
Action{
|
||||
text:qsTr("yes")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="yes";attending="yes"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("maybe")
|
||||
Action{text:qsTr("maybe")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="maybe";attending="maybe"})
|
||||
}
|
||||
}
|
||||
MenuItem{text:qsTr("no")
|
||||
Action{text:qsTr("no")
|
||||
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){
|
||||
model.friendica_activities.self.attending="no";attending="no"})}
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
Action {
|
||||
text: qsTr("Delete")
|
||||
onTriggered: {
|
||||
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.3
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -37,7 +38,7 @@ import "qrc:/qml/genericqml"
|
|||
Rectangle{
|
||||
id:permissionDialog
|
||||
x: mm
|
||||
width: messageColumn.width-5*mm
|
||||
width: messageColumn.width-3*mm
|
||||
height:root.height/3
|
||||
function updatePerms(){
|
||||
for (var i=0;i<groupModel.count;i++)
|
||||
|
@ -64,6 +65,7 @@ Rectangle{
|
|||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
text: qsTr("Friends")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
ListView {
|
||||
id: contactView
|
||||
|
@ -95,6 +97,7 @@ Rectangle{
|
|||
Text{
|
||||
color:"grey"
|
||||
text:contact.screen_name
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
|
@ -125,6 +128,7 @@ Rectangle{
|
|||
x:contactView.width+2*mm
|
||||
y:0.5*mm
|
||||
text: qsTr("Groups")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
ListView {
|
||||
id: groupView
|
||||
|
@ -156,6 +160,7 @@ Rectangle{
|
|||
Text{
|
||||
color:"grey"
|
||||
text:group.groupname
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
|
@ -178,8 +183,10 @@ Rectangle{
|
|||
else {groupstatus="neutral"} }
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
MButton{
|
||||
x:0.5*mm
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\uf0c7"
|
||||
|
@ -190,8 +197,10 @@ Rectangle{
|
|||
Service.savePermissions(db,perms)
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
MButton{
|
||||
x:contactView.width+2*mm
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin:1
|
||||
text:"\u2713"
|
||||
|
|
|
@ -29,9 +29,10 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.4
|
||||
import QtQuick.Layouts 1.11
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
@ -42,8 +43,10 @@ Rectangle{
|
|||
width: messageColumn.width-5*mm
|
||||
height:root.height/2
|
||||
|
||||
BlueButton{
|
||||
Button{
|
||||
id:closeButton
|
||||
height: 6*mm
|
||||
width: 8*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
|
@ -52,34 +55,57 @@ Rectangle{
|
|||
onClicked:{smileyDialog.visible=false}
|
||||
}
|
||||
|
||||
TabView{
|
||||
|
||||
TabBar {
|
||||
id: smileybar
|
||||
width: parent.width
|
||||
height: 9*mm
|
||||
position:TabBar.Header
|
||||
TabButton {
|
||||
text:qsTr("Unicode")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Standard")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Addon")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
|
||||
TabButton {
|
||||
text: qsTr("Adult")
|
||||
font.pixelSize: 2*mm
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StackLayout{
|
||||
id:smileyTabView
|
||||
tabPosition: Qt.BottomEdge
|
||||
currentIndex: smileybar.currentIndex
|
||||
anchors.top: closeButton.bottom
|
||||
anchors.topMargin: 1*mm
|
||||
width: smileyDialog.width-2*mm
|
||||
height: smileyDialog.height-7*mm
|
||||
currentIndex: 0
|
||||
style: TabViewStyle {
|
||||
frameOverlap: 1
|
||||
tab: Rectangle {
|
||||
color: "white"
|
||||
implicitWidth: smileyTabView.width/4-2*mm
|
||||
implicitHeight: 4*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
color: "dark grey"
|
||||
font.pixelSize:2.5*mm
|
||||
font.bold: styleData.selected
|
||||
}
|
||||
}
|
||||
frame: Rectangle { color: "light grey" }
|
||||
tabsAlignment:Qt.AlignHCenter
|
||||
}
|
||||
// style: TabViewStyle {
|
||||
// frameOverlap: 1
|
||||
// tab: Rectangle {
|
||||
// color: "white"
|
||||
// implicitWidth: smileyTabView.width/4-2*mm
|
||||
// implicitHeight: 4*mm
|
||||
// Text { id: text
|
||||
// anchors.centerIn: parent
|
||||
// text: styleData.title
|
||||
// color: "dark grey"
|
||||
// font.pixelSize:2.5*mm
|
||||
// font.bold: styleData.selected
|
||||
// }
|
||||
// }
|
||||
// frame: Rectangle { color: "light grey" }
|
||||
// tabsAlignment:Qt.AlignHCenter
|
||||
// }
|
||||
|
||||
Tab{
|
||||
title: qsTr("Unicode")
|
||||
Rectangle{
|
||||
id: htmlGridTab
|
||||
GridView {
|
||||
|
@ -101,9 +127,7 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Standard")
|
||||
|
||||
Rectangle{
|
||||
id: coreGridTab
|
||||
GridView {
|
||||
|
@ -127,9 +151,7 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Addon")
|
||||
|
||||
Rectangle{
|
||||
id: addonGridTab
|
||||
GridView {
|
||||
|
@ -151,9 +173,8 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Tab{
|
||||
title: qsTr("Adult")
|
||||
|
||||
|
||||
Rectangle{
|
||||
id: adultGridTab
|
||||
GridView {
|
||||
|
@ -175,7 +196,7 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -218,6 +239,4 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue