Version 0.004
This commit is contained in:
parent
10dccdcdbb
commit
438f8a4e4d
64 changed files with 2736 additions and 636 deletions
47
source-android/qml/calendarqml/CalendarDay.qml
Normal file
47
source-android/qml/calendarqml/CalendarDay.qml
Normal file
|
@ -0,0 +1,47 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
Item {
|
||||
id: calendarDay
|
||||
width:7*mm
|
||||
height: 7*mm
|
||||
property int dateInt:Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
|
||||
Rectangle {
|
||||
id: placeHolder
|
||||
color: 'lightblue'; antialiasing: true
|
||||
anchors.fill:parent
|
||||
}
|
||||
Text {
|
||||
id:daytext
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 0.5*mm
|
||||
color:(model.month==monthgrid.month)?"black":"grey"
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text: model.day
|
||||
font.bold: model.today
|
||||
font.pixelSize: 4*mm
|
||||
}
|
||||
Rectangle {
|
||||
id:eventRect
|
||||
color:"black"
|
||||
anchors.margins: 0.5*mm
|
||||
anchors.bottom: calendarDay.bottom
|
||||
width: parent.width-mm
|
||||
height: mm
|
||||
visible: eventdays.indexOf(dateInt)>-1
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: calendarDay
|
||||
onClicked: {
|
||||
var eventDate=[];
|
||||
var idx = eventdays.indexOf(dateInt);
|
||||
while (idx != -1) {
|
||||
eventDate.push(idx);
|
||||
idx = eventdays.indexOf(dateInt,idx + 1)
|
||||
}
|
||||
var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
|
||||
if (component.status== Component.Ready){
|
||||
var eventlist = component.createObject(calendartab,{"daylist": eventDate})}
|
||||
}
|
||||
}
|
||||
}
|
134
source-android/qml/calendarqml/CalendarTab.qml
Normal file
134
source-android/qml/calendarqml/CalendarTab.qml
Normal file
|
@ -0,0 +1,134 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.1
|
||||
import QtQml 2.2
|
||||
import Qt.labs.calendar 1.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/calendarqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:calendarrectangle
|
||||
y:1
|
||||
width:root.width-mm
|
||||
height:root.height-5*mm
|
||||
color: '#fff'
|
||||
property date currentTime: new Date()
|
||||
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
|
||||
property var events:[]
|
||||
property var eventdays:[]
|
||||
onEventdaysChanged: print(JSON.stringify(eventdays))
|
||||
|
||||
function showEvents(friend){
|
||||
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
eventdays=dayArray})
|
||||
}
|
||||
else if (friend!=""){
|
||||
calendartab.calendartabstatus=friend.substring(friend.lastIndexOf("/")+1,friend.length)
|
||||
Service.requestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
eventdays=dayArray})
|
||||
}
|
||||
else {calendartab.calendartabstatus="Events";
|
||||
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
eventdays=dayArray;
|
||||
calBusy.running=false
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: calBusy
|
||||
anchors.horizontalCenter: calendarView.horizontalCenter
|
||||
anchors.top:calendarView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: false
|
||||
}
|
||||
|
||||
|
||||
BlueButton{
|
||||
id: updateEvents
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right:calendartabstatusButton.left
|
||||
anchors.rightMargin:mm
|
||||
text:"\uf021"
|
||||
onClicked: {
|
||||
|
||||
Service.getEvents(db,login, calendartab,function(){
|
||||
showEvents("")
|
||||
})}}
|
||||
|
||||
BlueButton{
|
||||
id: calendartabstatusButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:2*mm
|
||||
text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus
|
||||
onClicked: {calendartabmenu.popup()}
|
||||
}
|
||||
Menu {
|
||||
id:calendartabmenu
|
||||
MenuItem {
|
||||
text: qsTr("Own Calendar")
|
||||
onTriggered: {
|
||||
calendartab.calendartabstatus="Events";
|
||||
// calendartabstatusButton.text=qsTr("own Calendar");
|
||||
showEvents("")}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id: calendarView
|
||||
x: mm;y:8*mm
|
||||
width: parent.width-2*mm; height: parent.height-9*mm
|
||||
clip: true
|
||||
snapMode: ListView.SnapOneItem
|
||||
orientation: ListView.Horizontal
|
||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||
model: CalendarModel {id:calendarModel
|
||||
from: new Date()
|
||||
to: new Date(new Date().valueOf()+93312000000)
|
||||
}
|
||||
delegate:
|
||||
ColumnLayout{
|
||||
width:calendarView.width
|
||||
Text{
|
||||
font.bold: true
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
text: model.year
|
||||
}
|
||||
Text{
|
||||
text: Qt.locale().standaloneMonthName(model.month)
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
}
|
||||
DayOfWeekRow{
|
||||
locale: monthgrid.locale
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MonthGrid {
|
||||
id: monthgrid
|
||||
Layout.fillWidth: true
|
||||
month: model.month
|
||||
year: model.year
|
||||
locale: Qt.locale()
|
||||
delegate: CalendarDay{}
|
||||
}
|
||||
}
|
||||
ScrollIndicator.horizontal: ScrollIndicator { }
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
root.eventSignal.connect(showEvents);
|
||||
if (calendartab.calendartabstatus=="Events"){showEvents("")}
|
||||
}
|
||||
}
|
85
source-android/qml/calendarqml/EventList.qml
Normal file
85
source-android/qml/calendarqml/EventList.qml
Normal file
|
@ -0,0 +1,85 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id:eventList
|
||||
z:2
|
||||
border.color: "grey"
|
||||
width: parent.width-4*mm
|
||||
height:parent.height-12*mm
|
||||
x:mm
|
||||
y:mm
|
||||
property var daylist:[]
|
||||
|
||||
BlueButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{eventList.destroy()}
|
||||
}
|
||||
ListView {
|
||||
id: eventlistView
|
||||
x: mm
|
||||
y:closeButton.height+2*mm
|
||||
width: eventList.width-2*mm
|
||||
height: eventList.height-closeButton.height-4*mm
|
||||
clip: true
|
||||
model: eventModel
|
||||
delegate: eventItem
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: eventModel
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
//print(JSON.stringify(daylist))
|
||||
for (var i=0; i<daylist.length;i++){//print(JSON.stringify(events[daylist[i]]));
|
||||
var liststate="";if(daylist.length<2){liststate="large"}
|
||||
eventModel.append({"event":events[daylist[i]],"eventstatus":liststate});
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:eventItem
|
||||
Rectangle{
|
||||
property string status: eventstatus
|
||||
width:eventlistView.width
|
||||
height:eventNameText.height+eventDetailsText.height+mm
|
||||
border.color: "light grey"
|
||||
border.width: 1
|
||||
Text {
|
||||
id:eventNameText
|
||||
x:mm
|
||||
width:parent.width
|
||||
height:contentHeight
|
||||
text: new Date(event.start+calendarrectangle.offsetTime).toLocaleTimeString()+": "+event.title
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
|
||||
Text {
|
||||
id:eventDetailsText
|
||||
x:mm
|
||||
z:4
|
||||
width: parent.width
|
||||
height: contentHeight
|
||||
text: status==""?"":Qt.atob(event.html)
|
||||
anchors.top: eventNameText.bottom
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{if (status==""){status="large"} else {status=""}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Controls 1.2
|
||||
import "qrc:/js/service.js" as Service
|
||||
|
@ -15,13 +15,18 @@ StackView{
|
|||
height:root.height-12*mm
|
||||
contentHeight: configBackground.height
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
Rectangle{
|
||||
id:configBackground
|
||||
color: "white"
|
||||
width:parent.width
|
||||
height:Math.max(90*mm,root.height-12*mm)
|
||||
property var users:[]
|
||||
|
||||
function setServericon(server){
|
||||
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){
|
||||
var serverdata = JSON.parse(obj);
|
||||
servericon.source=serverdata.site.logo})} catch(e){print(e)}
|
||||
}
|
||||
BlueButton{
|
||||
id:userButton
|
||||
text:qsTr("User")
|
||||
|
@ -35,6 +40,7 @@ StackView{
|
|||
"'; onTriggered: {Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
configBackground.setServericon(obj.server);
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
|
@ -49,37 +55,51 @@ StackView{
|
|||
}
|
||||
|
||||
Text {
|
||||
text: "Server"
|
||||
text: qsTr("Server")
|
||||
x: 4*mm; y: 10*mm
|
||||
}
|
||||
Text {
|
||||
text: "User"
|
||||
text: qsTr("User")
|
||||
x: 4*mm; y: 20*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Password"
|
||||
text: qsTr("Password")
|
||||
x: 4*mm; y: 30*mm
|
||||
}
|
||||
Text {
|
||||
text: "Image dir."
|
||||
text: qsTr("Image dir.")
|
||||
x: 4*mm; y: 40*mm
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Max. News"
|
||||
text: qsTr("Max. News")
|
||||
x: 4*mm; y: 50*mm
|
||||
}
|
||||
Text {
|
||||
text: "News as"
|
||||
text: qsTr("News as")
|
||||
x: 4*mm; y: 60*mm
|
||||
}
|
||||
Text {
|
||||
text: "Interval (0=None)"
|
||||
text: qsTr("Interval (0=None)")
|
||||
visible: false
|
||||
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
Image{
|
||||
id:servericon
|
||||
x:19*mm;y:10*mm
|
||||
width:5*mm; height: 5*mm
|
||||
source:""
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
Service.showServerConfig(servername.text, configBackground, function(configString){
|
||||
var serverconfigObject=Qt.createQmlObject(configString,configBackground,"serverconfigOutput");})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;}
|
||||
Flickable {
|
||||
id: servernameFlickable
|
||||
|
@ -93,9 +113,13 @@ StackView{
|
|||
height: servernameFlickable.height
|
||||
focus: true
|
||||
text:"https://..."
|
||||
//wrapMode: TextEdit.NoWrap
|
||||
//validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/}
|
||||
// onEditingFinished:{}
|
||||
onEditingFinished:{
|
||||
if((servername.text).substring(0,14) =="https://...http"){
|
||||
serverstring.text= (serverstring.text).substring(11)
|
||||
}
|
||||
|
||||
configBackground.setServericon(servername.text)
|
||||
}
|
||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable)
|
||||
}
|
||||
}
|
||||
|
@ -134,9 +158,11 @@ StackView{
|
|||
}
|
||||
}
|
||||
Slider{ id: maxNews
|
||||
x:37*mm; y: 50*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:100000; stepSize: 1000
|
||||
x:34*mm; y: 50*mm;width: root.width/3;height:5*mm
|
||||
minimumValue: 0;maximumValue:2000; stepSize: 100
|
||||
}
|
||||
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm;
|
||||
TextEdit{id:maxNewsText;
|
||||
anchors.fill: parent
|
||||
|
@ -199,13 +225,12 @@ StackView{
|
|||
|
||||
|
||||
BlueButton {
|
||||
x: 25*mm; y: 80*mm
|
||||
text: "Confirm"
|
||||
x: 25*mm; y: 78*mm
|
||||
text: qsTr("Confirm")
|
||||
onClicked:{
|
||||
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text,interval: messageIntervalField.text, newsViewType:newsTypeField.text};
|
||||
var errormessage="";
|
||||
if (servername.text==""){errormessage=qsTr("No server given! ")}
|
||||
//if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")}
|
||||
else if (username.text==""){errormessage+=qsTr("No username given! ")}
|
||||
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
|
||||
else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
|
||||
|
@ -228,11 +253,6 @@ StackView{
|
|||
userButton.color="black"
|
||||
//reset values
|
||||
root.login=userconfig;
|
||||
// root.contactlist=[];
|
||||
// root.news=[];
|
||||
// root.newContacts=[];
|
||||
// root.currentContact= 0;
|
||||
// root.contactLoadType= "";
|
||||
newstab.newstabstatus=userconfig.newsViewType;
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
|
@ -252,6 +272,7 @@ StackView{
|
|||
filesystem.Directory=imagestore.text+"albums";
|
||||
filesystem.rmDir();
|
||||
servername.text="https://...";
|
||||
servericon.source="";
|
||||
username.text="";
|
||||
password.text="";
|
||||
imagestore.text="";
|
||||
|
@ -272,6 +293,7 @@ StackView{
|
|||
text: "+"
|
||||
onClicked:{
|
||||
servername.text="https://..."
|
||||
servericon.source="";
|
||||
username.text=""
|
||||
password.text=""
|
||||
imagestore.text=""
|
||||
|
@ -297,8 +319,8 @@ StackView{
|
|||
onTriggered: {newsTypeField.text="Timeline"}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Tree")
|
||||
onTriggered: {newsTypeField.text="Tree"}
|
||||
text: qsTr("Conversations")
|
||||
onTriggered: {newsTypeField.text="Conversations"}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,6 +333,7 @@ StackView{
|
|||
Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
configBackground.setServericon(obj.server);
|
||||
username.text= obj.username;
|
||||
password.text=Qt.atob(obj.password);
|
||||
imagestore.text=obj.imagestore;
|
||||
|
|
|
@ -47,38 +47,11 @@ Rectangle {
|
|||
anchors.topMargin: mm
|
||||
anchors.top: parent.top
|
||||
onClicked:{
|
||||
contactComponent.state="large";
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if (component.status== Component.Ready){
|
||||
var contactDetails = component.createObject(wrapper,{"contact": contact})}
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})}
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer{id:selectiontimer; //weird behaviour when state set to "large" onCompleted
|
||||
interval: 200; running: false; repeat: false
|
||||
onTriggered: {
|
||||
|
||||
contactComponent.state="large";
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if (component.status== Component.Ready){
|
||||
var contactDetails = component.createObject(wrapper,{"contact": contact})}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if(status=="large"){selectiontimer.start()}
|
||||
else{contactComponent.state=""}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "large"
|
||||
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; x:mm; width:friendsTabView.width-4*mm; text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"}
|
||||
ParentChange{target:contactComponent;parent:root; x:mm;y:2*mm}
|
||||
//PropertyChanges { target: contactComponent; z: 2; x:0;y:0}
|
||||
PropertyChanges { target: wrapper; width:friendsTabView.width;height:friendsTabView.height-15*mm}
|
||||
PropertyChanges { target: photoImage; width:15*mm;height:15*mm;x:mm;y:mm }
|
||||
PropertyChanges { target: contactComponent.GridView.view; interactive:false}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,6 +2,44 @@ import QtQuick 2.0
|
|||
import QtQuick.Controls 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: contactLargeComponent
|
||||
x:mm
|
||||
y:mm
|
||||
property var contact:{}
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
|
||||
width:friendsTabView.width;
|
||||
height:friendsTabView.height-15*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
Image {
|
||||
id: photoImage
|
||||
x:mm
|
||||
y:mm
|
||||
width: 15*mm
|
||||
height:15*mm
|
||||
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: namelabel
|
||||
x: mm
|
||||
width:friendsTabView.width-4*mm
|
||||
height: 3*mm
|
||||
text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"
|
||||
elide:Text.ElideRight
|
||||
anchors.topMargin: 0
|
||||
anchors.left: photoImage.left
|
||||
color: "#303030"
|
||||
font.pixelSize: 4*mm
|
||||
anchors.top: photoImage.bottom
|
||||
}
|
||||
Rectangle{
|
||||
id: detailsrectangle
|
||||
anchors.top: namelabel.bottom
|
||||
|
@ -69,10 +107,27 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
BlueButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
text:"\uf073"
|
||||
onClicked:{
|
||||
root.currentIndex=3;
|
||||
calendartab.active=true;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
root.eventSignal(contact.url);
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: closeButton
|
||||
text: "\uf057" //"close"
|
||||
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
|
||||
onClicked:{contactLargeComponent.destroy();
|
||||
//contactComponent.state="";
|
||||
friendsTabView.contactSignal}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
91
source-android/qml/contactqml/ContactDetailsComponentOld.qml
Normal file
91
source-android/qml/contactqml/ContactDetailsComponentOld.qml
Normal file
|
@ -0,0 +1,91 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle{
|
||||
id: detailsrectangle
|
||||
anchors.top: namelabel.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
|
||||
ScrollView{
|
||||
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
|
||||
frameVisible: true
|
||||
id:namelabelflickable
|
||||
width: root.width-10*mm
|
||||
height:friendsTabView.height-45*mm
|
||||
x: mm
|
||||
clip:true
|
||||
Text{
|
||||
id:namelabeltext
|
||||
width: namelabelflickable.width
|
||||
height: implicitHeight
|
||||
font.pixelSize: 3*mm
|
||||
textFormat:Text.RichText
|
||||
wrapMode: Text.Wrap
|
||||
text:"<b>"+qsTr("Description")+": </b> "+Qt.atob(contact.description)+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
||||
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
Row{
|
||||
anchors.top: namelabelflickable.bottom
|
||||
anchors.topMargin: 2*mm
|
||||
x: mm
|
||||
spacing:4
|
||||
|
||||
BlueButton{
|
||||
id:photobutton
|
||||
text: "\uf03e" // "Photos"
|
||||
visible:(contact.network=="dfrn")
|
||||
onClicked:{
|
||||
fotostab.phototabstatus="Contact";
|
||||
root.currentIndex=2;
|
||||
fotostab.active=true;
|
||||
root.fotoSignal(contact) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:messagebutton
|
||||
text: "\uf0e6" //"Messages"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.messageSignal(contact.id) ;
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:dmbutton
|
||||
visible: (contact.following=="true")
|
||||
text: "\uf040" //"DM"
|
||||
onClicked:{
|
||||
root.currentIndex=0;
|
||||
newstab.active=true;
|
||||
root.directmessageSignal(contact.screen_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BlueButton{
|
||||
id:eventbutton
|
||||
visible:(contact.network=="dfrn")
|
||||
text:"\uf073"
|
||||
onClicked:{
|
||||
root.currentIndex=3;
|
||||
calendartab.active=true;
|
||||
calendartab.calendartabstatus="Friend"
|
||||
root.eventSignal(contact.url);
|
||||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id: closeButton
|
||||
text: "\uf057" //"close"
|
||||
onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,12 +11,13 @@ Rectangle {
|
|||
color: "white"
|
||||
|
||||
function showContactdetails(contact){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if(contact.isFriend){
|
||||
friendsTabView.currentIndex=0;
|
||||
friendsTabView.contactsSignal(contact)
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
else{friendsTabView.currentIndex=1;
|
||||
friendsTabView.contactsSignal(contact)
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
}
|
||||
TabView{
|
||||
|
@ -30,7 +31,7 @@ Rectangle {
|
|||
signal contactsSignal(var contact)
|
||||
signal groupsSignal(var username)
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex==0){//print("currentindex 0");
|
||||
if (currentIndex==0){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==1){
|
||||
|
@ -60,18 +61,14 @@ Rectangle {
|
|||
title: qsTr("Friends")
|
||||
Rectangle{
|
||||
id: friendsGridTab
|
||||
function makebig(friendindex){print("friendindex"+friendindex);if (friendindex){friendsModel.set(friendindex,{"status":"large"})}}
|
||||
function showFriends(contact,callback){//print("contact"+JSON.stringify(contact));
|
||||
function showFriends(contact){
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
var friendindex;
|
||||
Helperjs.readData(db,"contacts",root.login.username,function(friendsobject){
|
||||
for (var i=0;i<friendsobject.length;i++){
|
||||
var status="";
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
|
||||
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
|
||||
}
|
||||
if(contact){if (contact.cid==friendsobject[i].cid){status="large"}}
|
||||
friendsModel.append({"contact":friendsobject[i],"status":status});
|
||||
friendsModel.append({"contact":friendsobject[i]});
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,12 +110,11 @@ Rectangle {
|
|||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
model: friendsModel
|
||||
delegate: ContactComponent { }
|
||||
Component.onCompleted: positionViewAtBeginning()
|
||||
}
|
||||
|
||||
ListModel{id:friendsModel}
|
||||
|
@ -132,7 +128,7 @@ Rectangle {
|
|||
}
|
||||
|
||||
Tab{
|
||||
title: qsTr("Other Contacts")
|
||||
title: qsTr("Contacts")
|
||||
|
||||
Rectangle{
|
||||
id: contactsGridTab
|
||||
|
@ -140,9 +136,7 @@ Rectangle {
|
|||
try {contactsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
var status="";
|
||||
if(contact){if (contact.id==contactsobject[j].id){status="large"}}
|
||||
contactsModel.append({"contact":contactsobject[j],"status":status});
|
||||
contactsModel.append({"contact":contactsobject[j]});
|
||||
}
|
||||
},"isFriend",0,"screen_name ASC");
|
||||
}
|
||||
|
@ -156,12 +150,11 @@ Rectangle {
|
|||
clip: true
|
||||
cellHeight: 16*mm
|
||||
cellWidth: 17*mm
|
||||
add: Transition {
|
||||
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
}
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
model: contactsModel
|
||||
delegate: ContactComponent { }
|
||||
Component.onCompleted: positionViewAtBeginning()
|
||||
}
|
||||
|
||||
ListModel{id: contactsModel}
|
||||
|
|
|
@ -24,6 +24,7 @@ TabView{
|
|||
signal newsSignal(var news)
|
||||
signal friendsSignal(var username)
|
||||
signal contactdetailsSignal(var contact)
|
||||
signal eventSignal(var contact)
|
||||
//currentIndex: (login=="")? 3:0
|
||||
|
||||
property var news:[]
|
||||
|
@ -32,13 +33,13 @@ TabView{
|
|||
property string contactLoadType: ""
|
||||
|
||||
onLoginChanged:{
|
||||
if(login==""){root.currentIndex=3}
|
||||
if(login==""){root.currentIndex=4}
|
||||
else{
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
Newsjs.getCurrentContacts(login,db,function(contacts){
|
||||
contactlist=contacts})}
|
||||
}
|
||||
onNewContactsChanged:{
|
||||
onNewContactsChanged:{//print(JSON.stringify(newContacts));
|
||||
if(newContacts.length>0){// download first contact image and update db
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
|
@ -49,6 +50,7 @@ TabView{
|
|||
}
|
||||
|
||||
onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db
|
||||
|
||||
if(currentContact<newContacts.length){
|
||||
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
|
||||
else if (contactLoadType!=""){
|
||||
|
@ -96,10 +98,12 @@ TabView{
|
|||
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
else{
|
||||
Newsjs.chatsfromdb(db,login.username,function(dbnews){
|
||||
newsSignal(dbnews)
|
||||
})}
|
||||
}
|
||||
else if (newstab.conversation.length>0){newstab.conversation=[]}
|
||||
else{Service.cleanNews(root.db,function(){Qt.quit()})}
|
||||
}
|
||||
else if (currentIndex==2){fotoSignal("backButton")}
|
||||
|
@ -113,8 +117,8 @@ TabView{
|
|||
tab: Rectangle {
|
||||
color: styleData.selected?"sky blue":"light blue"
|
||||
border.color: "light grey"
|
||||
implicitWidth: root.width/4-2*mm
|
||||
implicitHeight: 4*mm
|
||||
implicitWidth: root.width/5-2*mm
|
||||
implicitHeight: 5*mm
|
||||
Text { id: text
|
||||
anchors.centerIn: parent
|
||||
text: styleData.title
|
||||
|
@ -145,9 +149,17 @@ TabView{
|
|||
property string phototabstatus:"Images"
|
||||
source: (root.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
|
||||
}
|
||||
Tab{
|
||||
title: "\uf073"
|
||||
id: calendartab
|
||||
property string calendartabstatus:"Events"
|
||||
source: (root.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
|
||||
}
|
||||
|
||||
|
||||
Tab{
|
||||
title:"\uf085"
|
||||
id: configtab
|
||||
source: (root.currentIndex==3)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,106 @@
|
|||
// ConversationStack with buttons
|
||||
// ConversationView with button
|
||||
import QtQuick 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Rectangle {
|
||||
id:conversationStack
|
||||
id:conversationList
|
||||
property var news
|
||||
y:1
|
||||
color: "white"
|
||||
width:root.width-2*mm
|
||||
height:root.height-8*mm
|
||||
z:2
|
||||
color: "white"
|
||||
border.color: "grey"
|
||||
width:root.width-5*mm
|
||||
height: conversationView.height+10*mm
|
||||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
if(newstab.conversation.length==0){
|
||||
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||
conversationList.destroy(); conversationsymbol.color="grey"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: conversationView
|
||||
x:3*mm
|
||||
y:8*mm
|
||||
width: conversationStack.width-4*mm
|
||||
height: conversationStack.height-10*mm
|
||||
width: conversationList.width-4*mm
|
||||
height: contentHeight
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: footerReply
|
||||
model: conversationModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
||||
ListModel{id: conversationModel}
|
||||
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)
|
||||
|
||||
WorkerScript {
|
||||
id: conversationWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
TextInput {
|
||||
id: replyText
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode: Text.Wrap
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
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){
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setParam("status", body);
|
||||
xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)}
|
||||
else {xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
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.status_id)
|
||||
}
|
||||
xhr.post();
|
||||
//replyText.text=""
|
||||
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ListModel{id: conversationModel}
|
||||
|
||||
WorkerScript {
|
||||
id: conversationWorker
|
||||
source: "qrc:/js/newsworker.js"
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: closeButton
|
||||
|
@ -37,10 +109,11 @@ Rectangle {
|
|||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"// qsTr("Close")
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop()
|
||||
newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||
conversationList.destroy();
|
||||
conversationsymbol.color="grey"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,11 @@ Rectangle{
|
|||
clip: true
|
||||
model: imageModel
|
||||
delegate: imageItem
|
||||
|
||||
}
|
||||
|
||||
FolderListModel{
|
||||
id: imageModel
|
||||
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG"]
|
||||
nameFilters: ["*.png", "*.jpg",".jpeg","*.JPG","*.gif"]
|
||||
sortField: FolderListModel.Time
|
||||
sortReversed:false
|
||||
showDotAndDotDot: true
|
||||
|
@ -111,8 +110,9 @@ Rectangle{
|
|||
directory=fileURL
|
||||
}
|
||||
else{
|
||||
attachImageURL=fileURL;
|
||||
imageDialog.destroy()
|
||||
attachImageURLs.push(fileURL);
|
||||
attachImage(fileURL);
|
||||
imageDialog.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ Flickable{
|
|||
id:messageSend
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property string attachImageURL: "";
|
||||
property var attachImageURLs: [];
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
|
@ -25,11 +25,13 @@ Flickable{
|
|||
property var group_allow:login.permissions[2]
|
||||
property var group_deny:login.permissions[3]
|
||||
|
||||
onAttachImageURLChanged: {if(attachImageURL!=""){
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment; source:"'+
|
||||
attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURL="";imageAttachment.destroy()}}}',messageColumn,"attachedImage");
|
||||
console.log("You chose: " + attachImageURL)
|
||||
}}
|
||||
function attachImage(url){
|
||||
//onAttachImageURLsChanged: {if(attachImageURL!=""){
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'",1)); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
console.log("You chose: " + url)
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
|
@ -42,7 +44,7 @@ Flickable{
|
|||
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
|
||||
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
|
||||
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
|
||||
if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )};
|
||||
if (attachImageURL.length>0) {for (var image in attachImageURL){xhr.setImageFileParam("media", attachImageURL[image] )}};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
|
@ -122,12 +124,11 @@ Flickable{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
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"//qsTr("Permissions")
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml");
|
||||
var permissions = component.createObject(messageColumn);
|
||||
|
@ -137,14 +138,14 @@ Flickable{
|
|||
text: "\uf0c6"
|
||||
visible:(directmessage==0)
|
||||
onClicked: {
|
||||
if (attachImageURL!=""){
|
||||
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment. Remove other attachment first!"), messageColumn)}
|
||||
else{print(filesystem.homePath);
|
||||
var defaultDirectory="file://"+osSettings.attachImageDir;//"file:///storage/emif.open()
|
||||
print(defaultDirectory);
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
|
||||
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
|
||||
}
|
||||
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{
|
||||
var defaultDirectory="file://"+osSettings.attachImageDir;
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/ImageDialog.qml");
|
||||
var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
|
||||
}
|
||||
}
|
||||
}
|
||||
BlueButton{
|
||||
|
@ -188,7 +189,7 @@ Flickable{
|
|||
var title=titleField.text.replace("\"","\'");
|
||||
var body=bodyField.getText(0,bodyField.length);
|
||||
if (directmessage==0){
|
||||
statusUpdate(title,body,messageSend.parentId,attachImageURL.toString())}
|
||||
statusUpdate(title,body,messageSend.parentId,attachImageURLs)}
|
||||
else {dmUpdate(title,body,"",messageSend.reply_to_user) }
|
||||
newstab.newstabstatus=login.newsViewType; newsStack.pop()
|
||||
}
|
||||
|
|
|
@ -13,23 +13,13 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
newsBusy.running=false;
|
||||
newstab.newstabstatus="Conversation";
|
||||
//newsStack.push({item:"qrc:/qml/newsqml/Conversation.qml",properties:{"news": conversation}})
|
||||
showNews(conversation);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
//print(root.newContacts[root.currentContact].name)
|
||||
}
|
||||
}else{downloadNotice.text=""}
|
||||
}
|
||||
|
@ -62,23 +52,19 @@ Item {
|
|||
newsWorker.sendMessage(msg);
|
||||
}
|
||||
|
||||
function showConversation(timelineIndex,newsitemobject){
|
||||
|
||||
function showConversation(conversationIndex,newsitemobject){
|
||||
newsBusy.running=true;
|
||||
root.contactLoadType="conversation";
|
||||
newsStack.timelineIndex= timelineIndex;
|
||||
if(newsitemobject.messagetype==0){
|
||||
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
|
||||
newsStack.conversationIndex= conversationIndex;
|
||||
if(newsitemobject.messagetype==0){
|
||||
Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;root.currentContact=0;
|
||||
})}
|
||||
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
|
||||
root.news=newsarray;root.newContacts=[];root.currentContact=1;
|
||||
})}
|
||||
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
|
||||
root.news=newsarray;root.newContacts=[];root.currentContact=1;
|
||||
})}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function onFriendsMessages(friend){
|
||||
newstab.newstabstatus="Contact"
|
||||
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
|
||||
|
@ -92,14 +78,11 @@ Item {
|
|||
StackView{
|
||||
id: newsStack
|
||||
anchors.fill:parent
|
||||
property int timelineIndex: 0
|
||||
onTimelineIndexChanged:print("timelineindex:"+ timelineIndex)
|
||||
property int conversationIndex: 0
|
||||
|
||||
initialItem:Rectangle {
|
||||
initialItem:Rectangle {
|
||||
y:1
|
||||
color: "white"
|
||||
width:root.width-2*mm
|
||||
height:root.height-8*mm
|
||||
|
||||
BlueButton{
|
||||
id:newstabstatusButton
|
||||
|
@ -116,26 +99,27 @@ Item {
|
|||
anchors.right: parent.right
|
||||
|
||||
BlueButton {
|
||||
id: newMessageButton
|
||||
width:10*mm
|
||||
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({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
|
||||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: quitButton
|
||||
width:10*mm
|
||||
text: "\uf08b"
|
||||
onClicked: {Service.cleanNews(root.db,function(){Qt.quit() })}
|
||||
}
|
||||
BlueButton {
|
||||
id: newMessageButton
|
||||
width:10*mm
|
||||
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({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}})
|
||||
},"isFriend",1);
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: quitButton
|
||||
width:10*mm
|
||||
text: "\uf08b"
|
||||
onClicked: {Service.cleanNews(root.db,function(){Qt.quit() })}
|
||||
}
|
||||
BlueButton {
|
||||
id: update
|
||||
text: "\uf021"
|
||||
onClicked: {
|
||||
|
@ -176,7 +160,7 @@ Item {
|
|||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Tree"){
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
|
@ -191,83 +175,35 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component { id:footerReply
|
||||
Rectangle{
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
color:"lightgrey"
|
||||
width:newsView.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
|
||||
//width: parent.width
|
||||
anchors.fill: parent
|
||||
selectByMouse: true
|
||||
}
|
||||
}
|
||||
|
||||
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 (newsModel.get(0).newsitemobject.messagetype==0){
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
xhr.url= login.server + "/api/statuses/update.json";
|
||||
xhr.setParam("status", body);
|
||||
xhr.setParam("in_reply_to_status_id", newsModel.get(newsModel.count-1).newsitemobject.status_id)}
|
||||
else {xhr.url= login.server + "/api/direct_messages/new.json";
|
||||
xhr.setParam("text", body);
|
||||
xhr.setParam("screen_name",newsModel.get(newsModel.count-1).newsitemobject.screen_name);
|
||||
xhr.setParam("replyto", newsModel.get(newsModel.count-1).newsitemobject.status_id)
|
||||
}
|
||||
xhr.post();
|
||||
//replyText.text=""
|
||||
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: newsView
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 8*root.mm
|
||||
anchors.topMargin: 7*root.mm
|
||||
anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm
|
||||
anchors.bottomMargin: 1*root.mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: (newstab.newstabstatus=="Conversation")?footerReply:footerComponent
|
||||
footer: footerComponent
|
||||
model: newsModel
|
||||
delegate: Newsitem{}
|
||||
Component.onCompleted: {//print(newstab.newstabstatus);
|
||||
if(newstab.newstabstatus!="Conversation"){
|
||||
positionViewAtIndex(newsStack.timelineIndex-1, ListView.Beginning)}
|
||||
else {positionViewAtBeginning();
|
||||
newsStack.timelineIndex=0
|
||||
}}
|
||||
}
|
||||
//onContentYChanged:{if(contentY<-15*mm&&contentY>(-15*mm-1)){print("refreshing");
|
||||
onDragEnded:{if(contentY<-8*mm){//print("refreshing");
|
||||
newsBusy.running=true;
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
root.contactLoadType="news";
|
||||
var onlynew=true;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
|
||||
root.news=ns;root.newContacts=nc;root.currentContact=0;
|
||||
if (ns.length==0){// update last 20 existing news for changes and likes
|
||||
onlynew=false;
|
||||
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
|
||||
root.contactLoadType="news";
|
||||
root.news=rns;root.newContacts=rnc;root.currentContact=0})
|
||||
}
|
||||
})
|
||||
}}
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
|
@ -331,10 +267,10 @@ Item {
|
|||
}
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Tree")
|
||||
text: qsTr("Conversations")
|
||||
onTriggered:{
|
||||
newsModel.clear();
|
||||
newstab.newstabstatus="Tree";
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,23 @@ import "qrc:/js/helper.js" as Helperjs
|
|||
|
||||
Item {
|
||||
id: newsitem
|
||||
width: newsView.width
|
||||
height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||
|
||||
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)
|
||||
|
||||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
newsBusy.running=false;
|
||||
if(index==newsStack.conversationIndex){
|
||||
if(newstab.conversation.length>0){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
|
||||
var conversation = component.createObject(friendicaActivities,{"news":newstab.conversation});
|
||||
}
|
||||
else{conversationsymbol.color="grey"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property string attending: ""
|
||||
onAttendingChanged: {attendLabel.visible=true;
|
||||
attendLabel.text= qsTr("attending: ")+ qsTr(attending)}
|
||||
|
@ -19,9 +33,7 @@ Item {
|
|||
function showActivityContacts(contacts){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml");
|
||||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||
|
||||
}
|
||||
|
||||
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
|
||||
|
||||
Rectangle{
|
||||
|
@ -29,7 +41,8 @@ Item {
|
|||
height:newsitem.height-1
|
||||
color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||
|
||||
Column {
|
||||
Row{id:toprow
|
||||
Column {
|
||||
id: authorcolumn
|
||||
width: 8*mm
|
||||
|
||||
|
@ -41,7 +54,7 @@ Item {
|
|||
height: 7*mm
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{print(root.currentIndex);
|
||||
onClicked:{
|
||||
try{root.currentIndex=1;
|
||||
friendstab.active=true;
|
||||
root.contactdetailsSignal(newsitemobject.user)} catch (e){Helperjs.showMessage("Error",e,root)}
|
||||
|
@ -61,7 +74,7 @@ Item {
|
|||
Column {
|
||||
id:newscolumn
|
||||
width: newsitem.width-8*mm
|
||||
anchors.left: authorcolumn.right
|
||||
//anchors.left: authorcolumn.right
|
||||
|
||||
Flow{
|
||||
id:topFlow
|
||||
|
@ -92,7 +105,7 @@ Item {
|
|||
|
||||
Label {
|
||||
id:newscountLabel
|
||||
visible:((newstabstatus=="Tree")&&(newsitemobject.newscount>1))?true:false
|
||||
visible:((newstabstatus=="Conversations")&&(newsitemobject.newscount>1))?true:false
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
|
@ -117,12 +130,25 @@ Item {
|
|||
wrapMode: Text.Wrap
|
||||
onLinkActivated:{
|
||||
Qt.openUrlExternally(link)}
|
||||
Component.onCompleted:{
|
||||
if (newsitemobject.attachmentList.length>0){
|
||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
|
||||
'AnimatedImage {id:gif;source: "'+newsitemobject.attachmentList[attachments].url+
|
||||
'";onStatusChanged: playing = (status == AnimatedImage.Ready)}',
|
||||
friendicaActivities,"Attachment"+attachments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flow{
|
||||
}
|
||||
}
|
||||
Flow{
|
||||
id:friendicaActivities
|
||||
anchors.top:toprow.bottom
|
||||
width:parent.width
|
||||
spacing:mm
|
||||
|
||||
Label{color: "grey"
|
||||
font.pixelSize: 1.5*mm
|
||||
text: friendica_activities.likeText
|
||||
|
@ -162,11 +188,22 @@ Item {
|
|||
onClicked: { showActivityContacts(newsitemobject.attendmaybe)}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
id:attendLabel
|
||||
//visible: false
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
|
||||
}
|
||||
}
|
||||
Row{
|
||||
Row{id:controlrow
|
||||
anchors.top:friendicaActivities.bottom
|
||||
|
||||
CheckBox{
|
||||
id:likeCheckbox
|
||||
height:3*mm
|
||||
//height:3*mm
|
||||
width:8*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
checked:(friendica_activities.self.liked==1)?true:false
|
||||
|
@ -195,7 +232,7 @@ Item {
|
|||
}
|
||||
CheckBox{
|
||||
id: dislikeCheckbox
|
||||
height:3*mm
|
||||
//height:3*mm
|
||||
width:8*mm
|
||||
visible: (newsitemobject.messagetype==0)? true:false
|
||||
checked: (friendica_activities.self.disliked==1)?true:false
|
||||
|
@ -222,10 +259,30 @@ Item {
|
|||
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0}
|
||||
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}}
|
||||
}
|
||||
|
||||
// Rectangle{
|
||||
// width: 8*mm
|
||||
// height: 3*mm
|
||||
// color:"transparent"
|
||||
// Text{
|
||||
// id:trashsymbol
|
||||
// color: "grey"
|
||||
// anchors.centerIn: parent
|
||||
// font.pixelSize: 2*mm
|
||||
// font.bold: true
|
||||
// text: "\uf1f8"
|
||||
// }
|
||||
// MouseArea{
|
||||
// anchors.fill:parent
|
||||
// onClicked: {
|
||||
// Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){
|
||||
// newsModel.remove(index)})
|
||||
// }}
|
||||
// }
|
||||
CheckBox {
|
||||
id:favoritedCheckbox
|
||||
visible:(newsitemobject.messagetype==0)
|
||||
width: 7*mm
|
||||
width: 8*mm
|
||||
style: CheckBoxStyle {
|
||||
background: Rectangle {
|
||||
implicitWidth: 6*mm
|
||||
|
@ -251,7 +308,7 @@ Item {
|
|||
}
|
||||
}
|
||||
Rectangle{
|
||||
width: 7*mm
|
||||
width: 8*mm
|
||||
height: 3*mm
|
||||
color:"transparent"
|
||||
Text{
|
||||
|
@ -267,7 +324,7 @@ Item {
|
|||
onClicked: {newsmenu.popup()}}
|
||||
}
|
||||
Rectangle{
|
||||
width: 7*mm
|
||||
width: 8*mm
|
||||
height: 3*mm
|
||||
visible:newstab.newstabstatus!="Conversation"
|
||||
color:"transparent"
|
||||
|
@ -281,20 +338,15 @@ Item {
|
|||
}
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked: { conversationsymbol.color="black";showConversation(index,newsitemobject)}
|
||||
onClicked:{
|
||||
conversationsymbol.color="black";
|
||||
showConversation(index,newsitemobject)
|
||||
}
|
||||
}
|
||||
}
|
||||
Label{
|
||||
id:attendLabel
|
||||
//visible: false
|
||||
color: "grey"
|
||||
height:3.5*mm
|
||||
font.pixelSize: 1.5*mm
|
||||
horizontalAlignment: Label.AlignRight
|
||||
text: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):""
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id:newsmenu
|
||||
MenuItem {
|
||||
|
@ -350,6 +402,4 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
@ -32,7 +32,7 @@ Rectangle{
|
|||
Text{
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
text: "Contacts"
|
||||
text: qsTr("Friends")
|
||||
}
|
||||
ListView {
|
||||
id: contactView
|
||||
|
@ -93,7 +93,7 @@ Rectangle{
|
|||
Text{
|
||||
x:contactView.width+2*mm
|
||||
y:0.5*mm
|
||||
text: "Groups"
|
||||
text: qsTr("Groups")
|
||||
}
|
||||
ListView {
|
||||
id: groupView
|
||||
|
|
|
@ -105,7 +105,7 @@ Rectangle {
|
|||
anchors.topMargin: 0.5*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin:2*mm
|
||||
text: qsTr(phototabstatus)
|
||||
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
|
||||
onClicked: {phototabmenu.popup()}
|
||||
}
|
||||
Menu {
|
||||
|
@ -114,7 +114,7 @@ Rectangle {
|
|||
text: qsTr("Own Images")
|
||||
onTriggered: {
|
||||
fotostab.phototabstatus="Images";
|
||||
phototabstatusButton.text=qsTr("own images");
|
||||
// phototabstatusButton.text=qsTr("Own images");
|
||||
showFotos("")}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue