This commit is contained in:
LubuWest 2018-11-09 22:06:13 +01:00
parent 12ac44fb70
commit aca94a5393
98 changed files with 1061 additions and 152 deletions

View File

@ -91,7 +91,16 @@
## v0.3.3 ##
* Update for OpenSSL and Qt
* Experimental support for Peertube (links are expanded for video widget)
* Some unicode emojis
* Update for OpenSSL and At
* Experimental support for Peertube (links are expanded to video widget)
* Some Unicode emojis
* Redesign of contact details (click on contact opens in new stack and shows last news)
## v0.3.4 ##
* Direct message creation from profile page works again
* Profile image upload works again
* Viewing private album pictures of contacts works again
* On first start servername from https://dir.friendica.social/servers/surprise selected
* Register button opens webview of registration page on server

View File

@ -5,5 +5,5 @@ You have probably selected Friendica as your preferred social network because yo
Storing some pieces of user data on the device is necessary for some app features, other apps on your device may not access this data (keeping apps own database storage protected from other apps is guaranteed by Android). The app has been programmed so that stored information contain any personal data (only login data and id number of last seen post will be transferred to servers). Photos from the albums and contact images are stored in a public directory on the device. Other apps may access these files and the Friendiqa needs access to this directory.
To send images from the Android gallery the app needs access to picture databases on the device.
This app dont collect any usage statistics. In addition, no information is sent from your Smartphone to me as a developer or to a website associated with me.
On first start, the website https://dir.friendica.social/servers/surprise is contacted and the selected server shown in the app.

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.3.3" android:versionCode="10" android:installLocation="auto">
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.3.4" android:versionCode="11" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:vmSafeMode="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:icon="@drawable/friendiqa" android:logo="@drawable/friendiqa" android:theme="@android:style/Theme.Holo.Light">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
<intent-filter>

View File

@ -223,5 +223,7 @@
<file>qml/newsqml/NewsImage.qml</file>
<file>qml/newsqml/NewsVideo.qml</file>
<file>qml/newsqml/ContactPage.qml</file>
<file>qml/newsqml/NewsLink.qml</file>
<file>qml/configqml/RegisterPage.qml</file>
</qresource>
</RCC>

View File

@ -13,7 +13,7 @@
TEMPLATE = app
TARGET = friendiqa
CONFIG += release
QT += qml quick gui widgets androidextras
QT += qml quick gui widgets androidextras sql webview
include(androidnative.pri/androidnative.pri)

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -151,7 +151,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){
function showMessage(header,message,rootwindow){print(message);
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -175,7 +175,6 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){
// screenscraping of albums page of contact with remoteAuth
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
//print("Photohtml: "+photohtml);
try {var obj=JSON.parse(photohtml);
if (obj.hasOwnProperty('status')){
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -465,7 +465,7 @@ function chatsfromdb(database,user,callback,stop_time){
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
helpernews.text=Qt.atob(helpernews.text);
helpernews.id=helpernews.status_id;
if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
if (helpernews.attachments!==null){print(Qt.atob(helpernews.attachments));helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
newsArray.push(helpernews);
}
callback(newsArray);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -31,7 +31,7 @@
function findend (text, startpos) {
var indexOf = text.substring(startpos || 0).search(/\s/);
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf;
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : text.length;
}
@ -135,6 +135,20 @@ else{
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
}
}
// if (newsitemobject.text.indexOf(".html")>-1){
// //print("message "+msg.options.showWebsiteForLinks);
// if (msg.options.showWebsiteForLinks!="false"){
// var linkhelper={mimetype:"text/html"}
// var linktext=newsitemobject.text;
// while (linktext.indexOf(".html")>-1){
// var linkhelperstringposition=linktext.indexOf(".html");
// var linkposend=findend(linktext,linkhelperstringposition);
// linkhelper.url=linktext.substring(linktext.lastIndexOf("http",linkhelperstringposition),linkposend);
// linktext=linktext.substring(linkhelperstringposition+5,linktext.length)
// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)}
// }
// }
// }
newsitemobject.attachmentList=attachmentList;

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
// This file is part of Friendiqa // https://github.com/lubuwest/Friendiqa
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -48,6 +49,7 @@ function initDatabase(database) { // initialize the database object
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)')
})}
function cleanPermissions(oldperms){
@ -293,6 +295,31 @@ function readActiveConfig(database){
return obj;
}
function readGlobaloptions(database,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var go=({});
db.transaction( function(tx) {
var rs = tx.executeSql('select * from globaloptions');
for (var r=0; r<rs.rows.length; r++){
go[rs.rows.item(r).k]=rs.rows.item(r).v
}
callback(go)
})
}
function updateglobaloptions(database,key,value){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from globaloptions where k="'+key+'"'); // check for key
if(result.rows.length === 1) {// use update
result = tx.executeSql('UPDATE globaloptions SET v="'+value+'" WHERE k="'+key+'"')
} else {// use insert
result = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', [key,value])
}
})
}
function deleteConfig(database,userobj,callback) { // delete user data from DB
if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";}
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
@ -486,6 +513,9 @@ function updateView(viewtype){
//downloadNotice.text="xhr start "+Date.now()
switch(viewtype){
case "Conversations":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
@ -495,6 +525,9 @@ function updateView(viewtype){
xhr.setParam("count",50)
break;
case "Timeline":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -123,6 +123,11 @@ StackView{
visible: false
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
}
// Text {
// text: qsTr("Show Website")
// x: 4*mm; y: 70*mm; width: 20*mm
// }
Image{
id:servericon
@ -176,12 +181,15 @@ StackView{
Rectangle{
color: "light grey"
x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm;
x: 25*mm; y: 20*mm; width: root.width/2-9*mm; height: 5*mm;
TextInput {
id: username
anchors.fill: parent
selectByMouse: true
//onEditingFinished:{
onEditingFinished:{
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),configBackground)
}
// Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
// var screennametest=JSON.parse(obj);
// if (screennametest.hasOwnProperty('status')){
@ -190,8 +198,16 @@ StackView{
// }else{configBackground.registeredUser=true}
// });
// }
}
}
}
}
BlueButton {
x: root.width/2+18*mm; y: 20*mm; width:7*mm
text: "\uf234"
onClicked: {
configStack.push({item:"qrc:/qml/configqml/RegisterPage.qml",properties:{url:servername.text+"/register?nickname="+username.getText(0,username.length)}})
}
}
Rectangle{
color: "light grey"
@ -284,6 +300,23 @@ StackView{
}
// CheckBox{
// id:showwebsiteCheckbox
// x:35*mm;y:70*mm
// onClicked:{
// if (checked==true){
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","true")
// root.globaloptions.showWebsiteForLinks="true"
// }
// else {
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","false")
// root.globaloptions.showWebsiteForLinks="false"
// }
// }
// }
BlueButton {
x: 25*mm; y: 78*mm
text: qsTr("Confirm")
@ -328,6 +361,8 @@ StackView{
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
}}
BlueButton {
x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm;
text: "-"
@ -413,8 +448,18 @@ StackView{
messageIntervalSlider.value=obj.timerInterval;
if( obj.isActive==0){userButton.fontColor='black'} else {userButton.fontColor='grey'}},"isActive",0
)
})
//Service.readGlobaloptions(db,function(go){
// if (root.globaloptions.showWebsiteForLinks!="false"){showwebsiteCheckbox.checked=true}
//})
}
catch (e){
Helperjs.friendicaWebRequest("https://dir.friendica.social/servers/surprise",configBackground,function(html){
var bpos=html.indexOf("baseurl");
var baseurl=html.substring(html.indexOf("http",bpos),html.indexOf('"',html.indexOf("http",bpos)));
servername.text=baseurl
})}
catch (e){print(e)}
}
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -43,7 +43,7 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.3.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.3.4 </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://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Most of C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,61 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.9
import QtWebView 1.1
import "qrc:/qml/genericqml"
Rectangle{
color:"white"
//border.color: "light grey"
property alias url:htmlview.url
width:root.width-5*mm
height:root.height-12*mm
WebView {id:htmlview;
height:parent.height-7*mm
width:parent.width
y:7*mm
MouseArea {anchors.fill:parent;
onClicked:{print(url)}
}
onLoadingChanged: print(loadProgress)
}
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{configStack.pop()}
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -113,7 +113,7 @@ Rectangle{
fotostab.phototabstatus="Contact";
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(root.login,contact) ;
root.fotoSignal(contact) ;
contactLargeComponent.destroy();
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -141,6 +141,7 @@ Rectangle {
MouseArea{
anchors.fill: parent
onClicked:{
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker");

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -56,10 +56,11 @@ TabView{
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db)
property var globaloptions: ({}) //Service.readGlobaloptions(db)
property var contactlist: []
property real mm: Screen.pixelDensity
signal messageSignal(var friend)
signal fotoSignal(var login, var friend)
signal fotoSignal(var username, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal friendsSignal(var username)
@ -191,6 +192,7 @@ TabView{
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
}
Component.onCompleted: {
Service.readGlobaloptions(db,function(go){globaloptions=go})
//print(xhr.networktype);
if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root)

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -110,7 +110,6 @@ Rectangle {
onClicked:{
currentIndex=0;
directmessageSignal(contact.screen_name)
newsStack.pop()
}
}
@ -126,7 +125,7 @@ Rectangle {
}
}
}//Row end
}//Column end
Label {
id: namelabel
x:mm
@ -168,7 +167,7 @@ Rectangle {
contactBusy.running=false;
contactModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts};
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts, 'options':globaloptions};
contactWorker.sendMessage(msg)
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -81,7 +81,7 @@ Rectangle {
} else { conversationBusy.running=false;
conversationModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation};
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'options':globaloptions};
conversationWorker.sendMessage(msg)
//conversationsymbol.color="grey"
}
@ -112,7 +112,7 @@ Rectangle {
wrapMode: Text.Wrap
anchors.fill: parent
selectByMouse: true
onHeightChanged: newsView.contentY+=4.5*mm
onHeightChanged: conversationView.contentY+=4.5*mm
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,52 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.9
import "qrc:/js/helper.js" as Helperjs
//import QtWebView 1.1
Rectangle{
color:"transparent"
width:newscolumn.width;
height:newscolumn.width/4*3
property string url:""//htmlview.text
Text{id:htmlview
textFormat:Text.RichText
}
// WebView {id:htmlview;
// anchors.fill: parent
// }
Component.onCompleted: //Helperjs.friendicaWebRequest(url,parent,function(html){
//print(html);
htmlview.text="Text <iframe src='"+url+"' width = '300px' height = '300px'>"
//})
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -87,7 +87,7 @@ Item {
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews, 'options':globaloptions};
newsWorker.sendMessage(msg);
//newsStack.appendNews=false
}
@ -146,8 +146,8 @@ Item {
}
function onDirectMessage(friend){
newstab.newstabstatus="SendMessage"
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
//newstab.newstabstatus="SendMessage" ,"login":login ,
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1, "login":root.login}});
}
function sendUrls(urls){print(root.currentIndex==0);
@ -335,12 +335,12 @@ Item {
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
@ -424,8 +424,8 @@ Item {
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
try{newsModel.clear()} catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
// xhr.setUrl(login.server);
if(root.news.length>0){showNews(root.news)}
else{ newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -134,11 +134,8 @@ Item {
MouseArea{
anchors.fill:parent
onClicked: {
conversationsymbol.color="black";
newsView.contentY+=newsitem.height;
var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml");
var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray});
showConversation(index,newsitemobject);
newsStack.push("qrc:/qml/newsqml/Conversation.qml");
showConversation(index,newsitemobject)
}
}
}
@ -186,7 +183,12 @@ Item {
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
} else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
}
// else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
// var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
// var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url});
// }
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
@ -459,6 +461,15 @@ Item {
})
}
}
MenuItem {
text: qsTr("Post")
onTriggered: {
Helperjs.friendicaPostRequest(root.login,"/item","preview=1&"+encodeURIComponent(newsitemobject.text),"POST",root,function(reply){
print(reply)
})
}
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -115,7 +115,7 @@ StackView{
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
Imagejs.newRequestFriendsAlbumPictures(root.login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -223,5 +223,7 @@
<file>qml/newsqml/NewsImage.qml</file>
<file>qml/newsqml/NewsVideo.qml</file>
<file>qml/newsqml/ContactPage.qml</file>
<file>qml/newsqml/NewsLink.qml</file>
<file>qml/configqml/RegisterPage.qml</file>
</qresource>
</RCC>

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -32,8 +32,10 @@
#include <QApplication>
#include <QtQml/QQmlEngine>
#include <QtQuick>
#include <QtWebView>
#include "xhr.h"
#include "filesystem.h"
#include "updatenews.h"
#include "remoteauthasyncimageprovider.h"
//#include "AndroidNative/systemdispatcher.h"
//#include "AndroidNative/environment.h"
@ -60,17 +62,21 @@ int main(int argc, char *argv[]) {
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
QtWebView::initialize();
RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
view.engine()->addImageProvider("remoteauthimage",imageProvider);
view.rootContext()->setContextProperty("remoteauth", imageProvider);
auto offlineStoragePath=QUrl::fromLocalFile(view.engine()->offlineStorageDatabaseFilePath("Friendiqa"));
view.rootContext()->setContextProperty("offlineStoragePath", offlineStoragePath);
XHR* xhr = XHR::instance();
view.rootContext()->setContextProperty("xhr", xhr);
FILESYSTEM* filesystem = FILESYSTEM::instance();
view.rootContext()->setContextProperty("filesystem", filesystem);
// UPDATENEWS* updatenews = UPDATENEWS::instance();
// view.rootContext()->setContextProperty("updatenews", updatenews);
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
view.show();
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,341 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "updatenews.h"
#include <QHttpPart>
#include <QTextCodec>
#include <QUrlQuery>
#include <QList>
#include <QDataStream>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QQmlEngine>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QSqlDatabase>
#include <QSqlError>
#include <QDateTime>
#include "xhr.h"
UPDATENEWS *UPDATENEWS::instance()
{
static UPDATENEWS udn;
return &udn;
}
UPDATENEWS::UPDATENEWS(QObject *parent) : QObject(parent)
{
}
void UPDATENEWS::setUrl(QString url)
{
if (url!=m_url) {
m_url = url;
emit urlChanged(m_url);
}
}
void UPDATENEWS::setDatabase()
{
static QQmlEngine qe;
QString db_url=qe.offlineStorageDatabaseFilePath("Friendiqa");
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile());
qDebug() << db_url;
if (!m_db.open())
{
qDebug() << "Error: connection with database fail " << m_db.lastError();
}
else
{
qDebug() << "Database: connection ok";
}
}
void UPDATENEWS::login()
{
qDebug() << "login";
QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
qDebug() <<"size "<< query.size();
while (query.next())
{
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
//emit this->loginChanged(m_login);
m_url=query.value(0).toString();
QString isActive=query.value(7).toString();
qDebug() << " username " << username<< password << m_url << isActive;
//UPDATENEWS::connect(&UPDATENEWS::getLogin,SIGNAL(loginChanged(QString)),this,SLOT(XHR::login(QString)));
m_api="/api/statuses/friends_timeline";
}
//return m_login;
}
void UPDATENEWS::timeline()
{
QSqlQuery query("SELECT status_id FROM news WHERE username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
if (query.isActive() && query.isSelect()){query.first();};
QString lastid=query.value(0).toString();
//query.finish();
qDebug() << lastid << query.at();
clearParams();
setParam("since_id",lastid);
setParam("count","50");
get();
QObject::connect(this,&UPDATENEWS::success,this,&UPDATENEWS::store);
}
void UPDATENEWS::store(QByteArray serverreply,QString apiname)
{
//qDebug() << serverreply;
QJsonDocument news;
QJsonParseError jsonerror;
news=QJsonDocument::fromJson(serverreply,&jsonerror);
qDebug() << news.isArray()<<news.isObject()<<news.isEmpty()<<jsonerror.errorString();
if (news.isArray()){
qDebug() << " isArray ";
//QJsonArray array = news.//news.toArray();
for (int i=0; i < news.array().count();i++){
QJsonValue newsitem=news[i];
QSqlQuery query(m_db);
query.prepare("INSERT INTO news (username,messagetype,text,created_at,in_reply_to_status_id,source,status_id,in_reply_to_user_id,geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0,username);
query.bindValue(1,"0");
query.bindValue(2, newsitem["text"].toString().toUtf8().toBase64());
QString sourcedate=newsitem["created_at"].toString();
QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15);
query.bindValue(3,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() );
if(newsitem["in_reply_to_status_id"]!=QJsonValue::Null){query.bindValue(4, newsitem["in_reply_to_status_id"].toInt());};
query.bindValue(5,newsitem["source"]);
query.bindValue(6,newsitem["id"].toInt());
if(newsitem["in_reply_to_user_id"]!=QJsonValue::Null){ query.bindValue(7,newsitem["in_reply_to_user_id"].toInt());};
query.bindValue(8,newsitem["geo"]);
query.bindValue( 9, newsitem["favorited"].toInt());
query.bindValue(10, newsitem["user"]["id"].toInt());
query.bindValue(11, newsitem["statusnet_html"].toString().toUtf8().toBase64());
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
if (newsitem.toObject().contains("friendica_activities")){
for (int a=0; a < newsitem["friendica_activities"]["like"].toArray().count();a++){
likeArray.append(newsitem["friendica_activities"]["like"][a]["url"].toString());
}
for (int b=0; b < newsitem["friendica_activities"]["dislike"].toArray().count();b++){
dislikeArray.append(newsitem["friendica_activities"]["dislike"][b]["url"].toString());
}
for (int c=0; c < newsitem["friendica_activities"]["attendyes"].toArray().count();c++){
attendyesArray.append(newsitem["friendica_activities"]["attendyes"][c]["url"].toString());
}
for (int d=0; d < newsitem["friendica_activities"]["attendno"].toArray().count();d++){
attendnoArray.append(newsitem["friendica_activities"]["attendno"][d]["url"].toString());
}
for (int e = 0; e < newsitem["friendica_activities"]["attendmaybe"].toArray().count();e++){
attendmaybeArray.append(newsitem["friendica_activities"]["attendmaybe"][e]["url"].toString());
}
};
QJsonArray friendica_activities; friendica_activities={likeArray,dislikeArray,attendyesArray,attendnoArray,attendmaybeArray};
QJsonDocument activities; activities.setArray(friendica_activities);
query.bindValue(13,activities.toJson(QJsonDocument::Compact).toBase64());
query.bindValue(14,"[]");
if (newsitem["attachments"]!=QJsonValue::Undefined){
query.bindValue(15, QJsonDocument(newsitem["attachments"].toArray()).toJson(QJsonDocument::Compact).toBase64());
};
query.bindValue(16, newsitem["friendica_owner"]["url"]);
qDebug() << query.exec() <<query.lastError();
//query.finish();
}
}
QList<QJsonValue> newcontacts=findNewContacts(news);
updateContacts(newcontacts);
emit updatesuccess();
}
QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
QSqlQuery query("SELECT profile_image_url FROM contacts",m_db);
QList<QString> imageurls;
while (query.next()){
imageurls.append(query.value(0).toString());
}
QList<QJsonValue> newcontacts;
QList<QString> newcontactimagelinks;
qDebug()<<news.array().count();
for (int i=0; i<news.array().count();i++){
if(imageurls.contains(news[i]["user"]["profile_image_url"].toString()) || newcontactimagelinks.contains(news[i]["user"]["profile_image_url"].toString())){
qDebug()<<"vorhanden";
}
else{ qDebug()<<"newcontact" <<news[i]["user"];
newcontacts.append(news[i]["user"]);
newcontactimagelinks.append(news[i]["user"]["profile_image_url"].toString());
}
}
return newcontacts;
}
void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
qint64 currentTime =QDateTime::currentMSecsSinceEpoch();
for (int i=0; i < contacts.count();i++){
QJsonValue contact=contacts[i];
QSqlQuery query(m_db);
query.prepare("INSERT INTO contacts username, id, name, screen_name, location,imageAge, "
"profile_image_url, description, profile_image, url, protected, followers_count, "
"friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count,"
" following, verified, statusnet_blocking, notifications, statusnet_profile_url,"
" cid, network, isFriend, timestamp"
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0,username);
query.bindValue(1, contact["id"]);
query.bindValue(2, contact["name"].toString().toUtf8().toBase64());
query.bindValue(3, contact["screen_name"]);
query.bindValue(4, contact["location"]);
query.bindValue(5, currentTime);
query.bindValue(6, contact["profile_image_url"]);
query.bindValue(7, contact["description"].toString().toUtf8().toBase64());
//query.bindValue(8,"")
query.bindValue(9, contact["url"]);
query.bindValue(10,contact["protected"]);
query.bindValue(11,contact["followers_count"]);
query.bindValue(12,contact["friends_count"]);
query.bindValue(13,contact["created_at"]);
query.bindValue(14,contact["favorites_count"]);
query.bindValue(15,contact["utc_offset"]);
query.bindValue(16,contact["time_zone"]);
query.bindValue(17,contact["statuses_count"]);
query.bindValue(18,contact["following"]);
query.bindValue(19,contact["verfied"]);
query.bindValue(20,contact["statusnet_blocking"]);
query.bindValue(21,contact["notifications"]);
query.bindValue(22,contact["statusnet_profile_url"]);
query.bindValue(23,contact["cid"]);
query.bindValue(24,contact["network"]);
query.bindValue(25, 1);
//query.bindValue(26,image_timestamp);
}
}
QString UPDATENEWS::url() const
{
return m_url;
}
void UPDATENEWS::setParam(QString name, QString value)
{
params.insert(name, value);
}
void UPDATENEWS::clearParams()
{
files.clear();
params.clear();
}
void UPDATENEWS::get()
{
QUrlQuery query;
QHashIterator<QString, QString> i(params);
while(i.hasNext()) {
i.next();
query.addQueryItem(i.key(), i.value());
}
QUrl requrl(m_url+m_api);
qDebug() << requrl;
requrl.setQuery(query);
QByteArray loginData = m_login.toLocal8Bit().toBase64();
QString headerData = "Basic " + loginData;
request.setRawHeader("Authorization", headerData.toLocal8Bit());
request.setUrl(requrl);
reply = manager.get(request);
connect(reply, &QNetworkReply::finished, this, &UPDATENEWS::onReplySuccess);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
connect(reply, &QNetworkReply::readyRead, this, &UPDATENEWS::onReadyRead);
connect(reply, &QNetworkReply::sslErrors, this, &UPDATENEWS::onSSLError);
}
void UPDATENEWS::onReplyError(QNetworkReply::NetworkError code)
{
qDebug() << code;
emit this->error( bufferToString(), m_url,m_api, (int) code);
buffer.clear();
reply->deleteLater();
}
void UPDATENEWS::onReplySuccess()
{
qDebug() << "!";
emit this->success( buffer, m_api);
buffer.clear();
// reply->deleteLater();
}
void UPDATENEWS::onReadyRead()
{
qDebug() << ".";
buffer += reply->readAll();
}
void UPDATENEWS::onSSLError(const QList<QSslError> &errors)
{
qDebug() << "XHR::onSSLError :" ;
QListIterator<QSslError> ierrs(errors);
while(ierrs.hasNext()) {
qDebug() << "\t" << ierrs.next().errorString();
}
}
QString UPDATENEWS::bufferToString()
{
return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
}

View File

@ -0,0 +1,110 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef UPDATENEWS_H
#define UPDATENEWS_H
#include <QObject>
#include <QJsonObject>
#include <QSqlDatabase>
#include "xhr.h"
class UPDATENEWS : public QObject
{
Q_OBJECT
Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
// Q_PROPERTY(QString login READ login NOTIFY loginChanged)
public:
static UPDATENEWS *instance();
explicit UPDATENEWS(QObject *parent = 0);
QString url() const;
//QString login() const;
signals:
// void loginChanged(QString login);
void urlChanged(QString url);
void updatesuccess();
//void apiChanged(QString api);
//network
void success(QByteArray data, QString api);
void error(QString data, QString url,QString api, int code);
//network
public slots:
void setUrl(QString url);
//void setLogin();
//QString login();
void setDatabase();
void login();
void timeline();
//network
void onReplyError(QNetworkReply::NetworkError code);
void onReplySuccess();
void onReadyRead();
void onSSLError(const QList<QSslError> &errors);
void setParam(QString name, QString value);
void clearParams();
void get();
//network
private:
QString m_url;
QString m_api;
QString m_login;
QString username;
QSqlDatabase m_db;
QList<QJsonValue> findNewContacts(QJsonDocument news);
//void timeline();
void store(QByteArray serverreply,QString apiname);
void updateContacts(QList<QJsonValue> contacts);
//network
QHash<QString, QString> params;
QHash<QString, QString> files;
QByteArray buffer;
QNetworkAccessManager manager;
QNetworkRequest request;
QNetworkReply *reply;
QNetworkConfiguration nc;
QString bufferToString();
//network
};
#endif // UPDATENEWS_H

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -205,7 +205,7 @@ void XHR::get()
}
QUrl requrl(m_url+m_api);
//qDebug() << requrl;
qDebug() << requrl;
requrl.setQuery(query);
QByteArray loginData = m_login.toLocal8Bit().toBase64();
QString headerData = "Basic " + loginData;

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -13,13 +13,14 @@
TEMPLATE = app
TARGET = friendiqa
CONFIG += release
QT += qml quick gui widgets
QT += qml quick gui widgets sql webview
SOURCES += common/friendiqa.cpp \
common/uploadableimage.cpp \
common/xhr.cpp \
common/filesystem.cpp \
common/remoteauthasyncimageprovider.cpp
common/remoteauthasyncimageprovider.cpp \
common/updatenews.cpp
RESOURCES = application.qrc
@ -39,7 +40,8 @@ HEADERS += \
common/uploadableimage.h \
common/xhr.h \
common/filesystem.h \
common/remoteauthasyncimageprovider.h
common/remoteauthasyncimageprovider.h \
common/updatenews.h
DISTFILES += \
qml/calendarqml/*.qml \
@ -52,4 +54,5 @@ DISTFILES += \
qml/configqml/*.qml \
js/*.js \
qml/newsqml/Hashtag.qml \
qml/newsqml/NewsImage.qml
qml/newsqml/NewsImage.qml \
qml/newsqml/NewsLink.qml

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -151,7 +151,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function showMessage(header,message,rootwindow){
function showMessage(header,message,rootwindow){print(message);
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}
var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}';

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -175,7 +175,6 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){
// screenscraping of albums page of contact with remoteAuth
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
//print("Photohtml: "+photohtml);
try {var obj=JSON.parse(photohtml);
if (obj.hasOwnProperty('status')){
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -465,7 +465,7 @@ function chatsfromdb(database,user,callback,stop_time){
helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html);
helpernews.text=Qt.atob(helpernews.text);
helpernews.id=helpernews.status_id;
if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
if (helpernews.attachments!==null){print(Qt.atob(helpernews.attachments));helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))};
newsArray.push(helpernews);
}
callback(newsArray);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -31,7 +31,7 @@
function findend (text, startpos) {
var indexOf = text.substring(startpos || 0).search(/\s/);
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : indexOf;
return (indexOf >= 0) ? (indexOf + (startpos || 0)) : text.length;
}
@ -135,6 +135,20 @@ else{
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
}
}
// if (newsitemobject.text.indexOf(".html")>-1){
// //print("message "+msg.options.showWebsiteForLinks);
// if (msg.options.showWebsiteForLinks!="false"){
// var linkhelper={mimetype:"text/html"}
// var linktext=newsitemobject.text;
// while (linktext.indexOf(".html")>-1){
// var linkhelperstringposition=linktext.indexOf(".html");
// var linkposend=findend(linktext,linkhelperstringposition);
// linkhelper.url=linktext.substring(linktext.lastIndexOf("http",linkhelperstringposition),linkposend);
// linktext=linktext.substring(linkhelperstringposition+5,linktext.length)
// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)}
// }
// }
// }
newsitemobject.attachmentList=attachmentList;

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
// This file is part of Friendiqa // https://github.com/lubuwest/Friendiqa
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -48,6 +49,7 @@ function initDatabase(database) { // initialize the database object
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)')
})}
function cleanPermissions(oldperms){
@ -293,6 +295,31 @@ function readActiveConfig(database){
return obj;
}
function readGlobaloptions(database,callback){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var go=({});
db.transaction( function(tx) {
var rs = tx.executeSql('select * from globaloptions');
for (var r=0; r<rs.rows.length; r++){
go[rs.rows.item(r).k]=rs.rows.item(r).v
}
callback(go)
})
}
function updateglobaloptions(database,key,value){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
var result = tx.executeSql('SELECT * from globaloptions where k="'+key+'"'); // check for key
if(result.rows.length === 1) {// use update
result = tx.executeSql('UPDATE globaloptions SET v="'+value+'" WHERE k="'+key+'"')
} else {// use insert
result = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', [key,value])
}
})
}
function deleteConfig(database,userobj,callback) { // delete user data from DB
if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";}
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
@ -486,6 +513,9 @@ function updateView(viewtype){
//downloadNotice.text="xhr start "+Date.now()
switch(viewtype){
case "Conversations":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
@ -495,6 +525,9 @@ function updateView(viewtype){
xhr.setParam("count",50)
break;
case "Timeline":
// updatenews.setDatabase();
// updatenews.login();
// updatenews.timeline();
var lastnews=Newsjs.getLastNews(login,db);
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -123,6 +123,11 @@ StackView{
visible: false
x: 4*mm; y: 70*mm; width:20*mm;wrapMode: Text.Wrap
}
// Text {
// text: qsTr("Show Website")
// x: 4*mm; y: 70*mm; width: 20*mm
// }
Image{
id:servericon
@ -176,12 +181,15 @@ StackView{
Rectangle{
color: "light grey"
x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm;
x: 25*mm; y: 20*mm; width: root.width/2-9*mm; height: 5*mm;
TextInput {
id: username
anchors.fill: parent
selectByMouse: true
//onEditingFinished:{
onEditingFinished:{
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),configBackground)
}
// Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){
// var screennametest=JSON.parse(obj);
// if (screennametest.hasOwnProperty('status')){
@ -190,8 +198,16 @@ StackView{
// }else{configBackground.registeredUser=true}
// });
// }
}
}
}
}
BlueButton {
x: root.width/2+18*mm; y: 20*mm; width:7*mm
text: "\uf234"
onClicked: {
configStack.push({item:"qrc:/qml/configqml/RegisterPage.qml",properties:{url:servername.text+"/register?nickname="+username.getText(0,username.length)}})
}
}
Rectangle{
color: "light grey"
@ -284,6 +300,23 @@ StackView{
}
// CheckBox{
// id:showwebsiteCheckbox
// x:35*mm;y:70*mm
// onClicked:{
// if (checked==true){
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","true")
// root.globaloptions.showWebsiteForLinks="true"
// }
// else {
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","false")
// root.globaloptions.showWebsiteForLinks="false"
// }
// }
// }
BlueButton {
x: 25*mm; y: 78*mm
text: qsTr("Confirm")
@ -328,6 +361,8 @@ StackView{
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
}}
BlueButton {
x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm;
text: "-"
@ -413,8 +448,17 @@ StackView{
messageIntervalSlider.value=obj.timerInterval;
if( obj.isActive==0){userButton.fontColor='black'} else {userButton.fontColor='grey'}},"isActive",0
)
})
//Service.readGlobaloptions(db,function(go){
// if (root.globaloptions.showWebsiteForLinks!="false"){showwebsiteCheckbox.checked=true}
//})
}
catch (e){
Helperjs.friendicaWebRequest("https://dir.friendica.social/servers/surprise",configBackground,function(html){
var baseurl=html.substring(html.indexOf("baseurl")+11,html.indexOf('"',html.indexOf("baseurl")+11))
servername.text=baseurl
})}
catch (e){print(e)}
}
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -43,7 +43,7 @@ Rectangle{
textFormat: Text.RichText
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.3.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.3.4 </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://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Most of C++ code by <a href='https://kirgroup.com/profile/fabrixxm'>Fabio</a><br>"+

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,61 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.9
import QtWebView 1.1
import "qrc:/qml/genericqml"
Rectangle{
color:"white"
//border.color: "light grey"
property alias url:htmlview.url
width:root.width-5*mm
height:root.height-12*mm
WebView {id:htmlview;
height:parent.height-7*mm
width:parent.width
y:7*mm
MouseArea {anchors.fill:parent;
onClicked:{print(url)}
}
onLoadingChanged: print(loadProgress)
}
BlueButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked:{configStack.pop()}
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -113,7 +113,7 @@ Rectangle{
fotostab.phototabstatus="Contact";
root.currentIndex=2;
fotostab.active=true;
root.fotoSignal(root.login,contact) ;
root.fotoSignal(contact) ;
contactLargeComponent.destroy();
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -141,6 +141,7 @@ Rectangle {
MouseArea{
anchors.fill: parent
onClicked:{
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker");

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -56,10 +56,11 @@ TabView{
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db)
property var globaloptions: ({}) //Service.readGlobaloptions(db)
property var contactlist: []
property real mm: Screen.pixelDensity
signal messageSignal(var friend)
signal fotoSignal(var login, var friend)
signal fotoSignal(var username, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal friendsSignal(var username)
@ -191,6 +192,7 @@ TabView{
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
}
Component.onCompleted: {
Service.readGlobaloptions(db,function(go){globaloptions=go})
//print(xhr.networktype);
if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root)

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -110,7 +110,6 @@ Rectangle {
onClicked:{
currentIndex=0;
directmessageSignal(contact.screen_name)
newsStack.pop()
}
}
@ -126,7 +125,7 @@ Rectangle {
}
}
}//Row end
}//Column end
Label {
id: namelabel
x:mm
@ -168,7 +167,7 @@ Rectangle {
contactBusy.running=false;
contactModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts};
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts, 'options':globaloptions};
contactWorker.sendMessage(msg)
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -81,7 +81,7 @@ Rectangle {
} else { conversationBusy.running=false;
conversationModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation};
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'options':globaloptions};
conversationWorker.sendMessage(msg)
//conversationsymbol.color="grey"
}
@ -112,7 +112,7 @@ Rectangle {
wrapMode: Text.Wrap
anchors.fill: parent
selectByMouse: true
onHeightChanged: newsView.contentY+=4.5*mm
onHeightChanged: conversationView.contentY+=4.5*mm
}
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -0,0 +1,52 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.9
import "qrc:/js/helper.js" as Helperjs
//import QtWebView 1.1
Rectangle{
color:"transparent"
width:newscolumn.width;
height:newscolumn.width/4*3
property string url:""//htmlview.text
Text{id:htmlview
textFormat:Text.RichText
}
// WebView {id:htmlview;
// anchors.fill: parent
// }
Component.onCompleted: //Helperjs.friendicaWebRequest(url,parent,function(html){
//print(html);
htmlview.text="Text <iframe src='"+url+"' width = '300px' height = '300px'>"
//})
}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -87,7 +87,7 @@ Item {
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow))
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews, 'options':globaloptions};
newsWorker.sendMessage(msg);
//newsStack.appendNews=false
}
@ -146,8 +146,8 @@ Item {
}
function onDirectMessage(friend){
newstab.newstabstatus="SendMessage"
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}});
//newstab.newstabstatus="SendMessage" ,"login":login ,
newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1, "login":root.login}});
}
function sendUrls(urls){print(root.currentIndex==0);
@ -335,12 +335,12 @@ Item {
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
if(newstab.newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login.username, function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
// else if(newstab.newstabstatus=="Contact"){
@ -424,8 +424,8 @@ Item {
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
try{newsModel.clear()} catch(e){}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
// xhr.setUrl(login.server);
if(root.news.length>0){showNews(root.news)}
else{ newstab.newstabstatus=login.newsViewType;
if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})}

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -186,7 +186,12 @@ Item {
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
} else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
}
// else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
// var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
// var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url});
// }
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
}
@ -459,6 +464,15 @@ Item {
})
}
}
MenuItem {
text: qsTr("Post")
onTriggered: {
Helperjs.friendicaPostRequest(root.login,"/item","preview=1&"+encodeURIComponent(newsitemobject.text),"POST",root,function(reply){
print(reply)
})
}
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
@ -115,7 +115,7 @@ StackView{
else{
try {photogroupModel.clear()}catch (e){print(e)}
if (friend){
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
Imagejs.newRequestFriendsAlbumPictures(root.login,friend,fotorectangle,function(albums,remoteAuthBool){
remoteContact=remoteAuthBool;
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
photoWorker.sendMessage(msg);

View File

@ -1,5 +1,5 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify