forked from lubuwest/Friendiqa
create and delete events
This commit is contained in:
parent
27cd83db3c
commit
400241ec6a
34 changed files with 1346 additions and 614 deletions
|
@ -35,9 +35,9 @@ import QtQuick.Controls.Material 2.12
|
|||
|
||||
Item {
|
||||
id: calendarDay
|
||||
width: root.fontFactor*osSettings.bigFontSize*2//5*mm
|
||||
height: root.fontFactor*osSettings.bigFontSize*2//5*mm
|
||||
property int dateInt: Math.floor(Date.parse(model.date)/86400000) //Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
|
||||
width: root.fontFactor*osSettings.bigFontSize*2
|
||||
height: root.fontFactor*osSettings.bigFontSize*2
|
||||
property int dateInt: Math.floor(model.date.valueOf()/86400000)
|
||||
Rectangle {
|
||||
id: placeHolder
|
||||
color: model.today?'lightblue':'transparent';
|
||||
|
@ -68,10 +68,8 @@ Item {
|
|||
}
|
||||
MouseArea {
|
||||
anchors.fill: calendarDay
|
||||
onClicked: {rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": dateInt,"events":events});
|
||||
// var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
|
||||
// if (component.status== Component.Ready){
|
||||
// var eventlist = component.createObject(calendartab,{"dayint": dateInt})}
|
||||
onClicked: {
|
||||
rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": dateInt,"events":events});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQml 2.2
|
||||
import Qt.labs.calendar 1.0
|
||||
|
@ -42,7 +42,7 @@ import "qrc:/qml/genericqml"
|
|||
|
||||
Rectangle {
|
||||
id:calendarrectangle
|
||||
// y:1
|
||||
// y:1
|
||||
width:parent.width
|
||||
height:parent.height
|
||||
color: Material.backgroundColor
|
||||
|
@ -53,21 +53,21 @@ Rectangle {
|
|||
|
||||
function showEvents(friend){
|
||||
if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
events=cleanEvents(eventArray);
|
||||
eventdays=dayArray})
|
||||
}
|
||||
else if (friend!=""){
|
||||
calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length)
|
||||
calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length)
|
||||
Service.newRequestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
eventdays=dayArray})
|
||||
events=cleanEvents(eventArray);
|
||||
eventdays=dayArray})
|
||||
}
|
||||
else {calendartab.calendartabstatus="Events";
|
||||
Service.eventsfromdb(db,login.username,function(eventArray,dayArray){
|
||||
events=eventArray;
|
||||
events=cleanEvents(eventArray);
|
||||
eventdays=dayArray;
|
||||
calBusy.running=false
|
||||
|
||||
var currentevents=events;
|
||||
var currentevents=events.filter(event=>(currentTime<=event.end));
|
||||
for (var i=0; i<Math.min(5,currentevents.length);i++){
|
||||
var liststate="";
|
||||
|
@ -77,15 +77,23 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
function cleanEvents(events){
|
||||
for (var item in events){
|
||||
events[item].start=events[item].start-offsetTime;
|
||||
if(events[item].end>0){events[item].end=events[item].end-offsetTime};
|
||||
}
|
||||
return events
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: calBusy
|
||||
anchors.horizontalCenter: calendarView.horizontalCenter
|
||||
anchors.top:calendarView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: false
|
||||
}
|
||||
id: calBusy
|
||||
anchors.horizontalCenter: calendarView.horizontalCenter
|
||||
anchors.top:calendarView.top
|
||||
anchors.topMargin: 2*mm
|
||||
width:10*mm
|
||||
height: 10*mm
|
||||
running: false
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
z:2
|
||||
|
@ -127,12 +135,56 @@ Rectangle {
|
|||
}}
|
||||
|
||||
Connections{
|
||||
target: updatenews
|
||||
target: updatenews
|
||||
|
||||
function onSuccess(api){
|
||||
calBusy.running=false;
|
||||
showEvents("")
|
||||
}
|
||||
function onSuccess(api){
|
||||
calBusy.running=false;
|
||||
showEvents("")
|
||||
}
|
||||
}
|
||||
|
||||
Dialog {
|
||||
id: deleteDialog
|
||||
anchors.centerIn: parent
|
||||
property int eventid:0
|
||||
title: qsTr("Delete Event?")
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
modal: true
|
||||
onAccepted: {//print("event.id"+event.id);
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi("/api/friendica/event_delete");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("id",eventid);
|
||||
xhr.post();
|
||||
}
|
||||
onRejected: {print("eventid "+eventid);close()}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id: createNewEvent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right:updateEvents.left
|
||||
anchors.rightMargin:mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize;
|
||||
text:"+"
|
||||
onClicked: {
|
||||
rootstackView.push("qrc:/qml/calendarqml/EventCreate.qml")
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: xhr
|
||||
function onSuccess(text,api){
|
||||
if(api=="/api/friendica/event_create"){
|
||||
calBusy.running=true;
|
||||
updatenews.setDatabase();
|
||||
updatenews.login();
|
||||
updatenews.setSyncAll(false);
|
||||
updatenews.events();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MButton{
|
||||
|
@ -152,7 +204,7 @@ Rectangle {
|
|||
font.pointSize: osSettings.systemFontSize
|
||||
onTriggered: {
|
||||
calendartab.calendartabstatus="Events";
|
||||
// calendartabstatusButton.text=qsTr("own Calendar");
|
||||
// calendartabstatusButton.text=qsTr("own Calendar");
|
||||
showEvents("")}
|
||||
}
|
||||
}
|
||||
|
@ -176,41 +228,41 @@ Rectangle {
|
|||
}
|
||||
delegate:
|
||||
Item{
|
||||
width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
|
||||
height: parent.height
|
||||
Text{
|
||||
font.bold: true
|
||||
//Layout.fillWidth: true
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
color: Material.primaryTextColor
|
||||
text: model.year
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
Text{y:1.5*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-osSettings.bigFontSize
|
||||
text: Qt.locale().standaloneMonthName(model.month)
|
||||
//Layout.fillWidth: true
|
||||
color: Material.primaryTextColor
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
DayOfWeekRow{y:3*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
locale: monthgrid.locale
|
||||
//Layout.fillWidth: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
|
||||
height: parent.height
|
||||
Text{
|
||||
font.bold: true
|
||||
//Layout.fillWidth: true
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
color: Material.primaryTextColor
|
||||
text: model.year
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
Text{y:1.5*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-osSettings.bigFontSize
|
||||
text: Qt.locale().standaloneMonthName(model.month)
|
||||
//Layout.fillWidth: true
|
||||
color: Material.primaryTextColor
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
DayOfWeekRow{y:3*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
locale: monthgrid.locale
|
||||
//Layout.fillWidth: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
|
||||
MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
|
||||
id: monthgrid
|
||||
height: parent.height-5*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
month: model.month
|
||||
year: model.year
|
||||
locale: Qt.locale()
|
||||
delegate: CalendarDay{}
|
||||
}
|
||||
MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
|
||||
id: monthgrid
|
||||
height: parent.height-5*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
month: model.month
|
||||
year: model.year
|
||||
locale: Qt.locale()
|
||||
delegate: CalendarDay{}
|
||||
}
|
||||
}
|
||||
ScrollIndicator.horizontal: ScrollIndicator { }
|
||||
Component.onCompleted: positionViewAtBeginning()
|
||||
|
@ -235,4 +287,4 @@ Rectangle {
|
|||
root.eventSignal.connect(showEvents);
|
||||
if (calendartab.calendartabstatus=="Events"){showEvents("")}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
391
source-linux/qml/calendarqml/EventCreate.qml
Normal file
391
source-linux/qml/calendarqml/EventCreate.qml
Normal file
|
@ -0,0 +1,391 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 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.0
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Controls 1.4 as Oldcontrols
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/qml/genericqml"
|
||||
import "qrc:/qml/calendarqml"
|
||||
|
||||
Rectangle{
|
||||
id:eventCreateBox
|
||||
color: Material.backgroundColor
|
||||
property date startDate: new Date()
|
||||
|
||||
function formatText(count, modelData) {
|
||||
var data = count === 12 ? modelData + 1 : modelData;
|
||||
return data.toString().length < 2 ? "0" + data : data;
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:closeButton
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{rootstackView.pop()}
|
||||
}
|
||||
|
||||
Label{
|
||||
x: 0.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 3*root.fontFactor*osSettings.bigFontSize
|
||||
height: root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
//verticalAlignment: TextInput.AlignBottom
|
||||
color: Material.primaryTextColor
|
||||
text:qsTr("Start")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textStartDate
|
||||
property string dateDay:(startDate.getDate()).toString().length<2?"0"+(startDate.getDate()):(startDate.getDate())
|
||||
property string dateMonth: (startDate.getMonth()+1).toString().length<2?"0"+(startDate.getMonth()+1):(startDate.getMonth()+1)
|
||||
x: 4*root.fontFactor*osSettings.bigFontSize
|
||||
y: root.fontFactor*osSettings.bigFontSize
|
||||
width: 5*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
text: dateDay+"-"+dateMonth+"-"+startDate.getFullYear()
|
||||
inputMask: "99-99-9999"
|
||||
validator: RegExpValidator{regExp: /^([0-2\s]?[0-9\s]|3[0-1\s])-(0[0-9\s]|1[0-2\s])-([0-9\s][0-9\s][0-9\s][0-9\s])$ / }
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: textStartDateDropdown
|
||||
x: 9.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text:"\uf0d7"
|
||||
onClicked:{
|
||||
cal.visible=true;
|
||||
cal.curSelection="start"
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textStartTime
|
||||
x: 13*root.fontFactor*osSettings.bigFontSize
|
||||
y: root.fontFactor*osSettings.bigFontSize
|
||||
width: 3*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
inputMask: "99:99"
|
||||
text: "00:00"
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
validator: RegExpValidator{regExp: /^([0-1\s]?[0-9\s]|2[0-3\s]):([0-5\s][0-9\s])$ / }
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: textStartTimeDropdown
|
||||
x: 16.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text:"\uf0d7"
|
||||
onClicked:{
|
||||
onClicked: {timeTumbler.visible=true;timeTumbler.curSelection="start"}
|
||||
}
|
||||
}
|
||||
|
||||
Label{
|
||||
x: 0.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: 4*root.fontFactor*osSettings.bigFontSize
|
||||
width: 3*root.fontFactor*osSettings.bigFontSize
|
||||
height: root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
color: Material.primaryTextColor
|
||||
text:qsTr("End")
|
||||
}
|
||||
TextField {
|
||||
id: textEndDate
|
||||
x: 4*root.fontFactor*osSettings.bigFontSize
|
||||
y: 3*root.fontFactor*osSettings.bigFontSize
|
||||
width: 5*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
inputMask: "99-99-9999"
|
||||
validator: RegExpValidator{regExp: /^([0-2\s]?[0-9\s]|3[0-1\s])-(0[0-9\s]|1[0-2\s])-([0-9\s][0-9\s][0-9\s][0-9\s])$ / }
|
||||
enabled: false
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: textEndDateDropdown
|
||||
x: 9.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: 3*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
enabled: false
|
||||
text:"\uf0d7"
|
||||
onClicked:{
|
||||
cal.visible=true;
|
||||
cal.curSelection="end"
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textEndTime
|
||||
x: 13*root.fontFactor*osSettings.bigFontSize
|
||||
y: 3*root.fontFactor*osSettings.bigFontSize
|
||||
width: 3*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
enabled: false
|
||||
horizontalAlignment: TextInput.AlignRight
|
||||
inputMask: "99:99"
|
||||
validator: RegExpValidator{regExp: /^([0-1\s]?[0-9\s]|2[0-3\s]):([0-5\s][0-9\s])$ / }
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
MButton {
|
||||
id: textEndTimeDropdown
|
||||
x: 16.5*root.fontFactor*osSettings.bigFontSize
|
||||
y: 3*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
enabled: false
|
||||
text:"\uf0d7"
|
||||
onClicked:{
|
||||
onClicked: {timeTumbler.visible=true;timeTumbler.curSelection="end"}
|
||||
}
|
||||
}
|
||||
|
||||
Column{
|
||||
x: 4*root.fontFactor*osSettings.bigFontSize
|
||||
y: 6*root.fontFactor*osSettings.bigFontSize
|
||||
width: parent.width-7*root.fontFactor*osSettings.bigFontSize
|
||||
Oldcontrols.Calendar{
|
||||
id:cal
|
||||
property string curSelection: "start"
|
||||
width: 12*root.fontFactor*osSettings.bigFontSize
|
||||
height: 15*root.fontFactor*osSettings.bigFontSize
|
||||
visible: false
|
||||
selectedDate: new Date()
|
||||
onClicked: {
|
||||
if (curSelection=="start"){
|
||||
textStartDate.text=Qt.formatDate(cal.selectedDate, "dd-MM-yyyy");
|
||||
}else{
|
||||
textEndDate.text=Qt.formatDate(cal.selectedDate, "dd-MM-yyyy");
|
||||
}
|
||||
cal.visible=false
|
||||
}
|
||||
}
|
||||
|
||||
Frame {
|
||||
id: timeTumbler
|
||||
width: 12*root.fontFactor*osSettings.bigFontSize
|
||||
height: 10*root.fontFactor*osSettings.bigFontSize
|
||||
visible: false
|
||||
property string curSelection: "start"
|
||||
|
||||
Row {
|
||||
Tumbler {
|
||||
id: hoursTumbler
|
||||
model: 24
|
||||
delegate: tumblerDelegateComponent
|
||||
currentIndex: 12
|
||||
}
|
||||
Tumbler {
|
||||
id: minutesTumbler
|
||||
model: 60
|
||||
delegate: tumblerDelegateComponent
|
||||
}
|
||||
}
|
||||
MButton {
|
||||
id: timeInputfinished
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
text:"\uf00c"
|
||||
onClicked:{
|
||||
if (timeTumbler.curSelection=="start"){
|
||||
textStartTime.text=formatText(24,hoursTumbler.currentIndex)+":"+formatText(60,minutesTumbler.currentIndex);
|
||||
}else{
|
||||
textEndTime.text=formatText(24,hoursTumbler.currentIndex)+":"+formatText(60,minutesTumbler.currentIndex);
|
||||
}
|
||||
timeTumbler.visible=false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox{
|
||||
id: checkNoEndTime
|
||||
width: 12*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
checked: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text: qsTr("no end")
|
||||
onCheckedChanged: {
|
||||
if(checked==true){
|
||||
textEndDate.enabled=false;
|
||||
textEndDateDropdown.enabled=false;
|
||||
textEndTime.enabled=false;
|
||||
textEndTimeDropdown.enabled=false;
|
||||
textEndDate.text="";
|
||||
textEndTime.text=""
|
||||
}else{
|
||||
textEndDate.enabled=true;
|
||||
textEndDateDropdown.enabled=true;
|
||||
textEndTime.enabled=true;
|
||||
textEndTimeDropdown.enabled=true;
|
||||
textEndDate.text=textStartDate.text;
|
||||
textEndTime.text=textStartTime.text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: titleField
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.bold: true
|
||||
placeholderText: qsTr("Title (required)")
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
color: Material.backgroundColor
|
||||
radius: 0.5*mm
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
height:Math.max(bodyField.contentHeight+root.fontFactor*osSettings.bigFontSize,2.5*root.fontFactor*osSettings.bigFontSize)
|
||||
TextArea {
|
||||
id: bodyField
|
||||
anchors.fill: parent
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.family: "Noto Sans"
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
placeholderText: qsTr("Event description (optional)")
|
||||
textFormat: TextEdit.PlainText
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: locationField
|
||||
width: parent.width-root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
placeholderText: qsTr("Location (optional)")
|
||||
}
|
||||
|
||||
CheckBox{
|
||||
id: chkbxPublish
|
||||
width: 10*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize
|
||||
checked: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text: qsTr("Publish event?")
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: eventCreateBusy
|
||||
anchors.horizontalCenter: eventCreateBox.horizontalCenter
|
||||
anchors.top:eventCreateBox.top
|
||||
anchors.topMargin: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width:3*root.fontFactor*osSettings.bigFontSize
|
||||
height: 3*root.fontFactor*osSettings.bigFontSize
|
||||
running: false
|
||||
}
|
||||
|
||||
MButton{
|
||||
id:createEventButton
|
||||
text: qsTr("Create event")
|
||||
onClicked:{
|
||||
let startdatetext=textStartDate.getText(0,textStartDate.length);
|
||||
let startdate=new Date(startdatetext.substring(6,10)+"-"+startdatetext.substring(3,5)+"-"+startdatetext.substring(0,2)+"T"+textStartTime.text)
|
||||
|
||||
if (titleField.text==""){
|
||||
Helperjs.showMessage(qsTr("Error"),qsTr("No event name supplied"),eventCreateBox)
|
||||
}else{
|
||||
let startdatetext=textStartDate.getText(0,textStartDate.length);
|
||||
let startdate=new Date(startdatetext.substring(6,10)+"-"+startdatetext.substring(3,5)+"-"+startdatetext.substring(0,2)+"T"+textStartTime.text)
|
||||
eventCreateBusy.running=true;
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setApi("/api/friendica/event_create");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("name", titleField.text);
|
||||
xhr.setParam("start_time",startdate.toISOString())
|
||||
if(!checkNoEndTime.checked){
|
||||
let enddatetext=textEndDate.getText(0,textEndDate.length);
|
||||
let enddate=new Date(enddatetext.substring(6,10)+"-"+enddatetext.substring(3,5)+"-"+enddatetext.substring(0,2)+"T"+textEndTime.text)
|
||||
xhr.setParam("end_time",enddate.toISOString())
|
||||
}
|
||||
xhr.setParam("name",titleField.text)
|
||||
if (bodyField.text!=""){xhr.setParam("desc",bodyField.text)}
|
||||
if (locationField.text!=""){xhr.setParam("place",locationField.text)}
|
||||
xhr.setParam("publish",chkbxPublish.checked)
|
||||
xhr.post();
|
||||
}
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: xhr
|
||||
function onSuccess(text,api){
|
||||
if (api=="/api/friendica/event_create"){
|
||||
updatenews.setDatabase();
|
||||
updatenews.login();
|
||||
updatenews.setSyncAll(false);
|
||||
updatenews.events();
|
||||
try{while(rootstackView.depth>1){rootstackView.pop()}}catch(e){}
|
||||
}
|
||||
}
|
||||
function onError(text,api){
|
||||
if (api=="/api/friendica/event_create"){
|
||||
Helperjs.showMessage(qsTr("Error"),text,root)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: tumblerDelegateComponent
|
||||
Label {
|
||||
text: formatText(Tumbler.tumbler.count, modelData)
|
||||
opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
|
||||
color:Material.primaryTextColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,10 +39,7 @@ import "qrc:/qml/calendarqml"
|
|||
|
||||
Rectangle{
|
||||
id:eventList
|
||||
// height: parent.height
|
||||
// width:parent.width
|
||||
color: Material.backgroundColor
|
||||
//radius: 0.5*mm
|
||||
property var daylist:[]
|
||||
property int dayint: 0
|
||||
property var events:[]
|
||||
|
@ -56,6 +53,37 @@ Rectangle{
|
|||
text: "\uf057"
|
||||
onClicked:{rootstackView.pop()}
|
||||
}
|
||||
|
||||
MButton{
|
||||
id: createNewEvent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right:closeButton.left
|
||||
anchors.rightMargin:mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize;
|
||||
text:"+"
|
||||
onClicked: {
|
||||
rootstackView.push("qrc:/qml/calendarqml/EventCreate.qml",{"startDate": new Date(dayint*86400000)})
|
||||
}
|
||||
}
|
||||
Dialog {
|
||||
id: deleteDialog
|
||||
anchors.centerIn: parent
|
||||
property int eventid:0
|
||||
title: qsTr("Delete Event?")
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
modal: true
|
||||
onAccepted: {//print("event.id"+event.id);
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi("/api/friendica/event_delete");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("id",eventid);
|
||||
xhr.post();
|
||||
}
|
||||
onRejected: {print("eventid "+eventid);close()}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: eventlistView
|
||||
y:closeButton.height+2*mm
|
||||
|
@ -65,11 +93,9 @@ Rectangle{
|
|||
model: eventModel
|
||||
delegate: EventListItem{}
|
||||
}
|
||||
|
||||
ListModel{
|
||||
id: eventModel
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
|
||||
for (var i=0; i<currentevents.length;i++){
|
||||
|
|
|
@ -42,8 +42,8 @@ Rectangle{
|
|||
property string status: eventstatus
|
||||
property var currEvent: event
|
||||
width:parent.width
|
||||
height:eventNameText.height+eventDetailsText.height+mm
|
||||
border.color: Material.backgroundDimColor//"light grey"
|
||||
height:Math.max(eventNameText.height+eventDetailsText.height,profileImage.height)+mm
|
||||
border.color: Material.backgroundDimColor
|
||||
color: Material.backgroundColor
|
||||
border.width: 1
|
||||
radius: 0.5*mm
|
||||
|
@ -54,8 +54,6 @@ Rectangle{
|
|||
y:1
|
||||
width: 7*mm
|
||||
height: 7*mm
|
||||
//radius:mm
|
||||
|
||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text {
|
||||
|
@ -64,8 +62,9 @@ Rectangle{
|
|||
width:parent.width-8*mm
|
||||
height:contentHeight
|
||||
color: Material.primaryTextColor
|
||||
textFormat: Text.RichText
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":\n"+event.title //+calendarrectangle.offsetTime
|
||||
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":<br>"+(status=="large"?"<b>"+event.title+"</b>":event.title)
|
||||
wrapMode:Text.Wrap
|
||||
}
|
||||
|
||||
|
@ -77,18 +76,51 @@ Rectangle{
|
|||
height: contentHeight
|
||||
color: Material.primaryTextColor
|
||||
textFormat: Text.RichText
|
||||
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)//Qt.atob(event.html)
|
||||
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)
|
||||
anchors.top: eventNameText.bottom
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
wrapMode:Text.Wrap
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
}
|
||||
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
MButton{
|
||||
id: deleteEvent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0.5*mm
|
||||
anchors.right:parent.right
|
||||
anchors.rightMargin:mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize;
|
||||
text:"\uf1f8"
|
||||
onClicked: {
|
||||
deleteDialog.eventid=event.id
|
||||
deleteDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
onClicked:{print("status "+status)
|
||||
if (status==""){
|
||||
rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": event.startday, "events":[event]});
|
||||
} else {rootstackView.pop()}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Connections{
|
||||
target: xhr
|
||||
function onSuccess(text,api){
|
||||
if (api=="/api/friendica/event_delete"){
|
||||
let obj=JSON.parse(text);
|
||||
if(obj.status=="deleted"&&obj.id==event.id){
|
||||
Helperjs.deleteData(db,"events",login.username, function(){
|
||||
eventModel.remove(index);
|
||||
},"id",obj.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,44 +290,44 @@ Page{
|
|||
|
||||
else {errormessage=""}
|
||||
if (errormessage=="") {
|
||||
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
|
||||
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials.json?skip_status=true",root,function(obj){
|
||||
accountBusy.running=false;
|
||||
var credentials=JSON.parse(obj);
|
||||
if (credentials.hasOwnProperty('status')){
|
||||
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
|
||||
}
|
||||
else{
|
||||
if (users.length==0){Service.setDefaultOptions(db);}
|
||||
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
|
||||
{
|
||||
filesystem.makePath(filesystem.homePath+"/"+username.text);
|
||||
}
|
||||
filesystem.Directory=imagestoredir //userconfig.imagestore;
|
||||
filesystem.makeDir("contacts");
|
||||
filesystem.makeDir("albums");
|
||||
userconfig.accountId=credentials.id
|
||||
Service.storeConfig(db,userconfig);
|
||||
Service.readConfig(db,function(userconfig){
|
||||
Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
});
|
||||
accountPage.users=storedUsers});
|
||||
//reset values
|
||||
login=userconfig;
|
||||
news=[];
|
||||
contactlist=[];
|
||||
rootstack.currentIndex=0;
|
||||
newstypeSignal("refresh");
|
||||
},"isActive",0);
|
||||
try{var credentials=JSON.parse(obj);
|
||||
if (credentials.hasOwnProperty('error')){
|
||||
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
|
||||
}
|
||||
else{
|
||||
if (users.length==0){Service.setDefaultOptions(db);}
|
||||
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
|
||||
{
|
||||
filesystem.makePath(filesystem.homePath+"/"+username.text);
|
||||
}
|
||||
filesystem.Directory=imagestoredir //userconfig.imagestore;
|
||||
filesystem.makeDir("contacts");
|
||||
filesystem.makeDir("albums");
|
||||
userconfig.accountId=credentials.id
|
||||
Service.storeConfig(db,userconfig);
|
||||
Service.readConfig(db,function(userconfig){
|
||||
Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
});
|
||||
accountPage.users=storedUsers});
|
||||
//reset values
|
||||
login=userconfig;
|
||||
news=[];
|
||||
contactlist=[];
|
||||
rootstack.currentIndex=0;
|
||||
newstypeSignal("refresh");
|
||||
},"isActive",0);
|
||||
|
||||
//Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc});
|
||||
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
|
||||
rootstackView.pop()
|
||||
}
|
||||
});
|
||||
//Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc});
|
||||
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
|
||||
rootstackView.pop()
|
||||
}
|
||||
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)};
|
||||
|
||||
}
|
||||
})}
|
||||
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
|
||||
}}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ Page{
|
|||
font.pointSize: osSettings.systemFontSize
|
||||
color:Material.primaryTextColor
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
text: "<b>Friendiqa v0.6.5 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
|
||||
text: "<b>Friendiqa v0.6.6 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
|
||||
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
|
||||
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
|
||||
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2020 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.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Layouts 1.11
|
||||
import QtQuick.LocalStorage 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/contactqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item{
|
||||
id: contactsGridTab
|
||||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
function showContacts(contact){
|
||||
try {contactsModel.clear()} catch(e){};
|
||||
Newsjs.listFriends(login,db,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contactsobject[j].screen_name)>1){
|
||||
contactsobject[j].screen_name=contactsobject[j].screen_name+"+"+contactsobject[j].cid
|
||||
}
|
||||
contactsModel.append({"contact":contactsobject[j]});
|
||||
}
|
||||
},searchText.text,-1);
|
||||
}
|
||||
MButton {
|
||||
id: cleanButton
|
||||
text: "\uf021"
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: mm
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
showContacts()
|
||||
// try {contactsModel.clear()} catch(e){print(e)};
|
||||
// Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
// for (var j=0;j<contactsobject.length;j++){
|
||||
// contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
// contactsobject[j].name=Qt.atob(contactsobject[j].name);
|
||||
// contactsModel.append({"contact":contactsobject[j]});
|
||||
// }
|
||||
// },"isFriend",0,"screen_name ASC");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id:searchComponent
|
||||
x: mm; y:mm
|
||||
color: Material.backgroundColor
|
||||
radius:0.5*mm
|
||||
width: 10*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
TextField {
|
||||
id: searchText
|
||||
color: Material.primaryTextColor
|
||||
focus: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
wrapMode: Text.Wrap
|
||||
anchors.fill:parent
|
||||
selectByMouse: true
|
||||
cursorVisible: false
|
||||
placeholderText: "\uf0b0"
|
||||
onTextChanged: {showContacts(root.login.username)}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: contactsView
|
||||
x:mm
|
||||
y:cleanButton.height+2*mm
|
||||
width:contactsGridTab.width-2*mm
|
||||
height:contactsGridTab.height-cleanButton.height-2*mm
|
||||
spacing: 2
|
||||
clip: true
|
||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
model: contactsModel
|
||||
delegate: ContactComponent { }
|
||||
}
|
||||
|
||||
ListModel{id: contactsModel}
|
||||
Component.onCompleted: {
|
||||
friendsTabView.contactsSignal.connect(showContacts);
|
||||
showContacts()
|
||||
}
|
||||
}
|
|
@ -45,9 +45,9 @@ Item{
|
|||
Layout.fillHeight: true
|
||||
property int currentContact: 0
|
||||
|
||||
function showFriends(contact){
|
||||
function showFriends(username){
|
||||
try {friendsModel.clear()} catch(e){};
|
||||
Helperjs.readData(db,"friendshiprequests",login.username,function(friendrequestsobject){
|
||||
Helperjs.readData(db,"friendshiprequests",username,function(friendrequestsobject){
|
||||
for (var i=0;i<friendrequestsobject.length;i++){
|
||||
if (friendrequestsobject[i].note!=null){
|
||||
friendrequestsobject[i].description=Qt.atob(friendrequestsobject[i].note);}
|
||||
|
@ -73,6 +73,19 @@ Item{
|
|||
},(searchText.text==""?searchText.preeditText:searchText.text));
|
||||
}
|
||||
|
||||
function showContacts(contact){
|
||||
try {friendsModel.clear()} catch(e){};
|
||||
Newsjs.listFriends(login,db,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contactsobject[j].screen_name)>1){
|
||||
contactsobject[j].screen_name=contactsobject[j].screen_name+"+"+contactsobject[j].cid
|
||||
}
|
||||
friendsModel.append({"contact":contactsobject[j]});
|
||||
}
|
||||
},searchText.text,-1);
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
function onDownloaded(type,url,filename,i){
|
||||
|
@ -108,11 +121,10 @@ Item{
|
|||
|
||||
ProgressBar{
|
||||
id: newContactsProgress
|
||||
width: 15*mm
|
||||
height: updateFriendsButton.height
|
||||
anchors.top: parent.top
|
||||
anchors.right:updateFriendsButton.left
|
||||
anchors.rightMargin:mm
|
||||
width: friendsView.width
|
||||
height: 2*mm
|
||||
x: mm
|
||||
y: updateFriendsButton.height+mm
|
||||
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
|
||||
value: friendsGridTab.currentContact/root.newContacts.length
|
||||
}
|
||||
|
@ -134,11 +146,30 @@ Item{
|
|||
selectByMouse: true
|
||||
cursorVisible: false
|
||||
placeholderText: "\uf0b0"
|
||||
onTextChanged: if (text.length>0){showFriends(root.login.username)}
|
||||
onPreeditTextChanged: {if (preeditText.length>0){showFriends(root.login.username)}}
|
||||
onTextChanged: {showFriends(root.login.username)}//if (text.length>0)
|
||||
onPreeditTextChanged: {{showFriends(root.login.username)}}//if (preeditText.length>0)
|
||||
}
|
||||
}
|
||||
|
||||
ComboBox{
|
||||
id: friendsCombo
|
||||
anchors.left: searchComponent.right
|
||||
anchors.leftMargin: root.fontFactor*osSettings.bigFontSize
|
||||
y: mm
|
||||
width: 6*root.fontFactor*osSettings.bigFontSize
|
||||
height: 1.5*root.fontFactor*osSettings.bigFontSize
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
model: [qsTr("Friends"), qsTr("All")]
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex === 0) {
|
||||
showFriends(root.login.username);
|
||||
} else{
|
||||
showContacts()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: sectionHeading
|
||||
Rectangle {
|
||||
|
@ -180,9 +211,9 @@ Item{
|
|||
ListView{
|
||||
id: friendsView
|
||||
x:mm
|
||||
y:updateFriendsButton.height+mm
|
||||
y:updateFriendsButton.height+2*mm
|
||||
width:friendsGridTab.width-2*mm
|
||||
height:friendsGridTab.height-(updateFriendsButton.height+7*mm)
|
||||
height:friendsGridTab.height-(updateFriendsButton.height+10*mm)
|
||||
clip: true
|
||||
spacing: 2
|
||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||
|
|
|
@ -79,11 +79,6 @@ Rectangle {
|
|||
font.pointSize: osSettings.systemFontSize
|
||||
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Contacts")
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
height: 1.7*root.fontFactor*osSettings.bigFontSize//7*mm
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("Groups")
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
|
@ -117,10 +112,7 @@ Rectangle {
|
|||
if (currentIndex==1){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==2){
|
||||
contactsSignal("")
|
||||
}
|
||||
else if (currentIndex==3){groupsSignal(root.login.username)}
|
||||
else if (currentIndex==2){groupsSignal(root.login.username)}
|
||||
}
|
||||
|
||||
Loader{
|
||||
|
@ -133,14 +125,9 @@ Rectangle {
|
|||
source:(friendsTabView.currentIndex==1)? "qrc:/qml/contactqml/FriendsListTab.qml":""
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: contactsListLoader
|
||||
source:(friendsTabView.currentIndex==2)? "qrc:/qml/contactqml/ContactsListTab.qml":""
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: groupsListLoader
|
||||
source:(friendsTabView.currentIndex==3)? "qrc:/qml/contactqml/GroupsListTab.qml":""
|
||||
source:(friendsTabView.currentIndex==2)? "qrc:/qml/contactqml/GroupsListTab.qml":""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,9 @@ Item{
|
|||
//print("Groupdata "+JSON.stringify(group));
|
||||
var api="";
|
||||
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
|
||||
xhr.url= login.server + api;
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi(api);
|
||||
xhr.clearParams();
|
||||
xhr.setParam("gid",group.id);
|
||||
xhr.setParam("name",group.name);
|
||||
|
|
|
@ -45,8 +45,9 @@ Rectangle {
|
|||
property var createdAtDate: new Date(profile.friendica_owner.created_at)
|
||||
|
||||
function updateProfileImage(){
|
||||
xhr.url= login.server + "/api/account/update_profile_image.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi("/api/account/update_profile_image.json");
|
||||
xhr.clearParams();
|
||||
xhr.setImageFileParam("image", photoImage.source );
|
||||
xhr.post();
|
||||
|
@ -96,9 +97,19 @@ Rectangle {
|
|||
case "education":keytext=qsTr("education");break;
|
||||
case "social_networks":keytext=qsTr("social networks");break;
|
||||
case "homepage":keytext=qsTr("homepage");break;
|
||||
case "custom_fields":keytext=qsTr("other");break;
|
||||
default:keytext=key;
|
||||
}
|
||||
profiletext=profiletext+("<b>"+keytext+": </b> "+(pobject[key])+"<br>");
|
||||
if (key=="custom_fields"){
|
||||
var customObject=pobject[key];
|
||||
for (var customkey in customObject){
|
||||
profiletext=profiletext+("<b>"+customObject[customkey].label+": </b> "+(customObject[customkey].value)+"<br>");}
|
||||
}else if(key=="homepage" || key=="profile_photo" || key=="profile_thumb"){
|
||||
profiletext=profiletext+("<b>"+keytext+": </b> <a href='"+(pobject[key])+"'>"+(pobject[key])+"</a><br>");
|
||||
}
|
||||
else{
|
||||
profiletext=profiletext+("<b>"+keytext+": </b> "+(pobject[key])+"<br>");
|
||||
}
|
||||
}
|
||||
}
|
||||
callback(profiletext)
|
||||
|
@ -224,7 +235,8 @@ Rectangle {
|
|||
wrapMode: Text.Wrap
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
text:profiletext
|
||||
color:Material.primaryTextColor//"black"
|
||||
color:Material.primaryTextColor
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,8 +93,8 @@ Item {
|
|||
y:5*root.fontFactor*osSettings.bigFontSize
|
||||
width:parent.width
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.bold: account.username==login.username && friendsTabView.currentIndex==2
|
||||
text: " "+qsTr("Contacts")
|
||||
font.bold: account.username==login.username && friendsTabView.currentIndex==3
|
||||
text: " "+qsTr("Groups")
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
|
@ -104,23 +104,5 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Label{
|
||||
y:6.5*root.fontFactor*osSettings.bigFontSize
|
||||
width:parent.width
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
font.bold: account.username==login.username && friendsTabView.currentIndex==3
|
||||
text: " "+qsTr("Groups")
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
login=account;
|
||||
if(!wideScreen){leftDrawerAndroid.close()}
|
||||
friendsTabView.currentIndex=3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,11 +217,11 @@ Page {
|
|||
height: 6*mm
|
||||
text:qsTr("Approve")
|
||||
onClicked:{
|
||||
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/authorize",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
|
||||
})
|
||||
root.friendsSignal();
|
||||
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
|
||||
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
|
@ -232,9 +232,10 @@ Page {
|
|||
text:qsTr("Reject")
|
||||
onClicked:{
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/reject",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
|
||||
})
|
||||
root.friendsSignal();
|
||||
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
|
||||
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
|
@ -245,9 +246,10 @@ Page {
|
|||
text:qsTr("Ignore")
|
||||
onClicked:{
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/ignore",'',"POST",root,function(returnvalue){
|
||||
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
|
||||
|
||||
});
|
||||
root.friendsSignal();
|
||||
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){},"id", contact.id)
|
||||
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
|
@ -259,13 +261,11 @@ Page {
|
|||
onClicked:{
|
||||
contactBusy.running=true;
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/follow",'',"POST",root,function(returnvalue){
|
||||
Helperjs.updateData(db,"contacts",login.username,"isFriend",1,function(){},"id",contact.id)
|
||||
root.friendsSignal(login.username);
|
||||
rootstackView.pop()
|
||||
// var username=login.username
|
||||
//
|
||||
});
|
||||
|
||||
});
|
||||
Helperjs.updateData(root.db,"contacts",root.login.username,"isFriend",1,function(){},"id",contact.id)
|
||||
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,12 +275,13 @@ Page {
|
|||
height: 6*mm
|
||||
text:qsTr("Unfollow")
|
||||
onClicked:{
|
||||
contactBusy.running=true;
|
||||
Helperjs.friendicaPostRequest(login,"/api/v1/accounts/" + contact.id + "/unfollow",'',"POST",root,function(returnvalue){
|
||||
contactBusy.running=true;
|
||||
Helperjs.updateData(db,"contacts",login.username,"isFriend",0,function(){},"id",contact.id)
|
||||
root.friendsSignal(login.username);
|
||||
rootstackView.pop()
|
||||
|
||||
});
|
||||
Helperjs.updateData(root.db,"contacts",root.login.username,"isFriend",0,function(){},"id",contact.id)
|
||||
//if (rootstack.currentIndex==1){root.friendsSignal(login.username)}
|
||||
rootstackView.pop()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +314,9 @@ Page {
|
|||
color: Material.primaryTextColor
|
||||
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(contact.description)!=""?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>"+
|
||||
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())+"<br>"+
|
||||
"<b>"+qsTr("Followers")+":</b> "+contact.followers_count+"<br>"+
|
||||
"<b>"+qsTr("Following")+":</b> "+contact.friends_count+"<br>"
|
||||
onLinkActivated: {
|
||||
Qt.openUrlExternally(link)}
|
||||
}
|
||||
|
|
|
@ -92,13 +92,11 @@ Page {
|
|||
ListView {
|
||||
id: conversationView
|
||||
property string viewtype: "conversation"
|
||||
//x:3*mm
|
||||
//y:8*mm
|
||||
width: conversationList.width//-4*mm
|
||||
height:conversationList.height-root.fontFactor*osSettings.bigFontSize//-20*mm
|
||||
height:conversationList.height-2*root.fontFactor*osSettings.bigFontSize//-20*mm
|
||||
clip: true
|
||||
spacing: 0
|
||||
footer: MessageSend{conversation:true}
|
||||
//footer: MessageSend{conversation:true}
|
||||
model: conversationModel
|
||||
delegate: Newsitem{}
|
||||
}
|
||||
|
@ -114,7 +112,7 @@ Page {
|
|||
|
||||
Connections{
|
||||
target:newstab
|
||||
onConversationChanged:{
|
||||
function onConversationChanged(){
|
||||
if(newstab.conversation.length==0){
|
||||
rootstackView.pop()
|
||||
} else { conversationBusy.running=false;
|
||||
|
|
|
@ -92,7 +92,7 @@ Rectangle{
|
|||
try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setUrl(login.server);
|
||||
if (in_reply_to_status_id==""){
|
||||
//if (in_reply_to_status_id==""){
|
||||
xhr.setApi("/api/statuses/update");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("source", "Friendiqa");
|
||||
|
@ -111,15 +111,16 @@ Rectangle{
|
|||
}
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
}else {
|
||||
xhr.setApi("/api/v1/statuses");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("status", status);
|
||||
xhr.setParam("in_reply_to_id", in_reply_to_status_id);
|
||||
xhr.post();
|
||||
Newsjs.storeHashtags(login,db,status,root)
|
||||
// }else {
|
||||
// xhr.setApi("/api/v1/statuses");
|
||||
// xhr.clearParams();
|
||||
// xhr.setParam("status", status);
|
||||
// xhr.setParam("in_reply_to_id", in_reply_to_status_id);
|
||||
// xhr.post();
|
||||
// Newsjs.storeHashtags(login,db,status,root)
|
||||
// messageSend.destroy()
|
||||
// }
|
||||
messageSend.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||
|
@ -402,7 +403,7 @@ Rectangle{
|
|||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: "\uf03e"
|
||||
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
|
||||
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)
|
||||
|
@ -526,9 +527,6 @@ Rectangle{
|
|||
PropertyChanges {
|
||||
target: titleField; visible:false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: attachButton; visible:false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: bodyField; placeholderText:"";focus:true
|
||||
}
|
||||
|
|
|
@ -50,8 +50,9 @@ Page{
|
|||
property int imageNo: 0
|
||||
|
||||
function uploadSelectedImage(inumber){
|
||||
xhr.url= login.server + "/api/friendica/photo/create.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi("/api/friendica/photo/create.json");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("desc",imageUploadModel.get(inumber).description);
|
||||
if(album.editText!=""){xhr.setParam("album", album.editText)}else{xhr.setParam("album", album.currentText)};
|
||||
|
@ -65,8 +66,9 @@ Page{
|
|||
|
||||
|
||||
function updateImage(){
|
||||
xhr.url= login.server + "/api/friendica/photo/update.json";
|
||||
xhr.setUrl(login.server);
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setApi("/api/friendica/photo/update.json");
|
||||
xhr.clearParams();
|
||||
xhr.setParam("desc",imageUploadModel.get(0).description);
|
||||
xhr.setParam("album", currentAlbum);
|
||||
|
|
|
@ -64,7 +64,6 @@ StackView{
|
|||
})
|
||||
xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
||||
xhr.setImagedir(login.imagestore);
|
||||
print("ownimagelist "+JSON.stringify(ownimagelist))
|
||||
xhr.setFilelist(ownimagelist);
|
||||
xhr.setDownloadtype("picturelist");
|
||||
xhr.getlist();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue