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 ## ## v0.6
* 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.5.3 ## * New language: Hungarian
* Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03 * Multiple photos in post open in separate slideshow
* Indentation to see replied to newsitem for conversation view * Layout redesign
* News view type config moved from account page to config page * Adaptive sidebar
* Simplification of account page on first start * Sync Friendship Requests, approve/deny/ignore requests
* Bugfixes * 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 ## * Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03
* Redesign of news item * Indentation to see replied to newsitem for conversation view
* Background sync for Android >8.0 * News view type config moved from account page to config page
* Bugfixes * Simplification of account page on first start
* Bugfixes
## v0.5.2
## v0.5.1 ## * Redesign of news item
* Videos open in full screen * Background sync for Android >8.0
* Youtube videos open in app * Bugfixes
* Option to minimize #nsfw post
* Rotate image in messageSend component
## v0.5 ## ## v0.5.1
* 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
* Videos open in full screen
* Youtube videos open in app
* Option to minimize #nsfw post
* Rotate image in messageSend component
## v0.4 ## ## v0.5
* 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
* 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 ## ## v0.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
* 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 ## ## v0.3.4
* 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)
* 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 ## ## v0.3.3
* 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
* 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 ## ## v0.3.2
* 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)
* 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 ## ## v0.3.1
* 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
* 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 ## ## v0.3
* 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)
* 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 ## ## v0.2.2
* 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)
* 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 ## ## v0.2.1
# News #
* Profile image download completely reworked, resulting in speed improvement
# Contacts # * Fix for [issue 4](https://github.com/LubuWest/Friendiqa/issues/4)
* New profile tab, data of public and private profiles shown * Fix for Friendica [issue 4689](https://github.com/friendica/friendica/issues/4689)
* Change profile picture * Long posts are automatically truncated
* For friends image button shows private images thanks to new remoteAuth API (Friendica 3.6 server required) --> private holiday pictures have finally arrived! * Intents for pictures (Send one image from gallery: attach to message, send multiple images: upload to album)
* 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 # ## v0.2
* Complete rework of image download, fixes bug with private images
* Download all or only new images
# Config # # News
* 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 # * Profile image download completely reworked, resulting in speed improvement
* Italian thanks to Davide de Prisco
# 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## ## 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## ## 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## ## v0.1##
# News # # News
* Native Android image selector for new message * Native Android image selector for new message
* Click on contacts shows contact details on news page * Click on contacts shows contact details on news page
* Fix problem with news list after deletion of item * Fix problem with news list after deletion of item
# Contacts # # Contacts
* Clean contacts with no news
# Images # * Clean contacts with no news
* 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 # # Images
* German, Spanish
* 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 * Android notifications or Dbus notification (Linux) for new items in friends timeline, replies and DMs
* Search for news * Search for news
* Click on hashtag in newsitem starts search for news with that word * 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 * 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 * 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 * Open links in external browser
@ -36,7 +36,6 @@ Currently supported:
* Update fetches new posts (up to last 50) since last in local DB * Update fetches new posts (up to last 50) since last in local DB
* More shows older posts from 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 * 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 image from Android gallery
* Send text or urls from other apps to Friendiqa * Send text or urls from other apps to Friendiqa
* Native Android image dialog * Native Android image dialog
@ -52,6 +51,7 @@ Currently supported:
* Tabs for own profiles, friends, other contacts and groups * Tabs for own profiles, friends, other contacts and groups
* Show profile(s) of user and change profile picture * Show profile(s) of user and change profile picture
* List of all known contacts with locally downloaded pictures * 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 * 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 pictures of contact (screenscraping of contact's website, works only with certain theme)
* Show public and private events of contact * Show public and private events of contact
@ -96,7 +96,7 @@ Currently supported:
* Multiple accounts * Multiple accounts
* View mode for news (tree or timeline) * View mode for news (tree or timeline)
* Maximum news (deleted after use of Quit button) * 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 * Hide #nsfw
ToDo ToDo
@ -111,8 +111,8 @@ ToDo
# Translations # # Translations #
* German, Spanish, Italian * 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/do pull request. * 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 # # 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 * 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"?> <?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"/> <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. <!-- 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. <!-- 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. --> 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"/> <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:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="Friendiqa" android:label="Friendiqa"
android:extractNativeLibs="true" android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:icon="@drawable/friendiqa" android:icon="@drawable/friendiqa"
android:theme="@android:style/Theme.Holo.Light" android:theme="@android:style/Theme.Holo.Light"
android:logo="@drawable/friendiqa"> 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> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/> <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 buildDir=.build
# qt5AndroidDir=/home/pankraz/Qt/5.11.1/android_armv7/src/android/java
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
android.enforceUniquePackageName=false 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.pm.PackageManager;
import android.content.Context; import android.content.Context;
import android.Manifest.permission; import android.Manifest.permission;
//import android.support.v4.app.ActivityCompat;
//import android.support.v4.content.ContextCompat;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -43,6 +41,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
//} else { //} else {
System.loadLibrary("friendiqa_arm64-v8a"); 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))) { 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(); SystemDispatcher.onActivityResume();
} else { } else {
@ -94,6 +93,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
protected void onNewIntent(Intent data) { protected void onNewIntent(Intent data) {
System.loadLibrary("friendiqa_arm64-v8a"); System.loadLibrary("friendiqa_arm64-v8a");
//System.loadLibrary("friendiqa_armeabi-v7a");
super.onNewIntent(data); super.onNewIntent(data);
if ((data!=null) && (data.getType() != null) && !(data.getBooleanExtra("used",false))){ if ((data!=null) && (data.getType() != null) && !(data.getBooleanExtra("used",false))){
String type = data.getType(); String type = data.getType();

View File

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

View File

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

View File

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

View File

@ -52,7 +52,8 @@ OTHER_FILES += qml/friendiqa.qml \
TRANSLATIONS += translations/friendiqa-de.ts \ TRANSLATIONS += translations/friendiqa-de.ts \
translations/friendiqa-es.ts \ translations/friendiqa-es.ts \
translations/friendiqa-it.ts translations/friendiqa-it.ts \
translations/friendiqa-hu.ts
HEADERS += \ HEADERS += \
common/uploadableimage.h \ 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_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 QtQuick.Layouts 1.11
import "qrc:/js/news.js" as Newsjs import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
StackView{ ApplicationWindow{
id:root 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)} property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)}
width: osSettings.appWidth visible: true
height:osSettings.appHeight
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000] property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db) 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 var contactlist: []
property real mm: osSettings.osType=="Android"?Screen.pixelDensity:Screen.pixelDensity*1.5 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 fotoSignal(var username, var friend)
signal directmessageSignal(var friend) signal directmessageSignal(var friend)
signal newsSignal(var news) signal newsSignal(var news)
signal newstypeSignal(var type) signal newstypeSignal(var type)
signal friendsSignal(var username) signal friendsSignal(var username)
signal contactdetailsSignal(var contact) signal contactdetailsSignal(var contact)
signal searchSignal (var searchterm)
signal eventSignal(var contact) signal eventSignal(var contact)
signal uploadSignal(var urls) signal uploadSignal(var urls)
signal sendtextSignal(var intenttext) signal sendtextSignal(var intenttext)
signal changeimage(var method, var type, var id) signal changeimage(var method, var type, var id)
signal updateSyncinterval(int interval) signal updateSyncinterval(int interval)
signal replySignal(var newsobject)
property var news:[] property var news:[]
property var newContacts:[] property var newContacts:[]
property var contactposts:[]
//property string contactLoadType: "" //property string contactLoadType: ""
property bool imagePicking: false property bool imagePicking: false
onLoginChanged:{ function onLoginChanged(login){
if(login==""){root.push("qrc:/qml/configqml/AccountPage.qml")} if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{root.push(rootStackItem) else{//rootstackView.push(rootstack)
if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;} if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){ Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})} contactlist=contacts})}
} }
onNewContactsChanged:{ function onNewContactsChanged(newContacts){
if(newContacts.length>0){// download contact images and update db if(newContacts.length>0){// download contact images and update db
var contacturls=[]; var contacturls=[];
var contactnames=[]; 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); contacturls.push(newContacts[link].profile_image_url);
contactnames.push(newContacts[link].screen_name); contactnames.push(newContacts[link].screen_name);
Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link]) 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{ Connections{
target:xhr target:xhr
onDownloaded:{ function onDownloaded(type,url,filename,i){
if(type=="contactlist"){ if(type=="contactlist"){
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]); var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
var result; var result;
@ -104,10 +132,12 @@ StackView{
} }
} }
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"} FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth) //Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
if (event.key === osSettings.backKey) { onClosing: {
//if (event.key === osSettings.backKey) {
if (rootstack.currentIndex==0){ if (rootstack.currentIndex==0){
newstab.active=true; newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){ if (newstab.newstabstatus!=globaloptions.newsViewType){
@ -119,278 +149,147 @@ StackView{
Newsjs.chatsfromdb(db,login.username,function(dbnews){ Newsjs.chatsfromdb(db,login.username,function(dbnews){
newsSignal(dbnews) newsSignal(dbnews)
})} })}
close.accepted=false;
} }
else if (newstab.conversation.length>0){newstab.conversation=[]} else if (newstab.conversation.length>0){
else if (root.depth>1){root.pop()} newstab.conversation=[];
else{Service.cleanNews(root.db,function(){ close.accepted=false
Service.cleanContacts(root.login,root.db,function(){ }
Qt.quit()}) 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 if (rootstack.currentIndex==2){fotoSignal("backButton")}
else {rootstack.currentIndex=0} 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
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()})
})
}
}
}
}
} }
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 footer:ToolBar{
duration: 1000 //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 id:rootstack
width:parent.width width:rootstackView.width
height: parent.height-7*mm height: rootstackView.height//-7*mm
//y:wideScreen?7*mm:0
currentIndex:bar.currentIndex currentIndex:bar.currentIndex
Loader{ Loader{
id: newstab id: newstab
Layout.fillWidth:true Layout.fillWidth:true
Layout.fillHeight: true Layout.fillHeight: true
property string newstabstatus property string newstabstatus
property var conversation:[] property var conversation:[]
property var contactposts:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":"" source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
} }
Loader{ Loader{
id: friendstab id: friendstab
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":"" source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
} }
Loader{ Loader{
id: fotostab id: fotostab
property string phototabstatus:"Images" property string phototabstatus:"Images"
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":"" source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
} }
Loader{ Loader{
id: calendartab id: calendartab
property string calendartabstatus:"Events" property string calendartabstatus:"Events"
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":"" source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
} }
} }
}
//}
Component.onCompleted: { Component.onCompleted: {
forceActiveFocus(); onLoginChanged(login);
//print(xhr.networktype()); globaloptions=Service.readGO(db);
//forceActiveFocus();
if(osSettings.osType=="Android"){ if(osSettings.osType=="Android"){
var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root); var IntentReceiverQml = component.createObject(root);
@ -400,5 +299,5 @@ StackView{
var LinuxSyncQml = component.createObject(root); 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/FriendsTab.qml</file>
<file>qml/contactqml/GroupComponent.qml</file> <file>qml/contactqml/GroupComponent.qml</file>
<file>qml/contactqml/ProfileComponent.qml</file> <file>qml/contactqml/ProfileComponent.qml</file>
<file>qml/contactqml/ContactDetailsComponent.qml</file>
<file>qml/contactqml/Contactlist.qml</file> <file>qml/contactqml/Contactlist.qml</file>
<file>qml/photoqml/PhotoComponent.qml</file> <file>qml/photoqml/PhotoComponent.qml</file>
<file>qml/photoqml/PhotogroupComponent.qml</file> <file>qml/photoqml/PhotogroupComponent.qml</file>
@ -237,6 +236,16 @@
<file>common/xhr.cpp</file> <file>common/xhr.cpp</file>
<file>common/xhr.h</file> <file>common/xhr.h</file>
<file>qml/newsqml/MoreComments.qml</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> </qresource>
</RCC> </RCC>

View File

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

View File

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

View File

@ -61,11 +61,11 @@ UPDATENEWS::UPDATENEWS(QObject *parent) : QObject(parent)
void UPDATENEWS::setUrl(QString url) void UPDATENEWS::setUrl(QString url)
{ {
if (url!=m_url) { if (url!=m_url) {
m_url = url; m_url = url;
xhr.setUrl(url); xhr.setUrl(url);
emit urlChanged(m_url); emit urlChanged(m_url);
} }
} }
@ -77,10 +77,10 @@ void UPDATENEWS::setDatabase()
m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile()); m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile());
//qDebug() << db_url; //qDebug() << db_url;
if (!m_db.open()) if (!m_db.open())
{ {
qDebug() << "Error: connection with database fail " << m_db.lastError(); 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); QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
while (query.next()) while (query.next())
{ {
username = query.value(1).toString(); username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray(); QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword); QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ; m_login=username+":"+password ;
xhr.setLogin(m_login); xhr.setLogin(m_login);
m_url=query.value(0).toString(); m_url=query.value(0).toString();
xhr.setUrl(m_url); xhr.setUrl(m_url);
m_imagedir=query.value(3).toString(); m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir); xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString(); 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 syncquery("SELECT * FROM globaloptions",m_db);
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db); // QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
// delquery.exec(); // delquery.exec();
m_updateInterval=0; m_updateInterval=0;
syncindex=0; syncindex=0;
synclist.clear(); synclist.clear();
@ -136,33 +136,35 @@ void UPDATENEWS::login()
void UPDATENEWS::startsync() void UPDATENEWS::startsync()
{ qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length(); { qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString))); //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))); //QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
if (syncindex<synclist.length()){ if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){ if (synclist[syncindex]=="sync_Timeline"){
timeline(); timeline();
} else if (synclist[syncindex]=="sync_Replies") { } else if (synclist[syncindex]=="sync_Replies") {
replies(); replies();
} else if (synclist[syncindex]=="sync_DirectMessages") { } else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages(); directmessages();
} else if (synclist[syncindex]=="sync_Notifications") { } else if (synclist[syncindex]=="sync_Notifications") {
notifications(); notifications();
} else if (synclist[syncindex]=="sync_Events") { } else if (synclist[syncindex]=="sync_FriendRequests") {
events(); friendrequests();
} }else if (synclist[syncindex]=="sync_Events") {
} else if (syncindex==synclist.length()) { events();
m_api=""; }
if(m_updateInterval!=0){ } else if (syncindex==synclist.length()) {
syncindex=0; m_api="";
synclist.clear(); if(m_updateInterval!=0){
m_db.close(); syncindex=0;
m_db.removeDatabase(m_db.connectionName()); synclist.clear();
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int))); m_db.close();
emit quitapp(); m_db.removeDatabase(m_db.connectionName());
alarm.setAlarm(m_updateInterval); QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
m_updateInterval=0; 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))); QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
} }
void UPDATENEWS::events() void UPDATENEWS::events()
{ { m_api="/api/friendica/events";
m_api="/api/friendica/events";
xhr.clearParams(); xhr.clearParams();
xhr.setUrl(m_url); xhr.setUrl(m_url);
xhr.setApi(m_api); 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))); 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) void UPDATENEWS::store(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else { { if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument news; QJsonDocument news;
//qDebug()<<apiname << serverreply; //qDebug()<<apiname;
QJsonParseError jsonerror; QJsonParseError jsonerror;
news=QJsonDocument::fromJson(serverreply,&jsonerror); news=QJsonDocument::fromJson(serverreply,&jsonerror);
if (news.isArray()){ if (news.isArray()){
@ -274,7 +287,9 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
if (testquery.first()) {continue;} if (testquery.first()) {continue;}
} }
QSqlQuery query(m_db); 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(0,username);
query.bindValue(1,"0"); query.bindValue(1,"0");
query.bindValue(2, newsitem["text"].toString().toUtf8().toBase64()); 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(); QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
query.bindValue(11, friendicaHtml.toUtf8().toBase64());} query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
else{query.bindValue(11, newsitem["friendica_html"].toString().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; QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
if (newsitem.toObject().contains("friendica_activities")){ if (newsitem.toObject().contains("friendica_activities")){
for (int a=0; a < newsitem["friendica_activities"]["like"].toArray().count();a++){ 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++){ for (int e = 0; e < newsitem["friendica_activities"]["attendmaybe"].toArray().count();e++){
attendmaybeArray.append(newsitem["friendica_activities"]["attendmaybe"][e]["url"].toString()); attendmaybeArray.append(newsitem["friendica_activities"]["attendmaybe"][e]["url"].toString());
} }
} }
QJsonArray friendica_activities; friendica_activities={likeArray,dislikeArray,attendyesArray,attendnoArray,attendmaybeArray}; QJsonArray friendica_activities; friendica_activities={likeArray,dislikeArray,attendyesArray,attendnoArray,attendmaybeArray};
QJsonDocument activities; activities.setArray(friendica_activities); QJsonDocument activities; activities.setArray(friendica_activities);
query.bindValue(13,activities.toJson(QJsonDocument::Compact).toBase64()); 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"]); query.bindValue(16, newsitem["friendica_author"]["url"]);
}else { }else {
query.bindValue(16, newsitem["user"]["url"]); query.bindValue(16, newsitem["user"]["url"]);
} }
if (apiname=="/api/statuses/replies"){ if (apiname=="/api/statuses/replies"){
query.bindValue(1,"3"); query.bindValue(1,"3");
@ -382,7 +399,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
QList<QJsonValue> newcontacts=findNewContacts(news); QList<QJsonValue> newcontacts=findNewContacts(news);
if (newcontacts.size()>0){ if (newcontacts.size()>0){
updateContacts(newcontacts); updateContacts(newcontacts);
startImagedownload(); startImagedownload("contactlist");
} else { } else {
if(m_updateInterval!=0){ 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){ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index){
//qDebug()<< "update Imagelocation " << downloadtype << " " << imageurl << " " << filename;
if (downloadtype=="contactlist"){ if (downloadtype=="contactlist"){
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db); QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
testquery.first(); testquery.first();
@ -413,6 +431,22 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
newcontactnames.clear(); newcontactnames.clear();
newcontactimagelinks.clear(); newcontactimagelinks.clear();
if(m_updateInterval!=0){ 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; syncindex+=1;
startsync(); startsync();
} }
@ -421,6 +455,7 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
} }
QJsonObject UPDATENEWS::findNotificationContact(QString contacturl){ QJsonObject UPDATENEWS::findNotificationContact(QString contacturl){
//qDebug()<< "findNotificationContact "<<contacturl;
QSqlQuery query("SELECT id,url FROM contacts WHERE url='"+contacturl+"' AND username='"+ username+"'",m_db); QSqlQuery query("SELECT id,url FROM contacts WHERE url='"+contacturl+"' AND username='"+ username+"'",m_db);
query.first(); query.first();
QJsonObject contact{ QJsonObject contact{
@ -442,7 +477,7 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
//main contacts //main contacts
if (news[i].toObject().contains("sender") ){ 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))){ 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{ else{
newcontacts.append(news[i]["sender"]); newcontacts.append(news[i]["sender"]);
newcontactimagelinks.append(news[i]["sender"]["profile_image_url"].toString().section('?',0,0)); 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") ){ if (news[i].toObject().contains("friendica_activities") ){
for (int a=0; a < news[i]["friendica_activities"]["like"].toArray().count();a++){ 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))){ 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{ else{
newcontacts.append(news[i]["friendica_activities"]["like"][a]); newcontacts.append(news[i]["friendica_activities"]["like"][a]);
newcontactimagelinks.append(news[i]["friendica_activities"]["like"][a]["profile_image_url"].toString().section('?',0,0)); 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++){ 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))){ 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{ else{
newcontacts.append(news[i]["friendica_activities"]["dislike"][b]); newcontacts.append(news[i]["friendica_activities"]["dislike"][b]);
newcontactimagelinks.append(news[i]["friendica_activities"]["dislike"][b]["profile_image_url"].toString().section('?',0,0)); 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 //owner contacts
if (news[i].toObject().contains("friendica_author") ){ 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))){ 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{ else{
newcontacts.append(news[i]["friendica_author"]); newcontacts.append(news[i]["friendica_author"]);
newcontactimagelinks.append(news[i]["friendica_author"]["profile_image_url"].toString().section('?',0,0)); newcontactimagelinks.append(news[i]["friendica_author"]["profile_image_url"].toString().section('?',0,0));
newcontactnames.append(news[i]["friendica_author"]["screen_name"].toString()); newcontactnames.append(news[i]["friendica_author"]["screen_name"].toString());
} }
} }
} }
return newcontacts; 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) void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else { { if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument events; QJsonDocument events;
QJsonParseError jsonerror; QJsonParseError jsonerror;
events=QJsonDocument::fromJson(serverreply,&jsonerror); events=QJsonDocument::fromJson(serverreply,&jsonerror);
@ -616,18 +752,18 @@ void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
QJsonDocument permissionDocument; permissionDocument.setArray(permissions); QJsonDocument permissionDocument; permissionDocument.setArray(permissions);
query.bindValue(13,permissionDocument.toJson(QJsonDocument::Compact)); query.bindValue(13,permissionDocument.toJson(QJsonDocument::Compact));
if(!(query.exec())) {qDebug()<< "store events " << query.lastError();} if(!(query.exec())) {qDebug()<< "store events " << query.lastError();}
} catch(...){ } catch(...){
qDebug() << "Friendiqasync Error event" << eventitem["name"]; qDebug() << "Friendiqasync Error event" << eventitem["name"];
} }
} }
emit this->success(m_api); emit this->success(m_api);
} }
} }
if(notifylist.contains("notify_Events")){ 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); 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()) { while (eventnotifyquery.next()) {
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1); alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
} }
} }
if(m_updateInterval!=0){ if(m_updateInterval!=0){
syncindex+=1; syncindex+=1;
@ -641,9 +777,9 @@ QString UPDATENEWS::url() const
return m_url; return m_url;
} }
void UPDATENEWS::startImagedownload() void UPDATENEWS::startImagedownload(QString downloadtype)
{ {
xhr.setDownloadtype("contactlist"); xhr.setDownloadtype(downloadtype );
xhr.setFilelist(newcontactimagelinks); xhr.setFilelist(newcontactimagelinks);
xhr.setContactlist(newcontactnames); xhr.setContactlist(newcontactnames);
xhr.setImagedir(m_imagedir); xhr.setImagedir(m_imagedir);

View File

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

View File

@ -218,7 +218,7 @@ void XHR::getlist()
{ {
if(dlindex < m_filelist.size()) { if(dlindex < m_filelist.size()) {
QString cleanfilename; 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::setFilename(imagedir()+"contacts/"+cleanfilename);
XHR::setUrl(m_filelist.at(dlindex));} XHR::setUrl(m_filelist.at(dlindex));}
else { else {
@ -329,7 +329,7 @@ void XHR::onRequestFinished()
buffer.clear(); buffer.clear();
file.close(); file.close();
emit this->downloaded(m_downloadtype,m_url,m_filename,dlindex); 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(); //reply->deleteLater();
} }

View File

@ -60,12 +60,12 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) {
} else if(xhrequest.readyState === XMLHttpRequest.DONE) { } else if(xhrequest.readyState === XMLHttpRequest.DONE) {
try{ if (xhrequest.responseText!=""){ try{ if (xhrequest.responseText!=""){
callback(xhrequest.responseText) callback(xhrequest.responseText)
}else{ }else{print("API:\n" +api+" NO RESPONSE");
showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow) showMessage("Error","API:\n" +api+" NO RESPONSE",rootwindow)
callback(xhrequest.responseText) 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)); 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); function showMessage(header,message,rootwindow){//print(message);
var cleanmessage=message.replace(/"/g,"-"); var cleanmessage=message.replace(/"/g,"-");
if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'} 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 //commented out for broken remoteauth
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){ Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
//Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),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')){ if (obj.hasOwnProperty('status')){
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
getAlbumFromHtml(photohtml,false,rootwindow,callback)}) getAlbumFromHtml(photohtml,false,rootwindow,callback)})

View File

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

View File

@ -57,7 +57,8 @@ function beautify(newsitemobject,msg){
if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1}
} }
var friendica_activities={self:self} var friendica_activities={self:self}
var attachmentList=[]; var imageAttachmentList=[];
var videoAttachmentList=[];
var videoformats=["mp4", "avi", "webm","ogg","mp3"] var videoformats=["mp4", "avi", "webm","ogg","mp3"]
try{if(newsitemobject.attachments){ try{if(newsitemobject.attachments){
var attachArray=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 if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"}
} }
else {attachhelper.url=attachArray[image].url} else {attachhelper.url=attachArray[image].url}
attachmentList.push(attachhelper) imageAttachmentList.push(attachhelper)
//print("Attachhelper "+attachhelper.url) //print("Attachhelper "+attachhelper.url)
newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(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","") 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]); var videohelperstringposition=videotext.indexOf("."+videoformats[format]);
videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4); videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4);
videotext=videotext.substring(videohelperstringposition+4,videotext.length) 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=ptvideotext.substring(ptvideotext.lastIndexOf("http",ptvideohelperstringposition),ptposend)+"-480.mp4";
ptvideohelper.url=ptvideohelper.url.replace("/videos/watch","/static/webseed"); ptvideohelper.url=ptvideohelper.url.replace("/videos/watch","/static/webseed");
ptvideotext=ptvideotext.substring(ptposend,ptvideotext.length) 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){ if (newsitemobject.text.indexOf("youtube.com/watch?v")>-1){
@ -112,11 +113,11 @@ function beautify(newsitemobject,msg){
var ythelper={mimetype:"video/youtube"} var ythelper={mimetype:"video/youtube"}
ythelper.url=yttext.substring(ythelperstringposition+8,ytposend); ythelper.url=yttext.substring(ythelperstringposition+8,ytposend);
yttext=yttext.substring(ytposend,yttext.length); 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)){ if ((msg.options.hasOwnProperty("hide_nsfw"))&&(msg.options.hide_nsfw==1)&&(newsitemobject.text.indexOf("#nsfw")>-1)){
newsitemobject.nsfw=true newsitemobject.nsfw=true
} else{newsitemobject.nsfw=false} } else{newsitemobject.nsfw=false}
@ -152,9 +153,9 @@ else{
if (j==0){newsitemobject.indent=0}else{ if (j==0){newsitemobject.indent=0}else{
for (var k=msg.model.count-1;k>-1;k--){ for (var k=msg.model.count-1;k>-1;k--){
if (newsitemobject.in_reply_to_status_id==msg.model.get(k).newsitemobject.id){ 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}; 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 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 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 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 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 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)'); 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 function readConfig(database,callback,filter,filtervalue) { // reads config
if (filter){var where = " WHERE "+ filter +" = '" + filtervalue+"'"} else { var where=""} 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)); var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3],initDatabase(database));
db.transaction( function(tx) { db.transaction( function(tx) {
var tables = tx.executeSql("SELECT * FROM sqlite_master WHERE type='table'"); var tables = tx.executeSql("SELECT * FROM sqlite_master WHERE type='table'");
if (tables.rows.length==0){print("no database");callback("")} else { if (tables.rows.length==0){print("no database");callback("")} else {
var rs = tx.executeSql('select * from config'+where); var rs = tx.executeSql('select * from config'+where);
var rsArray=[]; var rsArray=[];
if (rs.rows.length>0){ 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}; 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)} if (rsObject.newsViewType!="" && rsObject.newsViewType!=null){updateNewsviewtype(database,rsObject.newsViewType)}
} else {var rsObject=""} } else {print("config empty");var rsObject=""}
callback(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){ function readActiveConfig(database){
var obj=""; var obj="";
readConfig(database,function(config){obj=config},"isActive", 0); 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 db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
var go=({}); var go=({});
db.transaction( function(tx) { 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++){ for (var r=0; r<rs.rows.length; r++){
go[rs.rows.item(r).k]=rs.rows.item(r).v go[rs.rows.item(r).k]=rs.rows.item(r).v
} }
@ -360,7 +380,7 @@ function updateNewsviewtype(database, newsViewtype){
db.transaction( function(tx) { db.transaction( function(tx) {
var rs1 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', ["newsViewType",newsViewtype]) var rs1 = tx.executeSql('INSERT INTO globaloptions (k,v) VALUES (?,?)', ["newsViewType",newsViewtype])
var rs2 = tx.executeSql('UPDATE config SET 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){ function processNews(api,data){
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;}; 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==""){} if (data==""){}
else if (typeof(newslist)=='undefined'){ else if (typeof(newslist)=='undefined'){
Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) 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].statusnet_html=newslist[n].msg_html;
newslist[n].text=newslist[n].msg; newslist[n].text=newslist[n].msg;
} }
} else {//if(api!="/api/statuses/user_timeline"){ }
else {//if(api!="/api/statuses/user_timeline"){
var chatlist=[]; var chatlist=[];
var conversationIds=[]; var conversationIds=[];
var commentCount=[]; var commentCount=[];
for (var n in newslist){ for (var n in newslist){
newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at)); if (newslist[n]!=null){
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;} newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at));
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author); if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
newslist[n].user=cleanUser(newslist[n].user); newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
if (newslist[n].friendica_title!="") {newslist[n].statusnet_html="<b>"+newslist[n].friendica_title +"</b><br><br>"+newslist[n].friendica_html;} newslist[n].user=cleanUser(newslist[n].user);
else{newslist[n].statusnet_html=newslist[n].friendica_html} 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].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')){ if(newslist[n].hasOwnProperty('friendica_activities')){
for (var m in newslist[n].friendica_activities.like){ for (var m in newslist[n].friendica_activities.like){
newslist[n].friendica_activities.like[m]=cleanUser(newslist[n].friendica_activities.like[m]); newslist[n].friendica_activities.like[m]=cleanUser(newslist[n].friendica_activities.like[m]);
} }
for (var o in newslist[n].friendica_activities.dislike){ for (var o in newslist[n].friendica_activities.dislike){
newslist[n].friendica_activities.dislike[o]=cleanUser(newslist[n].friendica_activities.dislike[o]); newslist[n].friendica_activities.dislike[o]=cleanUser(newslist[n].friendica_activities.dislike[o]);
} }
for (var p in newslist[n].friendica_activities.attendyes){ for (var p in newslist[n].friendica_activities.attendyes){
newslist[n].friendica_activities.attendyes[p]=cleanUser(newslist[n].friendica_activities.attendyes[p]); newslist[n].friendica_activities.attendyes[p]=cleanUser(newslist[n].friendica_activities.attendyes[p]);
} }
for (var q in newslist[n].friendica_activities.attendno){ for (var q in newslist[n].friendica_activities.attendno){
newslist[n].friendica_activities.attendno[q]=cleanUser(newslist[n].friendica_activities.attendno[q]); newslist[n].friendica_activities.attendno[q]=cleanUser(newslist[n].friendica_activities.attendno[q]);
} }
for (var r in newslist[n].friendica_activities.attendmaybe){ for (var r in newslist[n].friendica_activities.attendmaybe){
newslist[n].friendica_activities.attendmaybe[r]=cleanUser(newslist[n].friendica_activities.attendmaybe[r]); newslist[n].friendica_activities.attendmaybe[r]=cleanUser(newslist[n].friendica_activities.attendmaybe[r]);
} }
} }
if(!(newslist[n].hasOwnProperty('friendica_author'))){ if(!(newslist[n].hasOwnProperty('friendica_author'))){
newslist[n].friendica_author=newslist[n].user newslist[n].friendica_author=newslist[n].user
} }
var conversationindex=conversationIds.indexOf(newslist[n].statusnet_conversation_id); var conversationindex=conversationIds.indexOf(newslist[n].statusnet_conversation_id);
//fill chatlist //fill chatlist
if (conversationindex==-1){ if (conversationindex==-1){
chatlist.push(newslist[n]); chatlist.push(newslist[n]);
conversationIds.push(newslist[n].statusnet_conversation_id); conversationIds.push(newslist[n].statusnet_conversation_id);
commentCount.push(1); commentCount.push(1);
} else{ } else{
commentCount[conversationindex]=commentCount[conversationindex]+1; commentCount[conversationindex]=commentCount[conversationindex]+1;
chatlist[conversationindex]=newslist[n]; chatlist[conversationindex]=newslist[n];
}
} }
} }
//enrich chatlist with old entries //enrich chatlist with old entries
@ -541,8 +572,8 @@ function processNews(api,data){
newslist.reverse(); newslist.reverse();
newstab.conversation=newslist newstab.conversation=newslist
} }
else if (api=="/api/statuses/user_timeline"){ else if (api=="/api/statuses/user_timeline" || api=="/api/users/show"){
newstab.contactposts=newslist root.contactposts=newslist
} }
else if ((api!="/api/direct_messages/all")&&(api!="/api/friendica/notifications")&&(newstab.newstabstatus==="Conversations")){ else if ((api!="/api/direct_messages/all")&&(api!="/api/friendica/notifications")&&(newstab.newstabstatus==="Conversations")){
showNews(chatlist);root.news=newslist showNews(chatlist);root.news=newslist

View File

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

View File

@ -33,8 +33,7 @@ import QtQuick 2.0
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQml 2.2 import QtQml 2.2
import Qt.labs.calendar 1.0 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/service.js" as Service
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/calendarqml" import "qrc:/qml/calendarqml"
@ -43,9 +42,9 @@ import "qrc:/qml/genericqml"
Rectangle { Rectangle {
id:calendarrectangle id:calendarrectangle
// y:1 // y:1
// width:root.width-mm width:parent.width//-mm
// height:root.height-5*mm height:parent.height//-5*mm
anchors.fill: parent // anchors.fill: parent
color: '#fff' color: '#fff'
property date currentTime: new Date() property date currentTime: new Date()
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000 property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
@ -69,6 +68,12 @@ Rectangle {
events=eventArray; events=eventArray;
eventdays=dayArray; eventdays=dayArray;
calBusy.running=false 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 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{ MButton{
id: updateEvents id: updateEvents
@ -90,8 +119,7 @@ Rectangle {
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right:calendartabstatusButton.left anchors.right:calendartabstatusButton.left
anchors.rightMargin:mm anchors.rightMargin:mm
height: 6*mm width: 2*root.fontFactor*osSettings.bigFontSize;
width: 8*mm
text:"\uf021" text:"\uf021"
onClicked: { onClicked: {
calBusy.running=true; calBusy.running=true;
@ -103,7 +131,7 @@ Rectangle {
// }) // })
}} }}
Connections{ Connections{
target: updatenews target: updatenews
function onSuccess(api){ function onSuccess(api){
@ -119,15 +147,15 @@ Connections{
anchors.topMargin: 0.5*mm anchors.topMargin: 0.5*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin:2*mm anchors.rightMargin:2*mm
height: 6*mm width: Math.max(6*root.fontFactor*osSettings.bigFontSize,implicitWidth)
width: Math.max(10*mm,implicitWidth)
text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus
Menu { Menu {
id:calendartabmenu id:calendartabmenu
width: 40*mm width: 20*root.fontFactor*osSettings.systemFontSize
MenuItem { MenuItem {
text: qsTr("Own Calendar") text: qsTr("Own Calendar")
font.pixelSize: 3*mm //font.pixelSize: 3*mm
font.pointSize: osSettings.systemFontSize
onTriggered: { onTriggered: {
calendartab.calendartabstatus="Events"; calendartab.calendartabstatus="Events";
// calendartabstatusButton.text=qsTr("own Calendar"); // calendartabstatusButton.text=qsTr("own Calendar");
@ -140,39 +168,50 @@ Connections{
ListView{ ListView{
id: calendarView id: calendarView
x: mm;y:8*mm y:2*root.fontFactor*osSettings.bigFontSize//8*mm
width: parent.width-2*mm; height: parent.height-9*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 clip: true
snapMode: ListView.SnapOneItem snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange highlightRangeMode: ListView.StrictlyEnforceRange
// currentIndex: count
// onCurrentIndexChanged:{print("Index "+currentIndex)}
model: CalendarModel {id:calendarModel model: CalendarModel {id:calendarModel
from: new Date() from: new Date()
to: new Date(new Date().valueOf()+93312000000) to: new Date(new Date().valueOf()+93312000000)
} }
delegate: delegate:
ColumnLayout{ Item{
width:calendarView.width width:Math.min(23*root.fontFactor*osSettings.bigFontSize,calendarView.width)
height: parent.height
Text{ Text{
font.bold: true font.bold: true
Layout.fillWidth: true //Layout.fillWidth: true
width: parent.width-root.fontFactor*osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter horizontalAlignment:Text.AlignHCenter
text: model.year 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) text: Qt.locale().standaloneMonthName(model.month)
Layout.fillWidth: true //Layout.fillWidth: true
horizontalAlignment:Text.AlignHCenter 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 locale: monthgrid.locale
Layout.fillWidth: true //Layout.fillWidth: true
font.pixelSize: 3*mm font.pointSize: osSettings.systemFontSize
} }
MonthGrid { MonthGrid {y:5*root.fontFactor*osSettings.bigFontSize
id: monthgrid id: monthgrid
Layout.fillWidth: true height: parent.height-5*root.fontFactor*osSettings.bigFontSize
width: parent.width-root.fontFactor*osSettings.bigFontSize
month: model.month month: model.month
year: model.year year: model.year
locale: Qt.locale() locale: Qt.locale()
@ -180,8 +219,24 @@ Connections{
} }
} }
ScrollIndicator.horizontal: ScrollIndicator { } 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: { Component.onCompleted: {
root.eventSignal.connect(showEvents); root.eventSignal.connect(showEvents);
if (calendartab.calendartabstatus=="Events"){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/service.js" as Service
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
import "qrc:/qml/calendarqml"
Rectangle{ Rectangle{
id:eventList id:eventList
z:2 // height: parent.height
border.color: "grey" // width:parent.width
width: parent.width-4*mm
height:parent.height-12*mm //radius: 0.5*mm
x:mm
y:mm
radius: 0.5*mm
property var daylist:[] property var daylist:[]
property int dayint: 0 property int dayint: 0
property var events:[]
MButton{ MButton{
id:closeButton id:closeButton
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 1*mm anchors.rightMargin: 1*mm
height: 6*mm
width: 8*mm
text: "\uf057" 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{ ListModel{
id: eventModel 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)); var currentevents=events.filter(event=>(dayint>=event.startday)&&(dayint<=event.endday));
for (var i=0; i<currentevents.length;i++){ for (var i=0; i<currentevents.length;i++){
var liststate="";if(currentevents.length<2){liststate="large"}; var liststate="";if(currentevents.length<2){liststate="large"};
//print(JSON.stringify(events[daylist[i]])); //print(JSON.stringify(events[daylist[i]]));
eventModel.append({"event":currentevents[i],"eventstatus":liststate}); 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 2.7
import QtQuick.Dialogs 1.2 import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
import "qrc:/js/layout.js" as Layoutjs import "qrc:/js/layout.js" as Layoutjs
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
@ -55,22 +55,21 @@ Page{
servericon.source=serverdata.site.logo})} catch(e){print(e)} servericon.source=serverdata.site.logo})} catch(e){print(e)}
} }
Button{ MButton{
id:userButton id:userButton
height: 8*mm
text:qsTr("User") text:qsTr("User")
//font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
font.pointSize: 16 x: root.fontFactor*osSettings.bigFontSize
x: mm y: root.fontFactor*osSettings.bigFontSize
y: mm width: root.width/2 - 2*mm
width: root.width/2 height: 2*root.fontFactor*osSettings.bigFontSize
visible: users.length>0 visible: users.length>0
onClicked:{ onClicked:{
var useritems=""; var useritems="";
for (var i=0;i<accountPage.users.length;i++){ 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){ "'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username; userButton.text=obj.username;
servername.text=obj.server; servername.text=obj.server;
@ -82,43 +81,17 @@ Page{
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'} if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
},'username','"+ accountPage.users[i].username+"')}}" },'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") var userlistObject=Qt.createQmlObject(menuString,accountPage,"usermenuOutput")
userlistObject.popup() } 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{ Image{
id:servericon id:servericon
x:4*mm;y:13.5*mm x:root.fontFactor*osSettings.bigFontSize;y:3*root.fontFactor*osSettings.bigFontSize
width:5*mm; height: 5*mm width:2.5*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
visible: false visible: false
source:"" source:""
MouseArea{ MouseArea{
@ -129,102 +102,87 @@ Page{
} }
} }
} }
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Button{ MButton{
id:serverSearchButton id:serverSearchButton
text:"\uf002" text:"\uf002"
font.pixelSize: 3*mm icon.name: "search"
font.pointSize: 16 font.pointSize: osSettings.bigFontSize
x:4*mm x:root.fontFactor*osSettings.bigFontSize
y:13.5*mm y:3*root.fontFactor*osSettings.bigFontSize
width: 5*mm; height:5*mm width: 2*root.fontFactor*osSettings.bigFontSize; height:2*root.fontFactor*osSettings.bigFontSize
visible: servericon.visible?false:true visible: servericon.visible?false:true
onClicked:{Qt.openUrlExternally(Qt.resolvedUrl("https://dir.friendica.social/servers"))} 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{ TextField {
color: "light grey" id: servername
x: 4*mm; y: 23.5*mm; width: root.width-6*mm; height: 5*mm; x: 4*root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize; width: root.width-18*mm; //height: 5*mm;
TextInput { placeholderText: qsTr("Server")
id: username font.pointSize: osSettings.systemFontSize
anchors.fill: parent onEditingFinished: {
//font.pixelSize:3*mm if ((servername.text)==""){}
font.pointSize: 16 else if((servername.text).substring(0,7) !=="https://"){
selectByMouse: true servername.text= "https://"+text//(serverstring.text).substring(8)
onEditingFinished:{
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
} }
imagestoredir=filesystem.homePath+"/"+username.text+"/" accountPage.setServericon(servername.text)}
//if (imagestore.text==filesystem.homePath+"/.friendiqa/"){imagestore.text=filesystem.homePath+"/.friendiqa/"+username.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{ TextField {
color: "light grey" id: username
x: 4*mm; y: 33.5*mm; width: root.width-6*mm; height: 5*mm; x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
TextInput { font.pointSize: osSettings.systemFontSize
id: password placeholderText: qsTr("Nickname")
anchors.fill: parent selectByMouse: true
//font.pixelSize:3*mm onEditingFinished: {
font.pointSize: 16 if (username.text.indexOf('@')>-1){
selectByMouse: true Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
echoMode: TextInput.PasswordEchoOnEdit }
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 { FileDialog {
id: imagestoreDialog 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{ BusyIndicator{
id: accountBusy id: accountBusy
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
y: 53.5*mm y: 16*root.fontFactor*osSettings.bigFontSize
width:10*mm width:10*mm
height: 10*mm height: 10*mm
running: false running: false
} }
Button { MButton {
x: 4*mm; y: 53.5*mm x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
height: 8*mm
text: qsTr("Confirm") text: qsTr("Confirm")
//font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
font.pointSize: 16
onClicked:{ onClicked:{
accountBusy.running=true; accountBusy.running=true;
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""}; var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""};
var errormessage=""; var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")} if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")} else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")} else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")} else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
//else if (imagestore.text=="") {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 if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
else {errormessage=""} else {errormessage=""}
if (errormessage=="") { if (errormessage=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){ Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){
accountBusy.running=false; accountBusy.running=false;
var credentials=JSON.parse(obj); var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('status')){ if (credentials.hasOwnProperty('status')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root) Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
} }
else{ else{
if (users.length==0){Service.setDefaultOptions(db);} if (users.length==0){Service.setDefaultOptions(db);}
print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text) //print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text)
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/") if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{//filesystem.Directory=filesystem.homePath; {//filesystem.Directory=filesystem.homePath;
filesystem.makePath(filesystem.homePath+"/"+username.text); filesystem.makePath(filesystem.homePath+"/"+username.text);
} }
filesystem.Directory=imagestoredir //userconfig.imagestore; filesystem.Directory=imagestoredir //userconfig.imagestore;
filesystem.makeDir("contacts"); filesystem.makeDir("contacts");
filesystem.makeDir("albums"); filesystem.makeDir("albums");
Service.storeConfig(db,userconfig); Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){ Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){ Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) { storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive; return obj1.isActive - obj2.isActive;
}); });
accountPage.users=storedUsers}); accountPage.users=storedUsers});
//reset values //reset values
root.login=userconfig; login=userconfig;
root.news=[]; news=[];
rootstack.currentIndex=0; rootstack.currentIndex=0;
root.newstypeSignal("refresh"); newstypeSignal("refresh");
},"isActive",0); },"isActive",0);
//Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc}); //Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc});
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root) Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
rootstackView.pop()
} }
}); });
@ -316,79 +264,82 @@ Page{
}} }}
Row{
Button { spacing:0.5*mm
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
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 1*mm anchors.rightMargin: 1*mm
text: "\uf057" MButton {
//font.pixelSize: 3*mm //x: parent.width/2+4*mm; y: mm;
font.pointSize: 16 width: 5*mm;
onClicked:{root.pop()} //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: { Component.onCompleted: {
try{Helperjs.readData(db,"config","",function(storedUsers){ try{Helperjs.readData(db,"config","",function(storedUsers){

View File

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

View File

@ -33,39 +33,38 @@ import QtQuick 2.0
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import "qrc:/qml/genericqml" import "qrc:/qml/genericqml"
Rectangle{ Page{
color:"white" //color:"white"
width:infoBoxText.contentWidth // width:infoBoxText.contentWidth
height:infoBoxText.contentHeight // height:infoBoxText.contentHeight
Text{id:infoBoxText Text{id:infoBoxText
anchors.top:closeButton.bottom anchors.top:closeButton.bottom
anchors.topMargin: mm anchors.topMargin: mm
textFormat: Text.RichText textFormat: Text.RichText
width: root.width-mm width: root.width-mm
font.pointSize: osSettings.systemFontSize
wrapMode: Text.WrapAtWordBoundaryOrAnywhere 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>"+ "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>"+ "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>"+ "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>"+ "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>"+ "Qt Framework <a href='https://www.qt.io'>www.qt.io</a><br>"+
"Icons by <a href='http://fontawesome.io'>FontAwesome</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>"+ "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>"+ "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>)" "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:{ onLinkActivated:{
Qt.openUrlExternally(link)} Qt.openUrlExternally(link)}
} }
Button{ MButton{
id:closeButton id:closeButton
height: 6*mm anchors.top: parent.top
width: 8*mm anchors.topMargin: root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top anchors.right: parent.right
anchors.topMargin: 1*mm anchors.rightMargin: 1*mm
anchors.right: parent.right text: "\uf057"
anchors.rightMargin: 1*mm font.pointSize: osSettings.bigFontSize
text: "\uf057" onClicked:{rootstackView.pop()}
font.pixelSize: 3*mm }
onClicked:{root.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 int backKey: Qt.Key_Back
//property string attachImageDir:filesystem.cameraPath+"/" //property string attachImageDir:filesystem.cameraPath+"/"
property string osType: "Android" property string osType: "Android"
property int systemFontSize: root.font.pointSize*1.1
property int bigFontSize: systemFontSize*1.3
property string imagePickQml: "ImagePicker" property string imagePickQml: "ImagePicker"
property string imagePicker:'import QtQuick 2.0; import "qrc:/qml/genericqml";'+ property string imagePicker:'import QtQuick 2.0; import "qrc:/qml/genericqml";'+
imagePickQml+'{multiple : true;onReady: {attachImageURLs.push(imageUrl);'+ imagePickQml+'{multiple : true;onReady: {attachImageURLs.push(imageUrl);'+

View File

@ -32,10 +32,12 @@
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick 2.0 import QtQuick 2.0
QtObject{ QtObject{
property real appWidth: Screen.desktopAvailableWidth/3 property real appWidth: Screen.desktopAvailableWidth/4*3
property real appHeight: Screen.desktopAvailableHeight/3*2 property real appHeight: Screen.desktopAvailableHeight/4*3
property int backKey: Qt.Key_Escape property int backKey: Qt.Key_Escape
property string osType: "Linux" 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 attachImageDir:filesystem.homePath+"/Pictures/"
property string imagePickQml: "ImagePickerLinux" property string imagePickQml: "ImagePickerLinux"
} }

View File

@ -36,10 +36,7 @@ import "qrc:/qml/genericqml"
Rectangle{ Rectangle{
color:"white" color:"white"
//border.color: "light grey"
property alias url:htmlview.url property alias url:htmlview.url
// width:root.width-5*mm
// height:root.height-12*mm
WebView {id:htmlview; WebView {id:htmlview;
height:parent.height-7*mm height:parent.height-7*mm
@ -55,13 +52,13 @@ Rectangle{
} }
Button{ Button{
id:closeButton id:closeButton
height:6*mm height: 3*root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 1*mm anchors.rightMargin: 1*mm
text: "\uf057" text: "\uf057"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
onClicked:{root.pop()} onClicked:{root.pop()}
} }
} }

View File

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

View File

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

View File

@ -47,41 +47,41 @@ Rectangle {
height:groupListView.height height:groupListView.height
ListView { ListView {
id: contactView id: contactView
x:mm x:mm
y:6*mm y:6*mm
width: contactlistRectangle.width-2*mm width: contactlistRectangle.width-2*mm
height: contactlistRectangle.height-10*mm height: contactlistRectangle.height-10*mm
clip: true clip: true
spacing: 0 spacing: 0
model: contactModel model: contactModel
delegate: listContact delegate: listContact
} }
ListModel{id: contactModel} ListModel{id: contactModel}
Component { id:listContact Component { id:listContact
Rectangle{ Rectangle{
border.color: "#EEEEEE" border.color: "#EEEEEE"
border.width: 1 border.width: 1
radius:0.5*mm radius:0.5*mm
width:contactView.width width:contactView.width
height:6*mm height:6*mm
Image { Image {
id: contactImage id: contactImage
x:1 x:1
y:1 y:1
width: 5*mm width: 5*mm
height:5*mm height:5*mm
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
} }
Text{ Text{
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right anchors.left: contactImage.right
anchors.margins: 1*mm anchors.margins: 1*mm
text:Qt.atob(contact.name) text:Qt.atob(contact.name)
} }
Text { Text {
id:selected id:selected
anchors.right:parent.right anchors.right:parent.right
@ -91,40 +91,38 @@ Rectangle {
width: 5*mm width: 5*mm
anchors.top: parent.top anchors.top: parent.top
color: "green" color: "green"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
} }
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked:{ onClicked:{
if(selected.visible==true){ if(selected.visible==true){
contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1); contacts.splice(Helperjs.inArray(contacts,"id",contact.id),1);
selected.visible=false selected.visible=false
} }
else{ else{
contacts.push(contact); contacts.push(contact);
selected.visible=true; selected.visible=true;
} }
} }
}
} }
} }
}
MButton { MButton {
id: closeButton id: closeButton
height:6* mm anchors.top: parent.top
width: 8*mm anchors.topMargin: 1*mm
anchors.top: parent.top anchors.right: parent.right
anchors.topMargin: 1*mm anchors.rightMargin: 1*mm
anchors.right: parent.right //color:"white"
anchors.rightMargin: 1*mm text: "\uf057"
//color:"white" onClicked: {
text: "\uf057" groupModelAppend(contacts,function(){
onClicked: { contactlistRectangle.destroy()
groupModelAppend(contacts,function(){ });
contactlistRectangle.destroy() }
});
}
} }
Component.onCompleted: { 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 2.11
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import QtQuick.LocalStorage 2.0 import QtQuick.LocalStorage 2.0
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
@ -45,60 +44,72 @@ Rectangle {
color: "white" color: "white"
function showContactdetails(contact){ function showContactdetails(contact){
rootstack.currentIndex=0; // rootstack.currentIndex=0;
bar.currentIndex=0; // bar.currentIndex=0;
root.contactdetailsSignal(contact) root.contactdetailsSignal(contact)
} }
function showProfile(callback){ BlueButton{
var profile=({}); x:mm
Helperjs.readData(db,"profiles",login.username,function(profileobject){ y:mm
var profilearray=[]; z:2
for (var i in profileobject){ visible: !wideScreen
profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata))); fontColor: "grey"
} border.color: "transparent"
profile.profiles=profilearray; text: "\uf0c9"
}); font.pointSize: osSettings.bigFontSize
Helperjs.readData(db,"contacts",login.username,function(owner){ onClicked:{
profile.friendica_owner=owner[0]; leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
},"isFriend",2);
callback(profile)
} }
TabBar { TabBar {
id: friendsbar id: friendsbar
width: parent.width width: osSettings.osType=="Android"?parent.width-2*osSettings.bigFontSize:parent.width
height: 9*mm height: 9*mm
x: osSettings.osType=="Android"?2*osSettings.bigFontSize:0
visible: !wideScreen
position:TabBar.Header position:TabBar.Header
currentIndex: 1 currentIndex: 1
TabButton { TabButton {
text: qsTr("Me") text: qsTr("Me")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
height: 7*mm height: 7*mm
} }
TabButton { TabButton {
text: qsTr("Friends") text: qsTr("Friends")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
height: 7*mm height: 7*mm
} }
TabButton { TabButton {
text: qsTr("Contacts") text: qsTr("Contacts")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
height: 7*mm height: 7*mm
} }
TabButton { TabButton {
text: qsTr("Groups") text: qsTr("Groups")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
height: 7*mm 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{ StackLayout{
id:friendsTabView id:friendsTabView
//anchors.fill: parent //anchors.fill: parent
x:mm width: wideScreen&&rootstackView.depth<2?parent.width-leftDrawer.width-mm:parent.width-mm//newstabitem.width/3*2:newstabitem.width
y:10*mm x: leftDrawer.width
width: parent.width-2*mm y: friendsbar.visible?friendsbar.height:0
height: parent.height-10*mm height: friendsbar.visible?parent.height-friendsbar.height-mm:parent.height-mm
currentIndex: friendsbar.currentIndex currentIndex: friendsbar.currentIndex
signal contactsSignal(var contact) signal contactsSignal(var contact)
signal groupsSignal(var username) signal groupsSignal(var username)
@ -113,267 +124,26 @@ Rectangle {
else if (currentIndex==3){groupsSignal(root.login.username)} else if (currentIndex==3){groupsSignal(root.login.username)}
} }
Loader{
Item{ id: profileLoader
id:profileGridTab source:(friendsTabView.currentIndex==0)? "qrc:/qml/contactqml/ProfileTab.qml":""
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
})
}
} }
ProgressBar{ Loader{
id: newContactsProgress id: friendsListLoader
width: 15*mm source:(friendsTabView.currentIndex==1)? "qrc:/qml/contactqml/FriendsListTab.qml":""
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=[]
}
} }
Item{ Loader{
id: contactsGridTab id: contactsListLoader
Layout.fillWidth:true source:(friendsTabView.currentIndex==2)? "qrc:/qml/contactqml/ContactsListTab.qml":""
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{
Item{ id: groupsListLoader
id: groupsGridTab source:(friendsTabView.currentIndex==3)? "qrc:/qml/contactqml/GroupsListTab.qml":""
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);
}
} }
}
}
Component.onCompleted: { Component.onCompleted: {
//root.contactdetailsSignal.connect(showContactdetails); //root.contactdetailsSignal.connect(showContactdetails);
} }

View File

@ -37,6 +37,8 @@ import "qrc:/qml/genericqml"
Item { Item {
id: groupComponent id: groupComponent
height: 5*root.fontFactor*osSettings.bigFontSize//8*mm
width: groupComponent.ListView.view.width
property var groupmembers:[] property var groupmembers:[]
//property bool newGroup: false //property bool newGroup: false
function groupModelAppend(groupcontacts,callback){ function groupModelAppend(groupcontacts,callback){
@ -47,67 +49,62 @@ Item {
Rectangle { Rectangle {
id: wrapper id: wrapper
width: 16*mm x:0.5*mm
height: 15*mm y:0.5*mm
width:parent.width-mm
height: parent.height-mm
radius: 0.5*mm radius: 0.5*mm
border.color: "grey" border.color: "grey"
color:"white" color:"white"
Image { // Image {
id: photoImage // id: photoImage
x:1 // x:1
y:1 // y:1
width: 10*mm // width: 10*mm
height:10*mm // height:10*mm
source:"qrc:/images/defaultcontact.jpg" // source:"qrc:/images/defaultcontact.jpg"
} // }
Rectangle{ Rectangle{
id:namelabelRect id:namelabelRect
x: 1 x: 1
y: 1
width: wrapper.width-2 width: wrapper.width-2
height: 3.5*mm height: 3*root.fontFactor*osSettings.bigFontSize
anchors.top: photoImage.bottom //border.color: "light grey"
border.color: "light grey"
TextInput { TextInput {
id: namelabel id: namelabel
anchors.fill: parent anchors.fill: parent
readOnly: true readOnly: true
text: group.new?"":group.groupname text: group.new?"":group.groupname
color: "#303030" color: "#303030"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
} }
} }
MButton{ MButton{
id: closeButton id: closeButton
visible: false visible: false
width: 8*mm anchors.right: parent.right
height: 6*mm
anchors.left: infobutton.right
anchors.margins: mm anchors.margins: mm
anchors.top: parent.top anchors.top: parent.top
text: "\uf057" text: "\uf057"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
onClicked:{groupComponent.state=""; onClicked:{groupComponent.state="";
if (group.new){groupsModel.remove(index)} if (group.new){groupsModel.remove(index)}
} }
} }
MButton{ MButton{
id:infobutton id:infobutton
width: 4*mm
height: 6*mm
//color:"transparent"
text:"?" text:"?"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
anchors.left: photoImage.right anchors.right: parent.right
anchors.leftMargin: mm anchors.rightMargin: mm
anchors.topMargin: mm anchors.topMargin: mm
anchors.top: parent.top anchors.top: parent.top
onClicked:{ onClicked:{
groupComponent.state="large";
//if(group.new){ //if(group.new){
Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){ Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){
try {groupModel.clear()}catch (e){print(e)} try {groupModel.clear()}catch (e){print(e)}
@ -124,15 +121,31 @@ Item {
} //catch(e){} } //catch(e){}
},"groupname",group.groupname); },"groupname",group.groupname);
//} //}
groupComponent.state="large"
} }
} }
Rectangle{ Rectangle{
id: detailsrectangle id: detailsrectangle
anchors.top: namelabelRect.bottom anchors.top: namelabelRect.bottom
anchors.topMargin: mm //anchors.topMargin: mm
opacity: 0 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 { // Component {
// id:groupMember // 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{ // Row{
anchors.top: groupListView.bottom // anchors.top: groupListView.bottom
anchors.topMargin: mm // anchors.topMargin: mm
spacing: mm // spacing: mm
// }
}
// BlueButton{ // BlueButton{
// id: addMembers // id: addMembers
@ -258,14 +257,15 @@ Item {
states: [ states: [
State { State {
name: "large" name: "large"
PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:groupsView.width; readOnly:false} PropertyChanges { target: groupComponent; height: groupsView.height - 6*root.fontFactor*osSettings.bigFontSize }
PropertyChanges { target: namelabelRect; height: 4.5*mm} 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: closeButton; visible: true}
PropertyChanges { target: groupComponent; z: 2 } //PropertyChanges { target: groupComponent; z: 2 }
PropertyChanges { target: wrapper; width:groupsView.width;height:groupsView.height -2*mm-1} //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: photoImage; width:15*mm;height:15*mm }
PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false} //PropertyChanges { target:groupComponent.GridView.view ;contentY:groupComponent.y;contentX:groupComponent.x;interactive:false}
PropertyChanges { target: detailsrectangle; opacity:1 } PropertyChanges { target: detailsrectangle; visible:true }
PropertyChanges { target: infobutton; visible: false} 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 { MButton {
id: update id: update
height: 6*mm
width: 8*mm
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: mm anchors.topMargin: mm
anchors.right: parent.right anchors.right: parent.right
text: "\uf021" text: "\uf021"
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
onClicked: { onClicked: {
Service.requestProfile(root.login,root.db,root,function(nc){ Service.requestProfile(root.login,root.db,root,function(nc){
root.newContacts=nc; root.newContacts=nc;
root.onNewContactsChanged(nc);
photoImage.source=""; photoImage.source="";
showProfile(function(newprofile){ showProfile(function(newprofile){
profile=newprofile; profile=newprofile;
@ -149,7 +148,7 @@ Rectangle {
imagePicking=true; imagePicking=true;
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+ osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+
'}}',profileGridTab,"imagePicker"); '}}',profileTab,"imagePicker");
imagePicker.pickImage() imagePicker.pickImage()
} }
} }
@ -172,16 +171,15 @@ Rectangle {
anchors.top: photoImage.top anchors.top: photoImage.top
anchors.right:photoImage.right anchors.right:photoImage.right
color: "white" color: "white"
font.pixelSize: 4*mm font.pointSize: 1.2*osSettings.bigFontSize
} }
MButton{ MButton{
id:updatebutton id:updatebutton
height: 6*mm width: 8*root.fontFactor*osSettings.bigFontSize
width: 12*mm
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
text:qsTr("Update") text:qsTr("Update")
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
anchors.left: photoImage.right anchors.left: photoImage.right
anchors.leftMargin: 0.5*mm anchors.leftMargin: 0.5*mm
anchors.topMargin: mm anchors.topMargin: mm
@ -199,7 +197,7 @@ Rectangle {
anchors.left: photoImage.left anchors.left: photoImage.left
wrapMode: Text.Wrap wrapMode: Text.Wrap
color: "#303030" color: "#303030"
font.pixelSize: 4*mm font.pointSize: osSettings.bigFontSize
anchors.top: photoImage.bottom anchors.top: photoImage.bottom
} }
@ -212,7 +210,7 @@ Rectangle {
height: 5*mm+profiletextfield.height height: 5*mm+profiletextfield.height
Text{ Text{
y:mm y:mm
font.pixelSize: 3*mm font.pointSize: osSettings.systemFontSize
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>" text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
color:"black" color:"black"
} }
@ -222,7 +220,7 @@ Rectangle {
y:4.5*mm y:4.5*mm
width:parent.width-2.5*mm width:parent.width-2.5*mm
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.pixelSize: 3*mm font.pointSize: osSettings.systemFontSize
text:profiletext text:profiletext
color:"black" color:"black"
} }
@ -234,7 +232,7 @@ Rectangle {
id:namelabeltext id:namelabeltext
width: namelabelflickable.width width: namelabelflickable.width
height: implicitHeight height: implicitHeight
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
textFormat:Text.RichText textFormat:Text.RichText
wrapMode: Text.Wrap 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+ 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 QtQuick.Layouts 1.11
import "qrc:/js/news.js" as Newsjs import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
import "qrc:/qml/genericqml"
StackView{ ApplicationWindow{
id:root 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)} property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsLinux.qml");return tmp.createObject(root)}
width: osSettings.appWidth width: globaloptions.hasOwnProperty("appWidth")?globaloptions.appWidth:osSettings.appWidth
height:osSettings.appHeight height:globaloptions.hasOwnProperty("appHeight")?globaloptions.appHeight:osSettings.appHeight
visible: true
property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000] property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000]
property var login: Service.readActiveConfig(db) 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 var contactlist: []
property real mm: osSettings.osType=="Android"?Screen.pixelDensity:Screen.pixelDensity*1.5 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 fotoSignal(var username, var friend)
signal directmessageSignal(var friend) signal directmessageSignal(var friend)
signal newsSignal(var news) signal newsSignal(var news)
signal newstypeSignal(var type) signal newstypeSignal(var type)
signal friendsSignal(var username) signal friendsSignal(var username)
signal contactdetailsSignal(var contact) signal contactdetailsSignal(var contact)
signal searchSignal (var searchterm)
signal eventSignal(var contact) signal eventSignal(var contact)
signal uploadSignal(var urls) signal uploadSignal(var urls)
signal sendtextSignal(var intenttext) signal sendtextSignal(var intenttext)
signal changeimage(var method, var type, var id) signal changeimage(var method, var type, var id)
signal updateSyncinterval(int interval) signal updateSyncinterval(int interval)
signal replySignal(var newsobject)
property var news:[] property var news:[]
property var newContacts:[] property var newContacts:[]
property var contactposts:[]
//property string contactLoadType: "" //property string contactLoadType: ""
property bool imagePicking: false property bool imagePicking: false
onLoginChanged:{ function onLoginChanged(login){
if(login==""){root.push("qrc:/qml/configqml/AccountPage.qml")} if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{root.push(rootStackItem) else{//rootstackView.push(rootstack)
if (login.newsViewType!="" || login.newsViewType!=null){newstab.newstabstatus=login.newsViewType;} if (login.newsViewType!="" || login.newsViewType!=null){
newstab.newstabstatus=login.newsViewType;}
Newsjs.getCurrentContacts(login,db,function(contacts){ Newsjs.getCurrentContacts(login,db,function(contacts){
contactlist=contacts})} contactlist=contacts})
}
} }
onNewContactsChanged:{ function onNewContactsChanged(newContacts){
if(newContacts.length>0){// download contact images and update db if(newContacts.length>0){// download contact images and update db
var contacturls=[]; var contacturls=[];
var contactnames=[]; 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); contacturls.push(newContacts[link].profile_image_url);
contactnames.push(newContacts[link].screen_name); contactnames.push(newContacts[link].screen_name);
Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link]) 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{ Connections{
target:xhr target:xhr
function onDownloaded(type,url,filename,i){ function onDownloaded(type,url,filename,i){
@ -104,10 +136,12 @@ StackView{
} }
} }
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"} FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth) //Keys.onReleased: {//print(event.key + "Backkey"+newstab.conversation.length+" "+root.depth)
if (event.key === osSettings.backKey) { onClosing: {
//if (event.key === osSettings.backKey) {
if (rootstack.currentIndex==0){ if (rootstack.currentIndex==0){
newstab.active=true; newstab.active=true;
if (newstab.newstabstatus!=globaloptions.newsViewType){ if (newstab.newstabstatus!=globaloptions.newsViewType){
@ -119,294 +153,149 @@ StackView{
Newsjs.chatsfromdb(db,login.username,function(dbnews){ Newsjs.chatsfromdb(db,login.username,function(dbnews){
newsSignal(dbnews) newsSignal(dbnews)
})} })}
close.accepted=false;
} }
else if (newstab.conversation.length>0){newstab.conversation=[]} else if (newstab.conversation.length>0){
else if (root.depth>1){root.pop()} newstab.conversation=[];
close.accepted=false
}
else if (root.depth>1){
root.pop();
close.accepted=false
}
else{ else{
Service.cleanNews(root.db,function(){ Service.cleanNews(root.db,function(){
Service.cleanHashtags(root.db,function(){ Service.cleanHashtags(root.db,function(){
Service.cleanContacts(root.login,root.db,function(){ Service.cleanContacts(root.login,root.db,function(){
Qt.quit()}) Qt.quit()})
})}) })})
close.accepted=true
} }
} }
else if (rootstack.currentIndex==2){fotoSignal("backButton")} else if (rootstack.currentIndex==2){fotoSignal("backButton")}
else {rootstack.currentIndex=0} else {rootstack.currentIndex=0}
event.accepted = true //event.accepted = true
}} //}
}
Drawer{
id: leftDrawer
width: 0.66* root.width
height: root.height header: ToolBar{
edge: Qt.LeftEdge position: wideScreen?ToolBar.Header:ToolBar.Footer
position: 1.0 background: Rectangle{
Column{ anchors.fill: parent
x:mm color: "#EEEEEE"//"#F8F8F8"
width:parent.width-mm }
Label{ RowLayout{
text: login.hasOwnProperty("username")?login.username:"" anchors.fill: parent
//font.pixelSize: 4*mm ToolButton{
font.pointSize: 16 visible: !wideScreen
width: parent.width text: "\uf0c9"
height: 6*mm onClicked:{
leftDrawer.visible?leftDrawer.close():leftDrawer.open()}
} }
// Label{ TabBar {
// text:login.hasOwnProperty("server")?"@"+login.server:"" id: bar
// font.pixelSize: 5*mm Layout.fillWidth: true
// width: parent.width //width: wideScreen?contentWidth:parent.width-10*mm
// } //x: 7*mm
onCurrentIndexChanged: rootstack.currentIndex=bar.currentIndex
Label{ TabButton {
text: "\uf021 " + qsTr("Refresh") text: "\uf03a"
//font.pixelSize: 4*mm background:Rectangle{
font.pointSize: 16 anchors.fill: parent
width: parent.width color: "#EEEEEE"
MouseArea{ }
anchors.fill: parent }
onClicked:{ TabButton {
leftDrawer.close(); text: "\uf0c0"
// newstypeSignal("refresh") background:Rectangle{
updatenews.setDatabase(); anchors.fill: parent
updatenews.login(); color: "#EEEEEE"
updatenews.startsync(); }
}
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{ LeftDrawerAndroid{
id:rootStackItem id: leftDrawer
width:parent.width visible:!wideScreen
height: parent.height }
//anchors.fill:parent
states: State {
name: "fullscreen";
PropertyChanges { target: bar; height:0 }
PropertyChanges { target: rootstack; height:parent.height }
}
transitions: Transition { // states: State {
PropertyAnimation { properties: "height"; // name: "fullscreen";
easing.type: Easing.InOutQuad // PropertyChanges { target: bar; height:0 }
duration: 1000 // PropertyChanges { target: rootstack; height:parent.height }
} // }
}
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 { // transitions: Transition {
text: "\uf073" // PropertyAnimation { properties: "height";
font.pixelSize: 3*mm // easing.type: Easing.InOutQuad
height: 6*mm // duration: 1000
} // }
} // }
StackView{id:rootstackView
StackLayout{ width:root.width
height: root.height
initialItem: StackLayout{
id:rootstack id:rootstack
width:parent.width width:rootstackView.width
height: parent.height-7*mm height: rootstackView.height//-7*mm
//y:wideScreen?7*mm:0
currentIndex:bar.currentIndex currentIndex:bar.currentIndex
Loader{ Loader{
id: newstab id: newstab
Layout.fillWidth:true Layout.fillWidth:true
Layout.fillHeight: true Layout.fillHeight: true
property string newstabstatus property string newstabstatus
property var conversation:[] property var conversation:[]
property var contactposts:[]
source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":"" source:(rootstack.currentIndex==0)? "qrc:/qml/newsqml/NewsTab.qml":""
} }
Loader{ Loader{
id: friendstab id: friendstab
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":"" source: (rootstack.currentIndex==1)?"qrc:/qml/contactqml/FriendsTab.qml":""
} }
Loader{ Loader{
id: fotostab id: fotostab
property string phototabstatus:"Images" property string phototabstatus:"Images"
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":"" source: (rootstack.currentIndex==2)?"qrc:/qml/photoqml/PhotoTab.qml":""
} }
Loader{ Loader{
id: calendartab id: calendartab
property string calendartabstatus:"Events" property string calendartabstatus:"Events"
Layout.fillWidth:true // Layout.fillWidth:true
Layout.fillHeight: true // Layout.fillHeight: true
source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":"" source: (rootstack.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":""
} }
} }
}
//}
Component.onCompleted: { Component.onCompleted: {
forceActiveFocus(); onLoginChanged(login);
//print(xhr.networktype()); globaloptions=Service.readGO(db);
if(osSettings.osType=="Android"){ if(osSettings.osType=="Android"){
var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml");
var IntentReceiverQml = component.createObject(root); var IntentReceiverQml = component.createObject(root);
@ -416,5 +305,5 @@ StackView{
var LinuxSyncQml = component.createObject(root); var LinuxSyncQml = component.createObject(root);
} }
} }
} //}
} }

View File

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

View File

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

View File

@ -15,7 +15,7 @@ Item {
Connections { Connections {
target: SystemDispatcher target: SystemDispatcher
onDispatched: { function onDispatched (type, message) {
if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) { if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) {
var h=[]; var h=[];
for (var n in message.imageUrls){ 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 import QtQuick.Controls 2.12
Button{ Button{
id: mButton 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 //radius: mm
height: 6*mm height: 2*root.fontFactor*osSettings.bigFontSize
//color: Material.grey //color: Material.grey
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
background: Rectangle{color:"#F8F8F8";radius: 0.5*mm} background: Rectangle{id:bg;color:"#F3F3F3";radius: 0.5*mm}
} }

View File

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

View File

@ -33,154 +33,290 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import "qrc:/js/helper.js" as Helperjs 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" import "qrc:/qml/genericqml"
Rectangle {
Page {
id:contactList id:contactList
color: "white"
property var contact:({}) property var contact:({})
property string profileimagesource:contact.profile_image property string profileimagesource:contact.profile_image
ListView {
id: contactView //function backRequested(){pageStack.pop()}
x:mm
y:9*mm function getDateDiffString (seconds){
width: contactList.width-4*mm var timestring="";
height:contactList.height-10*mm if (seconds<60) {timestring= Math.round(seconds) + " " +qsTr("seconds");}
clip: true else if (seconds<90){timestring= Math.round(seconds/60) + " " +qsTr("minute") ;}
spacing: 0 else if (seconds<3600){timestring= Math.round(seconds/60) + " " +qsTr("minutes");}
header: contactHeader else if (seconds<5400){timestring= Math.round(seconds/3600) + " " +qsTr("hour");}
model: contactModel else if (seconds<86400){timestring= Math.round(seconds/3600) + " " +qsTr("hours");}
delegate: Newsitem{} 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{ BusyIndicator{
id: contactBusy id: contactBusy
anchors.centerIn:parent anchors.centerIn:parent
width:10*mm width:10*mm
height: 10*mm height: 10*mm
running: true running: true
} }
Component { id: contactHeader Component { id: contactHeader
Rectangle{ Rectangle{
border.color: "#EEEEEE" border.color: "#EEEEEE"
border.width: 1 border.width: 1
color:"white" color:"white"
width:contactView.width width:contactView.width
height: profileImage.height+namelabel.height+detailtext.height+7*mm 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 //height: wrapper.height
property var createdAtDate: new Date(contact.created_at) 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>") property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
Image { Image {
id: profileImage id: profileImage
x:mm x:mm
y:mm y:mm
width: contactView.width/2 width: Math.min(15*root.fontFactor*osSettings.bigFontSize,contactView.width/2) //contactView.width/2
height:width height:width
source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
Connections{ Connections{
target:contactList target:contactList
onProfileimagesourceChanged:profileImage.source=profileimagesource onProfileimagesourceChanged:profileImage.source=profileimagesource
} }
} }
Column{id:buttoncolumn Flow{id:buttonflow
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: mm anchors.rightMargin: mm
y: mm width: contactView.width - (profileImage.width+3*mm)
spacing:4 height: (contact.hasOwnProperty("acct"))?21*mm:15*mm//profileImage.height
y: mm
spacing:4
MButton{ BlueButton{
id:photobutton id:photobutton
height: 6*mm height: 6*mm
width: 8*mm width: 8*mm
text: "\uf03e" // "Photos" text: "\uf03e" // "Photos"
//font.pixelSize: 3*mm visible:(contact.network=="dfrn")
visible:(contact.network=="dfrn") onClicked:{
onClicked:{ rootstack.currentIndex=2;
rootstack.currentIndex=2; bar.currentIndex=2;
bar.currentIndex=2; fotostab.phototabstatus="Contact";
fotostab.phototabstatus="Contact";
//fotostab.active=true; //fotostab.active=true;
fotoSignal(root.login,contact) ; fotoSignal(root.login,contact) ;
newsStack.pop(); rootstackView.pop();
} }
} }
MButton{ BlueButton{
id:dmbutton id:dmbutton
height: 6*mm height: 6*mm
width: 8*mm width: 8*mm
visible: (contact.following=="true") visible: (contact.following=="true")
text: "\uf040" //"DM" text: "\uf040" //"DM"
//font.pixelSize: 3*mm onClicked:{
onClicked:{ rootstack.currentIndex=0;
rootstack.currentIndex=0; newsSwipeview.currentIndex=2;
newsSwipeview.currentIndex=2; directmessageSignal(contact)
directmessageSignal(contact) }
} }
}
MButton{ BlueButton{
id:eventbutton id:eventbutton
visible:(contact.network=="dfrn") visible:(contact.network=="dfrn")
height: 6*mm height: 6*mm
width: 8*mm width: 8*mm
text:"\uf073" text:"\uf073"
//font.pixelSize: 3*mm onClicked:{
onClicked:{ rootstack.currentIndex=3;
rootstack.currentIndex=3; bar.currentIndex=3;
bar.currentIndex=3; calendartab.calendartabstatus="Friend"
calendartab.calendartabstatus="Friend" eventSignal(contact);
eventSignal(contact); rootstackView.pop()
newsStack.pop() }
} }
} BlueButton{
id:approvebutton
visible:(contact.hasOwnProperty("acct"))
height: 6*mm
//width: implicitContentWidth+2*mm//8*mm
text:qsTr("Approve")
onClicked:{
}//Column end Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/authorize",'',"POST",root,function(returnvalue){
Label { Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
id: namelabel })
x:mm root.friendsSignal();
width: contactView.width-2*mm rootstackView.pop()
height: implicitHeight }
text:contact.name+" (@"+contact.screen_name+")" }
wrapMode: Text.Wrap//elide:Text.ElideRight BlueButton{
color: "#303030" id:rejectbutton
font.pixelSize: 4*mm visible:(contact.hasOwnProperty("acct"))
anchors.top: profileImage.bottom height: 6*mm
anchors.topMargin: mm //width: implicitContentWidth+2*mm//8*mm
} text:qsTr("Reject")
Text{ onClicked:{
id:detailtext Helperjs.friendicaPostRequest(login,"/api/v1/follow_requests/" + contact.id + "/reject",'',"POST",root,function(returnvalue){
anchors.top: namelabel.bottom Helperjs.deleteData(db,"friendshiprequests",login.username,function(){},"id", contact.id)
anchors.topMargin: 2*mm })
x:mm root.friendsSignal();
width: contactView.width-2*mm rootstackView.pop()
height: implicitHeight }
font.pixelSize: 2.5*mm }
textFormat:Text.RichText BlueButton{
wrapMode: Text.Wrap id:ignorebutton
text:"<b>"+qsTr("Description")+": </b> "+contact.description+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+ visible:(contact.hasOwnProperty("acct"))
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+ height: 6*mm
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale()) //width: implicitContentWidth+2*mm//8*mm
onLinkActivated: { 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)} Qt.openUrlExternally(link)}
} }
//} //}
} }
}//Component end
}//Component end
Connections{ 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(){ 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; contactBusy.running=false;
contactModel.clear(); contactModel.clear();
var currentTime= new Date(); 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) contactWorker.sendMessage(msg)
} }
} }
@ -193,25 +329,26 @@ Rectangle {
} }
MButton { MButton {
id: closeButton id: closeButton
height: 6*mm anchors.top: parent.top
width: 8*mm anchors.topMargin: 0.5*root.fontFactor*osSettings.bigFontSize
anchors.top: parent.top anchors.right: parent.right
anchors.topMargin: 1*mm anchors.rightMargin: 1*mm
anchors.right: parent.right width: 2*root.fontFactor*osSettings.bigFontSize;
anchors.rightMargin: 1*mm text: "\uf057"
text: "\uf057" //font.pixelSize: 3*mm
//font.pixelSize: 3*mm onClicked: {
onClicked: { rootstackView.pop()
newsStack.pop() }
}
} }
Component.onCompleted: { Component.onCompleted: {
xhr.clearParams(); xhr.clearParams();
xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.setUrl(login.server); xhr.setUrl(login.server);
xhr.setApi("/api/statuses/user_timeline"); if(contact.isFriend==1 || contact.hasOwnProperty("acct")){
xhr.setParam("user_id",contact.id) xhr.setApi("/api/statuses/user_timeline");}
xhr.get(); 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/genericqml"
import "qrc:/qml/newsqml" import "qrc:/qml/newsqml"
Rectangle { Page {
id:conversationList id:conversationList
property var news:[] 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 { ListView {
id: conversationView id: conversationView
property string viewtype: "conversation" property string viewtype: "conversation"
x:3*mm //x:3*mm
y:8*mm //y:8*mm
width: conversationList.width-4*mm width: conversationList.width//-4*mm
height:conversationList.height-10*mm height:conversationList.height//-20*mm
clip: true clip: true
spacing: 0 spacing: 0
footer: MessageSend{conversation:true} footer: MessageSend{conversation:true}
@ -58,7 +105,7 @@ Rectangle {
BusyIndicator{ BusyIndicator{
id: conversationBusy id: conversationBusy
anchors.horizontalCenter: conversationView.horizontalCenter anchors.horizontalCenter: conversationView.horizontalCenter
anchors.top:conversationList.top anchors.top:conversationView.top
anchors.topMargin: 2*mm anchors.topMargin: 2*mm
width:10*mm width:10*mm
height: 10*mm height: 10*mm
@ -69,7 +116,7 @@ Rectangle {
target:newstab target:newstab
onConversationChanged:{ onConversationChanged:{
if(newstab.conversation.length==0){ if(newstab.conversation.length==0){
newsStack.pop() rootstackView.pop()
} else { conversationBusy.running=false; } else { conversationBusy.running=false;
conversationModel.clear(); conversationModel.clear();
var currentTime= new Date(); var currentTime= new Date();
@ -88,16 +135,16 @@ Rectangle {
MButton { MButton {
id: closeButton id: closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 1*mm anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057" text: "\uf057"
onClicked: { onClicked: {
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning); //newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
newstab.conversation=[]; 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"} onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
} }
Text{ Text{
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right anchors.left: contactImage.right
anchors.margins: 1*mm anchors.margins: 1*mm
text:contact.name text:contact.name
@ -86,9 +86,8 @@ Rectangle {
} }
}} }}
BlueButton { MButton {
id: closeButton id: closeButton
//width:10*mm
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
anchors.right: parent.right anchors.right: parent.right

View File

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

View File

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

View File

@ -32,19 +32,26 @@
import QtQuick 2.9 import QtQuick 2.9
AnimatedImage {id:gif; AnimatedImage {id:gif;
width:toprow.width; width:toprow.width;
property string mimetype:"" //property string mimetype:""
fillMode: Image.PreserveAspectFit; fillMode: Image.PreserveAspectFit;
onStatusChanged: playing = (status == AnimatedImage.Ready); onStatusChanged: playing = (status == AnimatedImage.Ready)
MouseArea {anchors.fill:parent; Rectangle{
onClicked:{ visible: (model.newsitemobject.imageAttachmentList.length>1)&&(gif.status==Image.Ready)
if (mimetype!="image/gif"){ opacity: 0.5
var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+ color: "black"
'Rectangle{id:recfullscreen;color:"white";width:root.width;height:root.height;'+ width:imageCountText.contentWidth+mm
'MouseArea {anchors.fill:parent;onClicked:{recfullscreen.destroy()}}'+ height: imageCountText.contentHeight+mm
'AnimatedImage {id:giffullscreen;source: "'+gif.source+ x: (gif.width-gif.paintedWidth)/2+gif.paintedWidth-width
'";anchors.centerIn:parent; width:root.width;height:root.height;fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready);'+ anchors.bottom: parent.bottom
'}}',root,"Attachmentlarge") 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/helper.js" as Helperjs
import "qrc:/js/service.js" as Service import "qrc:/js/service.js" as Service
StackView{ Rectangle{
id: newsStack id: newsStack
anchors.fill: parent //anchors.fill: parent
width: parent.width
height: parent.height
property string updateMethodNews: "refresh" property string updateMethodNews: "refresh"
property var allchats: ({}) property var allchats: ({})
signal replySignal(var newsobject)
property int lastnewsid:0 property int lastnewsid:0
property string newstabstatus: ""
function newstypeHandling(newstype){ BusyIndicator{
newsBusy.running=true; id: newsBusy
replySignal(""); //visible: false
//messagesend.state=""; anchors.horizontalCenter: parent.horizontalCenter
newsModel.clear(); anchors.top:parent.top
switch(newstype){ anchors.topMargin: 2*mm
case "timeline": width:10*mm
newstab.newstabstatus="Timeline"; height: 10*mm
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){ z:2
lastnewsid=lastid; running: false
showNews(dbnews) }
})}catch(e){Helperjs.showMessage("Error",e,root)};
break; function newstypeHandling(newstype){
case "conversation": newsBusy.running=true;
newstab.newstabstatus="Conversations"; replySignal("");
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){ //messagesend.state="";
lastnewsid=lastid; newsModel.clear();
showNews(news)}); switch(newstype){
break; case "timeline":
case "favorites": newstab.newstabstatus="Timeline";
newsStack.updateMethodNews="refresh"; try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
newstab.newstabstatus="Favorites"; lastnewsid=lastid;
Service.updateView("Favorites"); showNews(dbnews)
break; })}catch(e){Helperjs.showMessage("Error",e,root)};
case "replies": break;
newsStack.updateMethodNews="refresh"; case "conversation":
newstab.newstabstatus="Replies"; newstab.newstabstatus="Conversations";
Service.updateView("Replies"); Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
break; lastnewsid=lastid;
case "publictimeline": showNews(news)});
newsStack.updateMethodNews="refresh"; break;
newstab.newstabstatus="Public Timeline"; case "favorites":
Service.updateView("Public Timeline"); newsStack.updateMethodNews="refresh";
break; newstab.newstabstatus="Favorites";
case "groupnews": Service.updateView("Favorites");
newsStack.updateMethodNews="refresh"; break;
Service.showGroups(); case "replies":
break; newsStack.updateMethodNews="refresh";
case "search": newstab.newstabstatus="Replies";
newsView.anchors.topMargin=7*mm; Service.updateView("Replies");
newsBusy.running=false; break;
var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml"); case "publictimeline":
var searchItem = component.createObject(newsStack,{y:mm,width:root.width,height: 5*mm}); newsStack.updateMethodNews="refresh";
break; newstab.newstabstatus="Public Timeline";
case "refresh": Service.updateView("Public Timeline");
if (newstab.newstabstatus=="Timeline"){ break;
newsStack.updateMethodNews="append" case "groupnews":
} else {newsStack.updateMethodNews="refresh"} newsStack.updateMethodNews="refresh";
//root.contactLoadType="news"; newstab.newstabstatus="Groupnews";
if (newsSwipeview.stacktype=="Home"){ Service.showGroups();
Service.updateView(newstab.newstabstatus) break;
} case "search":
else if (newsSwipeview.stacktype=="DirectMessage"){ newsView.anchors.topMargin=7*mm;
Service.updateView("Direct Messages") newstab.newstabstatus="Search";
} newsBusy.running=false;
else if (newsSwipeview.stacktype=="Notifications"){ var leftoffset=osSettings.osType=="Android"?3*osSettings.bigFontSize:0
Service.updateView("Notifications") 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; break;
default: case "refresh":
if (newstab.newstabstatus=="Timeline"){ if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append" newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"} } else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news"; //print("Refresh "+newsSwipeview.stacktype+newstab.newstabstatus)
if (newsSwipeview.stacktype=="Home"){ if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus) Service.updateView(newstab.newstabstatus)
} }
else if (newsSwipeview.stacktype=="Directmessage"){ else if (newsSwipeview.stacktype=="DirectMessage"){
Service.updateView("Direct Messages") Service.updateView("Direct Messages")
} }
else if (newsSwipeview.stacktype=="Notifications"){ else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("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){ function showNews(newsToShow){
try{if (newsStack.depth>1){newsStack.pop()}}catch(e){} try{if (rootstackView.depth>1){rootstackView.pop()}}catch(e){}
newsBusy.running=false; newsBusy.running=false;
var currentTime= new Date(); var currentTime= new Date();
// downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now(); // downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now();
//print("appendnews "+JSON.stringify(newsToShow)) //print("appendnews "+JSON.stringify(newsToShow))
if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews} if (newsToShow.length==1){var method="refresh"}else{var method = newsStack.updateMethodNews}
var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions}; var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':method, 'options':globaloptions};
newsWorker.sendMessage(msg); newsWorker.sendMessage(msg);
//newsStack.appendNews=false //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(); var currentTime= new Date();
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 } try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
var messagetype=0; var messagetype=0;
switch(newsSwipeview.stacktype){ switch(newsSwipeview.stacktype){
case "Home":messagetype=0;break; case "Home":messagetype=0;break;
case "DirectMessages": messagetype=1;break; case "DirectMessages": messagetype=1;break;
case "Notifications":messagetype=2;break; case "Notifications":messagetype=2;break;
case "Replies":messagetype=3;break; case "Replies":messagetype=3;break;
default:messagetype=0; default:messagetype=0;
} }
if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id); //if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
if(newstabstatus=="Timeline"){
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){ Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions}; var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg); newsWorker.sendMessage(msg);
},false,lastnews_id)} },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){ Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions}; var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
newsWorker.sendMessage(msg); newsWorker.sendMessage(msg);
},lastnews_id)} },lastnews_id)}
else if (newstab.newstabstatus=="Notifications"){} //else if (newstab.newstabstatus=="Notifications"){}
else if (newstabstatus=="Notifications"){}
else{ 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; //newsStack.appendNews=true;
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){} try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
xhr.get() xhr.get()
} }
} }
Connections{ Connections{
target:xhr target:xhr
function onError(data,url,api,code){ function onError(data,url,api,code){
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);} if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
newsBusy.running=false; 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();}
}
}
}
} }
function onSuccess(data,api){
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
Service.processNews(api,data)
replySignal("")
}
}
ListView { Timer {id:replytimer; interval: 1000; running: false; repeat: false
id: newsView onTriggered: {"replytimer triggered";
property real oldContentY:0 newsBusy.running=true;
property bool viewdragged: false if(newstab.newstabstatus=="Conversation"){
property bool viewdraggedpositive: false showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
property string viewtype: "news" else{
anchors.fill: parent if (newstab.newstabstatus=="Timeline"){
anchors.margins: mm newsStack.updateMethodNews="append"
clip: true } else {newsStack.updateMethodNews="refresh"}
spacing: 0 if (newsSwipeview.stacktype=="Home"){
header: MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()} Service.updateView(newstab.newstabstatus)
footer: footerComponent }
model: newsModel else if (newsSwipeview.stacktype=="DirectMessages"){
delegate: Newsitem{} Service.updateView("Direct Messages")
onDragStarted: oldContentY=contentY }
onDragEnded: { else if (newsSwipeview.stacktype=="Replies"){
if(verticalOvershoot<-5*mm){ 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 viewdragged=true
} }
else if (verticalOvershoot>5*mm){ else if (verticalOvershoot>5*mm){
viewdraggedpositive=true viewdraggedpositive=true
} }
else{ else{
if((contentY-oldContentY)>15*mm){ if((contentY-oldContentY)>15*mm){
swipeIndicator.visible=false; //swipeIndicator.visible=false;
newsSwipeview.height=rootStackItem.height; //newsSwipeview.height=rootstack.height;
newsSwipeview.y=0; //newsSwipeview.y=0;
rootStackItem.state="fullscreen" //rootStackItem.state="fullscreen"
} }
else if ((contentY-oldContentY)<-15*mm){ else if ((contentY-oldContentY)<-15*mm){
swipeIndicator.visible=true; //swipeIndicator.visible=true;
newsSwipeview.height=rootStackItem.height-12*mm; //newsSwipeview.height=rootstack.height-12*mm;
newsSwipeview.y=5*mm; //newsSwipeview.y=5*mm;
rootStackItem.state="" //rootStackItem.state=""
} }
} }
} }
onViewdraggedChanged: { onViewdraggedChanged: {
if (viewdragged){ if (viewdragged){
var onlynew=true; var onlynew=true;
newsBusy.running=true; newsBusy.running=true;
viewdragged=false viewdragged=false
if (newstab.newstabstatus=="Timeline"){ if (newstab.newstabstatus=="Timeline"){
newsStack.updateMethodNews="append" newsStack.updateMethodNews="append"
} else {newsStack.updateMethodNews="refresh"} } else {newsStack.updateMethodNews="refresh"}
//root.contactLoadType="news"; //root.contactLoadType="news";
if (newsSwipeview.stacktype=="Home"){ if (newsSwipeview.stacktype=="Home"){
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){ Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
if (currentlastnews>lastnewsid){ if (currentlastnews>lastnewsid){
if(newstab.newstabstatus=="Timeline"){ if(newstab.newstabstatus=="Timeline"){
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){ try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
lastnewsid=lastid; lastnewsid=lastid;
showNews(dbnews) showNews(dbnews)
})}catch(e){Helperjs.showMessage("Error",e,root)}; })}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(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"){ else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages") Service.updateView("Direct Messages")
} }
@ -331,87 +354,82 @@ StackView{
Service.updateView("Replies") Service.updateView("Replies")
} }
} }
} }
onViewdraggedpositiveChanged: { onViewdraggedpositiveChanged: {
if (viewdraggedpositive){ if (viewdraggedpositive){print("listview dragged newstab.newstabstatus "+newstab.newstabstatus)
getOldNews(); getOldNews();
viewdraggedpositive=false 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){ ScrollBar.vertical: ScrollBar { }
lastnewsid=lastid; }
showNews(dbnews);
}) ListModel{id: newsModel}
}
else{ WorkerScript {
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){ id: newsWorker
lastnewsid=lastid; source: "qrc:/js/newsworker.js"
showNews(dbnews) }
})}
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 2.11
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
//import QtQuick.Controls.Styles 2.3
//import QtQuick.Dialogs 1.3
import "qrc:/qml/newsqml" import "qrc:/qml/newsqml"
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service 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 Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: { onTriggered: {
// downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now()
root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist); root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist);
root.onNewContactsChanged(root.newContacts);
Newsjs.storeNews(login,db,root.news,root) Newsjs.storeNews(login,db,root.news,root)
} }
} }
@ -56,6 +59,7 @@ Item {
xhr.setUrl(login.server); xhr.setUrl(login.server);
xhr.setApi("/api/conversation/show"); xhr.setApi("/api/conversation/show");
xhr.setParam("id",newsitemobject.id) xhr.setParam("id",newsitemobject.id)
xhr.setParam("count","200")
xhr.get(); xhr.get();
} }
else{ else{
@ -113,51 +117,101 @@ Item {
} }
function onFriendsMessages(friend){
newstab.newstabstatus="Contact" // CalendarTab{
Newsjs.newsfromdb(db,root.login.username, 0,function(dbnews){ // visible: wideScreen&&rootstackView.depth<2
if (dbnews.length==0){ // width: newstabitem.width/3
Newsjs.newsfromdb(db,login.username,0,function(forumnews){ // x: newsSwipeview.width
showNews(forumnews) // //anchors.left: newsSwipeview.right
},friend.url) // //anchors.fill: null
} // }
else showNews(dbnews) // Rectangle{
},friend.id) // 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{ LeftDrawerLinux{
text:"\uf0c9 " id:leftDrawer
font.pixelSize: 5* mm property var newstabstatus: newstab.newstabstatus
anchors.left: parent.left visible: wideScreen&&rootstackView.depth<2
anchors.margins: mm width: visible?root.fontFactor*osSettings.systemFontSize*15:0
color: "#B0BEC5" height: root.height-bar.height
MouseArea{
anchors.fill: parent
onClicked:{
leftDrawer.open()
}
}
} }
Label{
text:qsTr(newsSwipeview.stacktype) LeftDrawerAndroid{
font.pixelSize: 3* mm id: leftDrawerAndroid
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: 2*mm
} }
// 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{ SwipeView{
id: newsSwipeview id: newsSwipeview
property string stacktype:"Home" property string stacktype:"Home"
currentIndex: 0 currentIndex: 0
width: parent.width width: wideScreen&&rootstackView.depth<2?newstabitem.width-leftDrawer.width-mm:newstabitem.width-mm//newstabitem.width/3*2:newstabitem.width
height: parent.height-6*mm height: newstabitem.height-4*mm
y: 5*mm x: leftDrawer.width
function onDirectMessage(friend){currentIndex=2} function onDirectMessage(friend){currentIndex=2}
transitions: Transition { // transitions: Transition {
PropertyAnimation { properties: "height"; // PropertyAnimation { properties: "height";
easing.type: Easing.InOutQuad // easing.type: Easing.InOutQuad
duration: 1000 // 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: { onCurrentIndexChanged: {
switch(currentIndex){ switch(currentIndex){
@ -168,6 +222,7 @@ Item {
default: stacktype="Home"; default: stacktype="Home";
} }
} }
//anchors.fill: parent //anchors.fill: parent
Loader{ Loader{
id: friendstimeline id: friendstimeline
@ -192,16 +247,17 @@ Item {
source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":"" source:(newsSwipeview.currentIndex==3)? "qrc:/qml/newsqml/NewsStack.qml":""
//onLoaded: newsSwipeview.stacktype="Notifications" //onLoaded: newsSwipeview.stacktype="Notifications"
} }
Component.onCompleted: {root.directmessageSignal.connect(onDirectMessage)}
} }
PageIndicator { PageIndicator {
id: swipeIndicator id: swipeIndicator
z:5
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
count: newsSwipeview.count count: newsSwipeview.count
currentIndex: newsSwipeview.currentIndex currentIndex: newsSwipeview.currentIndex
anchors.bottom: newsSwipeview.bottom anchors.bottom: newsSwipeview.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
} }

View File

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

View File

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

View File

@ -37,7 +37,7 @@ import "qrc:/qml/genericqml"
Item { Item {
id: newsitem 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) 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 int itemindex: index
property var newsitemobject:model.newsitemobject property var newsitemobject:model.newsitemobject
@ -45,7 +45,7 @@ Item {
property var friendica_activities_view: getActivitiesView(model.newsitemobject) property var friendica_activities_view: getActivitiesView(model.newsitemobject)
onAttendingChanged: {attendLabel.visible=true; onAttendingChanged: {attendLabel.visible=true;
attendLabel.text= qsTr("attending")+": "+ qsTr(attending)} attendLabel.text= qsTr("attending")+": "+ qsTr(attending)}
signal replyto(string parent_id) signal replyto(string parent_id)
@ -54,425 +54,416 @@ Item {
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts}); var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
} }
function pushConversation(){ function pushConversation(){
if (model.newsitemobject.hasOwnProperty("currentconversation")){ if (model.newsitemobject.hasOwnProperty("currentconversation")){
newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})} rootstackView.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")}; //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) showConversation(index,newsitemobject)
} }
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"}
Rectangle{ Rectangle{
width:newsitem.width width:newsitem.width
height:newsitem.height-1 height:newsitem.height-1
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white" color: "white"
Column { Column {
id:toprow //newscolumn id:toprow //newscolumn
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *(newsitemobject.indent+1)):newsitem.width//-8*mm 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 x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*(newsitemobject.indent):0
Item{ height: newsitemobject.nsfw?5*mm:Math.min(itemHeader.height+itemBody.height,3/4*root.height)
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm) clip: true
width: parent.width Item{id:itemHeader
MouseArea{ height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
anchors.fill: parent width: parent.width
onClicked:{ MouseArea{
showContact(newsitemobject.user)} anchors.fill: parent
} onClicked:{
Image { showContact(newsitemobject.user)}
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
} }
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 { Label {
id:messageTypeLabel id:messageTypeLabel
color: "grey" color: "grey"
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source} text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
font.pixelSize: 1.5*mm font.pointSize: 0.6*osSettings.systemFontSize
} }
Label { Label {
id:createdAtLabel id:createdAtLabel
color: "grey" color: "grey"
font.pixelSize: 1.5*mm font.pointSize: 0.6*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight horizontalAlignment: Label.AlignRight
text: getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago") text: " \u00B7 "+getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
} }
Label { Label {
id:replytoLabel id:replytoLabel
color: "grey" color: "grey"
font.pixelSize: 1.5*mm font.pointSize: 0.6*osSettings.systemFontSize
font.family: "Noto Sans" font.family: "Noto Sans"
horizontalAlignment: Label.AlignRight horizontalAlignment: Label.AlignRight
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name text: try {" \u00B7 "+qsTr("In reply to ")+newsitemobject.reply_user.screen_name
}catch(e){" "} }catch(e){" "}
}
} }
//Component.onCompleted:print("Newsitemwidth "+newsitem.width+ " Indent "+newsitemobject.indent)
} }
}
MouseArea{ MouseArea{id: itemBody
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
width: toprow.width-2 width: toprow.width-2
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height) height: itemMessage.height
//height: implicitHeight onPressAndHold: {pushConversation()}
wrapMode: Text.Wrap Text {
clip:true color: "#404040"
onLinkActivated:{ linkColor: "light green"
Qt.openUrlExternally(link)} id: itemMessage
Component.onCompleted:{ textFormat: Text.RichText
if (newsitemobject.messagetype==0){ font.family: "Noto Sans"
var hashtags=[]; font.pointSize: osSettings.systemFontSize
hashtags=Newsjs.findTags(newsitemobject.text); text: newsitemobject.statusnet_html
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml"); width: toprow.width-2
for (var tags in hashtags){ //height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()}); height: implicitHeight
}} wrapMode: Text.Wrap
clip:true
if (newsitemobject.attachmentList.length>0){ onLinkActivated:{Qt.openUrlExternally(link)}
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); Component.onCompleted:{
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){ if (newsitemobject.messagetype==0){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); var hashtags=[];
var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); hashtags=Newsjs.findTags(newsitemobject.text);
} var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){ for (var tags in hashtags){
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml"); var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
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]});
} }
} }
}
if (newsitemobject.hasOwnProperty("lastcomment")){ if (newsitemobject.imageAttachmentList.length>0){
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml"); if(newsitemobject.imageAttachmentList[0].mimetype.substring(0,5)=="image"){
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1}); 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"); if (newsitemobject.videoAttachmentList.length>0){
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment}); 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{ BlueButton{
width: newsitem.width-8*mm-2 width: newsitem.width-2
height:5*mm height:5*mm
//anchors.bottom: messageColumn.bottom//itemMessage.bottom anchors.bottom: toprow.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 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" text:"\uf078"
fontColor:"grey" fontColor:"grey"
border.color: "transparent" border.color: "transparent"
color:"white" color:"white"
// gradient: Gradient { // gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" } // GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: "white" } // GradientStop { position: 0.5; color: "white" }
// } // }
radius:0 radius:0
onClicked: { onClicked: {
if (text=="\uf078"){ if (text=="\uf078"){
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077" toprow.height=toprow.implicitHeight+6*mm;text="\uf077"
} else { } else {
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height); toprow.height=Math.min(toprow.implicitHeight,3/4*root.height);
text="\uf078"; text="\uf078";
newsView.positionViewAtIndex(index,ListView.Beginning); newsView.positionViewAtIndex(index,ListView.Beginning);
} }
} }
} }
}
// Bottom row for activities // Bottom row for activities
Flow{ Flow{
id:friendicaActivities id:friendicaActivities
anchors.top:toprow.bottom anchors.top:toprow.bottom
width:parent.width width:parent.width
spacing:mm spacing:mm
Label{color: "grey" Label{color: "grey"
height:3.5*mm height:3.5*mm
font.pixelSize: 1.5*mm font.pointSize: 0.75*osSettings.systemFontSize
text: friendica_activities_view.likeText text: friendica_activities_view.likeText
MouseArea{ MouseArea{
anchors.fill: parent anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)} 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"
} }
} }
onClicked: { Label{color: "grey"
if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; height:3.5*mm
newsitemobject.friendica_activities_view.self.liked=1; font.pointSize: 0.75*osSettings.systemFontSize
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject}); 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; Label{color: "grey"
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject}); 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 //Bottom row for buttons
width:newsitem.width/5 //10*mm Row{id:controlrow
height: parent.height anchors.top:friendicaActivities.bottom
visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false height: root.fontFactor*osSettings.bigFontSize
checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false CheckBox{
indicator: Rectangle{ id:likeCheckbox
implicitWidth: newsitem.width/5 //10*mm width:newsitem.width/5 //10*mm
implicitHeight:4*mm height: parent.height
Text{ visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false
anchors.centerIn: parent checked:(model.newsitemobject.friendica_activities_view.self.liked==1)?true:false
font.pixelSize: 3*mm indicator: Rectangle{
font.family:fontAwesome.name implicitWidth: newsitem.width/5 //10*mm
color:dislikeCheckbox.checked?"black": "grey" implicitHeight:root.fontFactor*osSettings.bigFontSize
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119" Text{
anchors.centerIn: parent
font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name
color:likeCheckbox.checked?"black": "grey"
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
} }
} }
onClicked: { onClicked: {
if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false;
newsitemobject.friendica_activities_view.self.disliked=1; newsitemobject.friendica_activities_view.self.liked=1;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject}); 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); onClicked: {
newsitemobject.friendica_activities_view.self.disliked=0; if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false;
newsitem.ListView.view.model.set(index,{"newsitemobject":newsitemobject}); 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 { CheckBox {
id:favoritedCheckbox id:favoritedCheckbox
visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3)) visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))
width: newsitem.width/5 // 10*mm width: newsitem.width/5 // 10*mm
height: parent.height height: parent.height
indicator:Rectangle{ indicator:Rectangle{
implicitWidth: newsitem.width/5 //10*mm implicitWidth: newsitem.width/5 //10*mm
implicitHeight:4*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{ Text{
id:newsmenusymbol
color: "grey"
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: 3*mm font.pointSize: osSettings.systemFontSize
font.family:fontAwesome.name font.family:fontAwesome.name
color: favoritedCheckbox.checked?"black":"grey" text: "\uf142"
text:"\uf005"
} }
} MouseArea{
checked:(newsitemobject.favorited>0) anchors.fill:parent
onClicked:{ onClicked: {newsmenu.popup()}}
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();
} }
} }
Menu{ Menu {
title: qsTr("Attending") id:newsmenu
width: 20*mm width: 18*osSettings.FontSize
delegate: MenuItem{ delegate: MenuItem{
contentItem: Text{ contentItem: Text{
font.pixelSize: 3*mm font.pointSize: osSettings.systemFontSize
text: parent.text text: parent.text
} }
} }
Action{ Action{
text:qsTr("yes") text: qsTr("Reply")
onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){ onTriggered: {
model.newsitemobject.friendica_activities_view.self.attending="yes";attending="yes"}) 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") Action {
onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){ text: qsTr("DM")
model.newsitemobject.friendica_activities_view.self.attending="maybe";attending="maybe"}) onTriggered: {
root.directmessageSignal(newsitemobject.user.screen_name);
} }
} }
Action{text:qsTr("no") Action {
onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){ text: qsTr("Repost")
model.newsitemobject.friendica_activities_view.self.attending="no";attending="no"})} onTriggered: {
Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){
Helperjs.showMessage("Repost",qsTr("Success!"),root)
})
}
} }
} Action {
text: qsTr("Conversation")
Action { onTriggered: {
text: qsTr("Delete") pushConversation();
onTriggered: { }
Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){
var msg = {'deleteId': index, 'model': newsModel};
newsWorker.sendMessage(msg);
})
} }
}
Action { Menu{
text: qsTr("Show height") title: qsTr("Attending")
onTriggered: { width: 10*osSettings.systemFontSize
Helperjs.showMessage("Height",itemMessage.height + "toprow: "+ toprow.height,root) 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 width: messageColumn.width-5*mm
height:root.height/2 height:root.height/2
Button{ MButton{
id:closeButton id:closeButton
height: 6*mm
width: 8*mm
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
anchors.right: parent.right anchors.right: parent.right
@ -62,20 +60,20 @@ Rectangle{
position:TabBar.Header position:TabBar.Header
TabButton { TabButton {
text:qsTr("Unicode") text:qsTr("Unicode")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
} }
TabButton { TabButton {
text: qsTr("Standard") text: qsTr("Standard")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
} }
TabButton { TabButton {
text: qsTr("Addon") text: qsTr("Addon")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
} }
TabButton { TabButton {
text: qsTr("Adult") text: qsTr("Adult")
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
} }
} }
@ -86,7 +84,7 @@ Rectangle{
anchors.top: closeButton.bottom anchors.top: closeButton.bottom
anchors.topMargin: 1*mm anchors.topMargin: 1*mm
width: smileyDialog.width-2*mm width: smileyDialog.width-2*mm
height: smileyDialog.height-7*mm height: smileyDialog.height-4*root.fontFactor*osSettings.bigFontSize
Rectangle{ Rectangle{
id: htmlGridTab id: htmlGridTab
GridView { GridView {
@ -177,10 +175,6 @@ Rectangle{
} }
} }
} }
} }
Component{ Component{
id:smileyItem id:smileyItem
@ -207,7 +201,7 @@ Rectangle{
width:4.5*mm width:4.5*mm
height: 4.5*mm height: 4.5*mm
textFormat:Text.RichText textFormat:Text.RichText
font.pixelSize: 4*mm font.pointSize: 1.2*osSettings.systemFontSize
text: emoji text: emoji
MouseArea{ MouseArea{

View File

@ -63,7 +63,7 @@ Rectangle{
} }
function updateImage(){ function updateImage(){
xhr.url= login.server + "/api/friendica/photo/update.json"; xhr.url= login.server + "/api/friendica/photo/update.json";
xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setLogin(login.username+":"+Qt.atob(login.password));
xhr.clearParams(); xhr.clearParams();
@ -119,7 +119,7 @@ function updateImage(){
anchors.rightMargin: 1*mm anchors.rightMargin: 1*mm
spacing:5*mm spacing:5*mm
Text{ Text{
font.pixelSize: 3.5*mm font.pointSize: osSettings.bigFontSize
font.bold: true font.bold: true
text:qsTr("Upload to album") text:qsTr("Upload to album")
} }
@ -132,17 +132,46 @@ function updateImage(){
// } // }
// } // }
Button{ MButton{
id:closeButton id:closeButton
height: 8*mm
text: "\uf057" text: "\uf057"
font.pixelSize: 3*mm width: 2.5*root.fontFactor*osSettings.bigFontSize
onClicked:{photoStack.pop(); font.pointSize: osSettings.bigFontSize
//imageDialog.destroy() 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 {
// text: qsTr("Album") // text: qsTr("Album")
// x: 4*mm; y: 10*mm // x: 4*mm; y: 10*mm
@ -161,16 +190,28 @@ function updateImage(){
ListView{ ListView{
id: imageUploadView id: imageUploadView
x:3*mm //23*mm x:3*mm //23*mm
y:17*mm y: 11*mm + album.height
width: imageDialog.width-5*mm //25*mm 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 model: imageUploadModel
delegate: imageDelegate delegate: imageDelegate
footer: imageId==""?imageFooter:null footer: imageId==""?imageFooter:null
clip:true clip:true
orientation: ListView.Horizontal orientation: ListView.Horizontal
spacing: mm 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{ BusyIndicator{
id: uploadBusy id: uploadBusy
running: false running: false
@ -180,6 +221,7 @@ function updateImage(){
width:10*mm width:10*mm
height: 10*mm height: 10*mm
} }
ListModel{ ListModel{
id: imageUploadModel id: imageUploadModel
} }
@ -192,7 +234,7 @@ function updateImage(){
Image{ Image{
id: uploadImage id: uploadImage
width: root.width/2-mm //20*mm 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 fillMode: Image.PreserveAspectFit
source:imageUrl source:imageUrl
onVisibleChanged: descriptionInput.focus=true; onVisibleChanged: descriptionInput.focus=true;
@ -207,18 +249,19 @@ function updateImage(){
} }
Rectangle{ Rectangle{
color: "light grey" //color: "light grey"
border.color: "grey" border.color: "grey"
anchors.top: uploadImage.bottom anchors.top: uploadImage.bottom
anchors.topMargin: mm anchors.topMargin: mm
//x: mm; y: 15*mm; //x: mm; y: 15*mm;
width: root.width/2-mm //Math.max(root.width/2-mm, descriptionInput.contentWidth); 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{ TextField{
//TextInput { //TextInput {
id: descriptionInput id: descriptionInput
anchors.fill: parent anchors.fill: parent
font.pixelSize: 3*mm anchors.margins: mm
font.pointSize: osSettings.systemFontSize
selectByMouse: true selectByMouse: true
placeholderText: qsTr("Description") placeholderText: qsTr("Description")
text:description!=""?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{ Button{
id:uploadButton id:uploadButton
height: 8*mm height: 2*root.fontFactor*osSettings.bigFontSize
x:4*mm; y:root.width/2+18*mm //40*mm x:4*mm;
anchors.top:imageUploadView.bottom
anchors.topMargin: mm
//y:root.width/2+18*mm //40*mm
text: imageId==""?qsTr("Upload"):qsTr("Change") text: imageId==""?qsTr("Upload"):qsTr("Change")
font.pixelSize: 3*mm font.pointSize: osSettings.bigFontSize
onClicked:{ onClicked:{
if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)} if(album.currentText==""){Helperjs.showMessage(qsTr("Error"),qsTr(" No album name given"), imageDialog)}
else if (imageId!=""){uploadBusy.running=true; updateImage()} else if (imageId!=""){uploadBusy.running=true; updateImage()}

View File

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

View File

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

View File

@ -93,7 +93,7 @@ Package {
wrapMode:Text.Wrap wrapMode:Text.Wrap
color: "white" color: "white"
font.family: "Monospace" font.family: "Monospace"
font.pixelSize: 2*mm font.pointSize: osSettings.systemFontSize
anchors.bottom: albumWrapper.bottom anchors.bottom: albumWrapper.bottom
} }
@ -125,7 +125,7 @@ Package {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onPressAndHold:{ 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") var albummenuObject=Qt.createQmlObject(menuString,albumWrapper,"albummenuOutput")
albummenuObject.popup() 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