Friendiqa v0.2

This commit is contained in:
LubuWest 2018-02-19 22:36:00 +01:00
commit a3be940192
123 changed files with 9156 additions and 2455 deletions

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.4

View file

@ -1,7 +1,39 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.1
import QtQuick.Controls 2.3
import QtQml 2.2
import Qt.labs.calendar 1.0
import QtQuick.Controls 1.2 as Oldcontrol
import QtQuick.Layouts 1.3
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
@ -26,8 +58,8 @@ Rectangle {
eventdays=dayArray})
}
else if (friend!=""){
calendartab.calendartabstatus=friend.substring(friend.lastIndexOf("/")+1,friend.length)
Service.requestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length)
Service.newRequestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){
events=eventArray;
eventdays=dayArray})
}
@ -71,18 +103,19 @@ Rectangle {
anchors.right: parent.right
anchors.rightMargin:2*mm
text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus
Oldcontrol.Menu {
id:calendartabmenu
Oldcontrol.MenuItem {
text: qsTr("Own Calendar")
onTriggered: {
calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar");
showEvents("")}
}
}
onClicked: {calendartabmenu.popup()}
}
Menu {
id:calendartabmenu
MenuItem {
text: qsTr("Own Calendar")
onTriggered: {
calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar");
showEvents("")}
}
}
ListView{
id: calendarView

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/js/service.js" as Service
@ -39,8 +70,7 @@ Rectangle{
}
Component.onCompleted:{
//print(JSON.stringify(daylist))
for (var i=0; i<daylist.length;i++){//print(JSON.stringify(events[daylist[i]]));
for (var i=0; i<daylist.length;i++){
var liststate="";if(daylist.length<2){liststate="large"}
eventModel.append({"event":events[daylist[i]],"eventstatus":liststate});
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.2
@ -23,11 +54,15 @@ StackView{
width:parent.width
height:Math.max(90*mm,root.height-12*mm)
property var users:[]
property bool registeredUser: true
property var userdata: ({})
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")
@ -39,6 +74,7 @@ StackView{
useritems=useritems+"MenuItem{text:'"+configBackground.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
configBackground.registeredUser=true;
userButton.text=obj.username;
servername.text=obj.server;
configBackground.setServericon(obj.server);
@ -60,7 +96,7 @@ StackView{
x: 4*mm; y: 10*mm
}
Text {
text: qsTr("User")
text: qsTr("Nickname")
x: 4*mm; y: 20*mm
}
@ -125,25 +161,35 @@ StackView{
}
}
Rectangle{
color: "light grey"
Rectangle{
color: "light grey"
x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm;
TextInput {
id: username
anchors.fill: parent
selectByMouse: true
id: username
anchors.fill: parent
selectByMouse: true
onEditingFinished:{
Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
var screennametest=JSON.parse(obj);
if (screennametest.status.error){
Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground);
configBackground.registeredUser=false;
}else{configBackground.registeredUser=true}
});
}
}
}
}
Rectangle{
color: "light grey"
x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm;
TextInput {
id: password
anchors.fill: parent
selectByMouse: true
echoMode: TextInput.PasswordEchoOnEdit
id: password
anchors.fill: parent
selectByMouse: true
echoMode: TextInput.PasswordEchoOnEdit
}
}
}
Rectangle{color: "light grey"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;}
Flickable {
@ -232,34 +278,41 @@ StackView{
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! ")}
else if (username.text==""){errormessage+=qsTr("No username given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if ((configBackground.registeredUser==false)){errormessage+=qsTr("Nickname not registered at given server! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
else {errormessage=""}
if (errormessage=="") {
filesystem.Directory=userconfig.imagestore;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){
Service.getServerConfig(db,userconfig,root, function(obj){
var serverString=obj;
var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput");
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
});
configBackground.users=storedUsers});
userButton.color="black"
//reset values
root.login=userconfig;
newstab.newstabstatus=userconfig.newsViewType;
root.currentIndex=0;
newstab.active=true;
})},"isActive",0);
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('status')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
}
else{
filesystem.Directory=userconfig.imagestore;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
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;
});
configBackground.users=storedUsers});
userButton.color="black"
//reset values
root.login=userconfig;
root.news=[];
},"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)
}
});
}
else {Helperjs.show("Error", errormessage,root)}
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
}}
BlueButton {
@ -272,6 +325,7 @@ StackView{
filesystem.rmDir();
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
configBackground.registeredUser=true;
servername.text="https://...";
servericon.source="";
username.text="";
@ -293,6 +347,7 @@ StackView{
x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm;
text: "+"
onClicked:{
configBackground.registeredUser=true;
servername.text="https://..."
servericon.source="";
username.text=""

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/qml/genericqml"
@ -12,9 +43,9 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.1.2 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.2 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Profile <a href='https://freunde.ma-nic.de/profile/friendiqa'>https://freunde.ma-nic.de/profile/friendiqa</a><br>"+
"Sourcecode: <a href='https://github.com/LubuWest/Friendiqa'>https://github.com/LubuWest/Friendica</a><br>"+
"Sourcecode: <a href='https://github.com/LubuWest/Friendiqa'>https://github.com/LubuWest/Friendiqa</a><br>"+
"C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+
"QML and Javascript code by <a href='https://freunde.ma-nic.de/profile/marco'>Marco</a><br>"+
"Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+

View file

@ -1,8 +1,40 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick.Window 2.0
import QtQuick 2.0
QtObject{
property int appWidth: Screen.desktopAvailableWidth
property int appHeight: Screen.desktopAvailableHeight
property int backKey: Qt.Key_Back
property string attachImageDir:filesystem.cameraPath+"/"
//property string attachImageDir:filesystem.cameraPath+"/"
property string imagePickQml: "ImagePicker"
}

View file

@ -1,7 +1,39 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
QtObject{
property real appWidth: 500
property real appHeight: 500
property int backKey: Qt.Key_Escape
property string attachImageDir:filesystem.homePath+"/Pictures/"
//property string attachImageDir:filesystem.homePath+"/Pictures/"
property string imagePickQml: "ImagePickerLinux"
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/qml/genericqml"
@ -19,7 +50,7 @@ Rectangle {
y:1
width: 10*mm
height:10*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/qml/genericqml"
@ -8,7 +39,7 @@ 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>")
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Rectangle {
id: wrapper
@ -50,7 +81,7 @@ Rectangle{
frameVisible: true
id:namelabelflickable
width: root.width-10*mm
height:root.height-50*mm//friendsTabView.height-45*mm
height:root.height-50*mm
x: mm
clip:true
Text{
@ -82,7 +113,7 @@ Rectangle{
fotostab.phototabstatus="Contact";
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(contact) ;
root.fotoSignal(root.login,contact) ;
contactLargeComponent.destroy();
}
}
@ -93,7 +124,7 @@ Rectangle{
onClicked:{
root.currentIndex=0;
newstab.active=true;
root.messageSignal(contact.id) ;
root.messageSignal(contact) ;
contactLargeComponent.destroy();
}
}
@ -119,7 +150,7 @@ Rectangle{
root.currentIndex=3;
calendartab.active=true;
calendartab.calendartabstatus="Friend"
root.eventSignal(contact.url);
root.eventSignal(contact);
contactLargeComponent.destroy();
}
}

View file

@ -1,91 +0,0 @@
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}
}
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// List of people
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs

View file

@ -1,6 +1,38 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
@ -14,15 +46,28 @@ Rectangle {
function showContactdetails(contact){
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
if(contact.isFriend){
friendsTabView.currentIndex=0;
friendsTabView.currentIndex=1;
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
else{friendsTabView.currentIndex=1;
else{friendsTabView.currentIndex=2;
var contactDetails = component.createObject(friendstab,{"contact": contact})
}
}
function showProfile(callback){
var profile=({});
Helperjs.readData(db,"profiles",login.username,function(profileobject){
var profilearray=[];
for (var i in profileobject){
profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata)));
}
profile.profiles=profilearray;
});
Helperjs.readData(db,"contacts",login.username,function(owner){
profile.friendica_owner=owner[0];
},"isFriend",2);
callback(profile)
}
TabView{
id:friendsTabView
@ -31,23 +76,23 @@ Rectangle {
y:mm
width: root.width-2*mm
height: root.height-10*mm
currentIndex: 0
currentIndex: 1
signal contactsSignal(var contact)
signal groupsSignal(var username)
onCurrentIndexChanged:{
if (currentIndex==0){
if (currentIndex==1){
contactsSignal("")
}
else if (currentIndex==1){
else if (currentIndex==2){
contactsSignal("")
}
else if (currentIndex==2){groupsSignal(root.login.username)}
else if (currentIndex==3){groupsSignal(root.login.username)}
}
style: TabViewStyle {
frameOverlap: 1
tab: Rectangle {
color: "white"
implicitWidth: root.width/3-2*mm
implicitWidth: root.width/4-2*mm
implicitHeight: 4*mm
Text { id: text
anchors.centerIn: parent
@ -61,24 +106,43 @@ Rectangle {
tabsAlignment:Qt.AlignHCenter
}
Tab{
id:profileGridTab
title: qsTr("Me")
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
var profilecomp = component.createObject(profileGridTab,{"profile": profile});
});
}
}
Tab{
title: qsTr("Friends")
Rectangle{
id: friendsGridTab
property int currentContact:0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(db,"contacts",login.username,function(friendsobject){
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(Helperjs.getCount(db,login,"contacts","screen_name",friendsobject[i].screen_name)>1){
friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid
}
friendsModel.append({"contact":friendsobject[i]});
}
},"isFriend",1,"screen_name ASC");
}
Connections{
target:xhr
onDownloaded:{
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
currentContact=i+1;
if(currentContact==root.newContacts.length){showFriends(root.login.username)}
}
}
}
BlueButton {
id: updateFriendsButton
text: "\uf021"
@ -101,8 +165,8 @@ Rectangle {
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (root.currentContact!=root.newContacts.length)?true:false
value: root.currentContact/root.newContacts.length
visible: (currentContact!=(root.newContacts.length))?true:false
value: currentContact/root.newContacts.length
}
GridView {
@ -126,7 +190,8 @@ Rectangle {
Component.onCompleted: {
root.friendsSignal.connect(showFriends);
friendsTabView.contactsSignal.connect(showFriends);
showFriends(root.login.username)
showFriends(root.login.username);
root.newContacts=[]
}
}
}
@ -210,17 +275,6 @@ Rectangle {
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
// Helperjs.friendicaPostRequest(login,api,groupdata,"POST",rootwindow, function (obj){print("groupcreate "+obj);
// var groups=JSON.parse(obj);
// db.transaction( function(tx) {
// var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups
// for (var i=0;i<groups.length;i++){
// var memberarray=[]; for (var user in groups[i].user){memberarray.push(parseInt(groups[i].user[user].cid))}
// //print("Members: "+groups[i].user)
// var result2 = tx.executeSql('INSERT INTO groups VALUES (?,?,?,?)', [login.username,groups[i].name,groups[i].gid,JSON.stringify(memberarray)])}
// callback()
// });
// })
}
Connections{

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs

View file

@ -0,0 +1,277 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.3
import "qrc:/qml/genericqml"
import "qrc:/js/service.js" as Service
Rectangle {
width:root.width-2*mm
height:root.height-14*mm
color:"white"
property var profile:({})
property var attachImageURLs:[]
property var createdAtDate: new Date(profile.friendica_owner.created_at)
function updateProfileImage(){
xhr.url= login.server + "/api/account/update_profile_image.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setImageFileParam("image", photoImage.source );
xhr.post();
}
function buildProfiletext(pobject,callback){
var profileobject={};
var profiletext="";
for (var key in pobject){//print(key+obj[key])
if(pobject[key]!=""&&key!="users"&&key!="profile_id"){
var keytext="";
switch(key){
case "profile_name":keytext=qsTr("profile name");break;
case "is_default":keytext=qsTr("is default");break;
case "hide_friends":keytext=qsTr("hide friends");break;
case "profile_photo":keytext=qsTr("profile photo");break;
case "profile_thumb":keytext=qsTr("profile thumb");break;
case "publish":keytext=qsTr("publish");break;
case "net_publish":keytext=qsTr("publish in network");break;
case "description":keytext=qsTr("description");break;
case "date_of_birth":keytext=qsTr("date of birth");break;
case "address":keytext=qsTr("address");break;
case "city":keytext=qsTr("city");break;
case "region":keytext=qsTr("region");break;
case "postal_code":keytext=qsTr("postal code");break;
case "country":keytext=qsTr("country");break;
case "hometown":keytext=qsTr("hometown");break;
case "gender":keytext=qsTr("gender");break;
case "marital":keytext=qsTr("marital status");break;
case "marital_with":keytext=qsTr("married with");break;
case "marital_since":keytext=qsTr("married since");break;
case "sexual":keytext=qsTr("sexual");break;
case "politic":keytext=qsTr("politics");break;
case "religion":keytext=qsTr("religion");break;
case "public_keywords":keytext=qsTr("public keywords");break;
case "private_keywords":keytext=qsTr("private keywords");break;
case "likes":keytext=qsTr("likes");break;
case "dislikes":keytext=qsTr("dislikes");break;
case "about":keytext=qsTr("about");break;
case "music":keytext=qsTr("music");break;
case "book":keytext=qsTr("book");break;
case "tv":keytext=qsTr("tv");break;
case "film":keytext=qsTr("film");break;
case "interest":keytext=qsTr("interest");break;
case "romance":keytext=qsTr("romance");break;
case "work":keytext=qsTr("work");break;
case "education":keytext=qsTr("education");break;
case "social_networks":keytext=qsTr("social networks");break;
case "homepage":keytext=qsTr("homepage");break;
default:keytext=key;
}
profiletext=profiletext+("<b>"+keytext+": </b> "+(pobject[key])+"<br>");
}
}
callback(profiletext)
}
BlueButton {
id: update
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
text: "\uf021"
onClicked: {
Service.requestProfile(root.login,root.db,root,function(nc){
root.newContacts=nc;
photoImage.source="";
showProfile(function(newprofile){
profile=newprofile;
try {profileModel.clear()} catch(e){print(e)};
newprofile.profiles.sort(function(obj1, obj2) {
return obj1.profile_id - obj2.profile_id;
})
for(var i in newprofile.profiles){var obj=newprofile.profiles[i];
buildProfiletext(obj,function(profiletext){
profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext})
})
}
photoImage.source="file://"+newprofile.friendica_owner.profile_image;
});
});
}
}
Image {
id: photoImage
x:mm
y:mm
width: 15*mm
height:15*mm
source: "file://"+profile.friendica_owner.profile_image
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
MouseArea{
anchors.fill: parent
onClicked:{
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker");
imagePicker.pickImage()
}
}
}
Rectangle{
id:phototextRectangle
color:"black"
z:3
opacity: 0.5
width:6*mm
height: phototext.contentHeight
anchors.top: photoImage.top
anchors.right: photoImage.right
}
Text {
id:phototext
z:4
text: "\uf040"
width:5*mm
anchors.top: photoImage.top
anchors.right:photoImage.right
color: "white"
font.pixelSize: 4*mm
}
BlueButton{
id:updatebutton
height: 5*mm
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
text:qsTr("Update")
anchors.left: photoImage.right
anchors.leftMargin: 0.5*mm
anchors.topMargin: mm
anchors.top: parent.top
onClicked:{updateProfileImage()}
}
Label {
id: namelabel
x: mm
width: root.width-6*mm
height: 3*mm
text:(Qt.atob(profile.friendica_owner.name))+" (@"+profile.friendica_owner.screen_name+")"
elide:Text.ElideRight
anchors.topMargin: 0
anchors.left: photoImage.left
wrapMode: Text.Wrap
color: "#303030"
font.pixelSize: 4*mm
anchors.top: photoImage.bottom
}
ListModel{id:profileModel}
Component{
id:profileItem
Rectangle{
id:profileRect
width:profileView.width
height: 5*mm+profiletextfield.height
Text{
y:mm
font.pixelSize: 3*mm
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
color:"black"
}
Text{
id:profiletextfield
x:2*mm
y:3.5*mm
width:parent.width-2.5*mm
wrapMode: Text.Wrap
font.pixelSize: 3*mm
text:profiletext
color:"black"
}
}
}
Component{
id:textcomponent
Text{
id:namelabeltext
width: namelabelflickable.width
height: implicitHeight
font.pixelSize: 3*mm
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+(profile.friendica_owner.description)+"<br> <b>"+qsTr("Location")+":</b> "+profile.friendica_owner.location+"<br> <b>"+qsTr("Posts")+":</b> "+profile.friendica_owner.statuses_count+
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ profile.friendica_owner.url+"'>"+profile.friendica_owner.url+"</a><br>"+
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
onLinkActivated: {
Qt.openUrlExternally(link)}
}
}
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:root.height-36*mm//friendsTabView.height-45*mm
x: mm
clip:true
ListView {
id: profileView
header:textcomponent
width:root.width-10*mm
height: root.height
clip: true
spacing: 0
model: profileModel
delegate: profileItem
}
}
}
Component.onCompleted: {
profile.profiles.sort(function(obj1, obj2) {
return obj1.profile_id - obj2.profile_id;
})
for(var i in profile.profiles){var obj=profile.profiles[i];
buildProfiletext(obj,function(profiletext){
profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext})
})
}
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
@ -14,12 +45,13 @@ TabView{
width: osSettings.appWidth
height:osSettings.appHeight
focus:true
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db)
property var contactlist: []
property real mm: Screen.pixelDensity
signal messageSignal(var friend)
signal fotoSignal(var friend)
signal fotoSignal(var login, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal friendsSignal(var username)
@ -28,7 +60,6 @@ TabView{
property var news:[]
property var newContacts:[]
property int currentContact: 0
property string contactLoadType: ""
onLoginChanged:{
@ -38,9 +69,26 @@ TabView{
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})}
}
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])}
onNewContactsChanged:{
if(newContacts.length>0){// download contact images and update db
var contacturls=[];
var contactnames=[];
for (var link in newContacts){
contacturls.push(newContacts[link].profile_image_url);
contactnames.push(newContacts[link].screen_name);
Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link])
contactlist.push(newContacts[link].url);
}
xhr.setDownloadtype("contactlist");
xhr.setFilelist(contacturls);
xhr.setContactlist(contactnames);
xhr.setImagedir(login.imagestore);
xhr.getlist();
Service.processNews(function(){
root.contactLoadType="";
root.news=[];
})
}
else if (contactLoadType!=""){
Service.processNews(function(){
root.contactLoadType="";
@ -48,46 +96,22 @@ TabView{
})}
}
onCurrentContactChanged:{// download next contact image after successful download and update db
if(currentContact<newContacts.length){
Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])}
else if (contactLoadType!=""){
Service.processNews(function(){
root.contactLoadType="";
root.news=[];
root.newContacts=[];
root.currentContact=0;
})}
}
Connections{
target:xhr
onDownloaded:{if(data=="contact"){contacttimer.stop();root.currentContact=root.currentContact+1}}
onDownloaded:{
if(type=="contactlist"){
//print("contact image saved"+Date.now()+" "+filename+" "+url);
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
var result;
database.transaction( function(tx) {
result = tx.executeSql('UPDATE contacts SET profile_image="'+filename+'" where profile_image_url="'+url+'"');
})
}
}
}
Connections{
target:xhr
onError:{print("Error"+data);
if (data=="contact"){
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
var result;
database.transaction( function(tx) {
//print('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
root.currentContact=root.currentContact+1;contacttimer.stop()})}
}}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Timer {id:contacttimer; interval: 5000; running: false; repeat: false
onTriggered: {
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
database.transaction( function(tx) {
var result = tx.executeSql('UPDATE contacts SET profile_image="" where username="'+root.login.username+'" AND id = '+newContacts[currentContact].id);
root.currentContact=root.currentContact+1})}
}
Keys.onReleased: {
if (event.key === osSettings.backKey) {
if (currentIndex==0){
@ -103,7 +127,10 @@ TabView{
})}
}
else if (newstab.conversation.length>0){newstab.conversation=[]}
else{Service.cleanNews(root.db,function(){Qt.quit()})}
else{Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})}
}
else if (currentIndex==2){fotoSignal("backButton")}
else {currentIndex=0}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
Rectangle{
id: blueButton

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import Qt.labs.folderlistmodel 2.1
@ -14,7 +45,11 @@ Rectangle{
x:2*mm
y:10*mm
property string directory: ""
property bool multiSelection: false
property bool multiple: false
property string imageUrl: ""
property var imageUrls: []
signal ready();
function pickImage() {}
Text{
id:directoryText
@ -32,7 +67,7 @@ Rectangle{
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{imageDialog.destroy()}
onClicked:{ready();imageDialog.destroy()}
}
ListView {
@ -123,22 +158,25 @@ Rectangle{
directory=fileURL
}
else{
if (multiSelection!=true){
attachImageURLs.push(fileURL);
attachImage(fileURL);
if (multiple!=true){
//attachImageURLs.push(fileURL);
//attachImage(fileURL);
imageUrls.push(fileURL);
imageUrl=fileURL;
ready();
imageDialog.destroy()
}
else {
if(selected.visible==true){
attachImageURLs.splice(attachImageURLs.indexOf(fileURL,1))
imageUrls.splice(imageUrls.indexOf(fileURL,1))
selected.visible=false
}
else{
attachImageURLs.push(fileURL);
imageUrls.push(fileURL);
selected.visible=true;
}
attachImage(fileURL)
imageUrl=fileURL
}
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// ConversationView with button
import QtQuick 2.0
import QtQuick.Controls 1.2
@ -104,7 +135,6 @@ Rectangle {
xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)
}
xhr.post();
//replyText.text=""
} catch(e){Helperjs.showMessage("Error",e.toString(),root)}
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// List of people from Friendica Activities
import QtQuick 2.0
import "qrc:/js/helper.js" as Helperjs

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// message.qml
// message with buttons
import QtQuick 2.0
@ -123,15 +154,6 @@ Flickable{
}
Row{
ImagePicker {
id: imagePicker;
multiple : false
onReady: {
attachImageURLs.push(imagePicker.imageUrl);
attachImage(imagePicker.imageUrl)
}
}
spacing:2
BlueButton{id:permButton
visible: (directmessage==1)?false:true
@ -149,9 +171,9 @@ Flickable{
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/genericqml/ImageDialog.qml");
//var imagedialog = component.createObject(messageSend,{"directory": defaultDirectory});
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',messageSend,"imagePicker");
imagePicker.pickImage()
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.2
import "qrc:/qml/genericqml"
@ -13,21 +44,21 @@ Item {
}
}
Connections{
target:root
onCurrentContactChanged:{
if (root.newContacts.length>0){
if(root.currentContact<root.newContacts.length){
downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
//print(root.newContacts[root.currentContact].name)
}
}else{downloadNotice.text=""}
}
}
// Connections{
// target:root
// onCurrentContactChanged:{
// if (root.newContacts.length>0){
// if(root.currentContact<root.newContacts.length){
// downloadNotice.text= qsTr("Download profile image for ")+ root.newContacts[root.currentContact].name;
// //print(root.newContacts[root.currentContact].name)
// }
// }else{downloadNotice.text=""}
// }
// }
Connections{
target:xhr
onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}}
onSuccess:{replytimer.start() //wait 1 second to load new timeline
}
}
@ -40,7 +71,7 @@ Item {
var onlynew=true;
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){
root.contactLoadType="news";
root.news=rns;root.newContacts=rnc;root.currentContact=0})
root.news=rns;root.newContacts=rnc;})
}
}
}
@ -61,10 +92,10 @@ Item {
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;
root.news=ns;root.newContacts=nc;
})}
else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){
root.news=newsarray;root.newContacts=[];root.currentContact=1;
root.news=newsarray;root.newContacts=[];
})}
}
@ -77,7 +108,14 @@ Item {
function onFriendsMessages(friend){
newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend)
Newsjs.newsfromdb(db,root.login.username, function(dbnews){
if (dbnews.length==0){
Newsjs.newsfromdb(db,login.username,function(forumnews){
showNews(forumnews)
},friend.url)
}
else showNews(dbnews)
},friend.id)
}
function onDirectMessage(friend){
@ -127,7 +165,10 @@ Item {
BlueButton {
id: quitButton
text: "\uf08b"
onClicked: {Service.cleanNews(root.db,function(){Qt.quit() })}
onClicked: {Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit() })
})}
}
BlueButton {
id: update
@ -139,12 +180,12 @@ Item {
var onlynew=true;
//print("newstab "+ JSON.stringify(contactlist));
Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){
root.news=ns;root.newContacts=nc;root.currentContact=0;
root.news=ns;root.newContacts=nc;
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})
root.news=rns;root.newContacts=rnc;})
}
})
}
@ -205,12 +246,12 @@ Item {
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;
root.news=ns;root.newContacts=nc;
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})
root.news=rns;root.newContacts=rnc;})
}
})
}}
@ -272,7 +313,7 @@ Item {
root.contactLoadType="favorites";
newsBusy.running=true;
Newsjs.requestFavorites(root.login,db,root.contactlist,root,function(ns,nc){
root.news=ns; root.newContacts=nc;root.currentContact=0;
root.news=ns; root.newContacts=nc;
})
}
}
@ -300,10 +341,11 @@ Item {
root.directmessageSignal.connect(onDirectMessage);
root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){}
newstab.newstabstatus=login.newsViewType;
if(root.news.length>0){showNews(root.news)}
else{ newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}
}
}
}}
}
}

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
@ -35,7 +66,7 @@ Item {
Image {
id:profileImage
source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
x:1
width: 7*mm
height: 7*mm
@ -295,11 +326,8 @@ Item {
anchors.fill:parent
onClicked:{
conversationsymbol.color="black";
//Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
// var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject)
var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject)
}
}
}
@ -334,7 +362,6 @@ Item {
text: qsTr("Conversation")
onTriggered: {
conversationsymbol.color="black";
//Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
showConversation(index,newsitemobject)

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4

View file

@ -1,3 +1,34 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick.Controls 1.4
import "qrc:/js/service.js" as Service
@ -6,7 +37,7 @@ import "qrc:/qml/genericqml"
Rectangle{
id:imageDialog
//property var attachImageURLs: []
property var attachImageURLs: []
property var contacts: []
property var groups: []
property var contact_allow:login.permissions[0]
@ -21,15 +52,18 @@ Rectangle{
xhr.clearParams();
xhr.setParam("desc",imageUploadModel.get(inumber).description);
xhr.setParam("album", album.currentText);
xhr.setParam("contact_allow","27");
if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
//if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
//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 (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl );
xhr.post();
}
function attachImage(url){
imageUploadModel.append({"imageUrl":url,"description":""})
}
z:2
border.color: "grey"
width: parent.width-4*mm
@ -38,19 +72,6 @@ Rectangle{
y:10*mm
property string directory: ""
ImagePicker {
id: imagePicker;
multiple : true
onReady: {//var urlstring=decodeURIComponent(imagePicker.imageUrl);
//var fileurl="file://"+urlstring.substring(5);
for (var n in imagePicker.imageUrls){
imageUploadModel.append({"imageUrl":imagePicker.imageUrls[n].toString(),"description":""})
}
}
}
Connections{
target:xhr
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
@ -172,11 +193,10 @@ Rectangle{
MouseArea{
anchors.fill: parent
onClicked:{
//var defaultDirectory="file://"+osSettings.attachImageDir;
//var component = Qt.createComponent("qrc:/qml/genericqml/ImageDialog.qml");
//var imagedialog = component.createObject(imageDialog,{"directory": defaultDirectory, "multiSelection": true})
// filesystem.search
imagePicker.pickImage()
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}',imageDialog,"imagePicker");
imagePicker.pickImage()
}
}
}
@ -226,7 +246,6 @@ Rectangle{
Component.onCompleted:{
albumModel.append({"text":""});
try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){
//print(JSON.stringify(storedAlbums))
for (var n in storedAlbums){
albumModel.append({"text":storedAlbums[n]})}
})}

View file

@ -1,4 +1,35 @@
import QtQuick 2.0
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick.Controls 1.2
Package {
@ -20,12 +51,14 @@ Package {
BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready }
Image {
id: realImage;
visible: (albumWrapper.state != '')||(index==0)
width: photoWrapper.width; height: photoWrapper.height
antialiasing: true;
asynchronous: true
autoTransform:true
cache: false
fillMode: Image.PreserveAspectFit;
source: imageLocation
source: (albumWrapper.state == '')&&(index>0)?"":imageLocation
}
Rectangle{
id:phototextRectangle

View file

@ -1,51 +1,95 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 1.4
import QtQuick.Controls 1.2
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/photoqml"
import "qrc:/qml/genericqml"
Rectangle {
id:fotorectangle
y:1
width:root.width-mm
height:root.height-5*mm
color: '#fff'
property var newimages:[]
property int currentimageno: 0
property bool remoteContact: false
onNewimagesChanged:{
if(newimages.length>0){
//print("newimages "+JSON.stringify(newimages));
var ownimagelist=[];
Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){
for (var i=0;i<newimages.length;i++){
if(albums.indexOf(newimages[i].album)==-1){
filesystem.Directory=root.login.imagestore+"/albums";
filesystem.makeDir(newimages[i].album)}}
filesystem.makeDir(newimages[i].album)}
ownimagelist.push(root.login.server+"/api/friendica/photo?scale='0'&photo_id="+newimages[i].id);
}
})
Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab);
newImagesProgress.visible=true //download first image
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setImagedir(login.imagestore);
xhr.setFilelist(ownimagelist);
xhr.setDownloadtype("picturelist");
xhr.getlist();
newImagesProgress.visible=true
}
}
onCurrentimagenoChanged:{
if(currentimageno<newimages.length){Service.dataRequest(root.login,newimages[currentimageno].id,root.db,fotostab)};
if(currentimageno==newimages.length){newImagesProgress.visible=false;showFotos("");
if(currentimageno==newimages.length){newImagesProgress.visible=false;showFotos(root.login,"");
newimages=[];currentimageno=0}
// download next image
}
Connections{
target:xhr
onDownloaded:{if(data=="picture"){currentimageno=currentimageno+1}}
}
Connections{
target:xhr
onError:{if(data=="picture"){print("Error"+data);
currentimageno=currentimageno+1}}
onDownloadedjson:{
if(type=="picturelist"){
currentimageno=currentimageno+1
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
}
}
onDownloaded:{
if(type=="picture"){currentimageno=currentimageno+1}
}
onError:{if(data=="picturelist"){
var requestid=url.substring(url.lastIndexOf("=")+1);
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle)
} else {currentimageno=currentimageno+1}
}
}
// Connections{
// target:filesystem
@ -54,7 +98,7 @@ Rectangle {
// onSuccess:print("Success deleting");
// }
function showFotos(friend){
function showFotos(login,friend){
if(friend=="backButton"){
if(!albumgridview.currentItem){root.currentIndex=0}
if(albumgridview.currentItem.state=='fullscreen'){
@ -65,11 +109,12 @@ Rectangle {
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Service.requestFriendsAlbumPictures(login,friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true}
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);
})
phototabstatusButton.text=qsTr(friend.screen_name.toString())+qsTr("'s images")
phototabstatusButton.text=friend.screen_name+qsTr("\'s images")
}
else {
@ -79,11 +124,12 @@ Rectangle {
photoWorker.sendMessage(msg);
}
})
}}
}
}
}
function deletepics(type,url ,imageId){
Service.deleteImage(db,login,type, url,root,function(){//showFotos("")
Imagejs.deleteImage(db,login,type, url,filesystem,root,function(){//showFotos("")
})
}
@ -98,7 +144,6 @@ Rectangle {
value: currentimageno/newimages.length
}
//ImageUploadDialog{}
BlueButton{
id: uploadPhoto
anchors.top: parent.top
@ -118,9 +163,20 @@ Rectangle {
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
text:"\uf0ed"
onClicked: {
Service.requestList(root.login,root.db, fotostab,function(obj){newimages=obj})
Menu {
id:photoupdatemenu
MenuItem {
text: qsTr("All Images")
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){newimages=obj})}
}
}
onClicked: {photoupdatemenu.popup()}
}
BlueButton{
@ -130,18 +186,19 @@ Rectangle {
anchors.right: parent.right
anchors.rightMargin:2*mm
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
showFotos(root.login,"")}
}
}
onClicked: {phototabmenu.popup()}
}
Menu {
id:phototabmenu
MenuItem {
text: qsTr("Own Images")
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
showFotos("")}
}
}
DelegateModel{
id: visualphotoModel
@ -172,13 +229,15 @@ Rectangle {
text:qsTr("More")
}
MouseArea{anchors.fill:parent
onClicked:{
var lastalbum_id=photogroupModel.get(photogroupModel.count-1);
if(photogroupModel.get(photogroupModel.count-1).foreignPictures==false){
Service.requestFriendsAlbumPictures(friend,fotostab,function(albums){
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true}
onClicked:{print(photogroupModel.get(0).foreignPicture);
var lastalbum_id=photogroupModel.count-1;
if(photogroupModel.get(photogroupModel.count-1).foreignPicture==true){
Imagejs.newRequestFriendsAlbumPictures(login,photogroupModel.get(0).friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':lastalbum_id+1,'foreignPicture':true,'friend':photogroupModel.get(0).friend}
photoWorker.sendMessage(msg)
})}
})
}
else{Helperjs.readField("album",root.db, "imageData",root.login.username,function(albums){
var msg = { 'model': photogroupModel,'albums':albums,'foreignPicture': false,'firstalbum':lastalbum_id+1};
photoWorker.sendMessage(msg)})}
@ -202,6 +261,6 @@ Rectangle {
WorkerScript{id: photoWorker;source: "qrc:/js/photoworker.js"}
Component.onCompleted: { root.fotoSignal.connect(showFotos);
if (fotostab.phototabstatus=="Images"){showFotos("")}
if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")}
}
}

View file

@ -1,7 +1,39 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 1.3
import QtQml.Models 2.1
import "qrc:/js/service.js" as Service
//import "qrc:/js/service.js" as Service
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
Package {
@ -72,7 +104,7 @@ Package {
Component.onCompleted:{
try {photoModel.clear()}catch (e){print(e)}
if(foreignPicture){
Service.requestFriendsPictures(albumlink,fotostab,function(obj){
Imagejs.newRequestFriendsPictures(login,albumlink,friend,remoteContact,remoteauth,root,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
photoModel.append({"imageLocation": obj[k].thumb,"photoDescription":obj[k].name,"photoLink":obj[k].link})
@ -83,7 +115,7 @@ Package {
Helperjs.readData(db,"imageData",root.login.username,function(obj){
if (obj) {
for (var k=0;k<obj.length;k++){
if(obj[k].desc!=""&&obj[k].desc!="null"){var name=obj[k].desc}else{var name=obj[k].filename}
if(typeof(obj[k].desc)=="string" && obj[k].desc!=""){var name=obj[k].desc}else{var name=obj[k].filename}
photoModel.append({"imageLocation": obj[k].location+obj[k].filename,"photoDescription":name,"photoLink":obj[k].location+obj[k].filename})
}
}