Friendiqa v0.2.1

This commit is contained in:
LubuWest 2018-04-11 21:50:43 +02:00
commit ee50729e0d
45 changed files with 580 additions and 146 deletions

View file

@ -209,7 +209,7 @@ Flickable{
id: cancelButton
text: "\uf057"
onClicked: {newstab.newstabstatus=login.newsViewType;
newsStack.pop()}
newsStack.pop(null)}
}
BlueButton {
id: sendButton
@ -220,10 +220,11 @@ Flickable{
if (directmessage==0){
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
newstab.newstabstatus=login.newsViewType; newsStack.pop()
newstab.newstabstatus=login.newsViewType; newsStack.pop(null)
}
}
}
}
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
}

View file

@ -36,6 +36,8 @@ 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
@ -44,18 +46,6 @@ Item {
}
}
// Connections{
// target:root
// onCurrentContactChanged:{
// if (root.newContacts.length>0){
// if(root.currentContact<root.newContacts.length){
// downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
// //print(root.newContacts[root.currentContact].name)
// }
// }else{downloadNotice.text=""}
// }
// }
Connections{
target:xhr
// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
@ -63,6 +53,8 @@ Item {
}
}
Timer {id:replytimer; interval: 1000; running: false; repeat: false
onTriggered: {
if(newstab.newstabstatus=="Conversation"){
@ -123,7 +115,11 @@ Item {
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
}
function sendUrls(urls){
if((urls.length==1)&&(newsStack.depth<2)){
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
}
}
StackView{
id: newsStack
@ -131,6 +127,7 @@ Item {
property int conversationIndex: 0
initialItem:Rectangle {
id:newslistRectangle
y:1
color: "white"
@ -340,12 +337,23 @@ Item {
root.messageSignal.connect(onFriendsMessages);
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
root.uploadSignal.connect(sendUrls);
try{newsModel.clear()} catch(e){}
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)})}
//print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth);
//newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:[imageUrl]}})
// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
// osSettings.imagePickQml+'{multiple : true; onReady: {'+
// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
// ' root.currentIndex=2;fotostab.active=true;'+
// 'root.uploadSignal(imageUrls)};}}',newstab,"imagePicker");
//SystemDispatcher.setInitialized();
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)})}
}
}
}}
}
}
}

View file

@ -34,15 +34,15 @@ import QtQuick.Controls 1.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"
Item {
id: newsitem
width: parent.width
height:toprow.height+friendicaActivities.height+controlrow.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
property int itemindex: index
property string attending: ""
property int itemindex: index
onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
@ -145,8 +145,9 @@ Item {
textFormat: Text.RichText
text:Qt.atob(newsitemobject.statusnet_html)
width: newsitem.width-8*mm-2
height: implicitHeight
height: Math.min(implicitHeight,3/4*root.height)
wrapMode: Text.Wrap
clip:true
onLinkActivated:{
Qt.openUrlExternally(link)}
Component.onCompleted:{
@ -159,6 +160,29 @@ Item {
}
}
}
BlueButton{
width: newsitem.width-8*mm-2
height:10*mm
anchors.bottom: itemMessage.bottom
visible: itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
gradient: Gradient {
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 0.5; color: "white" }
}
radius:0
onClicked: {
if (text=="\uf078"){
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
} else {
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
}
}