version v0.6

This commit is contained in:
LubuWest 2021-05-12 21:41:34 +02:00
parent bdc28e632e
commit 8482bde3ed
86 changed files with 7064 additions and 3208 deletions

View file

@ -1,143 +1,157 @@
## v0.5.4 ##
* More Simplification of account page (images are stored in the private app directory, no permission required)
* Image attachment for Android 10 repaired
* Hashtags are saved after message is sent and can be used in later messages
* Bugfixes
## v0.6
## v0.5.3 ##
* Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03
* Indentation to see replied to newsitem for conversation view
* News view type config moved from account page to config page
* Simplification of account page on first start
* Bugfixes
* New language: Hungarian
* Multiple photos in post open in separate slideshow
* Layout redesign
* Adaptive sidebar
* Sync Friendship Requests, approve/deny/ignore requests
* Events: show upcoming events below calendar
* Linux: Drag&Drop for new messages and photo upload
* Linux: Remember app size
## v0.5.3
## v0.5.2 ##
* Redesign of news item
* Background sync for Android >8.0
* Bugfixes
* Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03
* Indentation to see replied to newsitem for conversation view
* News view type config moved from account page to config page
* Simplification of account page on first start
* Bugfixes
## v0.5.2
## v0.5.1 ##
* Videos open in full screen
* Youtube videos open in app
* Option to minimize #nsfw post
* Rotate image in messageSend component
* Redesign of news item
* Background sync for Android >8.0
* Bugfixes
## v0.5 ##
* Redesign due to QML Components 1 being deprecated in Qt 5.12: Slideview for News, left Drawer for Settings, message creation in listview header
* Android Notifications for News, DMs, Replies
* Global app config separated from account config
## v0.5.1
* Videos open in full screen
* Youtube videos open in app
* Option to minimize #nsfw post
* Rotate image in messageSend component
## v0.4 ##
* Background sync for friends timeline (interval on config page must be > 0) for Android > 5
* Replies timeline
* Bugfix: App asks for storage permission on first start
## v0.5
* Redesign due to QML Components 1 being deprecated in Qt 5.12: Slideview for News, left Drawer for Settings, message creation in listview header
* Android Notifications for News, DMs, Replies
* Global app config separated from account config
## 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
## v0.4
* Background sync for friends timeline (interval on config page must be > 0) for Android > 5
* Replies timeline
* Bugfix: App asks for storage permission on first start
## v0.3.3 ##
* 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
## v0.3.2 ##
* For news containing url ending with mp3, mp4, avi, webm, ogg: media can be played in app
* Pictures can be renamed or moved to another album
* Bugfix: random crashes for conversations
* Bugfix: attach image to message works again
* Bugfix: check for nickname on Server has been removed due to API change
## v0.3.3
* 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.1 ##
* By popular demand: Conversations open in a new stack, like in Twidere
* Conversations open after (long) press on news, like in Twidere
* Image attachments are shown below text and can be enlarged, like in Twidere (solves issue #8)
* New messages are html, line breaks work (solves issue #7)
## v0.3.2
* For news containing url ending with mp3, mp4, avi, webm, ogg: media can be played in app
* Pictures can be renamed or moved to another album
* Bugfix: random crashes for conversations
* Bugfix: attach image to message works again
* Bugfix: check for nickname on Server has been removed due to API change
## v0.3 ##
* Fix for [issue 6](https://github.com/LubuWest/Friendiqa/issues/6)
* Refactoring of news part
* Search button for news
* Click on hashtag in newsitem starts search for news with that word
* Public timeline
* Timeline for selected group
* Small redesign of SendMessage page
## v0.3.1
* By popular demand: Conversations open in a new stack, like in Twidere
* Conversations open after (long) press on news, like in Twidere
* Image attachments are shown below text and can be enlarged, like in Twidere (solves issue #8)
* New messages are html, line breaks work (solves issue #7)
## v0.2.2 ##
* Fix for [issue 5](https://github.com/LubuWest/Friendiqa/issues/5)
* Link to list of public server on Config Tab
* Small redesign of SendMessage page
* Intents for texts/urls (Send text or url from everywhere to create message)
## v0.3
* Fix for [issue 6](https://github.com/LubuWest/Friendiqa/issues/6)
* Refactoring of news part
* Search button for news
* Click on hashtag in newsitem starts search for news with that word
* Public timeline
* Timeline for selected group
* Small redesign of SendMessage page
## v0.2.1 ##
* Fix for [issue 4](https://github.com/LubuWest/Friendiqa/issues/4)
* Fix for Friendica [issue 4689](https://github.com/friendica/friendica/issues/4689)
* Long posts are automatically truncated
* Intents for pictures (Send one image from gallery: attach to message, send multiple images: upload to album)
## v0.2.2
* Fix for [issue 5](https://github.com/LubuWest/Friendiqa/issues/5)
* Link to list of public server on Config Tab
* Small redesign of SendMessage page
* Intents for texts/urls (Send text or url from everywhere to create message)
## v0.2 ##
# News #
* Profile image download completely reworked, resulting in speed improvement
## v0.2.1
# Contacts #
* New profile tab, data of public and private profiles shown
* Change profile picture
* For friends image button shows private images thanks to new remoteAuth API (Friendica 3.6 server required) --> private holiday pictures have finally arrived!
* For friends calendar button shows private events thanks to new remoteAuth API (Friendica 3.6 server required)
* News button for forum accounts shows news published via that forum
* Fix for [issue 4](https://github.com/LubuWest/Friendiqa/issues/4)
* Fix for Friendica [issue 4689](https://github.com/friendica/friendica/issues/4689)
* Long posts are automatically truncated
* Intents for pictures (Send one image from gallery: attach to message, send multiple images: upload to album)
# Images #
* Complete rework of image download, fixes bug with private images
* Download all or only new images
## v0.2
# Config #
* Check if nickname exist on server
* Check if password is correct
* Account deletion now also removes news, image data and events from local db
# News
# Translations #
* Italian thanks to Davide de Prisco
* Profile image download completely reworked, resulting in speed improvement
# Contacts
* New profile tab, data of public and private profiles shown
* Change profile picture
* For friends image button shows private images thanks to new remoteAuth API (Friendica 3.6 server required) --> private holiday pictures have finally arrived!
* For friends calendar button shows private events thanks to new remoteAuth API (Friendica 3.6 server required)
* News button for forum accounts shows news published via that forum
# Images
* Complete rework of image download, fixes bug with private images
* Download all or only new images
# Config
* Check if nickname exist on server
* Check if password is correct
* Account deletion now also removes news, image data and events from local db
# Translations
* Italian thanks to Davide de Prisco
## v0.1.2##
* FIX: Include openssl v1.0.2m for SSL connections in Android v7 and above
* FIX: Include openssl v1.0.2m for SSL connections in Android v7 and above
## v0.1.1##
* FIX: Spanish translation
* FIX: Empty Newsview after deletion of first newsitem
* FIX: Spanish translation
* FIX: Empty Newsview after deletion of first newsitem
## v0.1##
# News #
# News
* Native Android image selector for new message
* Click on contacts shows contact details on news page
* Fix problem with news list after deletion of item
* Native Android image selector for new message
* Click on contacts shows contact details on news page
* Fix problem with news list after deletion of item
# Contacts #
* Clean contacts with no news
# Contacts
# Images #
* Upload pictures with description to album (permissions cannot be set due to API problems)
* Delete pictures or albums from client and server (long press on picture in overview)
* Fix problem when enlarging photo
* Clean contacts with no news
# Translations #
* German, Spanish
# Images
* Upload pictures with description to album (permissions cannot be set due to API problems)
* Delete pictures or albums from client and server (long press on picture in overview)
* Fix problem when enlarging photo
# Translations
* German, Spanish

View file

@ -23,7 +23,7 @@ Currently supported:
* Android notifications or Dbus notification (Linux) for new items in friends timeline, replies and DMs
* Search for news
* Click on hashtag in newsitem starts search for news with that word
* Click on image shows image fullscreen
* Only first photo attachment in post is shown, click for more images and fullscreen image
* Click on video or youtube video shows video fullscreen
* For news containing urls ending with mp3, mp4, avi, webm, ogg or to a Peertube instance: media can be played in the app
* Open links in external browser
@ -36,7 +36,6 @@ Currently supported:
* Update fetches new posts (up to last 50) since last in local DB
* More shows older posts from local DB
* Create new Message with images or direct messages, Contact/Group access rights (can be stored), smileys
* Hashtags are saved after message is sent and can be used in later messages
* Send image from Android gallery
* Send text or urls from other apps to Friendiqa
* Native Android image dialog
@ -52,6 +51,7 @@ Currently supported:
* Tabs for own profiles, friends, other contacts and groups
* Show profile(s) of user and change profile picture
* List of all known contacts with locally downloaded pictures
* Show follow requests; approve, deny, ignore requests
* Additional information, last messages and other functionality shown in news tab
* Show public and private pictures of contact (screenscraping of contact's website, works only with certain theme)
* Show public and private events of contact
@ -96,7 +96,7 @@ Currently supported:
* Multiple accounts
* View mode for news (tree or timeline)
* Maximum news (deleted after use of Quit button)
* Sync home timeline, replies, DM, Notify yes/no
* Sync home timeline, replies, DM, Events, friend requests; Notify yes/no
* Hide #nsfw
ToDo
@ -111,8 +111,8 @@ ToDo
# Translations #
* German, Spanish, Italian
* To contribute translations: Have a look at linux-sources/translations/friendiqa-de.ts and open it with an editor. It's an xml file. Change values and send me the file/do pull request.
* German, Spanish, Italian, Hungarian
* To contribute translations: Have a look at linux-sources/translations/friendiqa-de.ts and open it with an editor. It's an xml file. Change values and send me the file to thomasschmidt45 at gmx.net / do pull request.
# Install #
* F-Droid binary repository: [https://www.ma-nic.de/fdroid/repo](https://www.ma-nic.de/fdroid/repo) or for those who get the "error getting index file" from F-Droid client due to outdated crypto libraries the url without encryption: [http://www.ma-nic.de/fdroid/repo](http://www.ma-nic.de/fdroid/repo) To include repo in Fdroid: Open config --> package sources --> plus symbol --> paste url

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.5.4" android:versionCode="22" android:installLocation="auto">
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6" android:versionCode="25" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
@ -8,7 +8,7 @@
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
<!-- %%INSERT_FEATURES android:requestLegacyExternalStorage="true" -->
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
@ -16,11 +16,13 @@
android:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="Friendiqa"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:icon="@drawable/friendiqa"
android:theme="@android:style/Theme.Holo.Light"
android:logo="@drawable/friendiqa">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:name="androidnative.friendiqa.FriendiqaActivity"
android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTask" android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>

0
source-android/android/arm/libcrypto_1_1.so Executable file → Normal file
View file

0
source-android/android/arm/libssl_1_1.so Executable file → Normal file
View file

0
source-android/android/arm64/libcrypto_1_1.so Executable file → Normal file
View file

0
source-android/android/arm64/libssl_1_1.so Executable file → Normal file
View file

View file

@ -1,7 +1,4 @@
# androidBuildToolsVersion=25.0.3
# androidCompileSdkVersion=26
buildDir=.build
# qt5AndroidDir=/home/pankraz/Qt/5.11.1/android_armv7/src/android/java
android.useAndroidX=true
android.enableJetifier=true
android.enforceUniquePackageName=false

0
source-android/android/gradlew vendored Executable file → Normal file
View file

View file

@ -8,8 +8,6 @@ import java.util.HashMap;
import android.content.pm.PackageManager;
import android.content.Context;
import android.Manifest.permission;
//import android.support.v4.app.ActivityCompat;
//import android.support.v4.content.ContextCompat;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@ -43,6 +41,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
//} else {
System.loadLibrary("friendiqa_arm64-v8a");
//System.loadLibrary("friendiqa_armeabi-v7a");
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
SystemDispatcher.onActivityResume();
} else {
@ -94,6 +93,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
protected void onNewIntent(Intent data) {
System.loadLibrary("friendiqa_arm64-v8a");
//System.loadLibrary("friendiqa_armeabi-v7a");
super.onNewIntent(data);
if ((data!=null) && (data.getType() != null) && !(data.getBooleanExtra("used",false))){
String type = data.getType();

View file

@ -112,7 +112,6 @@ public class ImagePicker {
return;
int requestCode = (Integer) message.get("requestCode");
Intent data = (Intent) message.get("data");
if (requestCode == PICK_IMAGE_ACTION) {
importImage(data);
} else if (requestCode == TAKE_PHOTO_ACTION) {
@ -127,8 +126,8 @@ public class ImagePicker {
static private void importImage(Intent data) {
Uri uri = data.getData();
Log.d(TAG,"importImage: uri:" + uri);
Log.d(TAG,"importImage: type: " + data.getType());
//Log.d(TAG,"importImage: uri:" + uri);
//Log.d(TAG,"importImage: type: " + data.getType());
if (data.getClipData() != null) {
importImageFromClipData(data);

View file

@ -140,6 +140,7 @@ public class SystemDispatcher {
waitingIntent=null;
isIntentPending=false;
} else { //onIntent start
Log.e(TAG,"notInitialized: onIntentStart "+data);
message.put("text",data.getStringExtra(Intent.EXTRA_TEXT));
message.put("subject",data.getStringExtra(Intent.EXTRA_SUBJECT));
waitingIntent = message;

View file

@ -67,13 +67,13 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) {
}
else{
QApplication app(argc, argv);
QQuickView view;
QQmlApplicationEngine view;
//qDebug()<<"FriendiqaMain started";
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
view.engine()->addImageProvider("remoteauthimage",imageProvider);
view.addImageProvider("remoteauthimage",imageProvider);
view.rootContext()->setContextProperty("remoteauth", imageProvider);
XHR* xhr = XHR::instance();
view.rootContext()->setContextProperty("xhr", xhr);
@ -83,8 +83,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) {
view.rootContext()->setContextProperty("alarm", alarm);
UPDATENEWS* updatenews = UPDATENEWS::instance();
view.rootContext()->setContextProperty("updatenews", updatenews);
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
view.show();
view.load(QUrl("qrc:/qml/friendiqa.qml"));
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();

View file

@ -52,7 +52,8 @@ OTHER_FILES += qml/friendiqa.qml \
TRANSLATIONS += translations/friendiqa-de.ts \
translations/friendiqa-es.ts \
translations/friendiqa-it.ts
translations/friendiqa-it.ts \
translations/friendiqa-hu.ts
HEADERS += \
common/uploadableimage.h \
@ -85,5 +86,3 @@ DISTFILES += \
ANDROID_EXTRA_LIBS = $$PWD/android/arm/libcrypto_1_1.so $$PWD/android/arm/libssl_1_1.so $$PWD/android/arm64/libcrypto_1_1.so $$PWD/android/arm64/libssl_1_1.so
ANDROID_ABIS = arm64-v8a
android: include(/home/pankraz/git/android_openssl/openssl.pri)

View file

@ -36,47 +36,52 @@ import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
StackView{
ApplicationWindow{
id:root
title: "Friendiqa"
property var globaloptions: Service.readGO(db)
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)}
width: osSettings.appWidth
height:osSettings.appHeight
visible: true
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db)
property var globaloptions: Service.readGO(db)
property real fontFactor: root.font.pixelSize/root.font.pointSize
property var contactlist: []
property real mm: osSettings.osType=="Android"?Screen.pixelDensity:Screen.pixelDensity*1.5
signal messageSignal(var friend)
property bool wideScreen : width>height
signal fotoSignal(var username, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal newstypeSignal(var type)
signal friendsSignal(var username)
signal contactdetailsSignal(var contact)
signal searchSignal (var searchterm)
signal eventSignal(var contact)
signal uploadSignal(var urls)
signal sendtextSignal(var intenttext)
signal changeimage(var method, var type, var id)
signal updateSyncinterval(int interval)
signal replySignal(var newsobject)
property var news:[]
property var newContacts:[]
property var contactposts:[]
//property string contactLoadType: ""
property bool imagePicking: false
onLoginChanged:{
if(login==""){root.push("qrc:/qml/configqml/AccountPage.qml")}
else{root.push(rootStackItem)
function onLoginChanged(login){
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{//rootstackView.push(rootstack)
if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})}
}
onNewContactsChanged:{
function onNewContactsChanged(newContacts){
if(newContacts.length>0){// download contact images and update db
var contacturls=[];
var contactnames=[];
for (var link in newContacts){
for (var link in newContacts){//print("new contact " +newContacts[link].screen_name);
contacturls.push(newContacts[link].profile_image_url);
contactnames.push(newContacts[link].screen_name);
Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link])
@ -91,9 +96,32 @@ StackView{
}
Connections {
target: root
function onWidthChanged(appWidth) {
if(osSettings.osType=="Linux" && Math.abs(appWidth-(globaloptions.appWidth||0))>50){
Service.updateglobaloptions(db,"appWidth",appWidth)
}
}
}
Connections {
target: root
function onHeightChanged(appHeight) {
if(osSettings.osType=="Linux" && Math.abs(appHeight-(globaloptions.appHeight||0))>50){
Service.updateglobaloptions(db,"appHeight",appHeight)
}
}
}
function showContact(contact){ //print(JSON.stringify(contact));
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
Connections{
target:xhr
onDownloaded:{
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
var result;
@ -104,10 +132,12 @@ StackView{
}
}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
if (event.key === osSettings.backKey) {
//Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
onClosing: {
//if (event.key === osSettings.backKey) {
if (rootstack.currentIndex==0){
newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){
@ -119,278 +149,147 @@ StackView{
Newsjs.chatsfromdb(db,login.username,function(dbnews){
newsSignal(dbnews)
})}
close.accepted=false;
}
else if (newstab.conversation.length>0){newstab.conversation=[]}
else if (root.depth>1){root.pop()}
else{Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})}
else if (newstab.conversation.length>0){
newstab.conversation=[];
close.accepted=false
}
else if (root.depth>1){
root.pop();
close.accepted=false
}
else{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})})
close.accepted=true
}
}
else if (rootstack.currentIndex==2){fotoSignal("backButton")}
else {rootstack.currentIndex=0}
event.accepted = true
}}
Drawer{
id: leftDrawer
width: 0.66* root.width
height: root.height
edge: Qt.LeftEdge
position: 1.0
Column{
x:mm
width:parent.width-mm
Label{
text: login.hasOwnProperty("username")?login.username:""
font.pixelSize: 4*mm
width: parent.width
height: 6*mm
}
// Label{
// text:login.hasOwnProperty("server")?"@"+login.server:""
// font.pixelSize: 5*mm
// width: parent.width
// }
Label{
text: "\uf021 " + qsTr("Refresh")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
// newstypeSignal("refresh")
updatenews.setDatabase();
updatenews.login();
updatenews.startsync();
}
}
}
Label{
text: "\uf1da " + qsTr("Timeline")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("timeline")
}
}
}
Label{
text: "\uf086 " + qsTr("Conversations")
width: parent.width
font.pixelSize: 4*mm
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("conversation")
}
}
}
Label{
text: "\uf005 " + qsTr("Favorites")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("favorites")
}
}
}
Label{
text: "\uf0ec " + qsTr("Replies")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("replies")
}
}
}
Label{
text: "\uf0ac " + qsTr("Public Timeline")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("publictimeline")
}
}
}
Label{
text: "\uf0c0 " + qsTr("Group news")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("groupnews")
}
}
}
Label{
text: "\uf002 " + qsTr("Search")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("search")
}
}
}
Label{
text: "\uf085 "+ qsTr("Settings")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/ConfigPage.qml");
leftDrawer.close()
}
}
}
Label{
text: "\uf2bb " + qsTr("Accounts")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/AccountPage.qml");
leftDrawer.close()
}
}
}
Label{
text: "\uf08b " +qsTr("Quit")
font.pixelSize: 4*mm
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
Service.cleanNews(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})
}
}
}
}
//event.accepted = true
//}
}
Item{
id:rootStackItem
width:parent.width
height: parent.height
//anchors.fill:parent
states: State {
name: "fullscreen";
PropertyChanges { target: bar; height:0 }
PropertyChanges { target: rootstack; height:parent.height }
}
transitions: Transition {
PropertyAnimation { properties: "height";
easing.type: Easing.InOutQuad
duration: 1000
footer:ToolBar{
//position: ToolBar.Footer
background: Rectangle{
anchors.fill: parent
color: "#EEEEEE"//"#F8F8F8"
}
//RowLayout{
// anchors.fill: parent
TabBar {
id: bar
width:parent.width
// Layout.fillWidth: true
//width: wideScreen?contentWidth:parent.width-10*mm
//x: 7*mm
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
font.pointSize: osSettings.bigFontSize
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf0c0"
font.pointSize: osSettings.bigFontSize
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf03e"
font.pointSize: osSettings.bigFontSize
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf073"
font.pointSize: osSettings.bigFontSize
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
}
}
TabBar {
id: bar
width: parent.width
height: 7*mm
position:TabBar.Footer
anchors.top: rootstack.bottom
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf0c0"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf03e"
font.pixelSize: 3*mm
height: 6*mm
}
// }
}
TabButton {
text: "\uf073"
font.pixelSize: 3*mm
height: 6*mm
}
}
StackLayout{
// states: State {
// name: "fullscreen";
// PropertyChanges { target: bar; height:0 }
// PropertyChanges { target: rootstack; height:parent.height }
// }
// transitions: Transition {
// PropertyAnimation { properties: "height";
// easing.type: Easing.InOutQuad
// duration: 1000
// }
// }
StackView{id:rootstackView
width:root.width
height: root.height
initialItem: StackLayout{
id:rootstack
width:parent.width
height: parent.height-7*mm
width:rootstackView.width
height: rootstackView.height//-7*mm
//y:wideScreen?7*mm:0
currentIndex:bar.currentIndex
Loader{
id: newstab
Layout.fillWidth:true
Layout.fillHeight: true
property string newstabstatus
property var conversation:[]
property var contactposts:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
}
Loader{
id: friendstab
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
}
Loader{
id: fotostab
property string phototabstatus:"Images"
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
}
Loader{
id: calendartab
property string calendartabstatus:"Events"
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
}
}
}
//}
Component.onCompleted: {
forceActiveFocus();
//print(xhr.networktype());
onLoginChanged(login);
globaloptions=Service.readGO(db);
//forceActiveFocus();
if(osSettings.osType=="Android"){
var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root);
@ -400,5 +299,5 @@ StackView{
var LinuxSyncQml = component.createObject(root);
}
}
}
//}
}

View file

@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.1.0)
project(friendiqa VERSION 0.6 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
find_package(Qt5 COMPONENTS Widgets Quick Sql DBus WebView REQUIRED)
set(MOC_SOURCES common/uploadableimage.h
common/xhr.h
common/filesystem.h
common/remoteauthasyncimageprovider.h
common/updatenews.h
common/alarm.h)
set(SOURCES common/friendiqa.cpp
common/uploadableimage.cpp
common/xhr.cpp
common/filesystem.cpp
common/remoteauthasyncimageprovider.cpp
common/updatenews.cpp
common/alarmlinux.cpp)
include_directories(common)
add_executable(friendiqa ${SOURCES} ${MOC_SOURCES} application.qrc)
target_link_libraries(friendiqa Qt::Core)
target_link_libraries(friendiqa Qt::Widgets)
target_link_libraries(friendiqa Qt::Quick)
target_link_libraries(friendiqa Qt::Sql)
target_link_libraries(friendiqa Qt::WebView)
target_link_libraries(friendiqa Qt::DBus)
# target_link_libraries(friendiqa Qt::Webengine)
# qt5_use_modules(friendiqa Core Widgets Quick Sql DBus)
install(TARGETS friendiqa DESTINATION bin)

View file

@ -19,7 +19,6 @@
<file>qml/contactqml/FriendsTab.qml</file>
<file>qml/contactqml/GroupComponent.qml</file>
<file>qml/contactqml/ProfileComponent.qml</file>
<file>qml/contactqml/ContactDetailsComponent.qml</file>
<file>qml/contactqml/Contactlist.qml</file>
<file>qml/photoqml/PhotoComponent.qml</file>
<file>qml/photoqml/PhotogroupComponent.qml</file>
@ -237,6 +236,16 @@
<file>common/xhr.cpp</file>
<file>common/xhr.h</file>
<file>qml/newsqml/MoreComments.qml</file>
<file>common/filesystemandroid.cpp</file>
<file>qml/newsqml/NewsPhotolist.qml</file>
<file>qml/genericqml/DrawerAccountComponent.qml</file>
<file>qml/configqml/LeftDrawerScrollview.qml</file>
<file>qml/genericqml/LeftDrawerLinux.qml</file>
<file>qml/genericqml/LeftDrawerAndroid.qml</file>
<file>qml/genericqml/DrawerAccountComponentContacts.qml</file>
<file>qml/contactqml/ProfileTab.qml</file>
<file>qml/contactqml/FriendsListTab.qml</file>
<file>qml/contactqml/ContactsListTab.qml</file>
<file>qml/contactqml/GroupsListTab.qml</file>
<file>qml/calendarqml/EventListItem.qml</file>
</qresource>
</RCC>

View file

@ -40,7 +40,6 @@ class ALARM : public QObject
//Q_PROPERTY(int alarmtime READ alarmtime WRITE setAlarm NOTIFY alarmChanged)
public:
static ALARM *instance();
explicit ALARM(QObject *parent = 0);
//int alarmtime() const;

View file

@ -31,7 +31,7 @@
#include <QApplication>
#include <QtQml/QQmlEngine>
#include <QtWebEngine>
//#include <QtWebEngine>
//#include <QAndroidService>
//#include <QtAndroid>
#include <QtQuick>
@ -39,7 +39,7 @@
#include "updatenews.h"
#include "filesystem.h"
#include "remoteauthasyncimageprovider.h"
//#include "alarm.h"
#include "alarm.h"
//#include "AndroidNative/systemdispatcher.h"
//#include "AndroidNative/environment.h"
//#include "AndroidNative/debug.h"
@ -73,15 +73,16 @@ int main(int argc, char *argv[]) {
//return app.exec();
}
else{
QtWebEngine::initialize();
//QtWebEngine::initialize();
QApplication app(argc, argv);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
QQmlApplicationEngine view;
//QQuickView view;
//view.setResizeMode(QQuickView::SizeRootObjectToView);
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
view.engine()->addImageProvider("remoteauthimage",imageProvider);
view.addImageProvider("remoteauthimage",imageProvider);
view.rootContext()->setContextProperty("remoteauth", imageProvider);
XHR* xhr = XHR::instance();
view.rootContext()->setContextProperty("xhr", xhr);
@ -92,8 +93,8 @@ int main(int argc, char *argv[]) {
UPDATENEWS* updatenews = UPDATENEWS::instance();
view.rootContext()->setContextProperty("updatenews", updatenews);
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
view.show();
view.load(QUrl("qrc:/qml/friendiqa.qml"));
//view.show();
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();
}

View file

@ -61,11 +61,11 @@ UPDATENEWS::UPDATENEWS(QObject *parent) : QObject(parent)
void UPDATENEWS::setUrl(QString url)
{
if (url!=m_url) {
m_url = url;
xhr.setUrl(url);
emit urlChanged(m_url);
}
if (url!=m_url) {
m_url = url;
xhr.setUrl(url);
emit urlChanged(m_url);
}
}
@ -77,10 +77,10 @@ void UPDATENEWS::setDatabase()
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();
}
if (!m_db.open())
{
qDebug() << "Error: connection with database fail " << m_db.lastError();
}
}
@ -89,23 +89,23 @@ void UPDATENEWS::login()
QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
while (query.next())
{
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
xhr.setLogin(m_login);
m_url=query.value(0).toString();
xhr.setUrl(m_url);
m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString();
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
xhr.setLogin(m_login);
m_url=query.value(0).toString();
xhr.setUrl(m_url);
m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString();
}
//m_updateInterval=query.value(5).toInt();
//m_updateInterval=query.value(5).toInt();
QSqlQuery syncquery("SELECT * FROM globaloptions",m_db);
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
// delquery.exec();
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
// delquery.exec();
m_updateInterval=0;
syncindex=0;
synclist.clear();
@ -136,33 +136,35 @@ void UPDATENEWS::login()
void UPDATENEWS::startsync()
{ qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){
timeline();
} else if (synclist[syncindex]=="sync_Replies") {
replies();
} else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages();
} else if (synclist[syncindex]=="sync_Notifications") {
notifications();
} else if (synclist[syncindex]=="sync_Events") {
events();
}
} else if (syncindex==synclist.length()) {
m_api="";
if(m_updateInterval!=0){
syncindex=0;
synclist.clear();
m_db.close();
m_db.removeDatabase(m_db.connectionName());
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
emit quitapp();
alarm.setAlarm(m_updateInterval);
m_updateInterval=0;
}
}
//QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
//QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){
timeline();
} else if (synclist[syncindex]=="sync_Replies") {
replies();
} else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages();
} else if (synclist[syncindex]=="sync_Notifications") {
notifications();
} else if (synclist[syncindex]=="sync_FriendRequests") {
friendrequests();
}else if (synclist[syncindex]=="sync_Events") {
events();
}
} else if (syncindex==synclist.length()) {
m_api="";
if(m_updateInterval!=0){
syncindex=0;
synclist.clear();
m_db.close();
m_db.removeDatabase(m_db.connectionName());
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
emit quitapp();
alarm.setAlarm(m_updateInterval);
m_updateInterval=0;
}
}
}
@ -237,10 +239,8 @@ void UPDATENEWS::notifications()
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::events()
{
m_api="/api/friendica/events";
{ m_api="/api/friendica/events";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
@ -258,11 +258,24 @@ void UPDATENEWS::events()
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
}
void UPDATENEWS::friendrequests()
{ m_api="/api/v1/follow_requests";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
xhr.get();
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(storeFriendrequests(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::store(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument news;
//qDebug()<<apiname << serverreply;
//qDebug()<<apiname;
QJsonParseError jsonerror;
news=QJsonDocument::fromJson(serverreply,&jsonerror);
if (news.isArray()){
@ -274,7 +287,9 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
if (testquery.first()) {continue;}
}
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.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());
@ -292,7 +307,9 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
else{query.bindValue(11, newsitem["friendica_html"].toString().toUtf8().toBase64());}
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
if (newsitem["statusnet_conversation_id"].isDouble()){
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
}else{query.bindValue(12, newsitem["statusnet_conversation_id"].toString());}
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++){
@ -310,7 +327,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
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());
@ -326,7 +343,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
query.bindValue(16, newsitem["friendica_author"]["url"]);
}else {
query.bindValue(16, newsitem["user"]["url"]);
}
}
if (apiname=="/api/statuses/replies"){
query.bindValue(1,"3");
@ -382,7 +399,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
QList<QJsonValue> newcontacts=findNewContacts(news);
if (newcontacts.size()>0){
updateContacts(newcontacts);
startImagedownload();
startImagedownload("contactlist");
} else {
if(m_updateInterval!=0){
@ -404,6 +421,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index){
//qDebug()<< "update Imagelocation " << downloadtype << " " << imageurl << " " << filename;
if (downloadtype=="contactlist"){
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
testquery.first();
@ -413,6 +431,22 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
newcontactnames.clear();
newcontactimagelinks.clear();
if(m_updateInterval!=0){
qDebug()<< "contactdownload finished!";
syncindex+=1;
startsync();
}
}
}
else if (downloadtype=="friendrequests"){
QSqlQuery testquery("SELECT avatar_static FROM friendshiprequests WHERE avatar ='"+imageurl+ "' AND username = '" +username+"'",m_db);
testquery.first();
QSqlQuery query("UPDATE friendshiprequests SET avatar_static='"+ filename +"' WHERE avatar ='"+imageurl+ "' AND username = '" +username+"'",m_db);
if(!(query.exec())) {qDebug()<< "update friendrequests Imagelocation " << query.lastError();}
if (index==(newcontactnames.length()-1)){
newcontactnames.clear();
newcontactimagelinks.clear();
if(m_updateInterval!=0){
qDebug()<< "friendrequests finished!";
syncindex+=1;
startsync();
}
@ -421,6 +455,7 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
}
QJsonObject UPDATENEWS::findNotificationContact(QString contacturl){
//qDebug()<< "findNotificationContact "<<contacturl;
QSqlQuery query("SELECT id,url FROM contacts WHERE url='"+contacturl+"' AND username='"+ username+"'",m_db);
query.first();
QJsonObject contact{
@ -442,7 +477,7 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
//main contacts
if (news[i].toObject().contains("sender") ){
if(imageurls.contains(news[i]["sender"]["profile_image_url"].toString().section('?',0,0)) || newcontactimagelinks.contains(news[i]["sender"]["profile_image_url"].toString().section('?',0,0))){
}
}
else{
newcontacts.append(news[i]["sender"]);
newcontactimagelinks.append(news[i]["sender"]["profile_image_url"].toString().section('?',0,0));
@ -462,7 +497,7 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
if (news[i].toObject().contains("friendica_activities") ){
for (int a=0; a < news[i]["friendica_activities"]["like"].toArray().count();a++){
if(imageurls.contains(news[i]["friendica_activities"]["like"][a]["profile_image_url"].toString().section('?',0,0)) || newcontactimagelinks.contains(news[i]["friendica_activities"]["like"][a]["profile_image_url"].toString().section('?',0,0))){
}
}
else{
newcontacts.append(news[i]["friendica_activities"]["like"][a]);
newcontactimagelinks.append(news[i]["friendica_activities"]["like"][a]["profile_image_url"].toString().section('?',0,0));
@ -471,7 +506,7 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
}
for (int b=0; b < news[i]["friendica_activities"]["dislike"].toArray().count();b++){
if(imageurls.contains(news[i]["friendica_activities"]["dislike"][b]["profile_image_url"].toString().section('?',0,0)) || newcontactimagelinks.contains(news[i]["friendica_activities"]["dislike"][b]["profile_image_url"].toString().section('?',0,0))){
}
}
else{
newcontacts.append(news[i]["friendica_activities"]["dislike"][b]);
newcontactimagelinks.append(news[i]["friendica_activities"]["dislike"][b]["profile_image_url"].toString().section('?',0,0));
@ -482,13 +517,13 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
//owner contacts
if (news[i].toObject().contains("friendica_author") ){
if(imageurls.contains(news[i]["friendica_author"]["profile_image_url"].toString().section('?',0,0)) || newcontactimagelinks.contains(news[i]["friendica_owner"]["profile_image_url"].toString().section('?',0,0))){
}
}
else{
newcontacts.append(news[i]["friendica_author"]);
newcontactimagelinks.append(news[i]["friendica_author"]["profile_image_url"].toString().section('?',0,0));
newcontactnames.append(news[i]["friendica_author"]["screen_name"].toString());
}
}
}
}
return newcontacts;
}
@ -585,9 +620,110 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
}
}
void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument friendrequests;
QJsonParseError jsonerror;
friendrequests=QJsonDocument::fromJson(serverreply,&jsonerror);
if (friendrequests.isArray()){
QSqlQuery imagequery("SELECT avatar FROM friendshiprequests",m_db);
QList<QString> imageurls;
while (imagequery.next()){
imageurls.append(imagequery.value(0).toString());
}
for (int i=0; i < friendrequests.array().count();i++){
QJsonValue friendrequestitem=friendrequests[i];
try{
QSqlQuery testquery("SELECT url FROM friendshiprequests WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'",m_db);
QSqlQuery query(m_db);
if (testquery.first()){
query.prepare("UPDATE friendshiprequests SET id=?, usernamef=?, acct=?, display_name=?,locked=?,"
"bot=?, discoverable=?, groupf=?, created_at=?,"
"note=?, avatar=?, header=?, header_static=?, followers_count=?,"
"following_count=?, statuses_count=?, last_status_at=?, emojis=?, fields=? "
" WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'");
query.bindValue(0, friendrequestitem["id"].toInt());
query.bindValue(1, friendrequestitem["username"]);
query.bindValue(2, friendrequestitem["acct"]);
query.bindValue(3, friendrequestitem["display_name"].toString().toUtf8().toBase64());
query.bindValue(4, friendrequestitem["locked"].toBool());
query.bindValue(5, friendrequestitem["bot"].toBool());
query.bindValue(6, friendrequestitem["discoverable"].toBool());
query.bindValue(7, friendrequestitem["group"].toBool());
query.bindValue(8, QDateTime::fromString(friendrequestitem["created_at"].toString(),Qt::ISODate).toMSecsSinceEpoch() );
query.bindValue(9, friendrequestitem["note"].toString().toUtf8().toBase64());
query.bindValue(10, friendrequestitem["avatar"]);
query.bindValue(11, friendrequestitem["header"]);
query.bindValue(12, friendrequestitem["header_static"]);
query.bindValue(13, friendrequestitem["followers_count"].toInt());
query.bindValue(14, friendrequestitem["following_count"].toInt());
query.bindValue(15, friendrequestitem["statuses_count"].toInt());
query.bindValue(16, QDateTime::fromString(friendrequestitem["last_status_at"].toString(),Qt::ISODate).toMSecsSinceEpoch() );
query.bindValue(17, friendrequestitem["emojis"].toString().toUtf8().toBase64());
query.bindValue(18, friendrequestitem["fields"].toString().toUtf8().toBase64());
}
else{
query.prepare("INSERT INTO friendshiprequests (username, id, usernamef, acct, display_name, locked,"
" created_at, followers_count, following_count, statuses_count, note, url, avatar, avatar_static, "
"header, header_static, emojis, moved, fields, bot, groupf, discoverable, last_status_at) "
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0, username);
query.bindValue(1, friendrequestitem["id"].toInt());
query.bindValue(2, friendrequestitem["username"].toString());
query.bindValue(3, friendrequestitem["acct"].toString());
query.bindValue(4, friendrequestitem["display_name"].toString().toUtf8().toBase64());
query.bindValue(5, friendrequestitem["locked"].toBool());
query.bindValue(6, QDateTime::fromString(friendrequestitem["created_at"].toString(),Qt::ISODate).toMSecsSinceEpoch());
query.bindValue(7, friendrequestitem["followers_count"].toInt());
query.bindValue(8, friendrequestitem["following_count"].toInt());
query.bindValue(9, friendrequestitem["statuses_count"].toInt());
query.bindValue(10, friendrequestitem["note"].toString().toUtf8().toBase64());
query.bindValue(11, friendrequestitem["url"].toString());
query.bindValue(12, friendrequestitem["avatar"].toString());
query.bindValue(13, "");
query.bindValue(14, friendrequestitem["header"].toString());
query.bindValue(15, friendrequestitem["header_static"].toString());
query.bindValue(16, friendrequestitem["emojis"].toString().toUtf8().toBase64());
query.bindValue(17, "false");
query.bindValue(18, friendrequestitem["fields"].toString().toUtf8().toBase64());
query.bindValue(19, friendrequestitem["bot"].toBool());
query.bindValue(20, friendrequestitem["group"].toBool());
query.bindValue(21, friendrequestitem["discoverable"].toBool());
query.bindValue(22, QDateTime::fromString(friendrequestitem["last_status_at"].toString(),Qt::ISODate).toMSecsSinceEpoch());
if(notifylist.contains("notify_FriendRequests")){
alarm.notify("Friend Request: "+ friendrequestitem["acct"].toString(),friendrequestitem["note"].toString(),0);
}
}
if(!(query.exec())) {qDebug()<< "friendrequestitem error " << query.lastError() << " " << query.lastQuery();}
} catch(...){
qDebug() << "Friendiqasync Error inserting friendrequestitem" << friendrequestitem["acct"] << " " ;
}
if(imageurls.contains(friendrequestitem["avatar"].toString() )){
}
else{
newcontactimagelinks.append(friendrequestitem["avatar"].toString());
newcontactnames.append(friendrequestitem["username"].toString());
}
}
if (newcontactimagelinks.length()>0){
qDebug() << "start Friendrequests imagedownload";
startImagedownload("friendrequests");
}
}
}
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(storeFriendrequests(QByteArray,QString)));
}
void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument events;
QJsonParseError jsonerror;
events=QJsonDocument::fromJson(serverreply,&jsonerror);
@ -616,18 +752,18 @@ void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
QJsonDocument permissionDocument; permissionDocument.setArray(permissions);
query.bindValue(13,permissionDocument.toJson(QJsonDocument::Compact));
if(!(query.exec())) {qDebug()<< "store events " << query.lastError();}
} catch(...){
qDebug() << "Friendiqasync Error event" << eventitem["name"];
}
} catch(...){
qDebug() << "Friendiqasync Error event" << eventitem["name"];
}
}
emit this->success(m_api);
emit this->success(m_api);
}
}
if(notifylist.contains("notify_Events")){
QSqlQuery eventnotifyquery("SELECT start,title FROM events WHERE (start BETWEEN " + QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()) + " AND "+QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()+(m_updateInterval*60*1000))+") AND username='"+ username +"'",m_db);
while (eventnotifyquery.next()) {
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
}
while (eventnotifyquery.next()) {
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
}
}
if(m_updateInterval!=0){
syncindex+=1;
@ -641,9 +777,9 @@ QString UPDATENEWS::url() const
return m_url;
}
void UPDATENEWS::startImagedownload()
void UPDATENEWS::startImagedownload(QString downloadtype)
{
xhr.setDownloadtype("contactlist");
xhr.setDownloadtype(downloadtype );
xhr.setFilelist(newcontactimagelinks);
xhr.setContactlist(newcontactnames);
xhr.setImagedir(m_imagedir);

View file

@ -68,11 +68,13 @@ public slots:
void startsync();
void directmessages();
void notifications();
void friendrequests();
void events();
//void startservice(QString type,QVariantMap map);
void startImagedownload();
void startImagedownload(QString downloadtype);
void updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index);
void store(QByteArray serverreply,QString apiname);
void storeFriendrequests(QByteArray serverreply,QString apiname);
void storeEvents(QByteArray serverreply,QString apiname);
void showError(QString data, QString url,QString api, int code);

View file

@ -218,7 +218,7 @@ void XHR::getlist()
{
if(dlindex < m_filelist.size()) {
QString cleanfilename;
if (m_downloadtype=="contactlist"){cleanfilename = m_contactlist.at(dlindex)+"-"+ m_filelist.at(dlindex).section('/',-1).section('?',0,0);
if (m_downloadtype=="contactlist" || m_downloadtype=="friendrequests" ){cleanfilename = m_contactlist.at(dlindex)+"-"+ m_filelist.at(dlindex).section('/',-1).section('?',0,0);
XHR::setFilename(imagedir()+"contacts/"+cleanfilename);
XHR::setUrl(m_filelist.at(dlindex));}
else {
@ -329,7 +329,7 @@ void XHR::onRequestFinished()
buffer.clear();
file.close();
emit this->downloaded(m_downloadtype,m_url,m_filename,dlindex);
if(downloadtype()=="contactlist"){dlindex=dlindex+1;XHR::getlist();}
if(downloadtype()=="contactlist" || downloadtype()=="friendrequests"){dlindex=dlindex+1;XHR::getlist();}
//reply->deleteLater();
}

View file

@ -60,12 +60,12 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
} else if(xhrequest.readyState === XMLHttpRequest.DONE) {
try{ if (xhrequest.responseText!=""){
callback(xhrequest.responseText)
}else{
}else{print("API:\n" +api+" NO RESPONSE");
showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow)
callback(xhrequest.responseText)
}
}
catch (e){showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
catch (e){print("API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText);showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)}
}
}
xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password));
@ -166,6 +166,20 @@ var where = " AND "+ filter +" = '" + filtervalue+"'";
});
}
function deleteData(database,table, username, callback,filter,filtervalue) { // reads and applies data from DB
if (filter){
var where = " AND "+ filter +" = '" + filtervalue+"'";
} else { var where="";}
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
if(!db) { return; }
db.transaction( function(tx) {
var rsArray=[];
var rs = tx.executeSql('DELETE from '+table+' WHERE username="'+username+'"'+where);
callback();
});
}
function showMessage(header,message,rootwindow){//print(message);
var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'}

View file

@ -177,7 +177,7 @@ function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){//prin
//commented out for broken remoteauth
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
//Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
try {var obj=JSON.parse(photohtml);print ("Photohtml: "+photohtml)
try {var obj=JSON.parse(photohtml);//print ("Photohtml: "+photohtml)
if (obj.hasOwnProperty('status')){
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
getAlbumFromHtml(photohtml,false,rootwindow,callback)})

View file

@ -334,7 +334,7 @@ function favorite(login,favorited,newsid,rootwindow){
}
function likerequest(login,database,verb,newsid,rootwindow){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/"+verb+"?id="+newsid, "","POST",rootwindow,function (obj){
Helperjs.friendicaPostRequest(login,"/api/friendica/activity/"+verb+"?id="+newsid, "","POST",rootwindow,function (obj){print("like "+ obj);
if (obj=='"ok"'){
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
db.transaction( function(tx) {
@ -461,14 +461,16 @@ function chatsfromdb(database,login,messagetype,callback,stop_time){
helpernews.currentconversation=[];
for (var h = 0;h<newsrs.rows.length;h++){
var helpernews2=newsrs.rows.item(h);
helpernews2.newscount=0;
helpernews2=fetchUsersForNews(database,login.username,helpernews2,allcontacts);
helpernews2.statusnet_html=Qt.atob(helpernews2.statusnet_html);
helpernews2.text=Qt.atob(helpernews2.text);//print(h+" "+helpernews2.text)
helpernews2.id=helpernews2.status_id;
helpernews2.friendica_author=objFromArray(allcontacts,"url",helpernews2.friendica_owner);
if (helpernews2.attachments!="" && helpernews2.attachments!==null){helpernews2.attachments=JSON.parse(Qt.atob(helpernews2.attachments))};
helpernews.currentconversation.push(helpernews2)
if(helpernews.id!=helpernews2.status_id){
helpernews2.newscount=0;
helpernews2=fetchUsersForNews(database,login.username,helpernews2,allcontacts);
helpernews2.statusnet_html=Qt.atob(helpernews2.statusnet_html);
helpernews2.text=Qt.atob(helpernews2.text);//print(h+" "+helpernews2.text)
helpernews2.id=helpernews2.status_id;
helpernews2.friendica_author=objFromArray(allcontacts,"url",helpernews2.friendica_owner);
if (helpernews2.attachments!="" && helpernews2.attachments!==null){helpernews2.attachments=JSON.parse(Qt.atob(helpernews2.attachments))};
helpernews.currentconversation.push(helpernews2)
}
}
newsArray.push(helpernews);
}

View file

@ -57,7 +57,8 @@ function beautify(newsitemobject,msg){
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
}
var friendica_activities={self:self}
var attachmentList=[];
var imageAttachmentList=[];
var videoAttachmentList=[];
var videoformats=["mp4", "avi", "webm","ogg","mp3"]
try{if(newsitemobject.attachments){
var attachArray=newsitemobject.attachments;
@ -71,7 +72,7 @@ function beautify(newsitemobject,msg){
else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
}
else {attachhelper.url=attachArray[image].url}
attachmentList.push(attachhelper)
imageAttachmentList.push(attachhelper)
//print("Attachhelper "+attachhelper.url)
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"")
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","")
@ -87,7 +88,7 @@ function beautify(newsitemobject,msg){
var videohelperstringposition=videotext.indexOf("."+videoformats[format]);
videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4);
videotext=videotext.substring(videohelperstringposition+4,videotext.length)
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=videohelper.url)){attachmentList.push(videohelper)}
if ((videoAttachmentList.length==0) || (videoAttachmentList[videoAttachmentList.length-1].url!=videohelper.url)){videoAttachmentList.push(videohelper)}
}
}
}
@ -101,7 +102,7 @@ function beautify(newsitemobject,msg){
ptvideohelper.url=ptvideotext.substring(ptvideotext.lastIndexOf("http",ptvideohelperstringposition),ptposend)+"-480.mp4";
ptvideohelper.url=ptvideohelper.url.replace("/videos/watch","/static/webseed");
ptvideotext=ptvideotext.substring(ptposend,ptvideotext.length)
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
if ((videoAttachmentList.length==0) || (videoAttachmentList[videoAttachmentList.length-1].url!=ptvideohelper.url)){videoAttachmentList.push(ptvideohelper)}
}
}
if (newsitemobject.text.indexOf("youtube.com/watch?v")>-1){
@ -112,11 +113,11 @@ function beautify(newsitemobject,msg){
var ythelper={mimetype:"video/youtube"}
ythelper.url=yttext.substring(ythelperstringposition+8,ytposend);
yttext=yttext.substring(ytposend,yttext.length);
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ythelper.url)){attachmentList.push(ythelper)}
if ((videoAttachmentList.length==0) || (videoAttachmentList[videoAttachmentList.length-1].url!=ythelper.url)){videoAttachmentList.push(ythelper)}
}
}
newsitemobject.attachmentList=attachmentList;
newsitemobject.videoAttachmentList=videoAttachmentList;
newsitemobject.imageAttachmentList=imageAttachmentList;
if ((msg.options.hasOwnProperty("hide_nsfw"))&&(msg.options.hide_nsfw==1)&&(newsitemobject.text.indexOf("#nsfw")>-1)){
newsitemobject.nsfw=true
} else{newsitemobject.nsfw=false}
@ -152,9 +153,9 @@ else{
if (j==0){newsitemobject.indent=0}else{
for (var k=msg.model.count-1;k>-1;k--){
if (newsitemobject.in_reply_to_status_id==msg.model.get(k).newsitemobject.id){
newsitemobject.indent=msg.model.get(k).newsitemobject.indent+1;
newsitemobject.indent=(msg.model.get(k).newsitemobject.indent||0)+1;
if (newsitemobject.indent>6){newsitemobject.indent=6};
break}
}
}
}}

View file

@ -46,7 +46,7 @@ function initDatabase(database) { // initialize the database object
tx.executeSql('CREATE TABLE IF NOT EXISTS news(username TEXT, messagetype INT, text TEXT, created_at INT, in_reply_to_status_id INT, source TEXT, status_id INT, in_reply_to_user_id INT, geo TEXT,favorited TEXT, uid INT, statusnet_html TEXT, statusnet_conversation_id TEXT,friendica_activities TEXT, friendica_activities_self TEXT, attachments TEXT, friendica_owner TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS contacts(username TEXT, id INT, name TEXT, screen_name TEXT, location TEXT,imageAge INT, profile_image_url TEXT, description TEXT, profile_image BLOB, url TEXT, protected TEXT, followers_count INT, friends_count INT, created_at INT, favourites_count TEXT, utc_offset TEXT, time_zone TEXT, statuses_count INT, following TEXT, verified TEXT, statusnet_blocking TEXT, notifications TEXT, statusnet_profile_url TEXT, cid INT, network TEXT, isFriend INT, timestamp INT)');
// tx.executeSql('CREATE INDEX IF NOT EXISTS contact_id ON contacts(id)');
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
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)');
@ -277,10 +277,12 @@ try {Helperjs.friendicaRequest(login,"/api/statusnet/config",rootwindow, functio
function readConfig(database,callback,filter,filtervalue) { // reads config
if (filter){var where = " WHERE "+ filter +" = '" + filtervalue+"'"} else { var where=""}
//print("readConfig");
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3],initDatabase(database));
db.transaction( function(tx) {
var tables = tx.executeSql("SELECT * FROM sqlite_master WHERE type='table'");
if (tables.rows.length==0){print("no database");callback("")} else {
var rs = tx.executeSql('select * from config'+where);
var rsArray=[];
if (rs.rows.length>0){
@ -289,11 +291,29 @@ function readConfig(database,callback,filter,filtervalue) { // reads config
}
var rsObject={server:rsArray[0].server,username:rsArray[0].username, password:rsArray[0].password,imagestore:rsArray[0].imagestore,isActive:rsArray[0].isActive, newsViewType:rsArray[0].newsViewType,permissions:JSON.parse(rsArray[0].permissions),maxContactAge:rsArray[0].maxContactAge,APIVersion:rsArray[0].APIVersion,addons:rsArray[0].addons};
if (rsObject.newsViewType!="" && rsObject.newsViewType!=null){updateNewsviewtype(database,rsObject.newsViewType)}
} else {var rsObject=""}
} else {print("config empty");var rsObject=""}
callback(rsObject)}}
)
}
function readAllLogins(database,callback) { // reads config
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3],initDatabase(database));
db.transaction( function(tx) {
var tables = tx.executeSql("SELECT * FROM sqlite_master WHERE type='table'");
if (tables.rows.length==0){print("no database");callback("")} else {
var rs = tx.executeSql('select * from config');
var rsArray=[];
if (rs.rows.length>0){
for(var i = 0; i < rs.rows.length; i++) {
rsArray.push(rs.rows.item(i));
rsArray[i].permissions=JSON.parse(rsArray[i].permissions)
}
}
}
callback(rsArray)}
)
}
function readActiveConfig(database){
var obj="";
readConfig(database,function(config){obj=config},"isActive", 0);
@ -312,7 +332,7 @@ 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');
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
}
@ -360,7 +380,7 @@ function updateNewsviewtype(database, newsViewtype){
db.transaction( function(tx) {
var rs1 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', ["newsViewType",newsViewtype])
var rs2 = tx.executeSql('UPDATE config SET newsViewType=""');
Helperjs.showMessage(qsTr("Changelog"),qsTr("Setting view type of news has moved from account page to config page."),root)
//Helperjs.showMessage(qsTr("Changelog"),qsTr("Setting view type of news has moved from account page to config page."),root)
})
}
@ -433,6 +453,11 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
function processNews(api,data){
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
if (api=="/api/users/show"){
var usermessages=[];
usermessages.push(newslist.status);
newslist=usermessages;
}
if (data==""){}
else if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
@ -475,49 +500,55 @@ function processNews(api,data){
newslist[n].statusnet_html=newslist[n].msg_html;
newslist[n].text=newslist[n].msg;
}
} else {//if(api!="/api/statuses/user_timeline"){
}
else {//if(api!="/api/statuses/user_timeline"){
var chatlist=[];
var conversationIds=[];
var commentCount=[];
for (var n in newslist){
newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at));
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
newslist[n].user=cleanUser(newslist[n].user);
if (newslist[n].friendica_title!="") {newslist[n].statusnet_html="<b>"+newslist[n].friendica_title +"</b><br><br>"+newslist[n].friendica_html;}
else{newslist[n].statusnet_html=newslist[n].friendica_html}
if (newslist[n]!=null){
newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at));
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
newslist[n].user=cleanUser(newslist[n].user);
if (newslist[n].friendica_title!="") {newslist[n].statusnet_html="<b>"+newslist[n].friendica_title +"</b><br><br>"+newslist[n].friendica_html;}
else{newslist[n].statusnet_html=newslist[n].friendica_html}
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
if(newslist[n].hasOwnProperty('friendica_activities')){
for (var m in newslist[n].friendica_activities.like){
newslist[n].friendica_activities.like[m]=cleanUser(newslist[n].friendica_activities.like[m]);
}
for (var o in newslist[n].friendica_activities.dislike){
newslist[n].friendica_activities.dislike[o]=cleanUser(newslist[n].friendica_activities.dislike[o]);
}
for (var p in newslist[n].friendica_activities.attendyes){
newslist[n].friendica_activities.attendyes[p]=cleanUser(newslist[n].friendica_activities.attendyes[p]);
}
for (var q in newslist[n].friendica_activities.attendno){
newslist[n].friendica_activities.attendno[q]=cleanUser(newslist[n].friendica_activities.attendno[q]);
}
for (var r in newslist[n].friendica_activities.attendmaybe){
newslist[n].friendica_activities.attendmaybe[r]=cleanUser(newslist[n].friendica_activities.attendmaybe[r]);
}
}
if(!(newslist[n].hasOwnProperty('friendica_author'))){
newslist[n].friendica_author=newslist[n].user
}
var conversationindex=conversationIds.indexOf(newslist[n].statusnet_conversation_id);
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
if(newslist[n].hasOwnProperty('friendica_activities')){
for (var m in newslist[n].friendica_activities.like){
newslist[n].friendica_activities.like[m]=cleanUser(newslist[n].friendica_activities.like[m]);
}
for (var o in newslist[n].friendica_activities.dislike){
newslist[n].friendica_activities.dislike[o]=cleanUser(newslist[n].friendica_activities.dislike[o]);
}
for (var p in newslist[n].friendica_activities.attendyes){
newslist[n].friendica_activities.attendyes[p]=cleanUser(newslist[n].friendica_activities.attendyes[p]);
}
for (var q in newslist[n].friendica_activities.attendno){
newslist[n].friendica_activities.attendno[q]=cleanUser(newslist[n].friendica_activities.attendno[q]);
}
for (var r in newslist[n].friendica_activities.attendmaybe){
newslist[n].friendica_activities.attendmaybe[r]=cleanUser(newslist[n].friendica_activities.attendmaybe[r]);
}
}
if(!(newslist[n].hasOwnProperty('friendica_author'))){
newslist[n].friendica_author=newslist[n].user
}
var conversationindex=conversationIds.indexOf(newslist[n].statusnet_conversation_id);
//fill chatlist
if (conversationindex==-1){
chatlist.push(newslist[n]);
conversationIds.push(newslist[n].statusnet_conversation_id);
commentCount.push(1);
} else{
commentCount[conversationindex]=commentCount[conversationindex]+1;
chatlist[conversationindex]=newslist[n];
//fill chatlist
if (conversationindex==-1){
chatlist.push(newslist[n]);
conversationIds.push(newslist[n].statusnet_conversation_id);
commentCount.push(1);
} else{
commentCount[conversationindex]=commentCount[conversationindex]+1;
chatlist[conversationindex]=newslist[n];
}
}
}
//enrich chatlist with old entries
@ -541,8 +572,8 @@ function processNews(api,data){
newslist.reverse();
newstab.conversation=newslist
}
else if (api=="/api/statuses/user_timeline"){
newstab.contactposts=newslist
else if (api=="/api/statuses/user_timeline" || api=="/api/users/show"){
root.contactposts=newslist
}
else if ((api!="/api/direct_messages/all")&&(api!="/api/friendica/notifications")&&(newstab.newstabstatus==="Conversations")){
showNews(chatlist);root.news=newslist

View file

@ -34,12 +34,15 @@ import QtQuick 2.11
Item {
id: calendarDay
width:7*mm
height: 7*mm
width: root.fontFactor*osSettings.bigFontSize*2//5*mm
height: root.fontFactor*osSettings.bigFontSize*2//5*mm
property int dateInt: Math.floor(Date.parse(model.date)/86400000) //Math.floor((Date.parse(model.date)-(new Date().getTimezoneOffset() * 60 * 1000))/86400000)
Rectangle {
id: placeHolder
color: 'lightblue'; antialiasing: true
color: model.today?'lightblue':'transparent';
border.color: 'lightblue'
border.width: 2
antialiasing: true
anchors.fill:parent
radius: 0.5*mm
}
@ -51,7 +54,7 @@ Item {
wrapMode: Text.WrapAnywhere
text: model.day
font.bold: model.today
font.pixelSize: 4*mm
font.pointSize: 1.2*osSettings.systemFontSize
}
Rectangle {
id:eventRect
@ -59,15 +62,15 @@ Item {
anchors.margins: 0.5*mm
anchors.bottom: calendarDay.bottom
width: parent.width-mm
height: mm
height: 0.5*osSettings.systemFontSize//mm
visible: eventdays.indexOf(dateInt)>-1
}
MouseArea {
anchors.fill: calendarDay
onClicked: {
var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
if (component.status== Component.Ready){
var eventlist = component.createObject(calendartab,{"dayint": dateInt})}
onClicked: {rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": dateInt,"events":events});
// var component = Qt.createComponent("qrc:/qml/calendarqml/EventList.qml");
// if (component.status== Component.Ready){
// var eventlist = component.createObject(calendartab,{"dayint": dateInt})}
}
}
}

View file

@ -33,8 +33,7 @@ import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQml 2.2
import Qt.labs.calendar 1.0
//import QtQuick.Controls 1.2 as Oldcontrol
import QtQuick.Layouts 1.3
//import QtQuick.Layouts 1.3
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/calendarqml"
@ -43,9 +42,9 @@ import "qrc:/qml/genericqml"
Rectangle {
id:calendarrectangle
// y:1
// width:root.width-mm
// height:root.height-5*mm
anchors.fill: parent
width:parent.width//-mm
height:parent.height//-5*mm
// anchors.fill: parent
color: '#fff'
property date currentTime: new Date()
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
@ -69,6 +68,12 @@ Rectangle {
events=eventArray;
eventdays=dayArray;
calBusy.running=false
var currentevents=events.filter(event=>(currentTime<=event.end));
for (var i=0; i<Math.min(5,currentevents.length);i++){
var liststate="";
eventModel.append({"event":currentevents[i],"eventstatus":liststate});
}
})
}
}
@ -83,6 +88,30 @@ Rectangle {
running: false
}
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
LeftDrawerLinux{
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
height: root.height-bar.height
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
MButton{
id: updateEvents
@ -90,8 +119,7 @@ Rectangle {
anchors.topMargin: 0.5*mm
anchors.right:calendartabstatusButton.left
anchors.rightMargin:mm
height: 6*mm
width: 8*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text:"\uf021"
onClicked: {
calBusy.running=true;
@ -103,7 +131,7 @@ Rectangle {
// })
}}
Connections{
Connections{
target: updatenews
function onSuccess(api){
@ -119,15 +147,15 @@ Connections{
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
height: 6*mm
width: Math.max(10*mm,implicitWidth)
width: Math.max(6*root.fontFactor*osSettings.bigFontSize,implicitWidth)
text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus
Menu {
id:calendartabmenu
width: 40*mm
width: 20*root.fontFactor*osSettings.systemFontSize
MenuItem {
text: qsTr("Own Calendar")
font.pixelSize: 3*mm
//font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
onTriggered: {
calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar");
@ -140,39 +168,50 @@ Connections{
ListView{
id: calendarView
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
y:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm//newstabitem.width/3*2:newstabitem.width
x: leftDrawer.width
height: 18*root.fontFactor*osSettings.bigFontSize //parent.height-9*mm
clip: true
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
// currentIndex: count
// onCurrentIndexChanged:{print("Index "+currentIndex)}
model: CalendarModel {id:calendarModel
from: new Date()
to: new Date(new Date().valueOf()+93312000000)
}
delegate:
ColumnLayout{
width:calendarView.width
Item{
width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
height: parent.height
Text{
font.bold: true
Layout.fillWidth: true
//Layout.fillWidth: true
width: parent.width-root.fontFactor*osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter
text: model.year
font.pointSize: osSettings.systemFontSize
}
Text{
Text{y:1.5*root.fontFactor*osSettings.bigFontSize
width: parent.width-osSettings.bigFontSize
text: Qt.locale().standaloneMonthName(model.month)
Layout.fillWidth: true
horizontalAlignment:Text.AlignHCenter
//Layout.fillWidth: true
horizontalAlignment:Text.AlignHCenter
font.pointSize: osSettings.systemFontSize
}
DayOfWeekRow{
DayOfWeekRow{y:3*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
locale: monthgrid.locale
Layout.fillWidth: true
font.pixelSize: 3*mm
//Layout.fillWidth: true
font.pointSize: osSettings.systemFontSize
}
MonthGrid {
MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
id: monthgrid
Layout.fillWidth: true
height: parent.height-5*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
month: model.month
year: model.year
locale: Qt.locale()
@ -180,8 +219,24 @@ Connections{
}
}
ScrollIndicator.horizontal: ScrollIndicator { }
Component.onCompleted: positionViewAtBeginning()
}
ListView {
id: eventlistView
y:20*root.fontFactor*osSettings.bigFontSize
x: leftDrawer.width
height: parent.height-20*root.fontFactor*osSettings.bigFontSize
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm
clip: true
model: eventModel
delegate: EventListItem{}
}
ListModel{
id: eventModel
}
Component.onCompleted: {
root.eventSignal.connect(showEvents);
if (calendartab.calendartabstatus=="Events"){showEvents("")}

View file

@ -34,101 +34,47 @@ import QtQuick.Controls 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml/calendarqml"
Rectangle{
id:eventList
z:2
border.color: "grey"
width: parent.width-4*mm
height:parent.height-12*mm
x:mm
y:mm
radius: 0.5*mm
// height: parent.height
// width:parent.width
//radius: 0.5*mm
property var daylist:[]
property int dayint: 0
property var events:[]
MButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
height: 6*mm
width: 8*mm
text: "\uf057"
onClicked:{eventList.destroy()}
onClicked:{rootstackView.pop()}
}
ListView {
id: eventlistView
y:closeButton.height+2*mm
width: eventList.width-4*root.fontFactor*osSettings.bigFontSize
height: eventList.height-closeButton.height-root.fontFactor*osSettings.bigFontSize
clip: true
model: eventModel
delegate: EventListItem{}
}
ListView {
id: eventlistView
x: mm
y:closeButton.height+2*mm
width: eventList.width-2*mm
height: eventList.height-closeButton.height-4*mm
clip: true
model: eventModel
delegate: eventItem
}
ListModel{
id: eventModel
}
ListModel{
id: eventModel
}
Component.onCompleted:{//print("daylist"+JSON.stringify(daylist) + dayint)
Component.onCompleted:{//print("daylist"+JSON.stringify(events) + dayint)
var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
for (var i=0; i<currentevents.length;i++){
var liststate="";if(currentevents.length<2){liststate="large"};
//print(JSON.stringify(events[daylist[i]]));
eventModel.append({"event":currentevents[i],"eventstatus":liststate});
}
}
Component{
id:eventItem
Rectangle{
property string status: eventstatus
width:eventlistView.width
height:eventNameText.height+eventDetailsText.height+mm
border.color: "light grey"
border.width: 1
radius: 0.5*mm
Image {
id:profileImage
source: ((event.eventOwner.profile_image!="") && (typeof(event.eventOwner.profile_image)=="string"))? "file://"+event.eventOwner.profile_image : event.eventOwner.profile_image_url
x:1
y:1
width: 7*mm
height: 7*mm
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text {
id:eventNameText
x: 8*mm
width:parent.width-8*mm
height:contentHeight
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +(event.end>0?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):" ")+": "+event.title //+calendarrectangle.offsetTime
font.pixelSize: 3*mm
wrapMode:Text.Wrap
}
Text {
id:eventDetailsText
x:8*mm
z:4
width: parent.width-8*mm
height: contentHeight
textFormat: Text.RichText
text: status==""?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)//Qt.atob(event.html)
anchors.top: eventNameText.bottom
font.pixelSize: 3*mm
wrapMode:Text.Wrap
onLinkActivated:{Qt.openUrlExternally(link)}
}
MouseArea{
anchors.fill: parent
onClicked:{if (status==""){status="large"} else {status=""}
}
}
}
}
}

View file

@ -0,0 +1,90 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml/calendarqml"
Rectangle{
id:eventItem
property string status: eventstatus
property var currEvent: event
width:parent.width
height:eventNameText.height+eventDetailsText.height+mm
border.color: "light grey"
border.width: 1
radius: 0.5*mm
Image {
id:profileImage
source: ((event.eventOwner.profile_image!="") && (typeof(event.eventOwner.profile_image)=="string"))? "file://"+event.eventOwner.profile_image : event.eventOwner.profile_image_url
x:1
y:1
width: 7*mm
height: 7*mm
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text {
id:eventNameText
x: 8*mm
width:parent.width-8*mm
height:contentHeight
font.pointSize: osSettings.systemFontSize
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":\n"+event.title //+calendarrectangle.offsetTime
wrapMode:Text.Wrap
}
Text {
id:eventDetailsText
x:8*mm
z:4
width: parent.width-8*mm
height: contentHeight
textFormat: Text.RichText
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)//Qt.atob(event.html)
anchors.top: eventNameText.bottom
font.pointSize: osSettings.systemFontSize
wrapMode:Text.Wrap
onLinkActivated:{Qt.openUrlExternally(link)}
}
MouseArea{
anchors.fill: parent
onClicked:{
if (status==""){
rootstackView.push("qrc:/qml/calendarqml/EventList.qml",{"dayint": event.startday, "events":[event]});
} else {rootstackView.pop()}
}
}
}

View file

@ -32,7 +32,7 @@
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "qrc:/js/service.js" as Service
import "qrc:/js/layout.js" as Layoutjs
import "qrc:/js/helper.js" as Helperjs
@ -55,22 +55,21 @@ Page{
servericon.source=serverdata.site.logo})} catch(e){print(e)}
}
Button{
MButton{
id:userButton
height: 8*mm
text:qsTr("User")
//font.pixelSize: 3*mm
font.pointSize: 16
x: mm
y: mm
width: root.width/2
font.pointSize: osSettings.bigFontSize
x: root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: root.width/2 - 2*mm
height: 2*root.fontFactor*osSettings.bigFontSize
visible: users.length>0
onClicked:{
var useritems="";
for (var i=0;i<accountPage.users.length;i++){
useritems=useritems+"MenuItem{font.pixelSize: 3*mm;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
useritems=useritems+"MenuItem{font.pointSize: osSettings.bigFontSize;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
@ -82,43 +81,17 @@ Page{
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
},'username','"+ accountPage.users[i].username+"')}}"
}
var menuString="import QtQuick.Controls 2.12;import 'qrc:/js/service.js' as Service; Menu {"+useritems+"}";
var menuString="import QtQuick.Controls 2.12;import 'qrc:/js/service.js' as Service;"+
" Menu {width:8*root.fontFactor*osSettings.bigFontSize;"+useritems+"}";
var userlistObject=Qt.createQmlObject(menuString,accountPage,"usermenuOutput")
userlistObject.popup() }
}
Text {
text: qsTr("Server")
//font.pixelSize:3*mm
font.pointSize: 16
x: 4*mm; y: 10*mm
}
Text {
text: qsTr("Nickname")
//font.pixelSize:3*mm
font.pointSize: 16
x: 4*mm; y: 20*mm
}
Text {
text: qsTr("Password")
//font.pixelSize:3*mm
font.pointSize: 16
x: 4*mm; y: 30*mm
}
Text {
id: imagedirlabel
visible: imagestore.text!=""
text: qsTr("Image dir.")
//font.pixelSize:3*mm
font.pointSize: 16
x: 4*mm; y: 40*mm
}
Image{
id:servericon
x:4*mm;y:13.5*mm
width:5*mm; height: 5*mm
x:root.fontFactor*osSettings.bigFontSize;y:3*root.fontFactor*osSettings.bigFontSize
width:2.5*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
visible: false
source:""
MouseArea{
@ -129,102 +102,87 @@ Page{
}
}
}
Button{
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
MButton{
id:serverSearchButton
text:"\uf002"
font.pixelSize: 3*mm
font.pointSize: 16
x:4*mm
y:13.5*mm
width: 5*mm; height:5*mm
icon.name: "search"
font.pointSize: osSettings.bigFontSize
x:root.fontFactor*osSettings.bigFontSize
y:3*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize; height:2*root.fontFactor*osSettings.bigFontSize
visible: servericon.visible?false:true
onClicked:{Qt.openUrlExternally(Qt.resolvedUrl("https://dir.friendica.social/servers"))}
}
Rectangle{color: "light grey"; x: 10*mm; y: 13.5*mm; width: root.width-12*mm; height: 5*mm;}
Flickable {
id: servernameFlickable
x: 10*mm; y: 13.5*mm; width: root.width-12*mm; height: 5*mm;
contentWidth: servername.paintedWidth
contentHeight: servername.paintedHeight
clip: true
TextEdit {
id: servername
width: servernameFlickable.width
height: servernameFlickable.height
focus: true
//font.pixelSize:3*mm
font.pointSize: 16
text:"https://"
onEditingFinished:{
if((servername.text).substring(0,11) =="https://http"){
serverstring.text= (serverstring.text).substring(8)
}
accountPage.setServericon(servername.text)
}
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable)
}
}
Rectangle{
color: "light grey"
x: 4*mm; y: 23.5*mm; width: root.width-6*mm; height: 5*mm;
TextInput {
id: username
anchors.fill: parent
//font.pixelSize:3*mm
font.pointSize: 16
selectByMouse: true
onEditingFinished:{
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
TextField {
id: servername
x: 4*root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize; width: root.width-18*mm; //height: 5*mm;
placeholderText: qsTr("Server")
font.pointSize: osSettings.systemFontSize
onEditingFinished: {
if ((servername.text)==""){}
else if((servername.text).substring(0,7) !=="https://"){
servername.text= "https://"+text//(serverstring.text).substring(8)
}
imagestoredir=filesystem.homePath+"/"+username.text+"/"
//if (imagestore.text==filesystem.homePath+"/.friendiqa/"){imagestore.text=filesystem.homePath+"/.friendiqa/"+username.text+"/"}
}
}
accountPage.setServericon(servername.text)}
}
// Button {
// x: root.width-9*mm; y: 23.5*mm; width:5*mm; height:5*mm
// text: "\uf234"
// font.pixelSize: 3*mm
// onClicked: {
// root.push("qrc:/qml/configqml/RegisterPage.qml",{url:servername.text+"/register?nickname="+username.getText(0,username.length)})
// }
// }
Rectangle{
color: "light grey"
x: 4*mm; y: 33.5*mm; width: root.width-6*mm; height: 5*mm;
TextInput {
id: password
anchors.fill: parent
//font.pixelSize:3*mm
font.pointSize: 16
selectByMouse: true
echoMode: TextInput.PasswordEchoOnEdit
TextField {
id: username
x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Nickname")
selectByMouse: true
onEditingFinished: {
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
}
imagestoredir=filesystem.homePath+"/"+username.text+"/"
//if (imagestore.text==filesystem.homePath+"/.friendiqa/"){imagestore.text=filesystem.homePath+"/.friendiqa/"+username.text+"/"}
}
}
TextField {
id: password
x: root.fontFactor*osSettings.bigFontSize; y: 9*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
//font.pixelSize:3*mm
font.pointSize: osSettings.systemFontSize
selectByMouse: true
echoMode: TextInput.Password
placeholderText: qsTr("Password")
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhSensitiveData
}
Text {
id: imagedirlabel
visible: imagestore.text!=""
text: qsTr("Image dir.")
font.pointSize: osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y: 12*root.fontFactor*osSettings.bigFontSize
}
TextField {
id: imagestore
x: root.fontFactor*osSettings.bigFontSize; y: 13*root.fontFactor*osSettings.bigFontSize; width: root.width-17*mm; //height: 5*mm;
visible:imagestore.text!=""
font.pointSize: osSettings.systemFontSize
selectByMouse: true
text: "" //filesystem.homePath+"/.friendiqa/"+username.text+"/" //(osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
wrapMode: TextEdit.NoWrap
onTextChanged: imagestoredir=imagestore.text
}
MButton {
x: root.width-3*root.fontFactor*osSettings.bigFontSize; y: 13*root.fontFactor*osSettings.bigFontSize;
height: 2*root.fontFactor*osSettings.bigFontSize;
visible:imagestore.text!=""
text: "..."
font.pointSize: osSettings.bigFontSize
onClicked:{imagestoreDialog.open()}
}
Rectangle{color: "light grey"; x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;visible:imagestore.text!=""}
Flickable {
id: imagestoreFlickable
visible:imagestore.text!="" //filesystem.homePath+"/"+username.text+"/""
x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;
clip: true
TextInput {
id: imagestore
width: imagestoreFlickable.width
height: imagestoreFlickable.height
//font.pixelSize:3*mm
font.pointSize: 16
text: "" //filesystem.homePath+"/.friendiqa/"+username.text+"/" //(osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
wrapMode: TextEdit.NoWrap
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
onTextChanged: imagestoredir=imagestore.text
}
}
FileDialog {
id: imagestoreDialog
@ -238,76 +196,66 @@ Page{
}
}
Button {
x: root.width-9*mm; y: 43.5*mm; width: 5*mm; height: 5*mm;
visible:imagestore.text!=""
text: "..."
//font.pixelSize: 3*mm
font.pointSize: 16
onClicked:{imagestoreDialog.open()}
}
BusyIndicator{
id: accountBusy
anchors.horizontalCenter: parent.horizontalCenter
y: 53.5*mm
y: 16*root.fontFactor*osSettings.bigFontSize
width:10*mm
height: 10*mm
running: false
}
Button {
x: 4*mm; y: 53.5*mm
height: 8*mm
MButton {
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Confirm")
//font.pixelSize: 3*mm
font.pointSize: 16
font.pointSize: osSettings.bigFontSize
onClicked:{
accountBusy.running=true;
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
//else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory 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=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
else {errormessage=""}
if (errormessage=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
accountBusy.running=false;
var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('status')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text)
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{//filesystem.Directory=filesystem.homePath;
filesystem.makePath(filesystem.homePath+"/"+username.text);
}
filesystem.Directory=imagestoredir //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;
});
accountPage.users=storedUsers});
var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('status')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
//print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text)
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{//filesystem.Directory=filesystem.homePath;
filesystem.makePath(filesystem.homePath+"/"+username.text);
}
filesystem.Directory=imagestoredir //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;
});
accountPage.users=storedUsers});
//reset values
root.login=userconfig;
root.news=[];
rootstack.currentIndex=0;
root.newstypeSignal("refresh");
},"isActive",0);
login=userconfig;
news=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
//Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc});
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
rootstackView.pop()
}
});
@ -316,79 +264,82 @@ Page{
}}
Button {
x: parent.width/2+2*mm; y: mm; width: 5*mm; height: 8*mm;
visible: users.length>0
text: "-"
//font.pixelSize: 3*mm
font.pointSize: 16
onClicked:{
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
Service.deleteConfig(db,userconfig,function(){
filesystem.Directory=imagestore.text+"contacts";
filesystem.rmDir();
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
servername.text="https://";
servericon.visible=false;
servericon.source="";
username.text="";
password.text="";
imagestore.text="";
//maxNews.value=0;
//newsTypeField.text="Conversations";
//messageIntervalSlider.value=30;
userButton.text=qsTr("User");
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;})
})
}}
Button {
x: parent.width/2+8*mm; y: mm; width: 5*mm; height: 8*mm;
visible: users.length>0
text: "+"
//font.pixelSize: 3*mm
font.pointSize: 16
onClicked:{
servername.text="https://"
servericon.visible=false;
servericon.source="";
username.text=""
password.text=""
imagestore.text="" //filesystem.homePath+"/.friendiqa/"+username.text//""
userButton.text=qsTr("User")
}
}
Button {
x: parent.width/2+14*mm; y: mm; width: 5*mm; height: 8*mm;
text: "?"
//font.pixelSize: 3*mm
font.pointSize: 16
onClicked:{
root.push("qrc:/qml/configqml/InfoBox.qml");
}
}
Button{
id:closeButton
height: 8*mm
width: 5*mm
visible: users.length>0
Row{
spacing:0.5*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.topMargin: root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
//font.pixelSize: 3*mm
font.pointSize: 16
onClicked:{root.pop()}
}
MButton {
//x: parent.width/2+4*mm; y: mm;
width: 5*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
visible: users.length>0
text: "-"
font.pointSize: osSettings.bigFontSize
onClicked:{
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
Service.deleteConfig(db,userconfig,function(){
filesystem.Directory=imagestore.text+"contacts";
filesystem.rmDir();
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
servername.text="https://";
servericon.visible=false;
servericon.source="";
username.text="";
password.text="";
imagestore.text="";
//maxNews.value=0;
//newsTypeField.text="Conversations";
//messageIntervalSlider.value=30;
userButton.text=qsTr("User");
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;})
})
}}
MButton {
//x: parent.width/2+10*mm; y: mm; //width: 5*mm; height: 8*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
visible: users.length>0
text: "+"
font.pointSize: osSettings.bigFontSize
onClicked:{
servername.text="https://"
servericon.visible=false;
servericon.source="";
username.text=""
password.text=""
imagestore.text="" //filesystem.homePath+"/.friendiqa/"+username.text//""
userButton.text=qsTr("User")
}
}
MButton {
//x: parent.width-12*mm; y: mm; //width: 5*mm; height: 8*mm;
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
text: "?"
font.pointSize: osSettings.bigFontSize
onClicked:{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
MButton{
id:closeButton
//height: 3*root.fontFactor*osSettings.bigFontSize
width: 5*mm;
visible: users.length>0
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}
Component.onCompleted: {
try{Helperjs.readData(db,"config","",function(storedUsers){

View file

@ -38,40 +38,42 @@ import "qrc:/qml/configqml"
import "qrc:/qml/genericqml"
Page{
//anchors.fill: parent
//anchors.fill: parent
width:root.width
height:root.height
Rectangle{
x: 4*mm; y:13.5*mm; width: parent.width - 14*mm; height: 5*mm;
color:"light grey"
x: root.fontFactor*osSettings.bigFontSize; y:4*root.fontFactor*osSettings.bigFontSize;
width: parent.width - 6*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize
color:"#F3F3F3"
radius: 0.5*mm
Text{
anchors.fill: parent
font.pixelSize:3*mm
font.pointSize: osSettings.bigFontSize
text:qsTr("Sync")
}
MouseArea{
anchors.fill:parent
onClicked:root.push("qrc:qml/configqml/SyncConfig.qml");
onClicked:rootstackView.push("qrc:qml/configqml/SyncConfig.qml");
}
}
Text {
text: qsTr("News as")
font.pixelSize:3*mm
x: 4*mm; y: 20*mm
font.pointSize:osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y: 8*root.fontFactor*osSettings.bigFontSize
}
Rectangle{
x: 4*mm; y: 23.5*mm; width: newsTypeField.contentWidth+2*mm; height: 5*mm;
color:"light grey"
radius: 0.5*mm
Text{
id: newsTypeField
anchors.fill: parent
font.pixelSize:3*mm
text:qsTr("Conversations")
x: root.fontFactor*osSettings.bigFontSize; y: 10*root.fontFactor*osSettings.bigFontSize;
width: newsTypeField.contentWidth+2*mm; height: 2*root.fontFactor*osSettings.bigFontSize
color:"#F3F3F3"
radius: 0.5*mm
Text{
id: newsTypeField
anchors.fill: parent
font.pointSize:osSettings.bigFontSize
text:qsTr("Conversations")
}
MouseArea{
anchors.fill:parent
@ -80,38 +82,43 @@ Page{
}
Menu {
id:newstypemenu
width:8*root.fontFactor*osSettings.bigFontSize
MenuItem {
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
text: qsTr("Timeline")
onTriggered: {newsTypeField.text=qsTr("Timeline");
Service.updateglobaloptions(root.db,"newsViewType","Timeline");}
}
}
MenuItem {
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
text: qsTr("Conversations")
onTriggered: {newsTypeField.text=qsTr("Conversations");
Service.updateglobaloptions(root.db,"newsViewType","Conversations");}
}
}
}
Text {
text: qsTr("Max. News")
font.pixelSize:3*mm
x: 4*mm; y:30*mm
font.pointSize: osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y:14*root.fontFactor*osSettings.bigFontSize
}
Slider{ id: maxNews
x:19*mm; y: 33.5*mm;width: root.width/2;height:5*mm
x:6*root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize;
width: root.width/2;height:2*root.fontFactor*osSettings.bigFontSize
from: 0;to:2000; stepSize: 100
value: root.globaloptions.hasOwnProperty("max_news")?root.globaloptions.max_news:1000
}
Rectangle{color: "light grey"; x: 4*mm; y: 33.5*mm; width: 9*mm; height: 5*mm;
Rectangle{
color: "#F3F3F3";
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize;
width: 4*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize;
radius: 0.5*mm
TextEdit{id:maxNewsText;
anchors.fill: parent
font.pixelSize:3*mm
font.pointSize: osSettings.bigFontSize
verticalAlignment:TextEdit.AlignRight
text:maxNews.value
selectByMouse: true
@ -125,10 +132,9 @@ Page{
CheckBox{
id: nsfwCheckbox
x: 4*mm
y: 43.5*mm
font.pixelSize: 3*mm
//width:5*mm
x: root.fontFactor*osSettings.bigFontSize
y: 20*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.bigFontSize
text: qsTr("Hide #nsfw?")
checked:(globaloptions["hide_nsfw"]==1)?true:false
onClicked: {
@ -146,24 +152,24 @@ Page{
MButton {
anchors.right: closeButton.left; anchors.rightMargin: mm;
anchors.top: parent.top
anchors.topMargin: 1*mm
width: 8*mm; height: 6*mm;
anchors.topMargin:root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "?"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onClicked:{
root.push("qrc:/qml/configqml/InfoBox.qml");
}
}
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
MButton{
id:closeButton
height: 6*mm
width :8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{root.pop()}
id:closeButton
// height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize;
anchors.top: parent.top
anchors.topMargin:root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}

View file

@ -33,39 +33,38 @@ import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Rectangle{
color:"white"
width:infoBoxText.contentWidth
height:infoBoxText.contentHeight
Page{
//color:"white"
// width:infoBoxText.contentWidth
// height:infoBoxText.contentHeight
Text{id:infoBoxText
anchors.top:closeButton.bottom
anchors.topMargin: mm
textFormat: Text.RichText
width: root.width-mm
font.pointSize: osSettings.systemFontSize
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.5.4 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.6 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+
"Code by <a href='https://freunde.ma-nic.de/profile/pankraz'>Marco</a><br>"+
"Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+
"Icons by <a href='http://fontawesome.io'>FontAwesome</a><br>"+
"Folder Icon by <a href='https://github.com/KDE/breeze-icons'>KDE Breeze Icons</a><br>"+
"AndroidNative by <a href='https://github.com/benlau/androidnative.pri'>Ben Lau</a><br>"+
"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href='http://www.openssl.org/'>http://www.openssl.org/</a>)"
onLinkActivated:{
"Code by <a href='https://freunde.ma-nic.de/profile/pankraz'>Marco</a><br>"+
"Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+
"Icons by <a href='http://fontawesome.io'>FontAwesome</a><br>"+
"Folder Icon by <a href='https://github.com/KDE/breeze-icons'>KDE Breeze Icons</a><br>"+
"AndroidNative by <a href='https://github.com/benlau/androidnative.pri'>Ben Lau</a><br>"+
"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (<a href='http://www.openssl.org/'>http://www.openssl.org/</a>)"
onLinkActivated:{
Qt.openUrlExternally(link)}
}
Button{
id:closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{root.pop()}
}
}
MButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}

View file

@ -0,0 +1,113 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
import "qrc:/js/service.js" as Service
ScrollView{
id:leftDrawerScrollviewId
clip: true
width:parent.width-mm
height: parent.height
contentHeight: leftDrawerColumn.height
property string currentnewstabstatus:root.globaloptions.hasOwnProperty("newsViewType")?root.globaloptions.newsViewType:"Conversations";
Column{
id:leftDrawerColumn
x:mm
y:0.5*root.fontFactor*osSettings.bigFontSize
width:parent.width-2*mm
height: 4*root.fontFactor*osSettings.bigFontSize
spacing: 0.7*root.fontFactor*osSettings.bigFontSize
Label{
width:implicitWidth
font.pointSize: osSettings.systemFontSize
text: "\uf085 "+ qsTr("Settings")
MouseArea{
anchors.fill:parent
onClicked:{rootstackView.push("qrc:qml/configqml/ConfigPage.qml");
if(!wideScreen){leftDrawerAndroid.close()}
}
}
}
Label{y: 2*root.fontFactor*osSettings.bigFontSize
width:implicitWidth
font.pointSize: osSettings.systemFontSize
text: "\uf2bb " + qsTr("Accounts")
MouseArea{
anchors.fill:parent
onClicked:{rootstackView.push("qrc:qml/configqml/AccountPage.qml");
if(!wideScreen){leftDrawerAndroid.close()}
}
}
}
Label{y: 4*root.fontFactor*osSettings.bigFontSize
width:implicitWidth
font.pointSize: osSettings.systemFontSize
text: "\uf08b " +qsTr("Quit")
MouseArea{
anchors.fill:parent
onClicked:{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})})
}
}
}
}
Component.onCompleted:{
Service.readAllLogins(db,function(accounts){
if (accounts.length>0 && bar.currentIndex==0){
leftDrawerColumn.height=4.5*root.fontFactor*osSettings.bigFontSize+accounts.length*13*root.fontFactor*osSettings.bigFontSize
for(var i = 0; i < accounts.length; i++) {
var accountComponent = Qt.createComponent("qrc:/qml/genericqml/DrawerAccountComponent.qml");
var accountQml = accountComponent.createObject(leftDrawerColumn,{
"y":4.5*root.fontFactor*osSettings.bigFontSize+i*13*root.fontFactor*osSettings.bigFontSize,
"currentnewstabstatus":currentnewstabstatus,
"account":accounts[i]});
}
}else if(accounts.length>0 && bar.currentIndex==1){
leftDrawerColumn.height=4.5*root.fontFactor*osSettings.bigFontSize+accounts.length*6.5*root.fontFactor*osSettings.bigFontSize
for(var i = 0; i < accounts.length; i++) {
var accountComponent = Qt.createComponent("qrc:/qml/genericqml/DrawerAccountComponentContacts.qml");
var accountQml = accountComponent.createObject(leftDrawerColumn,{
"y":4.5*root.fontFactor*osSettings.bigFontSize+i*6.5*root.fontFactor*osSettings.bigFontSize,
"account":accounts[i]});
}
}
})}
}

View file

@ -37,6 +37,8 @@ QtObject{
property int backKey: Qt.Key_Back
//property string attachImageDir:filesystem.cameraPath+"/"
property string osType: "Android"
property int systemFontSize: root.font.pointSize*1.1
property int bigFontSize: systemFontSize*1.3
property string imagePickQml: "ImagePicker"
property string imagePicker:'import QtQuick 2.0; import "qrc:/qml/genericqml";'+
imagePickQml+'{multiple : true;onReady: {attachImageURLs.push(imageUrl);'+

View file

@ -32,10 +32,12 @@
import QtQuick.Window 2.0
import QtQuick 2.0
QtObject{
property real appWidth: Screen.desktopAvailableWidth/3
property real appHeight: Screen.desktopAvailableHeight/3*2
property real appWidth: Screen.desktopAvailableWidth/4*3
property real appHeight: Screen.desktopAvailableHeight/4*3
property int backKey: Qt.Key_Escape
property string osType: "Linux"
property int systemFontSize: root.font.pointSize*1.1
property int bigFontSize: systemFontSize*1.5
//property string attachImageDir:filesystem.homePath+"/Pictures/"
property string imagePickQml: "ImagePickerLinux"
}

View file

@ -36,10 +36,7 @@ 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
@ -55,13 +52,13 @@ Rectangle{
}
Button{
id:closeButton
height:6*mm
height: 3*root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onClicked:{root.pop()}
}
}

View file

@ -39,22 +39,22 @@ Rectangle{
color: "#EEEEEE" //Material.Grey
property string adapter: ""
width: parent.width
height: 12*mm
height: 4*root.fontFactor*osSettings.bigFontSize
Label{
x: mm
y: 0.5*mm
font.pixelSize:3*mm
font.pointSize: osSettings.systemFontSize
text: qsTr(adapter)
}
CheckBox{
id: syncCheckbox
x: mm
y: 5*mm
width:20*mm
y: root.fontFactor*osSettings.bigFontSize
width: 10*root.fontFactor*osSettings.bigFontSize
checked:(globaloptions["sync_"+adapter]==1)?true:false
//style: CheckBoxStyle {
text: qsTr("sync")
font.pixelSize:3*mm
font.pointSize: osSettings.bigFontSize
onClicked: {
toggle();
if(syncCheckbox.checked==true){
@ -67,13 +67,13 @@ Rectangle{
}
CheckBox{
id: notifyCheckbox
x:25*mm
y: 5*mm
width:25*mm
x: 10*root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: 10*root.fontFactor*osSettings.bigFontSize
enabled: adapter!="Notifications"
checked:(globaloptions["notify_"+adapter]==1)?true:false
text: qsTr("notify")
font.pixelSize:3*mm
font.pointSize: osSettings.bigFontSize
onClicked: {
toggle();
if(notifyCheckbox.checked==true){

View file

@ -43,44 +43,50 @@ Rectangle{
//height:root.height
Text {
text: qsTr("Sync Interval (0=None)")
font.pixelSize:3*mm
font.pointSize: osSettings.bigFontSize
//visible: false
x: 4*mm; y: 10*mm; //width:35*mm;wrapMode: Text.Wrap
x: root.fontFactor*osSettings.bigFontSize; y: root.fontFactor*osSettings.bigFontSize; //width:35*mm;wrapMode: Text.Wrap
}
Slider{ id: messageIntervalSlider
x:22*mm; y: 13.5*mm;width: root.width/2;height:5*mm
x:8*root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize;
width: root.width-10*root.fontFactor*osSettings.bigFontSize;
height:2*root.fontFactor*osSettings.bigFontSize
value: globaloptions.hasOwnProperty("syncinterval")?globaloptions.syncinterval:0
from: 0;to:120; stepSize: 15
}
Rectangle{
x: 4*mm; y: 13.5*mm; width: 9*mm; height: 5*mm;
TextEdit{
id: messageIntervalField
anchors.fill: parent
font.pixelSize:3*mm
verticalAlignment:TextEdit.AlignRight
text:messageIntervalSlider.value
focus: true
selectByMouse: true
onTextChanged: {
Service.updateglobaloptions(root.db,"syncinterval",text);
if(osSettings.osType=="Android"){
x: root.fontFactor*osSettings.bigFontSize; y:4*root.fontFactor*osSettings.bigFontSize;
width: 4*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize;
TextEdit{
id: messageIntervalField
anchors.fill: parent
font.pointSize: osSettings.bigFontSize
verticalAlignment:TextEdit.AlignRight
text:messageIntervalSlider.value
focus: true
selectByMouse: true
onTextChanged: {
Service.updateglobaloptions(root.db,"syncinterval",text);
if(osSettings.osType=="Android"){
//print("setalarm")
alarm.setAlarm(text);
} else if(osSettings.osType=="Linux" && text !=0){
root.updateSyncinterval(parseInt(text))
}
}
} else if(osSettings.osType=="Linux" && text !=0){
root.updateSyncinterval(parseInt(text))
}
}
}
}
Text{x: 14*mm; y: 13.5*mm; width: 5*mm; height: 5*mm;
font.pixelSize:3*mm
Text{x: 6*root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize;
width: 2*root.fontFactor*osSettings.bigFontSize; height: 1.5*root.fontFactor*osSettings.bigFontSize;
font.pointSize: osSettings.bigFontSize
text:qsTr("Min.")
}
ScrollView{
width: root.width
height: root.height - 25*mm;y:22*mm
height: root.height - 10*root.fontFactor*osSettings.bigFontSize;
y:7*root.fontFactor*osSettings.bigFontSize
clip:true
Column{
//height: implicitHeight
@ -92,19 +98,19 @@ Rectangle{
SyncComponent{ adapter:"DirectMessages"}
SyncComponent{ adapter:"Notifications"}
SyncComponent{ adapter: "Events"}
SyncComponent{adapter: "FriendRequests"}
}
}
MButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
height: 6*mm
width: 8*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{root.pop()}
}
MButton{
id:closeButton
anchors.top: parent.top
anchors.topMargin: osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}

View file

@ -47,41 +47,41 @@ Rectangle {
height:groupListView.height
ListView {
id: contactView
x:mm
y:6*mm
width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm
clip: true
spacing: 0
model: contactModel
delegate: listContact
}
id: contactView
x:mm
y:6*mm
width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm
clip: true
spacing: 0
model: contactModel
delegate: listContact
}
ListModel{id: contactModel}
ListModel{id: contactModel}
Component { id:listContact
Rectangle{
border.color: "#EEEEEE"
border.width: 1
radius:0.5*mm
width:contactView.width
height:6*mm
Image {
id: contactImage
x:1
y:1
width: 5*mm
height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
anchors.left: contactImage.right
anchors.margins: 1*mm
text:Qt.atob(contact.name)
}
Component { id:listContact
Rectangle{
border.color: "#EEEEEE"
border.width: 1
radius:0.5*mm
width:contactView.width
height:6*mm
Image {
id: contactImage
x:1
y:1
width: 5*mm
height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right
anchors.margins: 1*mm
text:Qt.atob(contact.name)
}
Text {
id:selected
anchors.right:parent.right
@ -91,40 +91,38 @@ Rectangle {
width: 5*mm
anchors.top: parent.top
color: "green"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
}
MouseArea{
MouseArea{
anchors.fill: parent
onClicked:{
if(selected.visible==true){
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false
}
else{
contacts.push(contact);
selected.visible=true;
}
}
}
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false
}
else{
contacts.push(contact);
selected.visible=true;
}
}
}
}
}
}
MButton {
id: closeButton
height:6* mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
//color:"white"
text: "\uf057"
onClicked: {
groupModelAppend(contacts,function(){
contactlistRectangle.destroy()
});
}
MButton {
id: closeButton
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
//color:"white"
text: "\uf057"
onClicked: {
groupModelAppend(contacts,function(){
contactlistRectangle.destroy()
});
}
}
Component.onCompleted: {

View file

@ -0,0 +1,96 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.11
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
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: contactsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showContacts(contact){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
}
MButton {
id: cleanButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
})
}
}
ListView {
id: contactsView
x:mm
y:cleanButton.height+2*mm
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
spacing: 2
clip: true
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: contactsModel
delegate: ContactComponent { }
}
ListModel{id: contactsModel}
Component.onCompleted: {
friendsTabView.contactsSignal.connect(showContacts);
showContacts()
}
}

View file

@ -0,0 +1,159 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: friendsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
property int currentContact: 0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(root.db,"friendshiprequests",login.username,function(friendrequestsobject){
for (var i=0;i<friendrequestsobject.length;i++){//print(Qt.atob(friendrequestsobject[i].note));
if (friendrequestsobject[i].note!=null){
friendrequestsobject[i].description=Qt.atob(friendrequestsobject[i].note);}
else{friendrequestsobject[i].description=""}
friendrequestsobject[i].name=Qt.atob(friendrequestsobject[i].display_name);
friendrequestsobject[i].screen_name=friendrequestsobject[i].usernamef;
friendrequestsobject[i].location="";
friendrequestsobject[i].profile_image=friendrequestsobject[i].avatar_static;
friendrequestsobject[i].profile_image_url=friendrequestsobject[i].avatar;
friendrequestsobject[i].curIndex=friendsModel.count;
friendsModel.append({"contact":friendrequestsobject[i],"contactType":qsTr("Friend Requests")});
}
});
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
if(friendsobject[i].description!=""){
friendsobject[i].description=Qt.atob(friendsobject[i].description);}
friendsobject[i].name=Qt.atob(friendsobject[i].name);
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],"contactType":qsTr("Friends")});
}
},"isFriend",1,"screen_name ASC");
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)
}
}
}
}
MButton {
id: updateFriendsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
onClicked: {
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.deleteData(root.db,"friendshiprequests",root.login.username,function(){});
updatenews.setDatabase();
updatenews.login();
updatenews.friendrequests();
//root.contactLoadType="friends";
Newsjs.requestFriends(root.login,db,root,function(nc){
root.newContacts=nc
root.onNewContactsChanged(nc);
})
}
}
ProgressBar{
id: newContactsProgress
width: 15*mm
height: updateFriendsButton.height
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
value: friendsGridTab.currentContact/root.newContacts.length
}
Component {
id: sectionHeading
Rectangle {
width: friendsView.width
height: childrenRect.height
//color: "lightsteelblue"
required property string section
Text {
text: parent.section
font.bold: true
font.pointSize: osSettings.bigFontSize
}
}
}
//GridView {
ListView{
id: friendsView
x:mm
y:updateFriendsButton.height+mm
width:friendsGridTab.width-2*mm
height:friendsGridTab.height-(updateFriendsButton.height+5*mm)
clip: true
spacing: 2
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: friendsModel
delegate: ContactComponent { }
section.property: "contactType"
section.criteria: ViewSection.FullString
section.delegate: sectionHeading
}
ListModel{id:friendsModel}
Component.onCompleted: {
root.friendsSignal.connect(showFriends);
friendsTabView.contactsSignal.connect(showFriends);
showFriends(root.login.username);
root.newContacts=[]
}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs
@ -45,60 +44,72 @@ Rectangle {
color: "white"
function showContactdetails(contact){
rootstack.currentIndex=0;
bar.currentIndex=0;
// rootstack.currentIndex=0;
// bar.currentIndex=0;
root.contactdetailsSignal(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)
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
TabBar {
id: friendsbar
width: parent.width
width: osSettings.osType=="Android"?parent.width-2*osSettings.bigFontSize:parent.width
height: 9*mm
x: osSettings.osType=="Android"?2*osSettings.bigFontSize:0
visible: !wideScreen
position:TabBar.Header
currentIndex: 1
TabButton {
text: qsTr("Me")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Friends")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Contacts")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
TabButton {
text: qsTr("Groups")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
height: 7*mm
}
}
}
LeftDrawerLinux{
id:leftDrawer
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
height: root.height-bar.height
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
StackLayout{
id:friendsTabView
//anchors.fill: parent
x:mm
y:10*mm
width: parent.width-2*mm
height: parent.height-10*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm//newstabitem.width/3*2:newstabitem.width
x: leftDrawer.width
y: friendsbar.visible?friendsbar.height:0
height: friendsbar.visible?parent.height-friendsbar.height-mm:parent.height-mm
currentIndex: friendsbar.currentIndex
signal contactsSignal(var contact)
signal groupsSignal(var username)
@ -113,267 +124,26 @@ Rectangle {
else if (currentIndex==3){groupsSignal(root.login.username)}
}
Item{
id:profileGridTab
Layout.fillWidth:true
Layout.fillHeight: true
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
var profilecomp = component.createObject(profileGridTab,{"profile": profile});
});
}
}
Item{
id: friendsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
property int currentContact: 0
function showFriends(contact){
try {friendsModel.clear()} catch(e){print(e)};
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
for (var i=0;i<friendsobject.length;i++){
friendsobject[i].description=Qt.atob(friendsobject[i].description);
friendsobject[i].name=Qt.atob(friendsobject[i].name);
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
function onDownloaded(type,url,filename,i){
if(type=="contactlist"){
//print(url+" "+filename+" "+i)
friendsGridTab.currentContact=i+1;
if(friendsGridTab.currentContact==root.newContacts.length){
friendsGridTab.showFriends(root.login.username)
}
}
}
}
MButton {
id: updateFriendsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
height: 6*mm
width: 8*mm
onClicked: {
try {friendsModel.clear()} catch(e){print(e)};
//root.contactLoadType="friends";
Newsjs.requestFriends(root.login,db,root,function(nc){
root.newContacts=nc
})
}
Loader{
id: profileLoader
source:(friendsTabView.currentIndex==0)? "qrc:/qml/contactqml/ProfileTab.qml":""
}
ProgressBar{
id: newContactsProgress
width: 15*mm
height: updateFriendsButton.height
anchors.top: parent.top
anchors.right:updateFriendsButton.left
anchors.rightMargin:mm
visible: (friendsGridTab.currentContact!=(root.newContacts.length))?true:false
value: friendsGridTab.currentContact/root.newContacts.length
}
//GridView {
ListView{
id: friendsView
x:mm
y:updateFriendsButton.height+2*mm
width:friendsGridTab.width-2*mm
height:friendsGridTab.height-updateFriendsButton.height-2*mm
clip: true
spacing: 2
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: friendsModel
delegate: ContactComponent { }
}
ListModel{id:friendsModel}
Component.onCompleted: {
root.friendsSignal.connect(showFriends);
friendsTabView.contactsSignal.connect(showFriends);
showFriends(root.login.username);
root.newContacts=[]
}
Loader{
id: friendsListLoader
source:(friendsTabView.currentIndex==1)? "qrc:/qml/contactqml/FriendsListTab.qml":""
}
Item{
id: contactsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showContacts(contact){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
}
MButton {
id: cleanButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
height: 6*mm
width: 8*mm
onClicked: {
Service.cleanContacts(root.login,root.db,function(){
try {contactsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
for (var j=0;j<contactsobject.length;j++){
contactsobject[j].description=Qt.atob(contactsobject[j].description);
contactsobject[j].name=Qt.atob(contactsobject[j].name);
contactsModel.append({"contact":contactsobject[j]});
}
},"isFriend",0,"screen_name ASC");
})
}
}
ListView {
id: contactsView
x:mm
y:cleanButton.height+2*mm
width:contactsGridTab.width-2*mm
height:contactsGridTab.height-cleanButton.height-2*mm
spacing: 2
clip: true
function processContactSelection(contactobject){showContactdetails(contactobject)}
//add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: contactsModel
delegate: ContactComponent { }
}
ListModel{id: contactsModel}
Component.onCompleted: {
friendsTabView.contactsSignal.connect(showContacts);
}
Loader{
id: contactsListLoader
source:(friendsTabView.currentIndex==2)? "qrc:/qml/contactqml/ContactsListTab.qml":""
}
Item{
id: groupsGridTab
Layout.fillWidth:true
Layout.fillHeight: true
function showGroups(username){
try {groupsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
for (var j=0;j<groupsobject.length;j++){
groupsModel.append({"group":groupsobject[j]});
}})}
function updateGroup(login,database,group){
// update groups
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
//print("Groupdata "+JSON.stringify(group));
var api="";
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
xhr.url= login.server + api;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("gid",group.id);
xhr.setParam("name",group.name);
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
}
Connections{
target:xhr
function onError(data,url,api,code){print(data)}//if (data=="image"){Helperjs.showMessage()}}
function onSuccess(data,api){
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}
}
MButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
height: 6*mm
width: 8*mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
groupsGridTab.showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
// text: "\uf234"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: updateGroupsButton.left
// anchors.rightMargin: mm
// onClicked: {
// groupsModel.append({"group": {"new":true}});
// }
// }
GridView {
id: groupsView
x:mm
y:updateGroupsButton.height+2*mm
width:groupsGridTab.width-2*mm
height:groupsGridTab.height-updateGroupsButton.height-2*mm
clip: true
cellHeight: 16*mm
cellWidth: 17*mm
add: Transition {
NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
}
model: groupsModel
delegate: GroupComponent {}
//footer:groupFooter
}
ListModel{
id: groupsModel
}
// Component{
// id: groupFooter
// Image{
// id: footerImage
// width: 15*mm
// height: 15*mm
// fillMode: Image.PreserveAspectFit
// source:"qrc:/images/addImage.png"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// print("new group")
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
// var imagedialog = component.createObject(groupsView,{"group": []});}
// }
// }
// }
Component.onCompleted: {
friendsTabView.groupsSignal.connect(showGroups);
}
Loader{
id: groupsListLoader
source:(friendsTabView.currentIndex==3)? "qrc:/qml/contactqml/GroupsListTab.qml":""
}
}
}
Component.onCompleted: {
//root.contactdetailsSignal.connect(showContactdetails);
}

View file

@ -37,6 +37,8 @@ import "qrc:/qml/genericqml"
Item {
id: groupComponent
height: 5*root.fontFactor*osSettings.bigFontSize//8*mm
width: groupComponent.ListView.view.width
property var groupmembers:[]
//property bool newGroup: false
function groupModelAppend(groupcontacts,callback){
@ -47,67 +49,62 @@ Item {
Rectangle {
id: wrapper
width: 16*mm
height: 15*mm
x:0.5*mm
y:0.5*mm
width:parent.width-mm
height: parent.height-mm
radius: 0.5*mm
border.color: "grey"
color:"white"
Image {
id: photoImage
x:1
y:1
width: 10*mm
height:10*mm
source:"qrc:/images/defaultcontact.jpg"
}
// Image {
// id: photoImage
// x:1
// y:1
// width: 10*mm
// height:10*mm
// source:"qrc:/images/defaultcontact.jpg"
// }
Rectangle{
id:namelabelRect
x: 1
y: 1
width: wrapper.width-2
height: 3.5*mm
anchors.top: photoImage.bottom
border.color: "light grey"
height: 3*root.fontFactor*osSettings.bigFontSize
//border.color: "light grey"
TextInput {
id: namelabel
anchors.fill: parent
readOnly: true
text: group.new?"":group.groupname
color: "#303030"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
}
}
MButton{
id: closeButton
visible: false
width: 8*mm
height: 6*mm
anchors.left: infobutton.right
anchors.right: parent.right
anchors.margins: mm
anchors.top: parent.top
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)}
}
font.pointSize: osSettings.bigFontSize
onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)}
}
}
MButton{
id:infobutton
width: 4*mm
height: 6*mm
//color:"transparent"
text:"?"
font.pixelSize: 3*mm
anchors.left: photoImage.right
anchors.leftMargin: mm
font.pointSize: osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: mm
anchors.topMargin: mm
anchors.top: parent.top
onClicked:{
groupComponent.state="large";
//if(group.new){
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
try {groupModel.clear()}catch (e){print(e)}
@ -124,15 +121,31 @@ Item {
} //catch(e){}
},"groupname",group.groupname);
//}
groupComponent.state="large"
}
}
Rectangle{
id: detailsrectangle
anchors.top: namelabelRect.bottom
anchors.topMargin: mm
opacity: 0
//anchors.topMargin: mm
x:mm
width: parent.width-2*mm
height:parent.height -(3*root.fontFactor*osSettings.bigFontSize+mm)
visible: false
ListView{
id: groupListView
anchors.fill: parent
anchors.margins: mm
clip: true
spacing: 2
model: groupModel
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}
// Component {
// id:groupMember
@ -182,27 +195,13 @@ Item {
// }
// }
ListView{
id: groupListView
x:1
//anchors.top: parent.top
width: root.width-10*mm
height:groupsView.height - 24*mm
clip: true
spacing: 2
model: groupModel
delegate: ContactComponent { }// groupMember
function processContactSelection(contactobject){showContactdetails(contactobject)}
}
ListModel{id: groupModel}
Row{
anchors.top: groupListView.bottom
anchors.topMargin: mm
spacing: mm
}
// Row{
// anchors.top: groupListView.bottom
// anchors.topMargin: mm
// spacing: mm
// }
// BlueButton{
// id: addMembers
@ -258,14 +257,15 @@ Item {
states: [
State {
name: "large"
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width; readOnly:false}
PropertyChanges { target: namelabelRect; height: 4.5*mm}
PropertyChanges { target: groupComponent; height: groupsView.height - 6*root.fontFactor*osSettings.bigFontSize }
PropertyChanges { target: namelabel; font.pointSize: 1.2*osSettings.bigFontSize; readOnly:false}
//PropertyChanges { target: namelabelRect; height: 2*osSettings.bigFontSize}
PropertyChanges { target: closeButton; visible: true}
PropertyChanges { target: groupComponent; z: 2 }
PropertyChanges { target: wrapper; width:groupsView.width;height:groupsView.height -2*mm-1}
PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; opacity:1 }
//PropertyChanges { target: groupComponent; z: 2 }
//PropertyChanges { target: wrapper; width:groupsView.width-2*mm;height:groupsView.height -2*mm-1}
//PropertyChanges { target: photoImage; width:15*mm;height:15*mm }
//PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; visible:true }
PropertyChanges { target: infobutton; visible: false}
}
]

View file

@ -0,0 +1,141 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls 2.12
//import QtQuick.Layouts 1.11
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
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id: groupsGridTab
function showGroups(username){
try {groupsModel.clear()} catch(e){print(e)};
Helperjs.readData(db, "groups",root.login.username,function(groupsobject){
for (var j=0;j<groupsobject.length;j++){
groupsModel.append({"group":groupsobject[j]});
}})}
function updateGroup(login,database,group){
// update groups
//var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
//var groupdata={"gid":group.id,"name":group.name,"user":group.user};
//print("Groupdata "+JSON.stringify(group));
var api="";
if (group.new){api="/api/friendica/group_create.json?name="+group.name}else{api="/api/friendica/group_update.json?gid="+group.id}
xhr.url= login.server + api;
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
xhr.setParam("gid",group.id);
xhr.setParam("name",group.name);
xhr.setParam("user", group.user);
xhr.setParam("json",group);
xhr.post();
}
Connections{
target:xhr
function onError(data,url,api,code){print(data)}//if (data=="image"){Helperjs.showMessage()}}
function onSuccess(data,api){
if(api.startsWith("/api/friendica/group")){
Newsjs.requestGroups(root.login,root.db,root,function(){
showGroups(root.login.username)});
}
}
}
MButton {
id: updateGroupsButton
text: "\uf021"
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
anchors.rightMargin: mm
onClicked: {
Newsjs.requestGroups(root.login,root.db,root,function(){
groupsGridTab.showGroups(root.login.username)})}
}
// BlueButton {
// id: newGroupButton
// text: "\uf234"
// anchors.top: parent.top
// anchors.topMargin: mm
// anchors.right: updateGroupsButton.left
// anchors.rightMargin: mm
// onClicked: {
// groupsModel.append({"group": {"new":true}});
// }
// }
ListView {
id: groupsView
x:mm
y:updateGroupsButton.height+4*mm
width:groupsGridTab.width-2*mm
height:groupsGridTab.height-updateGroupsButton.height-2*mm
clip: true
// cellHeight: 16*mm
// cellWidth: 17*mm
// add: Transition {
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
// }
model: groupsModel
delegate: GroupComponent {}
//footer:groupFooter
}
ListModel{
id: groupsModel
}
// Component{
// id: groupFooter
// Image{
// id: footerImage
// width: 15*mm
// height: 15*mm
// fillMode: Image.PreserveAspectFit
// source:"qrc:/images/addImage.png"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// print("new group")
// var component = Qt.createComponent("qrc:/qml/contactqml/GroupComponent.qml");
// var imagedialog = component.createObject(groupsView,{"group": []});}
// }
// }
// }
Component.onCompleted: {
friendsTabView.groupsSignal.connect(showGroups);
showGroups()
}
}

View file

@ -105,16 +105,15 @@ Rectangle {
MButton {
id: update
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: mm
anchors.right: parent.right
text: "\uf021"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onClicked: {
Service.requestProfile(root.login,root.db,root,function(nc){
root.newContacts=nc;
root.onNewContactsChanged(nc);
photoImage.source="";
showProfile(function(newprofile){
profile=newprofile;
@ -149,7 +148,7 @@ Rectangle {
imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker");
'}}',profileTab,"imagePicker");
imagePicker.pickImage()
}
}
@ -172,16 +171,15 @@ Rectangle {
anchors.top: photoImage.top
anchors.right:photoImage.right
color: "white"
font.pixelSize: 4*mm
font.pointSize: 1.2*osSettings.bigFontSize
}
MButton{
id:updatebutton
height: 6*mm
width: 12*mm
width: 8*root.fontFactor*osSettings.bigFontSize
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
text:qsTr("Update")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
anchors.left: photoImage.right
anchors.leftMargin: 0.5*mm
anchors.topMargin: mm
@ -199,7 +197,7 @@ Rectangle {
anchors.left: photoImage.left
wrapMode: Text.Wrap
color: "#303030"
font.pixelSize: 4*mm
font.pointSize: osSettings.bigFontSize
anchors.top: photoImage.bottom
}
@ -212,7 +210,7 @@ Rectangle {
height: 5*mm+profiletextfield.height
Text{
y:mm
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
color:"black"
}
@ -222,7 +220,7 @@ Rectangle {
y:4.5*mm
width:parent.width-2.5*mm
wrapMode: Text.Wrap
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
text:profiletext
color:"black"
}
@ -234,7 +232,7 @@ Rectangle {
id:namelabeltext
width: namelabelflickable.width
height: implicitHeight
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(profile.friendica_owner.description))+"<br> <b>"+qsTr("Location")+":</b> "+profile.friendica_owner.location+"<br> <b>"+qsTr("Posts")+":</b> "+profile.friendica_owner.statuses_count+

View file

@ -0,0 +1,65 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 1.4
//import QtQuick.Layouts 1.11
//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
import "qrc:/qml/contactqml"
import "qrc:/qml/genericqml"
Item{
id:profileTab
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)
}
Component.onCompleted:{
showProfile(function(profile){
var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml");
var profilecomp = component.createObject(profileTab,{"profile": profile});
});
}
}

View file

@ -36,47 +36,56 @@ import QtQuick.Controls 2.4
import QtQuick.Layouts 1.11
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
StackView{
ApplicationWindow{
id:root
title: "Friendiqa"
property var globaloptions: Service.readGO(db)
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsLinux.qml");return tmp.createObject(root)}
width: osSettings.appWidth
height:osSettings.appHeight
width: globaloptions.hasOwnProperty("appWidth")?globaloptions.appWidth:osSettings.appWidth
height:globaloptions.hasOwnProperty("appHeight")?globaloptions.appHeight:osSettings.appHeight
visible: true
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db)
property var globaloptions: Service.readGO(db)
property real fontFactor: root.font.pixelSize/root.font.pointSize
property var contactlist: []
property real mm: osSettings.osType=="Android"?Screen.pixelDensity:Screen.pixelDensity*1.5
signal messageSignal(var friend)
property bool wideScreen : width>height
signal fotoSignal(var username, var friend)
signal directmessageSignal(var friend)
signal newsSignal(var news)
signal newstypeSignal(var type)
signal friendsSignal(var username)
signal contactdetailsSignal(var contact)
signal searchSignal (var searchterm)
signal eventSignal(var contact)
signal uploadSignal(var urls)
signal sendtextSignal(var intenttext)
signal changeimage(var method, var type, var id)
signal updateSyncinterval(int interval)
signal replySignal(var newsobject)
property var news:[]
property var newContacts:[]
property var contactposts:[]
//property string contactLoadType: ""
property bool imagePicking: false
onLoginChanged:{
if(login==""){root.push("qrc:/qml/configqml/AccountPage.qml")}
else{root.push(rootStackItem)
if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;}
function onLoginChanged(login){
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{//rootstackView.push(rootstack)
if (login.newsViewType!="" || login.newsViewType!=null){
newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})}
contactlist=contacts})
}
}
onNewContactsChanged:{
function onNewContactsChanged(newContacts){
if(newContacts.length>0){// download contact images and update db
var contacturls=[];
var contactnames=[];
for (var link in newContacts){
for (var link in newContacts){//print("new contact " +newContacts[link].screen_name);
contacturls.push(newContacts[link].profile_image_url);
contactnames.push(newContacts[link].screen_name);
Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link])
@ -91,6 +100,29 @@ StackView{
}
Connections {
target: root
function onWidthChanged(appWidth) {
if(osSettings.osType=="Linux" && Math.abs(appWidth-(globaloptions.appWidth||0))>50){
Service.updateglobaloptions(db,"appWidth",appWidth)
}
}
}
Connections {
target: root
function onHeightChanged(appHeight) {
if(osSettings.osType=="Linux" && Math.abs(appHeight-(globaloptions.appHeight||0))>50){
Service.updateglobaloptions(db,"appHeight",appHeight)
}
}
}
function showContact(contact){ //print(JSON.stringify(contact));
rootstackView.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact})
}
Connections{
target:xhr
function onDownloaded(type,url,filename,i){
@ -104,10 +136,12 @@ StackView{
}
}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
if (event.key === osSettings.backKey) {
//Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
onClosing: {
//if (event.key === osSettings.backKey) {
if (rootstack.currentIndex==0){
newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){
@ -119,294 +153,149 @@ StackView{
Newsjs.chatsfromdb(db,login.username,function(dbnews){
newsSignal(dbnews)
})}
close.accepted=false;
}
else if (newstab.conversation.length>0){newstab.conversation=[]}
else if (root.depth>1){root.pop()}
else if (newstab.conversation.length>0){
newstab.conversation=[];
close.accepted=false
}
else if (root.depth>1){
root.pop();
close.accepted=false
}
else{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})})
close.accepted=true
}
}
else if (rootstack.currentIndex==2){fotoSignal("backButton")}
else {rootstack.currentIndex=0}
event.accepted = true
}}
//event.accepted = true
//}
}
Drawer{
id: leftDrawer
width: 0.66* root.width
height: root.height
edge: Qt.LeftEdge
position: 1.0
Column{
x:mm
width:parent.width-mm
Label{
text: login.hasOwnProperty("username")?login.username:""
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
height: 6*mm
header: ToolBar{
position: wideScreen?ToolBar.Header:ToolBar.Footer
background: Rectangle{
anchors.fill: parent
color: "#EEEEEE"//"#F8F8F8"
}
RowLayout{
anchors.fill: parent
ToolButton{
visible: !wideScreen
text: "\uf0c9"
onClicked:{
leftDrawer.visible?leftDrawer.close():leftDrawer.open()}
}
// Label{
// text:login.hasOwnProperty("server")?"@"+login.server:""
// font.pixelSize: 5*mm
// width: parent.width
// }
Label{
text: "\uf021 " + qsTr("Refresh")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
// newstypeSignal("refresh")
updatenews.setDatabase();
updatenews.login();
updatenews.startsync();
TabBar {
id: bar
Layout.fillWidth: true
//width: wideScreen?contentWidth:parent.width-10*mm
//x: 7*mm
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf0c0"
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf03e"
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
TabButton {
text: "\uf073"
background:Rectangle{
anchors.fill: parent
color: "#EEEEEE"
}
}
}
Label{
text: "\uf1da " + qsTr("Timeline")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("timeline")
}
}
}
Label{
text: "\uf086 " + qsTr("Conversations")
width: parent.width
//font.pixelSize: 4*mm
font.pointSize: 16
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("conversation")
}
}
}
Label{
text: "\uf005 " + qsTr("Favorites")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("favorites")
}
}
}
Label{
text: "\uf0ec " + qsTr("Replies")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("replies")
}
}
}
Label{
text: "\uf0ac " + qsTr("Public Timeline")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("publictimeline")
}
}
}
Label{
text: "\uf0c0 " + qsTr("Group news")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("groupnews")
}
}
}
Label{
text: "\uf002 " + qsTr("Search")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.close();
newstypeSignal("search")
}
}
}
Label{
text: "\uf085 "+ qsTr("Settings")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/ConfigPage.qml");
leftDrawer.close()
}
}
}
Label{
text: "\uf2bb " + qsTr("Accounts")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked: {root.push("qrc:qml/configqml/AccountPage.qml");
leftDrawer.close()
}
}
}
Label{
text: "\uf08b " +qsTr("Quit")
//font.pixelSize: 4*mm
font.pointSize: 16
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){
Qt.quit()})
})})
}
}
}
}
}
Item{
id:rootStackItem
width:parent.width
height: parent.height
//anchors.fill:parent
states: State {
name: "fullscreen";
PropertyChanges { target: bar; height:0 }
PropertyChanges { target: rootstack; height:parent.height }
}
LeftDrawerAndroid{
id: leftDrawer
visible:!wideScreen
}
transitions: Transition {
PropertyAnimation { properties: "height";
easing.type: Easing.InOutQuad
duration: 1000
}
}
TabBar {
id: bar
width: parent.width
height: 7*mm
position:TabBar.Footer
anchors.top: rootstack.bottom
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
TabButton {
text: "\uf03a"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf0c0"
font.pixelSize: 3*mm
height: 6*mm
}
TabButton {
text: "\uf03e"
font.pixelSize: 3*mm
height: 6*mm
}
// states: State {
// name: "fullscreen";
// PropertyChanges { target: bar; height:0 }
// PropertyChanges { target: rootstack; height:parent.height }
// }
TabButton {
text: "\uf073"
font.pixelSize: 3*mm
height: 6*mm
}
}
StackLayout{
// transitions: Transition {
// PropertyAnimation { properties: "height";
// easing.type: Easing.InOutQuad
// duration: 1000
// }
// }
StackView{id:rootstackView
width:root.width
height: root.height
initialItem: StackLayout{
id:rootstack
width:parent.width
height: parent.height-7*mm
width:rootstackView.width
height: rootstackView.height//-7*mm
//y:wideScreen?7*mm:0
currentIndex:bar.currentIndex
Loader{
id: newstab
Layout.fillWidth:true
Layout.fillHeight: true
property string newstabstatus
property var conversation:[]
property var contactposts:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
}
Loader{
id: friendstab
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
}
Loader{
id: fotostab
property string phototabstatus:"Images"
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
}
Loader{
id: calendartab
property string calendartabstatus:"Events"
Layout.fillWidth:true
Layout.fillHeight: true
// Layout.fillWidth:true
// Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
}
}
}
//}
Component.onCompleted: {
forceActiveFocus();
//print(xhr.networktype());
onLoginChanged(login);
globaloptions=Service.readGO(db);
if(osSettings.osType=="Android"){
var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root);
@ -416,5 +305,5 @@ StackView{
var LinuxSyncQml = component.createObject(root);
}
}
}
//}
}

View file

@ -32,12 +32,12 @@
import QtQuick 2.0
Rectangle{
id: blueButton
width: Math.max(mainText.width+2*mm,8*mm)
width: Math.max(mainText.width+2*mm,5*mm)
height: 5*mm
color:"light blue"//"#EFEAEA" "sky blue"
border.color: "light blue"
color:"transparent"//"#EFEAEA" "sky blue"
property alias fontColor: mainText.color
// border.color:"grey"
// border.width:1
border.width:1
radius: mm
property alias text: mainText.text
property alias font: mainText.font
@ -51,8 +51,9 @@ Rectangle{
width: contentWidth
height: contentHeight
font.family:fontAwesome.name
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
text: ""
elide: Text.ElideNone
}
MouseArea{
id:buttonArea

View file

@ -35,15 +35,15 @@ import "qrc:/qml/genericqml"
Item {
id: contactComponent
height: 8*mm
width: parent.width
height: 5*root.fontFactor*osSettings.systemFontSize//8*mm
width: contactComponent.ListView.view.width//parent.width
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Rectangle {
id: wrapper
width:parent.width
height: 8*mm
height: parent.height//8*mm
radius: 0.5*mm
border.color: "grey"
color:"white"
@ -51,34 +51,45 @@ Item {
id: photoImage
x:0.5*mm
y:0.5*mm
width: 7*mm
height:7*mm
width: 4*root.fontFactor*osSettings.systemFontSize//7*mm
height:4*root.fontFactor*osSettings.systemFontSize//7*mm
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"}}
}
Column{
width: wrapper.width-8*mm
Flow{
width: wrapper.width-4*root.fontFactor*osSettings.systemFontSize//8*mm
height: wrapper.height-mm
anchors.left: photoImage.right
anchors.margins: 1*mm
spacing: mm
//spacing: mm
clip: true
Label {
id: namelabel
width: wrapper.width-4
height: 3*mm
width: Math.min(wrapper.width-(photoImage.width+mm),contentWidth)//wrapper.width-4
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
text: contact.name
elide:Text.ElideRight
elide: contentWidth>wrapper.width-4*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: "#303030"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
}
Label {
id: screennamelabel
width: wrapper.width-8*mm
height: 2.5*mm
text: "@"+contact.screen_name
elide:Text.ElideRight
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
height: 1.1*root.fontFactor*osSettings.bigFontSize//3*mm
text: "(@"+contact.screen_name+")"
elide: contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: "#303030"
font.pixelSize: 2.5*mm
font.pointSize: osSettings.bigFontSize
}
Label {
id: descriptionlabel
width: Math.min(wrapper.width-4*root.fontFactor*osSettings.systemFontSize,contentWidth)//contentWidth+2*mm//wrapper.width-8*mm
height: 2*root.fontFactor*osSettings.systemFontSize//2.5*mm
text: contact.description
elide:contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: "#303030"
font.pointSize: osSettings.systemFontSize
}
}
MouseArea{

View file

@ -0,0 +1,235 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Item {
id: drawerAccountComponent
property var account: ({})
width: parent.width
Label{
y:0.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
height: 1.5*osSettings.bigFontSize*root.fontFactor
verticalAlignment:Text.AlignBottom
font.pointSize: osSettings.bigFontSize
text: account.username
}
// Label{
// text:login.hasOwnProperty("server")?"@"+login.server:""
// font.pixelSize: 5*mm
// width: parent.width
// }
Label{
y:2*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
text: "\uf021 " + qsTr("Refresh")
MouseArea{
anchors.fill:parent
onClicked: {
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newstypeSignal("refresh")
// updatenews.setDatabase();
// updatenews.login();
// updatenews.startsync();
}
}
}
Label{
y:3.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Timeline"
text: "\uf1da " + qsTr("Timeline")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Timeline";
newstypeSignal("timeline")
}
}
}
Label{
y:5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Conversations"
text: "\uf086 " + qsTr("Conversations")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Conversations";
newstypeSignal("conversation")
}
}
}
Label{
y:6.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Replies"
text: "\uf0ec " + qsTr("Replies")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=1
currentnewstabstatus="Replies";
newstypeSignal("replies")
}
}
}
Label{
y:8*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="DirectMessages"
text: "\uf0e0 " + qsTr("Direct Messages")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=2//newstypeSignal("replies")
currentnewstabstatus="DirectMessages";
}
}
}
Label{
y:9.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Favorites"
text: "\uf005 " + qsTr("Favorites")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Favorites";
newstypeSignal("favorites")
}
}
}
Label{
y:11*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Public Timeline"
text: "\uf0ac " + qsTr("Public Timeline")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Public Timeline";
newstypeSignal("publictimeline")
}
}
}
Label{
y:12.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Groupnews"
text: "\uf0c0 " + qsTr("Group news")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Groupnews";
newstypeSignal("groupnews")
}
}
}
Label{
y:14*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Search"
text: "\uf002 " + qsTr("Search")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=0;
currentnewstabstatus="Search";
newstypeSignal("search")
}
}
}
Label{
y:15.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Notifications"
text: "\uf0f3 " + qsTr("Notifications")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
newsSwipeview.currentIndex=3;
currentnewstabstatus="Notifications";
newstypeSignal("notifications")
}
}
}
}

View file

@ -0,0 +1,126 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Item {
id: drawerAccountComponent
property var account: ({})
width: parent.width
Label{
y:0.5*osSettings.bigFontSize
width:parent.width
height: 1.5*root.fontFactor*osSettings.bigFontSize
verticalAlignment:Text.AlignBottom
font.pointSize: osSettings.bigFontSize
text: account.username
}
// Label{
// text:login.hasOwnProperty("server")?"@"+login.server:""
// font.pixelSize: 5*mm
// width: parent.width
// }
Label{
y:2*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && friendsTabView.currentIndex==0
text: " "+qsTr("Profile")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
friendsTabView.currentIndex=0;
profileLoader.source="";
profileLoader.source="qrc:/qml/contactqml/ProfileTab.qml"
}
}
}
Label{
y:3.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && friendsTabView.currentIndex==1
text: " "+qsTr("Friends")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
friendsTabView.currentIndex=1
friendsListLoader.source="";
friendsListLoader.source="qrc:/qml/contactqml/FriendsListTab.qml"
}
}
}
Label{
y:5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && friendsTabView.currentIndex==2
text: " "+qsTr("Contacts")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
friendsTabView.currentIndex=2
}
}
}
Label{
y:6.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && friendsTabView.currentIndex==3
text: " "+qsTr("Groups")
MouseArea{
anchors.fill:parent
onClicked:{
login=account;
if(!wideScreen){leftDrawerAndroid.close()}
friendsTabView.currentIndex=3
}
}
}
}

View file

@ -62,7 +62,7 @@ Rectangle{
}
Button{
id:closeButton
height: 8*mm
height: 3*root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top
anchors.topMargin: 0.5*mm
anchors.right: parent.right
@ -126,7 +126,7 @@ Rectangle{
width: fileIsDir?parent.width - 12*mm :imageView.width-mm
anchors.bottom: folderImage.bottom
color: fileIsDir?"black":"white"
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
wrapMode:Text.Wrap
}
Text {
@ -138,7 +138,7 @@ Rectangle{
width: 10*mm
anchors.top: folderImage.top
color: "green"
font.pixelSize: 10*mm
font.pointSize: 3*osSettings.bigFontSize
}
Image{id:folderImage

View file

@ -15,7 +15,7 @@ Item {
Connections {
target: SystemDispatcher
onDispatched: {
function onDispatched (type, message) {
if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) {
var h=[];
for (var n in message.imageUrls){

View file

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

View file

@ -0,0 +1,55 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/qml/configqml"
Rectangle{
// id: leftDrawer
// width: osSettings.systemFontSize*30
// height: root.height-bar.height
//y: bar.height
signal opened()
LeftDrawerScrollview{
width:parent.width-mm
height:parent.height
x:mm
}
Rectangle{
width: 1
height: leftDrawer.height
anchors.right: leftDrawer.right
color: "#EEEEEE"
}
Component.onCompleted: {opened();}
}

View file

@ -32,10 +32,11 @@ import QtQuick 2.6
import QtQuick.Controls 2.12
Button{
id: mButton
width: Math.max(text.width+2*mm,8*mm)
property alias color: bg.color
width: Math.max(text.width+2*mm,2*root.fontFactor*osSettings.bigFontSize)
//radius: mm
height: 6*mm
height: 2*root.fontFactor*osSettings.bigFontSize
//color: Material.grey
font.pixelSize: 3*mm
background: Rectangle{color:"#F8F8F8";radius: 0.5*mm}
font.pointSize: osSettings.bigFontSize
background: Rectangle{id:bg;color:"#F3F3F3";radius: 0.5*mm}
}

View file

@ -41,7 +41,7 @@ Rectangle {
id:searchComponent
Rectangle{
color: "white"
color: "#EEEEEE"
radius:0.5*mm
anchors.left: parent.left
anchors.leftMargin:mm
@ -53,7 +53,7 @@ Rectangle {
TextInput {
id: searchText
focus: true
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
wrapMode: Text.Wrap
anchors.fill: parent
selectByMouse: true

View file

@ -33,154 +33,290 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
Rectangle {
Page {
id:contactList
color: "white"
property var contact:({})
property string profileimagesource:contact.profile_image
ListView {
id: contactView
x:mm
y:9*mm
width: contactList.width-4*mm
height:contactList.height-10*mm
clip: true
spacing: 0
header: contactHeader
model: contactModel
delegate: Newsitem{}
}
//function backRequested(){pageStack.pop()}
function getDateDiffString (seconds){
var timestring="";
if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
else if (seconds<90){timestring= Math.round(seconds/60) + " " +qsTr("minute") ;}
else if (seconds<3600){timestring= Math.round(seconds/60) + " " +qsTr("minutes");}
else if (seconds<5400){timestring= Math.round(seconds/3600) + " " +qsTr("hour");}
else if (seconds<86400){timestring= Math.round(seconds/3600) + " " +qsTr("hours");}
else if (seconds<129600){timestring= Math.round(seconds/86400) + " " +qsTr("day");}
else if (seconds<3888000){timestring= Math.round(seconds/86400) + " " +qsTr("days");}
else if (seconds<5832000){timestring= Math.round(seconds/3888000) + " " +qsTr("month");}
else if (seconds<69984000){timestring= Math.round(seconds/3888000) + " " +qsTr("months");}
else {timestring= Math.round(seconds/46656000) + " " + qsTr("years");}
return timestring;
}
function getActivitiesView(newsitemobject){
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){
if (newsitemobject.friendica_activities.like.length>0){
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
}
if (newsitemobject.friendica_activities.dislike.length>0){
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
}
if (newsitemobject.friendica_activities.attendyes.length>0){
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
}
if (newsitemobject.friendica_activities.attendno.length>0){
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
}
if (newsitemobject.friendica_activities.attendmaybe.length>0){
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
}
function showConversation(conversationIndex,newsitemobject){
if(newsitemobject.messagetype==0 || newsitemobject.messagetype==3){
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/conversation/show");
xhr.setParam("id",newsitemobject.id)
xhr.get();
}
else{
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/direct_messages/conversation");
xhr.setParam("uri",newsitemobject.statusnet_conversation_id)
xhr.get();
}
}
Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: {
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
root.onNewContactsChanged(root.newContacts);
Newsjs.storeNews(login,db,root.news,root)
}
}
ListView {
id: contactView
x:mm
y:4*root.fontFactor*osSettings.bigFontSize
width: contactList.width-2*mm
height:contactList.height-7*root.fontFactor*osSettings.bigFontSize
clip: true
spacing: 0
property string viewtype: "conversation"
header: contactHeader
model: contactModel
delegate: Newsitem{}
}
BusyIndicator{
id: contactBusy
anchors.centerIn:parent
width:10*mm
height: 10*mm
running: true
}
id: contactBusy
anchors.centerIn:parent
width:10*mm
height: 10*mm
running: true
}
Component { id: contactHeader
Rectangle{
border.color: "#EEEEEE"
border.width: 1
color:"white"
width:contactView.width
height: profileImage.height+namelabel.height+detailtext.height+7*mm
//height: wrapper.height
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Component { id: contactHeader
Rectangle{
border.color: "#EEEEEE"
border.width: 1
color:"white"
width:contactView.width
height: contactView.width<35*root.fontFactor*osSettings.systemFontSize?(profileImage.height+namelabel.height+detailtext.height+7*mm):Math.max(profileImage.height,(buttonflow.height+namelabel.height+detailtext.height))+7*mm
//height: wrapper.height
property var createdAtDate: new Date(contact.created_at)
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Image {
id: profileImage
x:mm
y:mm
width: contactView.width/2
height:width
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
Connections{
target:contactList
onProfileimagesourceChanged:profileImage.source=profileimagesource
}
}
Column{id:buttoncolumn
anchors.right: parent.right
anchors.rightMargin: mm
y: mm
spacing:4
Image {
id: profileImage
x:mm
y:mm
width: Math.min(15*root.fontFactor*osSettings.bigFontSize,contactView.width/2) //contactView.width/2
height:width
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
Connections{
target:contactList
onProfileimagesourceChanged:profileImage.source=profileimagesource
}
}
Flow{id:buttonflow
anchors.right: parent.right
anchors.rightMargin: mm
width: contactView.width - (profileImage.width+3*mm)
height: (contact.hasOwnProperty("acct"))?21*mm:15*mm//profileImage.height
y: mm
spacing:4
MButton{
id:photobutton
height: 6*mm
width: 8*mm
text: "\uf03e" // "Photos"
//font.pixelSize: 3*mm
visible:(contact.network=="dfrn")
onClicked:{
rootstack.currentIndex=2;
bar.currentIndex=2;
fotostab.phototabstatus="Contact";
BlueButton{
id:photobutton
height: 6*mm
width: 8*mm
text: "\uf03e" // "Photos"
visible:(contact.network=="dfrn")
onClicked:{
rootstack.currentIndex=2;
bar.currentIndex=2;
fotostab.phototabstatus="Contact";
//fotostab.active=true;
fotoSignal(root.login,contact) ;
newsStack.pop();
}
}
//fotostab.active=true;
fotoSignal(root.login,contact) ;
rootstackView.pop();
}
}
MButton{
id:dmbutton
height: 6*mm
width: 8*mm
visible: (contact.following=="true")
text: "\uf040" //"DM"
//font.pixelSize: 3*mm
onClicked:{
rootstack.currentIndex=0;
newsSwipeview.currentIndex=2;
directmessageSignal(contact)
}
}
BlueButton{
id:dmbutton
height: 6*mm
width: 8*mm
visible: (contact.following=="true")
text: "\uf040" //"DM"
onClicked:{
rootstack.currentIndex=0;
newsSwipeview.currentIndex=2;
directmessageSignal(contact)
}
}
MButton{
id:eventbutton
visible:(contact.network=="dfrn")
height: 6*mm
width: 8*mm
text:"\uf073"
//font.pixelSize: 3*mm
onClicked:{
rootstack.currentIndex=3;
bar.currentIndex=3;
calendartab.calendartabstatus="Friend"
eventSignal(contact);
newsStack.pop()
}
}
BlueButton{
id:eventbutton
visible:(contact.network=="dfrn")
height: 6*mm
width: 8*mm
text:"\uf073"
onClicked:{
rootstack.currentIndex=3;
bar.currentIndex=3;
calendartab.calendartabstatus="Friend"
eventSignal(contact);
rootstackView.pop()
}
}
BlueButton{
id:approvebutton
visible:(contact.hasOwnProperty("acct"))
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Approve")
onClicked:{
}//Column end
Label {
id: namelabel
x:mm
width: contactView.width-2*mm
height: implicitHeight
text:contact.name+" (@"+contact.screen_name+")"
wrapMode: Text.Wrap//elide:Text.ElideRight
color: "#303030"
font.pixelSize: 4*mm
anchors.top: profileImage.bottom
anchors.topMargin: mm
}
Text{
id:detailtext
anchors.top: namelabel.bottom
anchors.topMargin: 2*mm
x:mm
width: contactView.width-2*mm
height: implicitHeight
font.pixelSize: 2.5*mm
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+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: {
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/authorize",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
})
root.friendsSignal();
rootstackView.pop()
}
}
BlueButton{
id:rejectbutton
visible:(contact.hasOwnProperty("acct"))
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Reject")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/reject",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
})
root.friendsSignal();
rootstackView.pop()
}
}
BlueButton{
id:ignorebutton
visible:(contact.hasOwnProperty("acct"))
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Ignore")
onClicked:{
Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/ignore",'',"POST",root,function(returnvalue){
Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
});
root.friendsSignal();
rootstackView.pop()
}
}
}//Flow end
Label {
id: namelabel
//x:mm
width: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.width-2*mm:contactView.width-17*root.fontFactor*osSettings.bigFontSize
height: implicitHeight
text:contact.name+" (@"+contact.screen_name+")"
wrapMode: Text.Wrap//elide:Text.ElideRight
color: "#303030"
font.pointSize: 1.2*osSettings.bigFontSize
font.family: "Noto Sans"
anchors.top: contactView.width<35*root.fontFactor*osSettings.systemFontSize?profileImage.bottom:buttonflow.bottom
anchors.margins: mm
anchors.left: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.left:profileImage.right
}
Text{
id:detailtext
anchors.top: namelabel.bottom
anchors.left: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.left:profileImage.right
anchors.margins: 2*mm
//x:mm
width: contactView.width<35*root.fontFactor*osSettings.systemFontSize?contactView.width-2*mm:contactView.width-17*root.fontFactor*osSettings.bigFontSize
height: implicitHeight
font.pointSize: osSettings.systemFontSize
font.family: "Noto Sans"
textFormat:Text.RichText
wrapMode: Text.Wrap
text:"<b>"+qsTr("Description")+": </b> "+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)}
}
}
//}
}
//}
}
}//Component end
}//Component end
Connections{
target:newstab
target:xhr
function onError(data,url,api,code){
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
contactBusy.running=false;
}
function onSuccess(data,api){
Service.processNews(api,data)
replySignal("")
}
}
Connections{
target:root
function onContactpostsChanged(){
if (newstab.contactposts.length>0){profileimagesource=newstab.contactposts[0].user.profile_image_url_large}
if (root.contactposts.length>0&&root.contactposts[0]!=null){profileimagesource=root.contactposts[0].user.profile_image_url_large}
contactBusy.running=false;
contactModel.clear();
var currentTime= new Date();
var msg = {'currentTime': currentTime, 'model': contactModel,'news':newstab.contactposts, 'options':globaloptions};
var msg = {'currentTime': currentTime, 'model': contactModel,'news':root.contactposts, 'options':globaloptions};
contactWorker.sendMessage(msg)
}
}
@ -193,25 +329,26 @@ Rectangle {
}
MButton {
id: closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
//font.pixelSize: 3*mm
onClicked: {
newsStack.pop()
}
id: closeButton
anchors.top: parent.top
anchors.topMargin: 0.5*root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
//font.pixelSize: 3*mm
onClicked: {
rootstackView.pop()
}
}
Component.onCompleted: {
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/statuses/user_timeline");
xhr.setParam("user_id",contact.id)
xhr.get();
xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
if(contact.isFriend==1 || contact.hasOwnProperty("acct")){
xhr.setApi("/api/statuses/user_timeline");}
else{xhr.setApi("/api/users/show");}
xhr.setParam("user_id",contact.id)
xhr.get();
}
}

View file

@ -36,19 +36,66 @@ import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
Rectangle {
Page {
id:conversationList
property var news:[]
color: "white"
// color: "white"
//function backRequested(){pageStack.pop()}
// width:root.width
// height: root.height-7*mm
function getDateDiffString (seconds){
var timestring="";
if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
else if (seconds<90){timestring= Math.round(seconds/60) + " " +qsTr("minute") ;}
else if (seconds<3600){timestring= Math.round(seconds/60) + " " +qsTr("minutes");}
else if (seconds<5400){timestring= Math.round(seconds/3600) + " " +qsTr("hour");}
else if (seconds<86400){timestring= Math.round(seconds/3600) + " " +qsTr("hours");}
else if (seconds<129600){timestring= Math.round(seconds/86400) + " " +qsTr("day");}
else if (seconds<3888000){timestring= Math.round(seconds/86400) + " " +qsTr("days");}
else if (seconds<5832000){timestring= Math.round(seconds/3888000) + " " +qsTr("month");}
else if (seconds<69984000){timestring= Math.round(seconds/3888000) + " " +qsTr("months");}
else {timestring= Math.round(seconds/46656000) + " " + qsTr("years");}
return timestring;
}
function getActivitiesView(newsitemobject){
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){
if (newsitemobject.friendica_activities.like.length>0){
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
}
if (newsitemobject.friendica_activities.dislike.length>0){
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
}
if (newsitemobject.friendica_activities.attendyes.length>0){
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
}
if (newsitemobject.friendica_activities.attendno.length>0){
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
}
if (newsitemobject.friendica_activities.attendmaybe.length>0){
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
}
ListView {
id: conversationView
property string viewtype: "conversation"
x:3*mm
y:8*mm
width: conversationList.width-4*mm
height:conversationList.height-10*mm
//x:3*mm
//y:8*mm
width: conversationList.width//-4*mm
height:conversationList.height//-20*mm
clip: true
spacing: 0
footer: MessageSend{conversation:true}
@ -58,7 +105,7 @@ Rectangle {
BusyIndicator{
id: conversationBusy
anchors.horizontalCenter: conversationView.horizontalCenter
anchors.top:conversationList.top
anchors.top:conversationView.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
@ -69,7 +116,7 @@ Rectangle {
target:newstab
onConversationChanged:{
if(newstab.conversation.length==0){
newsStack.pop()
rootstackView.pop()
} else { conversationBusy.running=false;
conversationModel.clear();
var currentTime= new Date();
@ -88,16 +135,16 @@ Rectangle {
MButton {
id: closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
onClicked: {
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
newstab.conversation=[];
if (rootstackView.depth>1){ rootstackView.pop()}
}
}

View file

@ -74,7 +74,7 @@ Rectangle {
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right
anchors.margins: 1*mm
text:contact.name
@ -86,9 +86,8 @@ Rectangle {
}
}}
BlueButton {
MButton {
id: closeButton
//width:10*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right

View file

@ -46,6 +46,6 @@ Rectangle {
}
MouseArea{
anchors.fill: parent
onClicked:{search(hashtagText.text.replace("#",""))}
onClicked:{root.searchSignal(hashtagText.text.replace("#",""))}
}
}

View file

@ -43,9 +43,9 @@ import "qrc:/qml/genericqml"
Rectangle{
color:"#EEEEEE"
width:parent.width
height: (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
id:messageSend
visible:(newsSwipeview.stacktype!="Notifications")?true:false
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
property string parentId: ""
property bool textfocus: false
//property var parentObject:({})
@ -61,14 +61,12 @@ Rectangle{
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
function directmessagePrepare(friend){
messageSend.state="active";
reply_to_user=friend.screen_name;
receiverLabel.text=friend.screen_name;
}
function sendUrls(urls){
if((urls.length==1 && attachImageURLs.length==0)){
attachImage(urls);
@ -87,15 +85,13 @@ Rectangle{
}
}
function attachImage(url){
imageAttachment.source=url.toString();
}
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
//xhr.url= login.server + "/api/statuses/update.json";
newsBusy.running=true;
try{newsBusy.running=true;}catch(e){conversationBusy.running=true}
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/statuses/update");
@ -116,7 +112,7 @@ Rectangle{
};
xhr.post();
Newsjs.storeHashtags(login,db,status,root)
}
}
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
newsBusy.running=true;
@ -139,7 +135,7 @@ Rectangle{
reply_to_user=newsitemobject.user.screen_name;
parentId=newsitemobject.id
} else {
messageSend.state="";
messageSend.state=null;
reply_to_user="";
parentId="";
bodyField.text="";
@ -152,6 +148,9 @@ Rectangle{
Newsjs.listFriends(login,db,function(contacts){
contactModel.clear();
for (var i=0;i<contacts.length;i++){
if(contacts[i].description!="" &&contacts[i].description!=null){
contacts[i].description=Qt.atob(contacts[i].description)
}
contactModel.append({"contact":contacts[i]})
}
contactSelector.visible=true
@ -171,17 +170,36 @@ Rectangle{
// anchors.fill: parent
// contentHeight: messageColumn.height
// boundsBehavior: Flickable.StopAtBounds
DropArea{
anchors.fill: parent
onDropped: {
if (messageSend.state==""){messageSend.state="active"}
if (drop.keys.includes('text/uri-list')){
attachImageURLs.push(drop.text);
attachImage(drop.text)}
else if (drop.keys.includes('text/html')){
bodyField.append(drop.html)}
else if (drop.keys.includes('text/plain')){
bodyField.append(drop.text)
}
}
}
Column {
y:0.5*mm
id:messageColumn
spacing: 0.5*mm
width: parent.width
height: 10*mm//implicitHeight
height: 11*mm+stackTypeDescription.height//implicitHeight
Label{id:stackTypeDescription
width: parent.width
horizontalAlignment:Text.AlignHCenter
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
font.pointSize: osSettings.bigFontSize
}
TextArea{
id:receiverLabel
width: messageColumn.width//-8*mm
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
placeholderText:qsTr("to:")
text: ""
visible:false
@ -193,7 +211,7 @@ Rectangle{
id: titleField
x: 0.5*mm
width: parent.width-mm
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Title (optional)")
visible: false//(parentId === "") && (bodyField.length>1)
onVisibleChanged: if ((visible==true)&&(conversation==true)){
@ -211,21 +229,22 @@ Rectangle{
TextArea {
id: bodyField
property string contactprefix:""
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
anchors.fill: parent
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
font.family: "Noto Sans"
wrapMode: Text.Wrap
selectByMouse: true
placeholderText: conversation?"": qsTr("What's on your mind?")
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
textFormat: TextEdit.RichText //TextEdit.PlainText
onLineCountChanged: (conversation==true)?conversationView.contentY=conversationView.contentY+3*mm:newsView.contentY=newsView.contentY+3*mm
onLinkActivated:{Qt.openUrlExternally(link)}
onActiveFocusChanged:{
onActiveFocusChanged:{//print(placeholder)
if (activeFocus==true){
if (conversation==true){
setParent(conversationModel.get(0).newsitemobject);
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
messageSend.state="conversation";
conversationView.contentY=conversationView.contentY+20*mm
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
} else if (textfocus==false){
messageSend.state="active";
newsView.positionViewAtBeginning();
@ -347,18 +366,18 @@ Rectangle{
height: 12*mm
x: 0.5*mm
MButton{id:permButton
visible: (newsSwipeview.stacktype!=="DirectMessages")
height: 6*mm
width: 7*mm
visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
}
MButton {
id: attachButton
height: 6*mm
width: 7*mm
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf03e"
visible:(newsSwipeview.stacktype!="DirectMessages")
visible:!conversation?(newsSwipeview.stacktype!="DirectMessages"):true
onClicked: {
if (attachImageURLs.length>0){//Server currently accepts only one attachment
Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn)
@ -376,23 +395,23 @@ Rectangle{
MButton{
id:smileyButton
text: "\uf118"
height: 6*mm
width: 7*mm
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
}
MButton{
id:hastagButton
text: "\uf292"
height: 6*mm
width: 7*mm
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
}
MButton {
id: cancelButton
height: 6*mm
width: 7*mm
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf057"
onClicked: {
if (textfocus==true){messageSend.destroy()}
@ -409,21 +428,21 @@ Rectangle{
}
MButton {
id: sendButton
height: 6*mm
width: 7*mm
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (newsSwipeview.stacktype!=="DirectMessages"){
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
statusUpdate(title,body,parentId,attachImageURLs)}
else {
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
}
if (conversation==true){
newstab.newstabstatus=root.globaloptions.newsViewType; newsStack.pop(null)
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
}
}
}
@ -432,7 +451,7 @@ Rectangle{
SmileyDialog{id:smileyDialog;x:mm;visible: false}
}
Component.onCompleted:{
newsStack.replySignal.connect(setParent);
root.replySignal.connect(setParent);
root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
@ -464,7 +483,7 @@ Rectangle{
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
}
},
@ -482,6 +501,9 @@ Rectangle{
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
PropertyChanges {
target: stackTypeDescription; visible:false
}
}
]
}

View file

@ -49,7 +49,6 @@ Rectangle{
width: contentWidth
height: contentHeight
font.family:fontAwesome.name
//font.pixelSize: 3*mm
text: qsTr("Show all comments")+" (" +comments + ")" //"\uf0dc"
}
MouseArea{

View file

@ -32,19 +32,26 @@
import QtQuick 2.9
AnimatedImage {id:gif;
width:toprow.width;
property string mimetype:""
//property string mimetype:""
fillMode: Image.PreserveAspectFit;
onStatusChanged: playing = (status == AnimatedImage.Ready);
MouseArea {anchors.fill:parent;
onClicked:{
if (mimetype!="image/gif"){
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+
'Rectangle{id:recfullscreen;color:"white";width:root.width;height:root.height;'+
'MouseArea {anchors.fill:parent;onClicked:{recfullscreen.destroy()}}'+
'AnimatedImage {id:giffullscreen;source: "'+gif.source+
'";anchors.centerIn:parent; width:root.width;height:root.height;fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready);'+
'}}',root,"Attachmentlarge")
}
onStatusChanged: playing = (status == AnimatedImage.Ready)
Rectangle{
visible: (model.newsitemobject.imageAttachmentList.length>1)&&(gif.status==Image.Ready)
opacity: 0.5
color: "black"
width:imageCountText.contentWidth+mm
height: imageCountText.contentHeight+mm
x: (gif.width-gif.paintedWidth)/2+gif.paintedWidth-width
anchors.bottom: parent.bottom
Text {
anchors.centerIn: parent
id: imageCountText
text: "+ " + (model.newsitemobject.imageAttachmentList.length-1).toString()
color: "white"
}
}
MouseArea {anchors.fill:parent;
onClicked:{
rootstackView.push("qrc:/qml/newsqml/NewsPhotolist.qml",{"photolistarray": model.newsitemobject.imageAttachmentList})}
}
}

View file

@ -0,0 +1,134 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.9
import QtQuick.Controls 2.12
import "qrc:/qml/genericqml"
Page{
id:photolistview
width:root.width;
height:root.height//-7*mm
property var photolistarray: []
Rectangle{
anchors.fill: newsphotolistView
color: "black"
}
ListView{
id: newsphotolistView
anchors.fill: parent
orientation: Qt.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
model:photolistModel
delegate: photoWrapper
}
ListModel{
id: photolistModel
}
MButton {
id: closeButton
z:2
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
text: "\uf057"
onClicked: {if (rootstackView.depth>1){ rootstackView.pop()}
}
}
Component {
id: photoWrapper
AnimatedImage {
id: realImage;
width: photolistview.width; height: photolistview.height
antialiasing: true;
asynchronous: true
autoTransform:true
cache: false
fillMode: Image.PreserveAspectFit;
onStatusChanged: playing = (status == AnimatedImage.Ready);
source: url
BusyIndicator{
running: realImage.status==Image.Loading
anchors.centerIn: parent
}
}
// PinchArea {
// id:imagePinch
// pinch.target: realImage
// anchors.fill: realImage
// pinch.minimumScale: 0.1
// pinch.maximumScale: 10
// enabled: false
// }
}
BlueButton{
width: 5*mm
height:photolistview.height
anchors.left: newsphotolistView.left
visible: newsphotolistView.currentIndex!=0
text:"\uf053"
fontColor:"grey"
border.color: "transparent"
color:"transparent"
radius:0
onClicked: {newsphotolistView.currentIndex=newsphotolistView.currentIndex-1}
}
BlueButton{
width: 5*mm
height:photolistview.height
anchors.right: newsphotolistView.right
visible: newsphotolistView.currentIndex!=photolistarray.length-1
text:"\uf054"
fontColor:"grey"
border.color: "transparent"
color:"transparent"
radius:0
onClicked: {newsphotolistView.currentIndex=newsphotolistView.currentIndex+1}
}
Component.onCompleted: {
if (photolistarray.length>0){
photolistarray.forEach(function(photo){
photolistModel.append(photo)
})
}
}
}

View file

@ -35,292 +35,315 @@ import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
StackView{
Rectangle{
id: newsStack
anchors.fill: parent
//anchors.fill: parent
width: parent.width
height: parent.height
property string updateMethodNews: "refresh"
property var allchats: ({})
signal replySignal(var newsobject)
property int lastnewsid:0
property string newstabstatus: ""
function newstypeHandling(newstype){
newsBusy.running=true;
replySignal("");
//messagesend.state="";
newsModel.clear();
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
break;
case "conversation":
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
case "favorites":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites");
break;
case "replies":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Replies";
Service.updateView("Replies");
break;
case "publictimeline":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline");
break;
case "groupnews":
newsStack.updateMethodNews="refresh";
Service.showGroups();
break;
case "search":
newsView.anchors.topMargin=7*mm;
newsBusy.running=false;
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:mm,width:root.width,height: 5*mm});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessage"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
break;
default:
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="Directmessage"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
}
}
BusyIndicator{
id: newsBusy
//visible: false
anchors.horizontalCenter: parent.horizontalCenter
anchors.top:parent.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
z:2
running: false
}
function newstypeHandling(newstype){
newsBusy.running=true;
replySignal("");
//messagesend.state="";
newsModel.clear();
switch(newstype){
case "timeline":
newstab.newstabstatus="Timeline";
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
break;
case "conversation":
newstab.newstabstatus="Conversations";
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
break;
case "favorites":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites");
break;
case "replies":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Replies";
Service.updateView("Replies");
break;
case "publictimeline":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline");
break;
case "groupnews":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Groupnews";
Service.showGroups();
break;
case "search":
newsView.anchors.topMargin=7*mm;
newstab.newstabstatus="Search";
newsBusy.running=false;
var leftoffset=osSettings.osType=="Android"?3*osSettings.bigFontSize:0
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml");
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-leftoffset,height: 5*mm});
break;
case "refresh":
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//print("Refresh "+newsSwipeview.stacktype+newstab.newstabstatus)
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessage"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
break;
default:
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="Directmessage"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
}
}
function showNews(newsToShow){
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){}
newsBusy.running=false;
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+JSON.stringify(newsToShow))
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
newsWorker.sendMessage(msg);
//newsStack.appendNews=false
}
function showNews(newsToShow){
try{if (rootstackView.depth>1){rootstackView.pop()}}catch(e){}
newsBusy.running=false;
var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+JSON.stringify(newsToShow))
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
newsWorker.sendMessage(msg);
//newsStack.appendNews=false
}
function showContact(contact){ //print(JSON.stringify(contact));
//newstab.newstabstatus="Contact";
newsStack.push("qrc:/qml/newsqml/ContactPage.qml",{"contact": contact});
}
function search(term){//print("Search "+term)
if (term!=""){
newstab.newstabstatus="Search";
newsBusy.running=true;
newsStack.updateMethodNews="refresh";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/search");
xhr.clearParams();
xhr.setParam("q",term)
xhr.get();}
newsView.anchors.topMargin=mm
}
function getOldNews(){
function search(term){//print("Search "+term)
if (term!=""){
//newstab.newstabstatus="Search";
newstabstatus="Search";
newsBusy.running=true;
newsStack.updateMethodNews="refresh";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server);
xhr.setApi("/api/search");
xhr.clearParams();
xhr.setParam("q",term)
xhr.get();}
newsView.anchors.topMargin=mm
}
function getOldNews(){print("newstab.newstabstatus" +newstab.newstabstatus)
var currentTime= new Date();
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
//if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
if(newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg);
},false,lastnews_id)}
else if(newstab.newstabstatus=="Conversations"){
//else if(newstab.newstabstatus=="Conversations"){
else if(newstabstatus=="Conversations"){
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg);
},lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){}
//else if (newstab.newstabstatus=="Notifications"){}
else if (newstabstatus=="Notifications"){}
else{
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
//newsStack.appendNews=true;
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
xhr.get()
}
}
Connections{
target:xhr
function onError(data,url,api,code){
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
newsBusy.running=false;
}
function onSuccess(data,api){
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
Service.processNews(api,data)
replySignal("")
}
}
Timer {id:replytimer; interval: 1000; running: false; repeat: false
onTriggered: {"replytimer triggered";
newsBusy.running=true;
if(newstab.newstabstatus=="Conversation"){
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
else{
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
replySignal("")
//Service.updateView(newstab.newstabstatus)
}
}
}
initialItem: Rectangle {
id:newslistRectangle
y:1
color: "white"
//anchors.fill:parent
Component { id:footerComponent
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:newsView.width
height:6*mm
Text{
font.pixelSize: 1.5*mm
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{
anchors.fill:parent
onClicked:{
if (newsModel.count==0){
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
}
else {getOldNews();}
}
}
}
target:xhr
function onError(data,url,api,code){
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
newsBusy.running=false;
}
function onSuccess(data,api){
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
Service.processNews(api,data)
replySignal("")
}
}
ListView {
id: newsView
property real oldContentY:0
property bool viewdragged: false
property bool viewdraggedpositive: false
property string viewtype: "news"
anchors.fill: parent
anchors.margins: mm
clip: true
spacing: 0
header: MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()}
footer: footerComponent
model: newsModel
delegate: Newsitem{}
onDragStarted: oldContentY=contentY
onDragEnded: {
if(verticalOvershoot<-5*mm){
Timer {id:replytimer; interval: 1000; running: false; repeat: false
onTriggered: {"replytimer triggered";
newsBusy.running=true;
if(newstab.newstabstatus=="Conversation"){
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
else{
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
replySignal("")
//Service.updateView(newstab.newstabstatus)
}
}
}
Component { id:footerComponent
Rectangle{
border.color: "#EEEEEE"
border.width: 1
width:newsView.width
height:6*mm
Text{
font.pointSize: osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")
}
MouseArea{
anchors.fill:parent
onClicked:{
if (newsModel.count==0){
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
}
else {print("Footer newstab.newstabstatus "+newstab.newstabstatus);getOldNews();}
}
}
}
}
ListView {
id: newsView
property real oldContentY:0
property bool viewdragged: false
property bool viewdraggedpositive: false
property string viewtype: "news"
width: parent.width
height: parent.height-3*mm
//anchors.fill: parent
anchors.margins: 0.5*mm
clip: true
spacing: 0
header:
MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()}
footer: footerComponent
model: newsModel
delegate: Newsitem{}
onDragStarted: oldContentY=contentY
onDragEnded: {
if(verticalOvershoot<-5*mm){
viewdragged=true
}
else if (verticalOvershoot>5*mm){
}
else if (verticalOvershoot>5*mm){
viewdraggedpositive=true
}
else{
}
else{
if((contentY-oldContentY)>15*mm){
swipeIndicator.visible=false;
newsSwipeview.height=rootStackItem.height;
newsSwipeview.y=0;
rootStackItem.state="fullscreen"
//swipeIndicator.visible=false;
//newsSwipeview.height=rootstack.height;
//newsSwipeview.y=0;
//rootStackItem.state="fullscreen"
}
else if ((contentY-oldContentY)<-15*mm){
swipeIndicator.visible=true;
newsSwipeview.height=rootStackItem.height-12*mm;
newsSwipeview.y=5*mm;
rootStackItem.state=""
//swipeIndicator.visible=true;
//newsSwipeview.height=rootstack.height-12*mm;
//newsSwipeview.y=5*mm;
//rootStackItem.state=""
}
}
}
onViewdraggedChanged: {
if (viewdragged){
var onlynew=true;
newsBusy.running=true;
viewdragged=false
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
}
}
onViewdraggedChanged: {
if (viewdragged){
var onlynew=true;
newsBusy.running=true;
viewdragged=false
if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
Service.updateView(newstab.newstabstatus)
if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)};
}
});
}
if(newstab.newstabstatus=="Conversations"){
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
lastnewsid=lastid;
showNews(news)});
}
} else {
Service.updateView(newstab.newstabstatus)
}
});
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
}
@ -331,87 +354,82 @@ StackView{
Service.updateView("Replies")
}
}
}
onViewdraggedpositiveChanged: {
if (viewdraggedpositive){
}
}
onViewdraggedpositiveChanged: {
if (viewdraggedpositive){print("listview dragged newstab.newstabstatus "+newstab.newstabstatus)
getOldNews();
viewdraggedpositive=false
}
}
}
ListModel{id: newsModel}
WorkerScript {
id: newsWorker
source: "qrc:/js/newsworker.js"
}
BusyIndicator{
id: newsBusy
anchors.horizontalCenter: parent.horizontalCenter
anchors.top:parent.top
anchors.topMargin: 2*mm
width:10*mm
height: 10*mm
running: false
}
Rectangle{
id:downloadNotice
property alias text: noticeText.text
color:"white"
border.color:"grey"
z:1
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom:parent.bottom
anchors.bottomMargin: 2*mm
width: noticeText.width+2*mm
height: noticeText.height+2*mm
visible: (downloadNotice.text!="")
Text{
id:noticeText
color: "grey"
anchors.centerIn: parent
width: contentWidth
height: contentHeight
font.pixelSize: 2*mm
text:""
}
}
Component.onCompleted: {
root.newstypeSignal.connect(newstypeHandling);
root.messageSignal.connect(onFriendsMessages);
root.contactdetailsSignal.connect(showContact);
root.newsSignal.connect(showNews);
try{newsModel.clear()} catch(e){}
swipeIndicator.visible=true;
newsSwipeview.height=rootStackItem.height-12*mm;
newsSwipeview.y=5*mm;
rootStackItem.state=""
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews);
})
}
else{
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}
}
ScrollBar.vertical: ScrollBar { }
}
ListModel{id: newsModel}
WorkerScript {
id: newsWorker
source: "qrc:/js/newsworker.js"
}
Rectangle{
id:downloadNotice
property alias text: noticeText.text
color:"white"
border.color:"grey"
z:1
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom:parent.bottom
anchors.bottomMargin: 2*mm
width: noticeText.width+2*mm
height: noticeText.height+2*mm
visible: (downloadNotice.text!="")
Text{
id:noticeText
color: "grey"
anchors.centerIn: parent
width: contentWidth
height: contentHeight
font.pointSize: osSettings.systemFontSize
text:""
}
}
Component.onCompleted: {
root.newstypeSignal.connect(newstypeHandling);
root.contactdetailsSignal.connect(showContact);
root.newsSignal.connect(showNews);
root.searchSignal.connect(search);
try{newsModel.clear()} catch(e){}
swipeIndicator.visible=true;
//newsSwipeview.height=rootstack.height//-12*mm;
//newsSwipeview.y=5*mm;
//rootStackItem.state=""
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
newstabstatus=newstab.newstabstatus;
var messagetype=0;
switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break;
default:messagetype=0;
}
//if((newstab.newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews);
})
}
else{
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
lastnewsid=lastid;
showNews(dbnews)
})}
}
//}
}

View file

@ -31,20 +31,23 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 2.3
//import QtQuick.Dialogs 1.3
import "qrc:/qml/newsqml"
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
Item {
Rectangle{
id:newstabitem
width:rootstack.width//-5*mm
height: rootstack.height-8*mm//rootstack.height-100*mm
onHeightChanged: {newsSwipeview.height=height-6*mm}
//anchors.fill: parent
//onHeightChanged: {newsSwipeview.height=height-5*mm}
Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: {
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
root.onNewContactsChanged(root.newContacts);
Newsjs.storeNews(login,db,root.news,root)
}
}
@ -56,6 +59,7 @@ Item {
xhr.setUrl(login.server);
xhr.setApi("/api/conversation/show");
xhr.setParam("id",newsitemobject.id)
xhr.setParam("count","200")
xhr.get();
}
else{
@ -113,51 +117,101 @@ Item {
}
function onFriendsMessages(friend){
newstab.newstabstatus="Contact"
Newsjs.newsfromdb(db,root.login.username, 0,function(dbnews){
if (dbnews.length==0){
Newsjs.newsfromdb(db,login.username,0,function(forumnews){
showNews(forumnews)
},friend.url)
}
else showNews(dbnews)
},friend.id)
// CalendarTab{
// visible: wideScreen&&rootstackView.depth<2
// width: newstabitem.width/3
// x: newsSwipeview.width
// //anchors.left: newsSwipeview.right
// //anchors.fill: null
// }
// Rectangle{
// color: "#F8F8F8"
// height: parent.height
// width: 0.5*mm
// anchors.left: newsSwipeview.right
// }
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
Label{
text:"\uf0c9 "
font.pixelSize: 5* mm
anchors.left: parent.left
anchors.margins: mm
color: "#B0BEC5"
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.open()
}
}
LeftDrawerLinux{
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
visible: wideScreen&&rootstackView.depth<2
width: visible?root.fontFactor*osSettings.systemFontSize*15:0
height: root.height-bar.height
}
Label{
text:qsTr(newsSwipeview.stacktype)
font.pixelSize: 3* mm
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 2*mm
LeftDrawerAndroid{
id: leftDrawerAndroid
}
// BlueButton{
// z:2
// anchors.left: newsSwipeview.left
// anchors.verticalCenter: newsSwipeview.verticalCenter//anchors.bottom: newsSwipeview.bottom
// anchors.margins: mm
// visible: wideScreen && newsSwipeview.currentIndex!=0
// text:"\uf053"
// fontColor:"grey"
// border.color: "transparent"
// color:"transparent"
// radius:0
// onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex-1}
// }
// BlueButton{
// z:2
// anchors.right: newsSwipeview.right
// anchors.verticalCenter: newsSwipeview.verticalCenter//anchors.bottom: newsSwipeview.bottom
// anchors.margins: mm
// visible: wideScreen && newsSwipeview.currentIndex!=3
// text:"\uf054"
// fontColor:"grey"
// border.color: "transparent"
// color:"transparent"
// radius:0
// onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex+1}
// }
SwipeView{
id: newsSwipeview
property string stacktype:"Home"
currentIndex: 0
width: parent.width
height: parent.height-6*mm
y: 5*mm
width: wideScreen&&rootstackView.depth<2?newstabitem.width-leftDrawer.width-mm:newstabitem.width-mm//newstabitem.width/3*2:newstabitem.width
height: newstabitem.height-4*mm
x: leftDrawer.width
function onDirectMessage(friend){currentIndex=2}
transitions: Transition {
PropertyAnimation { properties: "height";
easing.type: Easing.InOutQuad
duration: 1000
}
}
// transitions: Transition {
// PropertyAnimation { properties: "height";
// easing.type: Easing.InOutQuad
// duration: 1000
// }
// }
// Label{
// text:"\uf0c9 "
// font.pixelSize: 5* mm
// anchors.left: parent.left
// anchors.margins: mm
// color: "#B0BEC5"
// MouseArea{
// anchors.fill: parent
// onClicked:{
// leftDrawer.open()
// }
// }
// }
onCurrentIndexChanged: {
switch(currentIndex){
@ -168,6 +222,7 @@ Item {
default: stacktype="Home";
}
}
//anchors.fill: parent
Loader{
id: friendstimeline
@ -192,16 +247,17 @@ Item {
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
//onLoaded: newsSwipeview.stacktype="Notifications"
}
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage)}
}
PageIndicator {
id: swipeIndicator
z:5
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
count: newsSwipeview.count
currentIndex: newsSwipeview.currentIndex
anchors.bottom: newsSwipeview.bottom
anchors.horizontalCenter: parent.horizontalCenter
}
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
}

View file

@ -50,9 +50,9 @@ Rectangle{
MouseArea {anchors.fill:parent;
onClicked:{
if(attachment.mimetype=="video/youtube"){
root.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
rootstackView.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
} else {
root.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
rootstackView.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype});
}
}
}

View file

@ -33,12 +33,13 @@ import QtMultimedia 5.8
import QtQuick 2.9
import QtQuick.Controls 2.12
Rectangle{
Page{
id:newsvideofullscreen
color:"black"
//color:"black"
//border.color: "light grey"
width:root.width;
height:root.height
height:root.height-3*root.fontFactor*osSettings.bigFontSize
property alias source:video.source
Text{
id:noticeText
@ -46,7 +47,7 @@ Rectangle{
color:"light grey"
width:parent.width/2
wrapMode: Text.Wrap
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
x:parent.width/2-parent.height/4
y:parent.height/5
visible: video.playbackState!=MediaPlayer.PlayingState
@ -55,7 +56,7 @@ Rectangle{
Video {id:video;
anchors.fill:parent
property string mimetype:""
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString;}
onErrorChanged:{noticeText.font.pointSize=osSettings.bigFontSize;noticeText.text=errorString;}
fillMode: Image.PreserveAspectFit;
autoLoad: true
autoPlay: true
@ -63,7 +64,7 @@ Rectangle{
MouseArea {
anchors.fill:parent;
onClicked:{
root.pop()
rootstackView.pop()
}
}
}
@ -76,6 +77,7 @@ Rectangle{
z:2
visible:video.playbackState!=MediaPlayer.StoppedState
value: video.position/video.duration
MouseArea {
anchors.fill:parent;
onClicked:{

View file

@ -32,14 +32,16 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.8
import QtQuick.Controls 2.12
import "qrc:/js/helper.js" as Helperjs
import QtWebView 1.1
Rectangle{
Page {
id:newsYplayer
color:"black"
//color:"black"
width:root.width;
height:root.height
height:root.height-7*mm
property string url:""
property string ytcode:""

View file

@ -37,7 +37,7 @@ import "qrc:/qml/genericqml"
Item {
id: newsitem
width: newsView.width //parent.width
width: newsitemobject.hasOwnProperty("indent")&&newsitemobject.indent>0?parent.width:newsitem.ListView.view.width//parent.width//newsView.width //
height:toprow.height+friendicaActivities.height+controlrow.height+conversationColumn.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
property int itemindex: index
property var newsitemobject:model.newsitemobject
@ -45,7 +45,7 @@ Item {
property var friendica_activities_view: getActivitiesView(model.newsitemobject)
onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending")+": "+ qsTr(attending)}
attendLabel.text= qsTr("attending")+": "+ qsTr(attending)}
signal replyto(string parent_id)
@ -54,425 +54,416 @@ Item {
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
}
function pushConversation(){
if (model.newsitemobject.hasOwnProperty("currentconversation")){
newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")};
rootstackView.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
//newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
//else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")};
else{rootstackView.push("qrc:/qml/newsqml/Conversation.qml")};
showConversation(index,newsitemobject)
}
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
Rectangle{
width:newsitem.width
height:newsitem.height-1
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
width:newsitem.width
height:newsitem.height-1
color: "white"
Column {
id:toprow //newscolumn
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *(newsitemobject.indent+1)):newsitem.width//-8*mm
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*(newsitemobject.indent):0
Item{
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
showContact(newsitemobject.user)}
}
Image {
id:profileImage
source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
x:1
y:1
width: 7*mm
height: 7*mm
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Flow{
id:topFlow
spacing: mm
width:parent.width-8*mm
anchors.left: profileImage.right
anchors.margins: mm
Label {
id:user_name
//color: "grey"
width:parent.width
font.bold: true
font.pixelSize: 2.5*mm
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: newsitemobject.user.name+" (@"+newsitemobject.user.screen_name+")"+newsitemobject.forumname
Column {
id:toprow //newscolumn
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *(newsitemobject.indent+1)):newsitem.width//-8*mm
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*(newsitemobject.indent):0
height: newsitemobject.nsfw?5*mm:Math.min(itemHeader.height+itemBody.height,3/4*root.height)
clip: true
Item{id:itemHeader
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
width: parent.width
MouseArea{
anchors.fill: parent
onClicked:{
showContact(newsitemobject.user)}
}
Image {
id:profileImage
source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url
x:1
y:1
width: 2*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
//radius:mm
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Flow{
id:topFlow
spacing: 0.5*mm
width:parent.width-8*mm
anchors.left: profileImage.right
anchors.margins: mm
Label {
id:user_name
//color: "grey"
width:parent.width
font.bold: true
font.pointSize: osSettings.systemFontSize
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: newsitemobject.user.name+" (@"+newsitemobject.user.screen_name+")"+newsitemobject.forumname
}
Label {
id:messageTypeLabel
color: "grey"
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
font.pixelSize: 1.5*mm
}
Label {
id:createdAtLabel
color: "grey"
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
}
Label {
id:replytoLabel
color: "grey"
font.pixelSize: 1.5*mm
font.family: "Noto Sans"
horizontalAlignment: Label.AlignRight
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
}catch(e){" "}
Label {
id:messageTypeLabel
color: "grey"
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
font.pointSize: 0.6*osSettings.systemFontSize
}
Label {
id:createdAtLabel
color: "grey"
font.pointSize: 0.6*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
text: " \u00B7 "+getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
}
Label {
id:replytoLabel
color: "grey"
font.pointSize: 0.6*osSettings.systemFontSize
font.family: "Noto Sans"
horizontalAlignment: Label.AlignRight
text: try {" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name
}catch(e){" "}
}
}
//Component.onCompleted:print("Newsitemwidth "+newsitem.width+ " Indent "+newsitemobject.indent)
}
}
MouseArea{
width: toprow.width-2
height: itemMessage.height
onPressAndHold: {
pushConversation();
}
Text {
color: "#404040"
linkColor: "light green"
id: itemMessage
textFormat: Text.RichText
font.family: "Noto Sans"
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
MouseArea{id: itemBody
width: toprow.width-2
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
//height: implicitHeight
wrapMode: Text.Wrap
clip:true
onLinkActivated:{
Qt.openUrlExternally(link)}
Component.onCompleted:{
if (newsitemobject.messagetype==0){
var hashtags=[];
hashtags=Newsjs.findTags(newsitemobject.text);
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
for (var tags in hashtags){
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
}}
if (newsitemobject.attachmentList.length>0){
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":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(toprow,{"url":newsitemobject.attachmentList[attachments].url});
}
else {
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
var videoQml = component.createObject(toprow,{"attachment":newsitemobject.attachmentList[attachments]});
height: itemMessage.height
onPressAndHold: {pushConversation()}
Text {
color: "#404040"
linkColor: "light green"
id: itemMessage
textFormat: Text.RichText
font.family: "Noto Sans"
font.pointSize: osSettings.systemFontSize
text: newsitemobject.statusnet_html
width: toprow.width-2
//height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
height: implicitHeight
wrapMode: Text.Wrap
clip:true
onLinkActivated:{Qt.openUrlExternally(link)}
Component.onCompleted:{
if (newsitemobject.messagetype==0){
var hashtags=[];
hashtags=Newsjs.findTags(newsitemobject.text);
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
for (var tags in hashtags){
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
}
}
}
if (newsitemobject.hasOwnProperty("lastcomment")){
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
if (newsitemobject.imageAttachmentList.length>0){
if(newsitemobject.imageAttachmentList[0].mimetype.substring(0,5)=="image"){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
var imageQml = component.createObject(toprow,{"source":newsitemobject.imageAttachmentList[0].url});
}
}
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
if (newsitemobject.videoAttachmentList.length>0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
var videoQml = component.createObject(toprow,{"attachment":newsitemobject.videoAttachmentList[0]});
}
if (newsitemobject.hasOwnProperty("lastcomment")){
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
}
}
}
}}
}}
}
BlueButton{
width: newsitem.width-8*mm-2
width: newsitem.width-2
height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
anchors.bottom: toprow.bottom//itemMessage.bottom
visible: toprow.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
text:"\uf078"
fontColor:"grey"
border.color: "transparent"
color:"white"
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" }
// }
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" }
// }
radius:0
onClicked: {
if (text=="\uf078"){
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
toprow.height=toprow.implicitHeight+6*mm;text="\uf077"
} else {
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
toprow.height=Math.min(toprow.implicitHeight,3/4*root.height);
text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning);
}
}
}
}
// Bottom row for activities
Flow{
id:friendicaActivities
anchors.top:toprow.bottom
width:parent.width
spacing:mm
// Bottom row for activities
Flow{
id:friendicaActivities
anchors.top:toprow.bottom
width:parent.width
spacing:mm
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities_view.likeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities_view.dislikeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities_view.attendyesText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
}}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities_view.attendnoText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
}
}
Label{color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
text: friendica_activities_view.attendmaybeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
}
}
Label{
id:attendLabel
color: "grey"
height:3.5*mm
font.pixelSize: 1.5*mm
horizontalAlignment: Label.AlignRight
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
}
}
//Bottom row for buttons
Row{id:controlrow
anchors.top:friendicaActivities.bottom
height: 4*mm
CheckBox{
id:likeCheckbox
width:newsitem.width/5 //10*mm
height: parent.height
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
checked:(model.newsitemobject.friendica_activities_view.self.liked==1)?true:false
indicator: Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:4*mm
Text{
anchors.centerIn: parent
font.pixelSize: 3*mm
font.family:fontAwesome.name
color:likeCheckbox.checked?"black": "grey"
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
Label{color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.likeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
}
}
onClicked: {
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false;
newsitemobject.friendica_activities_view.self.liked=1;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
Label{color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.dislikeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
}
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root);
newsitemobject.friendica_activities_view.self.liked=0;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}}
}
Label{color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendyesText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
}}
Label{color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendnoText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
}
}
Label{color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.attendmaybeText
MouseArea{
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)}
}
}
Label{
id:attendLabel
color: "grey"
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
}
}
CheckBox{
id: dislikeCheckbox
width:newsitem.width/5 //10*mm
height: parent.height
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false
indicator: Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:4*mm
Text{
anchors.centerIn: parent
font.pixelSize: 3*mm
font.family:fontAwesome.name
color:dislikeCheckbox.checked?"black": "grey"
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
//Bottom row for buttons
Row{id:controlrow
anchors.top:friendicaActivities.bottom
height: root.fontFactor*osSettings.bigFontSize
CheckBox{
id:likeCheckbox
width:newsitem.width/5 //10*mm
height: parent.height
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
checked:(model.newsitemobject.friendica_activities_view.self.liked==1)?true:false
indicator: Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:root.fontFactor*osSettings.bigFontSize
Text{
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color:likeCheckbox.checked?"black": "grey"
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
}
}
onClicked: {
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false;
newsitemobject.friendica_activities_view.self.disliked=1;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
onClicked: {
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false;
newsitemobject.friendica_activities_view.self.liked=1;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}
else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root);
newsitemobject.friendica_activities_view.self.liked=0;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}}
}
CheckBox{
id: dislikeCheckbox
width:newsitem.width/5 //10*mm
height: parent.height
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false
indicator: Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:root.fontFactor*osSettings.bigFontSize
Text{
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color:dislikeCheckbox.checked?"black": "grey"
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
}
}
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root);
newsitemobject.friendica_activities_view.self.disliked=0;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}}
}
onClicked: {
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false;
newsitemobject.friendica_activities_view.self.disliked=1;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}
else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root);
newsitemobject.friendica_activities_view.self.disliked=0;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject});
}}
}
CheckBox {
id:favoritedCheckbox
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
width: newsitem.width/5 // 10*mm
height: parent.height
indicator:Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:4*mm
CheckBox {
id:favoritedCheckbox
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
width: newsitem.width/5 // 10*mm
height: parent.height
indicator:Rectangle{
implicitWidth: newsitem.width/5 //10*mm
implicitHeight:root.fontFactor*osSettings.bigFontSize
Text{
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color: favoritedCheckbox.checked?"black":"grey"
text:"\uf005"
}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkState==Qt.Checked){
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkState==Qt.Unchecked){
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: newsitem.width/5 //10*mm
height: parent.height
visible:(newsitemobject.messagetype!==2)
color:"transparent"
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color: favoritedCheckbox.checked?"black":"grey"
text:"\uf005"
text: "\uf142"
}
}
checked:(newsitemobject.favorited>0)
onClicked:{
if(favoritedCheckbox.checkState==Qt.Checked){
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
else if(favoritedCheckbox.checkState==Qt.Unchecked){
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
}
}
Rectangle{
width: newsitem.width/5 //10*mm
height: parent.height
visible:(newsitemobject.messagetype!==2)
color:"transparent"
Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent
font.pixelSize: 3*mm
font.family:fontAwesome.name
text: "\uf142"
}
MouseArea{
anchors.fill:parent
onClicked: {newsmenu.popup()}}
}
}
Menu {
id:newsmenu
width: 30*mm
delegate: MenuItem{
contentItem: Text{
font.pixelSize: 3*mm
text: parent.text
}
}
Action{
text: qsTr("Reply")
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
}
}
Action {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
}
Action {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
Helperjs.showMessage("Repost",qsTr("Success!"),root)
})
}
}
Action {
text: qsTr("Conversation")
onTriggered: {
pushConversation();
MouseArea{
anchors.fill:parent
onClicked: {newsmenu.popup()}}
}
}
Menu{
title: qsTr("Attending")
width: 20*mm
Menu {
id:newsmenu
width: 18*osSettings.FontSize
delegate: MenuItem{
contentItem: Text{
font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
text: parent.text
}
}
Action{
text:qsTr("yes")
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="yes";attending="yes"})
text: qsTr("Reply")
onTriggered: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;
if (newsitem.ListView.view.viewtype=="conversation"){conversation=true}
else{conversation=false};
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
}
}
Action{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="maybe";attending="maybe"})
Action {
text: qsTr("DM")
onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
}
}
Action{text:qsTr("no")
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="no";attending="no"})}
Action {
text: qsTr("Repost")
onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
Helperjs.showMessage("Repost",qsTr("Success!"),root)
})
}
}
}
Action {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
var msg = {'deleteId': index, 'model': newsModel};
newsWorker.sendMessage(msg);
})
Action {
text: qsTr("Conversation")
onTriggered: {
pushConversation();
}
}
}
Action {
text: qsTr("Show height")
onTriggered: {
Helperjs.showMessage("Height",itemMessage.height + "toprow: "+ toprow.height,root)
Menu{
title: qsTr("Attending")
width: 10*osSettings.systemFontSize
delegate: MenuItem{
contentItem: Text{
font.pointSize: osSettings.systemFontSize
text: parent.text
}
}
Action{
text:qsTr("yes")
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="yes";attending="yes"})
}
}
Action{text:qsTr("maybe")
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="maybe";attending="maybe"})
}
}
Action{text:qsTr("no")
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){
model.newsitemobject.friendica_activities_view.self.attending="no";attending="no"})}
}
}
Action {
text: qsTr("Delete")
onTriggered: {
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
var msg = {'deleteId': index, 'model': newsModel};
newsWorker.sendMessage(msg);
})
}
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
//}
}
Column{
id:conversationColumn
anchors.top:controlrow.bottom
width: newsitem.width
}
//MenuItem{
// text:qsTr("Show on website")
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
//}
}
Column{
id:conversationColumn
anchors.top:controlrow.bottom
//anchors.right: parent.right
width: newsitem.width
}
}
}

View file

@ -42,10 +42,8 @@ Rectangle{
width: messageColumn.width-5*mm
height:root.height/2
Button{
MButton{
id:closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top
anchors.topMargin: 1*mm
anchors.right: parent.right
@ -62,20 +60,20 @@ Rectangle{
position:TabBar.Header
TabButton {
text:qsTr("Unicode")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Standard")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Addon")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Adult")
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
}
}
@ -86,7 +84,7 @@ Rectangle{
anchors.top: closeButton.bottom
anchors.topMargin: 1*mm
width: smileyDialog.width-2*mm
height: smileyDialog.height-7*mm
height: smileyDialog.height-4*root.fontFactor*osSettings.bigFontSize
Rectangle{
id: htmlGridTab
GridView {
@ -177,10 +175,6 @@ Rectangle{
}
}
}
}
Component{
id:smileyItem
@ -207,7 +201,7 @@ Rectangle{
width:4.5*mm
height: 4.5*mm
textFormat:Text.RichText
font.pixelSize: 4*mm
font.pointSize: 1.2*osSettings.systemFontSize
text: emoji
MouseArea{

View file

@ -63,7 +63,7 @@ Rectangle{
}
function updateImage(){
function updateImage(){
xhr.url= login.server + "/api/friendica/photo/update.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams();
@ -119,7 +119,7 @@ function updateImage(){
anchors.rightMargin: 1*mm
spacing:5*mm
Text{
font.pixelSize: 3.5*mm
font.pointSize: osSettings.bigFontSize
font.bold: true
text:qsTr("Upload to album")
}
@ -132,17 +132,46 @@ function updateImage(){
// }
// }
Button{
MButton{
id:closeButton
height: 8*mm
text: "\uf057"
font.pixelSize: 3*mm
onClicked:{photoStack.pop();
//imageDialog.destroy()
width: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.bigFontSize
onClicked:{photoStack.pop()}
}
}
ComboBox{
id: album
x: 3*mm
y: 3*root.fontFactor*osSettings.bigFontSize
width: root.width/2;
height: 2.5*root.fontFactor*osSettings.bigFontSize//5*mm;
font.pointSize: osSettings.bigFontSize
editable:true
model: albumModel
// delegate: ItemDelegate {
// width: album.width
// contentItem: Text {
// //text: modelData
// color: "white"
// font: album.font
// font.pixelSize: album.font.pixelSize
// elide: Text.ElideRight
// verticalAlignment: Text.AlignVCenter
// }
// //highlighted: album.highlightedIndex === index
// }
onAccepted: {
if (find(currentText) === -1) {
albumModel.append({text: editText})
currentIndex = find(editText)
}
}
}
ListModel{id:albumModel}
// Text {
// text: qsTr("Album")
// x: 4*mm; y: 10*mm
@ -161,16 +190,28 @@ function updateImage(){
ListView{
id: imageUploadView
x:3*mm //23*mm
y:17*mm
y: 11*mm + album.height
width: imageDialog.width-5*mm //25*mm
height: root.width/2 //25*mm
height: parent.height -(9*root.fontFactor*osSettings.bigFontSize)//root.width/2 //25*mm
model: imageUploadModel
delegate: imageDelegate
footer: imageId==""?imageFooter:null
clip:true
orientation: ListView.Horizontal
spacing: mm
DropArea{
anchors.fill: parent
onDropped: {
if (drop.keys.includes('text/uri-list')){
var urllist=drop.text.split('\n');
for(var i=0;i< urllist.length;i++){
attachImage(urllist[i])
}
}
}
}
}
BusyIndicator{
id: uploadBusy
running: false
@ -180,6 +221,7 @@ function updateImage(){
width:10*mm
height: 10*mm
}
ListModel{
id: imageUploadModel
}
@ -192,7 +234,7 @@ function updateImage(){
Image{
id: uploadImage
width: root.width/2-mm //20*mm
height: imageUploadView.height-6*mm//height: 14*mm
height: imageUploadView.height-(3*root.fontFactor*osSettings.bigFontSize+2*mm)
fillMode: Image.PreserveAspectFit
source:imageUrl
onVisibleChanged: descriptionInput.focus=true;
@ -207,18 +249,19 @@ function updateImage(){
}
Rectangle{
color: "light grey"
//color: "light grey"
border.color: "grey"
anchors.top: uploadImage.bottom
anchors.topMargin: mm
//x: mm; y: 15*mm;
width: root.width/2-mm //Math.max(root.width/2-mm, descriptionInput.contentWidth);
height: 5*mm;
height: 2.5*root.fontFactor*osSettings.bigFontSize +2*mm //5*mm;
TextField{
//TextInput {
id: descriptionInput
anchors.fill: parent
font.pixelSize: 3*mm
anchors.margins: mm
font.pointSize: osSettings.systemFontSize
selectByMouse: true
placeholderText: qsTr("Description")
text:description!=""?description:""
@ -248,44 +291,17 @@ function updateImage(){
}
}
}
ComboBox{
id: album
x: 3*mm
y: 10*mm
width: root.width/2;
height: 5*mm;
font.pixelSize: 3*mm
editable:true
model: albumModel
// delegate: ItemDelegate {
// width: album.width
// contentItem: Text {
// //text: modelData
// color: "white"
// font: album.font
// font.pixelSize: album.font.pixelSize
// elide: Text.ElideRight
// verticalAlignment: Text.AlignVCenter
// }
// //highlighted: album.highlightedIndex === index
// }
onAccepted: {
if (find(currentText) === -1) {
albumModel.append({text: editText})
currentIndex = find(editText)
}
}
}
ListModel{id:albumModel}
Button{
id:uploadButton
height: 8*mm
x:4*mm; y:root.width/2+18*mm //40*mm
height: 2*root.fontFactor*osSettings.bigFontSize
x:4*mm;
anchors.top:imageUploadView.bottom
anchors.topMargin: mm
//y:root.width/2+18*mm //40*mm
text: imageId==""?qsTr("Upload"):qsTr("Change")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onClicked:{
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else if (imageId!=""){uploadBusy.running=true; updateImage()}

View file

@ -78,7 +78,7 @@ Package {
width:15*mm
anchors.bottom: photoWrapper.bottom
color: "white"
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
wrapMode:Text.Wrap
}
MouseArea {

View file

@ -152,6 +152,31 @@ StackView{
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml",{"attachImageURLs":urls})
}
BlueButton{
x:mm
y:mm
z:2
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
onClicked:{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
LeftDrawerLinux{
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
visible: wideScreen&&rootstackView.depth<2
width: visible?osSettings.systemFontSize*15:0
height: root.height-bar.height
}
LeftDrawerAndroid{
id: leftDrawerAndroid
}
ProgressBar{
id: newImagesProgress
width: 15*mm
@ -169,8 +194,6 @@ StackView{
anchors.topMargin: 0.5*mm
anchors.right:updatePhotolist.left
anchors.rightMargin:mm
height: 6*mm
width: 8*mm
text:"\uf0ee"
onClicked: {
photoStack.push("qrc:/qml/photoqml/ImageUploadDialog.qml");
@ -184,22 +207,20 @@ StackView{
anchors.topMargin: 0.5*mm
anchors.right:phototabstatusButton.left
anchors.rightMargin:mm
height: 6*mm
width: 8*mm
text:"\uf0ed"
Menu {
id:photoupdatemenu
width:40*mm
width:8*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("All Images")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, false, fotostab,function(obj){fotorectangle.newimages=obj})}
}
MenuItem {
text: qsTr("Only new")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onTriggered: {
Imagejs.requestList(root.login,root.db, true,fotostab,function(obj){fotorectangle.newimages=obj})}
}
@ -213,15 +234,14 @@ StackView{
anchors.topMargin: 0.5*mm
anchors.right: parent.right
anchors.rightMargin:2*mm
height: 6*mm
width: Math.max(10*mm,implicitWidth)
width: Math.max(8*root.fontFactor*osSettings.bigFontSize,implicitWidth)
text: fotostab.phototabstatus=="Images"?qsTr("Own Images"):fotostab.phototabstatus
Menu {
id:phototabmenu
width: 40*mm
width: 20*root.fontFactor*osSettings.bigFontSize
MenuItem {
text: qsTr("Own Images")
font.pixelSize: 3*mm
font.pointSize: osSettings.bigFontSize
onTriggered: {
fotostab.phototabstatus="Images";
// phototabstatusButton.text=qsTr("Own images");
@ -246,8 +266,10 @@ StackView{
id: albumgridview
cellWidth: 17*mm
cellHeight: 17*mm
x: mm;y:8*mm
width: parent.width-2*mm; height: parent.height-9*mm
x: leftDrawer.width//mm;
y:8*mm
width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm //parent.width-2*mm;
height: parent.height-9*mm
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
@ -256,7 +278,7 @@ StackView{
width:12*mm
height:6*mm
Text{
font.pixelSize: 1.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")
}
@ -282,11 +304,9 @@ StackView{
MButton {
id: backButton
height: 6*mm
width: 8*mm
text: "\uf057"
x: parent.width - backButton.width - 3*mm
y: -backButton.height - 4*mm
x: parent.width - backButton.width - root.fontFactor*osSettings.bigFontSize
y: -backButton.height - root.fontFactor*osSettings.bigFontSize
z:2
onClicked: {photoBackground.opacity=0}
}

View file

@ -93,7 +93,7 @@ Package {
wrapMode:Text.Wrap
color: "white"
font.family: "Monospace"
font.pixelSize: 2*mm
font.pointSize: osSettings.systemFontSize
anchors.bottom: albumWrapper.bottom
}
@ -125,7 +125,7 @@ Package {
MouseArea {
anchors.fill: parent
onPressAndHold:{
var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('album',albumname);photogroupModel.remove(index)}}}";
var menuString="import QtQuick.Controls 2.12; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('album',albumname);photogroupModel.remove(index)}}}";
var albummenuObject=Qt.createQmlObject(menuString,albumWrapper,"albummenuOutput")
albummenuObject.popup()
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff