diff --git a/CHANGELOG.md b/CHANGELOG.md index 20ef1b5..0ff0b7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.5.2 ## +* Redesign of news item +* Background sync for Android >8.0 +* Bugfixes + + ## v0.5.1 ## * Videos open in full screen * Youtube videos open in app diff --git a/source-android/android/AndroidManifest.xml b/source-android/android/AndroidManifest.xml index 8b1c467..e87a2a4 100644 --- a/source-android/android/AndroidManifest.xml +++ b/source-android/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + @@ -88,7 +88,8 @@ - + + diff --git a/source-android/android/build.gradle b/source-android/android/build.gradle index ef7e187..73677ef 100644 --- a/source-android/android/build.gradle +++ b/source-android/android/build.gradle @@ -1,15 +1,17 @@ buildscript { repositories { + google() jcenter() + mavenCentral() } - dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' + classpath 'com.android.tools.build:gradle:3.5.2' } } allprojects { repositories { + google() jcenter() maven { url "https://maven.google.com" @@ -25,12 +27,16 @@ dependencies { //apply plugin: 'android-library' -dependencies { - compile 'com.android.support:support-v4:25.4.0' -} +//dependencies { +// compile 'com.android.support:support-v4:25.4.0' +//} + +//dependencies { +// compile 'com.android.support:support-compat:25.4.0' +//} dependencies { - compile 'com.android.support:support-compat:25.4.0' + compile 'androidx.appcompat:appcompat:1.1.0' } android { diff --git a/source-android/android/gradle.properties b/source-android/android/gradle.properties index 45a105a..82755ae 100644 --- a/source-android/android/gradle.properties +++ b/source-android/android/gradle.properties @@ -1,4 +1,4 @@ -androidBuildToolsVersion=25.0.3 -androidCompileSdkVersion=27 buildDir=.build -qt5AndroidDir=/home/pankraz/Qt/5.11.1/android_armv7/src/android/java +android.useAndroidX=true +android.enableJetifier=true +android.enforceUniquePackageName=false diff --git a/source-android/android/gradle/wrapper/gradle-wrapper.properties b/source-android/android/gradle/wrapper/gradle-wrapper.properties index 0c71e76..5660985 100644 --- a/source-android/android/gradle/wrapper/gradle-wrapper.properties +++ b/source-android/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip diff --git a/source-android/android/gradlew b/source-android/android/gradlew old mode 100644 new mode 100755 diff --git a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java index b9a4ffd..185e924 100644 --- a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java +++ b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java @@ -7,8 +7,10 @@ import java.util.Map; import android.content.pm.PackageManager; import android.content.Context; import android.Manifest.permission; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; +//import android.support.v4.app.ActivityCompat; +//import android.support.v4.content.ContextCompat; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; /** An alternative Activity class for Qt applicaiton. diff --git a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeService.java b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeService.java index ef0d8bf..8537bf1 100644 --- a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeService.java +++ b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeService.java @@ -1,23 +1,69 @@ package androidnative; +import android.os.Build; import android.content.Context; import android.content.Intent; +import android.app.PendingIntent; +import android.content.Context; +import android.app.NotificationChannel; +import android.app.NotificationManager; import android.util.Log; +import android.app.Notification.Builder; +import android.app.Notification; +import android.app.job.JobScheduler; import org.qtproject.qt5.android.bindings.QtService; +import org.qtproject.qt5.android.QtNative; +import org.qtproject.friendiqa.R; +import androidnative.friendiqa.FriendiqaActivity; public class AndroidNativeService extends QtService { private static String TAG = "AndroidNative"; public void startQtService(Context ctx) { - Log.d(TAG,"Friendiqa QtService"); - ctx.startService(new Intent(ctx, AndroidNativeService.class)); + Log.d(TAG, "QtActivity active "+String.valueOf(QtNative.activity()!=null)); + if (QtNative.activity()==null){ + //Log.d(TAG,"Friendiqasync Stop existing QtService"); + ctx.stopService(new Intent(ctx, AndroidNativeService.class)); + + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + //Log.d(TAG,"Friendiqasync startForegroundService"); + ctx.startForegroundService(new Intent(ctx, AndroidNativeService.class)); + } else { + ctx.startService(new Intent(ctx, AndroidNativeService.class)); + } } public static void stopQtService(Context ctx) { - Log.d(TAG,"Friendiqa QtServiceStop"); - + //Log.d(TAG,"Friendiqasync QtServiceStop"); ctx.stopService(new Intent(ctx, AndroidNativeService.class)); } - + @Override + public void onCreate() + { + Context context; + context = this.getApplicationContext(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + + Intent intent = new Intent(context,FriendiqaActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); + String CHANNEL_ID = "channel_02"; + NotificationChannel channel = new NotificationChannel(CHANNEL_ID, + "Sync Channel", + NotificationManager.IMPORTANCE_DEFAULT); + channel.setSound(null,null); + ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(channel); + //Log.d(TAG,"Friendiqa onCreate Notification"); + Notification notification = new Notification.Builder(context,CHANNEL_ID) + .setSmallIcon(R.drawable.friendiqanotification) + .setContentTitle("Friendiqa") + .setContentText("Background Sync") + .setContentIntent(pendingIntent).build(); + startForeground(1, notification);} + JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + jobScheduler.cancel(1); + super.onCreate(); + } } diff --git a/source-android/androidnative.pri/java/src/androidnative/Util.java b/source-android/androidnative.pri/java/src/androidnative/Util.java index 8aefa9e..6ea90cf 100644 --- a/source-android/androidnative.pri/java/src/androidnative/Util.java +++ b/source-android/androidnative.pri/java/src/androidnative/Util.java @@ -11,8 +11,10 @@ import android.content.ComponentName; import android.app.job.JobScheduler; import android.app.job.JobInfo; import android.app.PendingIntent; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; import org.qtproject.qt5.android.QtNative; import androidnative.friendiqa.FriendiqaService; import androidnative.friendiqa.FriendiqaStopService; @@ -120,32 +122,46 @@ public class Util { final String textTitle = (String) message.get("title"); final String textContent = (String) message.get("message"); final int notificationId = (int) message.get("id"); - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setSmallIcon(R.drawable.friendiqanotification) - .setContentIntent(pendingIntent) - .setContentTitle(textTitle) - .setContentText(textContent) - .setStyle(new NotificationCompat.BigTextStyle() - .bigText(textContent)) - - .setPriority(NotificationCompat.PRIORITY_DEFAULT) - .setAutoCancel(true); + + NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); - NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); - notificationManager.notify(notificationId, builder.build()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + final String CHANNEL_ID = "channel_01"; + NotificationChannel channel = new NotificationChannel(CHANNEL_ID, + "Channel for Friendiqa News", + NotificationManagerCompat.IMPORTANCE_LOW); + notificationManager.createNotificationChannel(channel); + NotificationCompat.Builder builder = new NotificationCompat.Builder(context,CHANNEL_ID) + .setSmallIcon(R.drawable.friendiqanotification) + .setContentIntent(pendingIntent) + .setContentTitle(textTitle) + .setContentText(textContent) + .setStyle(new NotificationCompat.BigTextStyle() + .bigText(textContent)) + .setAutoCancel(true); + notificationManager.notify(notificationId, builder.build()); + + } else { + NotificationCompat.Builder builder = new NotificationCompat.Builder(context) + .setSmallIcon(R.drawable.friendiqanotification) + .setContentIntent(pendingIntent) + .setContentTitle(textTitle) + .setContentText(textContent) + .setStyle(new NotificationCompat.BigTextStyle() + .bigText(textContent)) + + .setPriority(NotificationCompat.PRIORITY_DEFAULT) + .setAutoCancel(true); + notificationManager.notify(notificationId, builder.build()); + } } static void setSchedule(Map message) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) { - return; - } - //Log.d(TAG,"Friendiqa schedule Androidnative service"); + final Integer value = (Integer) message.get("value"); - //final Activity activity = QtNative.activity(); - //final Service service = QtNative.service(); //final int JOB_ID = 1; final int ONE_MIN = 60 * 1000; Context context; @@ -155,34 +171,49 @@ public class Util { } else { context = QtNative.activity().getApplicationContext(); } - ComponentName component = new ComponentName(context, FriendiqaService.class); - JobInfo.Builder builder = new JobInfo.Builder(2, component) - // schedule it to run any time between 1 - 5 minutes - .setMinimumLatency(value * ONE_MIN) - .setOverrideDeadline((value + 5)*ONE_MIN) - //.setPeriodic(value * ONE_MIN) - .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY); - JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); - jobScheduler.schedule(builder.build()); - - if (QtNative.service() != null){ - //Log.d(TAG,"Schedule Stopping Friendiqa Androidnative service"); - ComponentName componentStopper = new ComponentName(context, FriendiqaStopService.class); - JobInfo.Builder stopbuilder = new JobInfo.Builder(1, componentStopper) - .setMinimumLatency(50) - .setOverrideDeadline(100); + if (value==0){ + JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + jobScheduler.cancelAll(); + //Log.d(TAG,"Friendiqasync deleting Androidnative jobscheduler"); + } else { + //Log.d(TAG,"Friendiqasync schedule Androidnative jobscheduler"); + ComponentName component = new ComponentName(context, FriendiqaService.class); + JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + //Log.d(TAG,"Jobinfolist size " + String.valueOf(jobScheduler.getAllPendingJobs().size())); + if (jobScheduler.getAllPendingJobs().size()==0){ + JobInfo.Builder builder = new JobInfo.Builder(2, component) + .setPeriodic(value * ONE_MIN) + .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) + .setPersisted(true) + .setPrefetch(true); + //Log.d(TAG,"Friendiqa schedule Androidnative sync schedule"+ (value * ONE_MIN)); + jobScheduler.schedule(builder.build()); + } else { + for ( JobInfo jobInfo : jobScheduler.getAllPendingJobs() ) { + //Log.d(TAG,"Jobinfo current interval " + String.valueOf(jobInfo.getIntervalMillis ())); + if (jobInfo.getIntervalMillis ()!=(value * ONE_MIN)){ + JobInfo.Builder builder = new JobInfo.Builder(2, component) + .setPeriodic(value * ONE_MIN) + .setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY) + .setPersisted(true) + .setPrefetch(true); + //Log.d(TAG,"Friendiqa schedule Androidnative sync schedule"+ (value * ONE_MIN)); + jobScheduler.schedule(builder.build()); + } + } + } + //Log.d(TAG,"Active service " + String.valueOf(QtNative.service()!=null)); + if (QtNative.service() != null){ + //Log.d(TAG,"Schedule Stopping Friendiqa Androidnative service"); + ComponentName componentStopper = new ComponentName(context, FriendiqaStopService.class); + JobInfo.Builder stopbuilder = new JobInfo.Builder(1, componentStopper) + .setMinimumLatency(50) + .setOverrideDeadline(100); - JobScheduler jobStopScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); - jobStopScheduler.schedule(stopbuilder.build()); - - - //AndroidNativeService.stopQtService(context); + JobScheduler jobStopScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); + jobStopScheduler.schedule(stopbuilder.build()); + } } //context.stopService(new Intent(context, AndroidNativeService.class)); } - - /**static void stopService(Map message){ - this.stopService(new Intent(this, AndroidNativeService.class)); - } - **/ } diff --git a/source-android/friendiqa.pro b/source-android/friendiqa.pro index e28a85e..2f8fe6a 100644 --- a/source-android/friendiqa.pro +++ b/source-android/friendiqa.pro @@ -77,3 +77,9 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) { $$PWD/android/libcrypto_1_1.so \ $$PWD/android/libssl_1_1.so } + +contains(ANDROID_TARGET_ARCH,arm64-v8a) { + ANDROID_EXTRA_LIBS = \ + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.5.2/source-android/../../../../../git/android_openssl/arm64/libcrypto_1_1.so \ + $$PWD/../../../../../git/android_openssl/arm64/libssl_1_1.so +} diff --git a/source-android/images b/source-android/images index 6de3f1b..f6e087d 120000 --- a/source-android/images +++ b/source-android/images @@ -1 +1 @@ -./../source-linux/images/ \ No newline at end of file +../source-linux/images \ No newline at end of file diff --git a/source-android/js b/source-android/js index 2935f6c..d7539d8 120000 --- a/source-android/js +++ b/source-android/js @@ -1 +1 @@ -./../source-linux/js/ \ No newline at end of file +../source-linux/js \ No newline at end of file diff --git a/source-android/qml/calendarqml b/source-android/qml/calendarqml index b621df7..efa5132 120000 --- a/source-android/qml/calendarqml +++ b/source-android/qml/calendarqml @@ -1 +1 @@ -./../../source-linux/qml/calendarqml/ \ No newline at end of file +../../source-linux/qml/calendarqml \ No newline at end of file diff --git a/source-android/qml/configqml b/source-android/qml/configqml index a5fb93b..1d9fc92 120000 --- a/source-android/qml/configqml +++ b/source-android/qml/configqml @@ -1 +1 @@ -./../../source-linux/qml/configqml/ \ No newline at end of file +../../source-linux/qml/configqml \ No newline at end of file diff --git a/source-android/qml/contactqml b/source-android/qml/contactqml index 3468d4f..3e93dac 120000 --- a/source-android/qml/contactqml +++ b/source-android/qml/contactqml @@ -1 +1 @@ -./../../source-linux/qml/contactqml/ \ No newline at end of file +../../source-linux/qml/contactqml \ No newline at end of file diff --git a/source-android/qml/friendiqa.qml b/source-android/qml/friendiqa.qml index b4e2e3f..956ea67 100644 --- a/source-android/qml/friendiqa.qml +++ b/source-android/qml/friendiqa.qml @@ -31,14 +31,14 @@ import QtQuick 2.5 import QtQuick.LocalStorage 2.0 -import QtQuick.Window 2.13 +import QtQuick.Window 2.0 import QtQuick.Controls 2.4 import QtQuick.Layouts 1.11 import "qrc:/js/news.js" as Newsjs import "qrc:/js/service.js" as Service -StackView{ +StackView{ id:root property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)} width: osSettings.appWidth @@ -107,7 +107,6 @@ StackView{ Keys.onReleased: { if (event.key === osSettings.backKey) { - if (rootstack.currentIndex==0){ newstab.active=true; if (newstab.newstabstatus!=login.newsViewType){ @@ -120,6 +119,7 @@ StackView{ newsSignal(dbnews) })} } + else if (newstab.conversation.length>0){newstab.conversation=[]} else if (root.depth>1){root.pop()} else{Service.cleanNews(root.db,function(){ @@ -161,10 +161,10 @@ StackView{ anchors.fill: parent onClicked:{ leftDrawer.close(); - newstypeSignal("refresh") -// updatenews.setDatabase(); -// updatenews.login(); -// updatenews.startsync(); +// newstypeSignal("refresh") + updatenews.setDatabase(); + updatenews.login(); + updatenews.startsync(); } } } @@ -308,6 +308,8 @@ StackView{ Item{ id:rootStackItem + width:parent.width + height: parent.height //anchors.fill:parent states: State { name: "fullscreen"; @@ -389,10 +391,10 @@ StackView{ } } - - Component.onCompleted: { - forceActiveFocus(); + Component.onCompleted: { + forceActiveFocus(); Service.readGlobaloptions(db,function(go){globaloptions=go}) + //print(xhr.networktype()); if(osSettings.osType=="Android"){ var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); var IntentReceiverQml = component.createObject(root); diff --git a/source-android/qml/genericqml b/source-android/qml/genericqml index fb2051d..5fdbcc3 120000 --- a/source-android/qml/genericqml +++ b/source-android/qml/genericqml @@ -1 +1 @@ -./../../source-linux/qml/genericqml/ \ No newline at end of file +../../source-linux/qml/genericqml \ No newline at end of file diff --git a/source-android/qml/newsqml b/source-android/qml/newsqml index 892373b..f6ab73f 120000 --- a/source-android/qml/newsqml +++ b/source-android/qml/newsqml @@ -1 +1 @@ -./../../source-linux/qml/newsqml/ \ No newline at end of file +../../source-linux/qml/newsqml \ No newline at end of file diff --git a/source-android/qml/photoqml b/source-android/qml/photoqml index 4000452..4528ee0 120000 --- a/source-android/qml/photoqml +++ b/source-android/qml/photoqml @@ -1 +1 @@ -./../../source-linux/qml/photoqml/ \ No newline at end of file +../../source-linux/qml/photoqml \ No newline at end of file diff --git a/source-android/translations b/source-android/translations new file mode 120000 index 0000000..d630c0b --- /dev/null +++ b/source-android/translations @@ -0,0 +1 @@ +../source-linux/translations \ No newline at end of file diff --git a/source-linux/application.qrc b/source-linux/application.qrc index 7d672af..1b454d1 100644 --- a/source-linux/application.qrc +++ b/source-linux/application.qrc @@ -228,7 +228,7 @@ images/smileys/adult/finger.gif images/smileys/adult/sperm.gif images/smileys/adult/tits.gif - images/addImage.png + images/addImage.png common/filesystem.cpp common/filesystem.h common/friendiqa.cpp @@ -236,5 +236,6 @@ common/uploadableimage.h common/xhr.cpp common/xhr.h + qml/newsqml/MoreComments.qml diff --git a/source-linux/common/updatenews.cpp b/source-linux/common/updatenews.cpp index b86a172..b48bf83 100644 --- a/source-linux/common/updatenews.cpp +++ b/source-linux/common/updatenews.cpp @@ -123,13 +123,19 @@ void UPDATENEWS::login() notifylist.append(syncquery.value(0).toString()); //qDebug() << " notify " << syncquery.value(0).toString() << " " < newcontacts=findNewContacts(news); @@ -409,12 +420,23 @@ QList UPDATENEWS::findNewContacts(QJsonDocument news){ for (int i=0; i contacts){ for (int i=0; i < contacts.count();i++){ QJsonValue contact=contacts[i]; QSqlQuery query(m_db); - //qDebug() << "updatecontact " << contact["screen_name"]; - QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db); - if (testquery.first()){ - query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?," - "profile_image_url=?, description=?, protected=?, followers_count=?," - "friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?," - "following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? " - " WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'"); - query.bindValue(0, contact["id"].toInt()); - query.bindValue(1, contact["name"].toString().toUtf8().toBase64()); - query.bindValue(2, contact["screen_name"]); - query.bindValue(3, contact["location"]); - query.bindValue(4, currentTime); - query.bindValue(5, contact["profile_image_url"].toString().section('?',0,0)); - if(contact["description"].isNull() ){query.bindValue(6,"");}else{query.bindValue(6, contact["description"].toString().toUtf8().toBase64());} - query.bindValue(7,contact["protected"].toBool()); - query.bindValue(8,contact["followers_count"].toInt()); - query.bindValue(9,contact["friends_count"].toInt()); - QString sourcedate=contact["created_at"].toString(); - QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15); - query.bindValue(10,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() ); - query.bindValue(11,contact["favorites_count"].toInt()); - query.bindValue(12,contact["utc_offset"].toInt()); - query.bindValue(13,contact["time_zone"].toString()); - query.bindValue(14,contact["statuses_count"].toInt()); - query.bindValue(15,contact["following"].toBool()); - query.bindValue(16,contact["verfied"].toBool()); - query.bindValue(17,contact["statusnet_blocking"].toBool()); - query.bindValue(18,contact["notifications"].toBool()); - query.bindValue(19,contact["statusnet_profile_url"]); - query.bindValue(20,contact["cid"].toInt()); - query.bindValue(21,contact["network"]); - qint64 timestamp=0; - QString timestamphelper=contact["profile_image_url"].toString(); - try {timestamp=timestamphelper.mid(timestamphelper.indexOf("?ts")+4,timestamphelper.length()).toUInt();} catch(...){} - query.bindValue(22,timestamp); + try{ + //qDebug() << "updatecontact " << contact["screen_name"]; + QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db); + if (testquery.first()){ + query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?," + "profile_image_url=?, description=?, protected=?, followers_count=?," + "friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?," + "following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? " + " WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'"); + query.bindValue(0, contact["id"].toInt()); + query.bindValue(1, contact["name"].toString().toUtf8().toBase64()); + query.bindValue(2, contact["screen_name"]); + query.bindValue(3, contact["location"]); + query.bindValue(4, currentTime); + query.bindValue(5, contact["profile_image_url"].toString().section('?',0,0)); + if(contact["description"].isNull() ){query.bindValue(6,"");}else{query.bindValue(6, contact["description"].toString().toUtf8().toBase64());} + query.bindValue(7,contact["protected"].toBool()); + query.bindValue(8,contact["followers_count"].toInt()); + query.bindValue(9,contact["friends_count"].toInt()); + QString sourcedate=contact["created_at"].toString(); + QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15); + query.bindValue(10,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() ); + query.bindValue(11,contact["favorites_count"].toInt()); + query.bindValue(12,contact["utc_offset"].toInt()); + query.bindValue(13,contact["time_zone"].toString()); + query.bindValue(14,contact["statuses_count"].toInt()); + query.bindValue(15,contact["following"].toBool()); + query.bindValue(16,contact["verfied"].toBool()); + query.bindValue(17,contact["statusnet_blocking"].toBool()); + query.bindValue(18,contact["notifications"].toBool()); + query.bindValue(19,contact["statusnet_profile_url"]); + query.bindValue(20,contact["cid"].toInt()); + query.bindValue(21,contact["network"]); + qint64 timestamp=0; + QString timestamphelper=contact["profile_image_url"].toString(); + try {timestamp=timestamphelper.mid(timestamphelper.indexOf("?ts")+4,timestamphelper.length()).toUInt();} catch(...){} + query.bindValue(22,timestamp); + } + + else{ + query.prepare("INSERT INTO contacts (username, id, name, screen_name, location,imageAge," + "profile_image_url, description, profile_image, url, protected, followers_count," + "friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count," + "following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)" + "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + + query.bindValue(0,username); + query.bindValue(1, contact["id"].toInt()); + query.bindValue(2, contact["name"].toString().toUtf8().toBase64()); + query.bindValue(3, contact["screen_name"]); + query.bindValue(4, contact["location"]); + query.bindValue(5, currentTime); + query.bindValue(6, contact["profile_image_url"].toString().section('?',0,0)); + if(contact["description"].isNull() ){query.bindValue(7,"");}else{query.bindValue(7, contact["description"].toString().toUtf8().toBase64());} + query.bindValue(8,"none"); + query.bindValue(9, contact["url"].toString()); + query.bindValue(10,contact["protected"].toBool()); + query.bindValue(11,contact["followers_count"].toInt()); + query.bindValue(12,contact["friends_count"].toInt()); + QString sourcedate=contact["created_at"].toString(); + QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15); + query.bindValue(13,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() ); + query.bindValue(14,contact["favorites_count"].toInt()); + query.bindValue(15,contact["utc_offset"].toInt()); + query.bindValue(16,contact["time_zone"].toString()); + query.bindValue(17,contact["statuses_count"].toInt()); + query.bindValue(18,contact["following"].toBool()); + query.bindValue(19,contact["verfied"].toBool()); + query.bindValue(20,contact["statusnet_blocking"].toBool()); + query.bindValue(21,contact["notifications"].toBool()); + query.bindValue(22,contact["statusnet_profile_url"]); + query.bindValue(23,contact["cid"].toInt()); + query.bindValue(24,contact["network"]); + query.bindValue(25, 0); + qint64 timestamp=0; + QString timestamphelper=contact["profile_image_url"].toString(); + try {timestamp=timestamphelper.mid(timestamphelper.indexOf("?ts")+4,timestamphelper.length()).toUInt();} catch(...){} + query.bindValue(26,timestamp); + + } + query.exec() ; + } catch(...){ + qDebug() << "Friendiqasync Error inserting contact" << contact["screen_name"] << " " << contact.toString(); } - - else{ - query.prepare("INSERT INTO contacts (username, id, name, screen_name, location,imageAge," - "profile_image_url, description, profile_image, url, protected, followers_count," - "friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count," - "following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)" - "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); - - query.bindValue(0,username); - query.bindValue(1, contact["id"].toInt()); - query.bindValue(2, contact["name"].toString().toUtf8().toBase64()); - query.bindValue(3, contact["screen_name"]); - query.bindValue(4, contact["location"]); - query.bindValue(5, currentTime); - query.bindValue(6, contact["profile_image_url"].toString().section('?',0,0)); - if(contact["description"].isNull() ){query.bindValue(7,"");}else{query.bindValue(7, contact["description"].toString().toUtf8().toBase64());} - query.bindValue(8,"none"); - query.bindValue(9, contact["url"].toString()); - query.bindValue(10,contact["protected"].toBool()); - query.bindValue(11,contact["followers_count"].toInt()); - query.bindValue(12,contact["friends_count"].toInt()); - QString sourcedate=contact["created_at"].toString(); - QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15); - query.bindValue(13,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() ); - query.bindValue(14,contact["favorites_count"].toInt()); - query.bindValue(15,contact["utc_offset"].toInt()); - query.bindValue(16,contact["time_zone"].toString()); - query.bindValue(17,contact["statuses_count"].toInt()); - query.bindValue(18,contact["following"].toBool()); - query.bindValue(19,contact["verfied"].toBool()); - query.bindValue(20,contact["statusnet_blocking"].toBool()); - query.bindValue(21,contact["notifications"].toBool()); - query.bindValue(22,contact["statusnet_profile_url"]); - query.bindValue(23,contact["cid"].toInt()); - query.bindValue(24,contact["network"]); - query.bindValue(25, 0); - qint64 timestamp=0; - QString timestamphelper=contact["profile_image_url"].toString(); - try {timestamp=timestamphelper.mid(timestamphelper.indexOf("?ts")+4,timestamphelper.length()).toUInt();} catch(...){} - query.bindValue(26,timestamp); - - } - query.exec() ; } } diff --git a/source-linux/common/xhr.cpp b/source-linux/common/xhr.cpp index a126ff2..76e2f06 100644 --- a/source-linux/common/xhr.cpp +++ b/source-linux/common/xhr.cpp @@ -295,6 +295,7 @@ void XHR::onReplyError(QNetworkReply::NetworkError code) emit this->error( bufferToString(), m_url,m_api, (int) code); buffer.clear(); reply->deleteLater(); + if((downloadtype()=="contactlist")||(downloadtype()=="picturelist")){dlindex=dlindex+1;XHR::getlist();} } void XHR::onReplySuccess() diff --git a/source-linux/friendiqa.pro b/source-linux/friendiqa.pro index 5fc8454..f36eaad 100644 --- a/source-linux/friendiqa.pro +++ b/source-linux/friendiqa.pro @@ -47,6 +47,7 @@ HEADERS += \ DISTFILES += \ qml/calendarqml/*.qml \ + qml/newsqml/Lastcomment.qml \ qml/newsqml/NewsVideoLarge.qml \ translations/*.ts \ translations/*.qm \ @@ -58,3 +59,6 @@ DISTFILES += \ js/*.js \ qml/newsqml/NewsStack.qml \ qml/configqml/SyncComponent.qml + +target.path=/usr/bin/friendiqa +INSTALLS+=target \ No newline at end of file diff --git a/source-linux/js/news.js b/source-linux/js/news.js index 6a0439d..ab4a39c 100644 --- a/source-linux/js/news.js +++ b/source-linux/js/news.js @@ -187,7 +187,7 @@ function storeNews(login,database,news,rootwindow){ // save news after contacts download, call next function var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); for (var i=0;i= 0) ? (indexOf + (startpos || 0)) : text.length; } +function beautify(newsitemobject,msg){ + var forumname=""; + try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_author')&& + ((newsitemobject.friendica_author.url)!=(newsitemobject.user.url))&&((newsitemobject.friendica_author.url)!=null)){ + //print(" Friendica Author "+JSON.stringify(newsitemobject)); + forumname=" via "+newsitemobject.user.name; + newsitemobject.user=newsitemobject.friendica_author; + }}catch(e){print("forum name "+e)} + 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); + if (newsitemobject.hasOwnProperty("friendica_activities_self")){ + if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} + if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} + if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} + if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1} + if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} + }}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))} + var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} + var attachmentList=[]; + var videoformats=["mp4", "avi", "webm","ogg","mp3"] + try{if(newsitemobject.attachments){ + var attachArray=newsitemobject.attachments; + for (var image in attachArray){ + var attachhelper={mimetype:attachArray[image].mimetype} + var attachhelperstring=Qt.btoa(attachArray[image].url) + var helperstringposition=newsitemobject.statusnet_html.indexOf(attachhelperstring); + if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); + if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"} + else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"} + else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"} + } + else {attachhelper.url=attachArray[image].url} + attachmentList.push(attachhelper) + //print("Attachhelper "+attachhelper.url) + newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"") + newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","") + newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"") + } + } + }catch(e){print("attachment "+e)} + for (var format in videoformats){ + if (newsitemobject.text.indexOf("."+videoformats[format])>-1){ + var videohelper={mimetype:"video/"+videoformats[format]} + var videotext=newsitemobject.text; + while (videotext.indexOf("."+videoformats[format])>-1){ + var videohelperstringposition=videotext.indexOf("."+videoformats[format]); + videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4); + videotext=videotext.substring(videohelperstringposition+4,videotext.length) + if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=videohelper.url)){attachmentList.push(videohelper)} + } + } + } + if (newsitemobject.text.indexOf("/videos/watch/")>-1){ + var ptvideohelper={mimetype:"video/mp4"} + var ptvideotext=newsitemobject.text; + while (ptvideotext.indexOf("/videos/watch/")>-1){ + var ptvideohelperstringposition=ptvideotext.indexOf("/videos/watch/"); + var ptposend=findend(ptvideotext,ptvideohelperstringposition); + if(ptposend==-1){ptposend=ptvideotext.length}; + ptvideohelper.url=ptvideotext.substring(ptvideotext.lastIndexOf("http",ptvideohelperstringposition),ptposend)+"-480.mp4"; + ptvideohelper.url=ptvideohelper.url.replace("/videos/watch","/static/webseed"); + ptvideotext=ptvideotext.substring(ptposend,ptvideotext.length) + if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)} + } + } + if (newsitemobject.text.indexOf("youtube.com/watch?v")>-1){ + //print("message "+msg.options.showWebsiteForLinks); + //if (msg.options.showYoutube!="false"){ + + var yttext=newsitemobject.text; + while (yttext.indexOf("youtube.com/watch?v")>-1){ + var ythelperstringposition=yttext.indexOf("watch?v="); + var ytposend=findend(yttext,ythelperstringposition); + var ythelper={mimetype:"video/youtube"} + ythelper.url=yttext.substring(ythelperstringposition+8,ytposend); + yttext=yttext.substring(ytposend,yttext.length); + if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ythelper.url)){attachmentList.push(ythelper)} + } + //} + } + +// if (newsitemobject.text.indexOf(".html")>-1){ +// //print("message "+msg.options.showWebsiteForLinks); +// if (msg.options.showWebsiteForLinks!="false"){ +// var linkhelper={mimetype:"text/html"} +// var linktext=newsitemobject.text; +// while (linktext.indexOf(".html")>-1){ +// var linkhelperstringposition=linktext.indexOf(".html"); +// var linkposend=findend(linktext,linkhelperstringposition); +// linkhelper.url=linktext.substring(linktext.lastIndexOf("http",linkhelperstringposition),linkposend); +// linktext=linktext.substring(linkhelperstringposition+5,linktext.length) +// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)} +// } +// } +// } + + newsitemobject.attachmentList=attachmentList; + + if ((msg.options.hasOwnProperty("hide_nsfw"))&&(msg.options.hide_nsfw==1)&&(newsitemobject.text.indexOf("#nsfw")>-1)){ + newsitemobject.nsfw=true + } else{newsitemobject.nsfw=false} + + var seconds=(msg.currentTime-newsitemobject.created_at)/1000; + var timestring=""; + if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");} + else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");} + else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");} + else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");} + else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");} + else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");} + else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");} + else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");} + else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");} + else {timestring=Math.round(seconds/46656000)+" "+qsTr("years") +" "+qsTr("ago");} + + newsitemobject.dateDiff=timestring; + newsitemobject.friendica_activities_view=friendica_activities; + newsitemobject.forumname=forumname; + return newsitemobject; +} + + WorkerScript.onMessage = function(msg) { if(msg.deleteId!==undefined) @@ -53,143 +196,17 @@ else{ // newsitemobject.user.profile_image_url=""; // newsitemobject.user.name=""; // } - var forumname=""; - try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_author')&& - ((newsitemobject.friendica_author.url)!=(newsitemobject.user.url))&&((newsitemobject.friendica_author.url)!=null)){ - //print(" Friendica Author "+JSON.stringify(newsitemobject)); - forumname=" via "+newsitemobject.user.name; - newsitemobject.user=newsitemobject.friendica_author; - }}catch(e){print("forum name "+e)} - 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); - if (newsitemobject.hasOwnProperty("friendica_activities_self")){ - if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} - if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} - if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} - if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1} - if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - }}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))} - var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} - var attachmentList=[]; - var videoformats=["mp4", "avi", "webm","ogg","mp3"] - try{if(newsitemobject.attachments){ - var attachArray=newsitemobject.attachments; - for (var image in attachArray){ - var attachhelper={mimetype:attachArray[image].mimetype} - var attachhelperstring=Qt.btoa(attachArray[image].url) - var helperstringposition=newsitemobject.statusnet_html.indexOf(attachhelperstring); - if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); - if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"} - else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"} - else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"} - } - else {attachhelper.url=attachArray[image].url} - attachmentList.push(attachhelper) - //print("Attachhelper "+attachhelper.url) - newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"") - newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","") - newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"") - } - } - }catch(e){print("attachment "+e)} - for (var format in videoformats){ - if (newsitemobject.text.indexOf("."+videoformats[format])>-1){ - var videohelper={mimetype:"video/"+videoformats[format]} - var videotext=newsitemobject.text; - while (videotext.indexOf("."+videoformats[format])>-1){ - var videohelperstringposition=videotext.indexOf("."+videoformats[format]); - videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4); - videotext=videotext.substring(videohelperstringposition+4,videotext.length) - if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=videohelper.url)){attachmentList.push(videohelper)} - } - } - } - if (newsitemobject.text.indexOf("/videos/watch/")>-1){ - var ptvideohelper={mimetype:"video/mp4"} - var ptvideotext=newsitemobject.text; - while (ptvideotext.indexOf("/videos/watch/")>-1){ - var ptvideohelperstringposition=ptvideotext.indexOf("/videos/watch/"); - var ptposend=findend(ptvideotext,ptvideohelperstringposition); - if(ptposend==-1){ptposend=ptvideotext.length}; - ptvideohelper.url=ptvideotext.substring(ptvideotext.lastIndexOf("http",ptvideohelperstringposition),ptposend)+"-480.mp4"; - ptvideohelper.url=ptvideohelper.url.replace("/videos/watch","/static/webseed"); - ptvideotext=ptvideotext.substring(ptposend,ptvideotext.length) - if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)} - } - } - if (newsitemobject.text.indexOf("youtube.com/watch?v")>-1){ - //print("message "+msg.options.showWebsiteForLinks); - //if (msg.options.showYoutube!="false"){ - var yttext=newsitemobject.text; - while (yttext.indexOf("youtube.com/watch?v")>-1){ - var ythelperstringposition=yttext.indexOf("watch?v="); - var ytposend=findend(yttext,ythelperstringposition); - var ythelper={mimetype:"video/youtube"} - ythelper.url=yttext.substring(ythelperstringposition+8,ytposend); - yttext=yttext.substring(ytposend,yttext.length); - if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ythelper.url)){attachmentList.push(ythelper)} - } - //} - } - -// if (newsitemobject.text.indexOf(".html")>-1){ -// //print("message "+msg.options.showWebsiteForLinks); -// if (msg.options.showWebsiteForLinks!="false"){ -// var linkhelper={mimetype:"text/html"} -// var linktext=newsitemobject.text; -// while (linktext.indexOf(".html")>-1){ -// var linkhelperstringposition=linktext.indexOf(".html"); -// var linkposend=findend(linktext,linkhelperstringposition); -// linkhelper.url=linktext.substring(linktext.lastIndexOf("http",linkhelperstringposition),linkposend); -// linktext=linktext.substring(linkhelperstringposition+5,linktext.length) -// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)} -// } -// } -// } - - newsitemobject.attachmentList=attachmentList; - - if ((msg.options.hasOwnProperty("hide_nsfw"))&&(msg.options.hide_nsfw==1)&&(newsitemobject.text.indexOf("#nsfw")>-1)){ - newsitemobject.nsfw=true - } else{newsitemobject.nsfw=false} - - var seconds=(msg.currentTime-newsitemobject.created_at)/1000; - var timestring=""; - if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");} - else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");} - else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");} - else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");} - else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");} - else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");} - else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");} - else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");} - else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");} - else {timestring=Math.round(seconds/46656000)+" "+qsTr("years") +" "+qsTr("ago");} - - var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities,"forumname":forumname})} + //var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities,"forumname":forumname})} //print("News:"+j+msg.news.length+JSON.stringify(data)); + newsitemobject=beautify(newsitemobject,msg); + if (newsitemobject.hasOwnProperty("currentconversation")&&(newsitemobject.currentconversation.length>1)){ + newsitemobject.lastcomment=beautify(newsitemobject.currentconversation[newsitemobject.currentconversation.length-1],msg); + //print("Currentconversation" + newsitemobject.currentconversation.length+JSON.stringify(newsitemobject.lastcomment)) + } + + var data=({"newsitemobject": newsitemobject}) + } if(msg.method=="append") { msg.model.insert(j, data)} else{ diff --git a/source-linux/js/service.js b/source-linux/js/service.js index cfba95b..cebba1e 100644 --- a/source-linux/js/service.js +++ b/source-linux/js/service.js @@ -288,7 +288,7 @@ function readConfig(database,callback,filter,filtervalue) { // reads config } function readActiveConfig(database){ - var obj; + var obj=""; readConfig(database,function(config){obj=config},"isActive", 0); return obj; } @@ -341,12 +341,15 @@ function cleanNews(database,callback){ var maxnewsrs = tx.executeSql("SELECT v FROM globaloptions WHERE k='max_news'"); var maxnews=1000; if(maxnewsrs.rows.length>0){ maxnews=maxnewsrs.rows.item(0).v}; for (var i=0; i<6;i++){ - if (i!=0){maxnews=maxnews/5} + if (i!=0){var maxnewsa=maxnews/5}else{maxnewsa=maxnews} var newscountrs = tx.executeSql('SELECT COUNT(*) from news WHERE messagetype='+i); - var newscount = newscountrs.rows.item(0)["COUNT(*)"];//print("newscount "+newscount) - if (newscount>maxnews){ - var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnews)); - var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnews-1).created_at; + var newscount = 0; + if (newscountrs.rows.length>0){newscount=newscountrs.rows.item(0)["COUNT(*)"]};//print(i+"newscount "+newscount) + if (newscount>maxnewsa){ + var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnewsa)); +// print('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnewsa)) +// print(JSON.stringify(lastvalidtimers.rows.item(newscount-maxnewsa-1))) + var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnewsa-1).created_at; var deleters = tx.executeSql('DELETE from news WHERE messagetype='+i+' AND created_at<='+lastvalidtime)} } callback() @@ -387,7 +390,8 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f } function processNews(api,data){ - //print(api + data); + //print("processNews "+api + data); + try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;}; if (data==""){} else if (typeof(newslist)=='undefined'){ @@ -397,34 +401,6 @@ function processNews(api,data){ Helperjs.showMessage(qsTr("JSON status Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) } else if (!(Array.isArray(newslist))){ -// print("processNews not array"+newslist+JSON.stringify(newslist)); -// if(newslist.hasOwnProperty('id')){ -// newslist.created_at=Date.parse(Newsjs.cleanDate(newslist.created_at)); -// newslist.messagetype=5; -// newslist.friendica_author=cleanUser(newslist.friendica_author); -// newslist.user=cleanUser(newslist.user); -// if(newslist.in_reply_to_user_id){newslist.reply_user=Newsjs.objFromArray(allcontacts,"id",newslist.in_reply_to_user_id)} -// var dummynewslist=[newslist]; -// Newsjs.storeNews(login,db,dummynewslist,root); -// 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((login.newsViewType=="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) -// })} - -// } replytimer.restart() } else { @@ -624,6 +600,10 @@ function updateView(viewtype){ if (viewtype==="Conversations"){Newsjs.allchatsfromdb(db,login.username,function(temp){ newsStack.allchats=temp })} + if ((osSettings.osType=="Android") && root.globaloptions.hasOwnProperty("syncinterval") && root.globaloptions.syncinterval !=null && root.globaloptions.syncinterval !=0){ + //alarm.setAlarm(root.globaloptions.syncinterval); + setBackgroundsync() + } } function showGroups(){ @@ -638,6 +618,17 @@ function showGroups(){ }) } +function setBackgroundsync(){ + Helperjs.readData(db,"globaloptions","",function(lastsync){ + //print("Lastsync "+(parseFloat(lastsync[0]["v"])+120) + " Date "+Date.now()/1000 + " "+((parseFloat(lastsync[0]["v"])+120)<(Date.now()/1000))) + if((lastsync.length>0)&&((parseFloat(lastsync[0]["v"])+120)<(Date.now()/1000))){ + alarm.setAlarm(root.globaloptions.syncinterval); + + } + + },"k","lastsync") +} + function getGroupnews(list){ newstab.newstabstatus="Group news"; newsBusy.running=true; diff --git a/source-linux/qml/configqml/AccountPage.qml b/source-linux/qml/configqml/AccountPage.qml index b5ed38e..5473f24 100644 --- a/source-linux/qml/configqml/AccountPage.qml +++ b/source-linux/qml/configqml/AccountPage.qml @@ -335,6 +335,8 @@ Page{ //reset values root.login=userconfig; root.news=[]; + rootstack.currentIndex=0; + root.newstypeSignal("refresh"); },"isActive",0); //Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc}); diff --git a/source-linux/qml/configqml/InfoBox.qml b/source-linux/qml/configqml/InfoBox.qml index 31a9c57..dc463d4 100644 --- a/source-linux/qml/configqml/InfoBox.qml +++ b/source-linux/qml/configqml/InfoBox.qml @@ -43,12 +43,11 @@ Rectangle{ textFormat: Text.RichText width: root.width-mm wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: "Friendiqa v0.5
Licensed under GPL 3 with the exception of OpenSSL
"+ - "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ + text: "Friendiqa v0.5.2
Licensed under GPL 3 with the exception of OpenSSL
"+ + "Website https://friendiqa.ma-nic.de
"+ "Sourcecode: https://git.friendi.ca/LubuWest/Friendiqa
"+ "Privacy Policy: http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md
"+ - "Most of C++ code by Fabio
"+ - "QML and Javascript code by Marco
"+ + "Code by Marco
"+ "Qt Framework www.qt.io
"+ "Icons by FontAwesome
"+ "Folder Icon by KDE Breeze Icons
"+ diff --git a/source-linux/qml/configqml/SyncConfig.qml b/source-linux/qml/configqml/SyncConfig.qml index 9f42fe8..369cf56 100644 --- a/source-linux/qml/configqml/SyncConfig.qml +++ b/source-linux/qml/configqml/SyncConfig.qml @@ -62,10 +62,9 @@ Rectangle{ selectByMouse: true onTextChanged: { Service.updateglobaloptions(root.db,"syncinterval",text); - if(osSettings.osType=="Android" && text !=0){ + if(osSettings.osType=="Android"){ alarm.setAlarm(text); } else if(osSettings.osType=="Linux" && text !=0){ - } } } diff --git a/source-linux/qml/friendiqa.qml b/source-linux/qml/friendiqa.qml index 3d2d255..a42f4bf 100644 --- a/source-linux/qml/friendiqa.qml +++ b/source-linux/qml/friendiqa.qml @@ -105,10 +105,11 @@ StackView{ FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"} - Keys.onReleased: { + Keys.onReleased: {print("Backkey"+newstab.conversation.length+" "+root.depth) if (event.key === osSettings.backKey) { - if (currentIndex==0){ + if (rootstack.currentIndex==0){ newstab.active=true; + print(newstab.newstabstatus) if (newstab.newstabstatus!=login.newsViewType){ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,0,function(dbnews){ @@ -118,7 +119,9 @@ StackView{ Newsjs.chatsfromdb(db,login.username,function(dbnews){ newsSignal(dbnews) })} + print(newstab.conversation.length); } + else if (newstab.conversation.length>0){newstab.conversation=[]} else if (root.depth>1){root.pop()} else{Service.cleanNews(root.db,function(){ @@ -126,8 +129,8 @@ StackView{ Qt.quit()}) })} } - else if (currentIndex==2){fotoSignal("backButton")} - else {currentIndex=0} + else if (rootstack.currentIndex==2){fotoSignal("backButton")} + else {rootstack.currentIndex=0} event.accepted = true }} @@ -160,10 +163,10 @@ StackView{ anchors.fill: parent onClicked:{ leftDrawer.close(); - newstypeSignal("refresh") -// updatenews.setDatabase(); -// updatenews.login(); -// updatenews.startsync(); +// newstypeSignal("refresh") + updatenews.setDatabase(); + updatenews.login(); + updatenews.startsync(); } } } @@ -307,6 +310,8 @@ StackView{ Item{ id:rootStackItem + width:parent.width + height: parent.height //anchors.fill:parent states: State { name: "fullscreen"; @@ -389,6 +394,7 @@ StackView{ } Component.onCompleted: { + forceActiveFocus(); Service.readGlobaloptions(db,function(go){globaloptions=go}) //print(xhr.networktype()); if(osSettings.osType=="Android"){ diff --git a/source-linux/qml/genericqml/IntentReceiver.qml b/source-linux/qml/genericqml/IntentReceiver.qml index 1ceaacf..8c3a007 100644 --- a/source-linux/qml/genericqml/IntentReceiver.qml +++ b/source-linux/qml/genericqml/IntentReceiver.qml @@ -38,9 +38,9 @@ Item { Component.onCompleted: { SystemDispatcher.setInitialized(); - if (root.globaloptions.hasOwnProperty("syncinterval") && root.globaloptions.syncinterval !=null && root.globaloptions.syncinterval !=0){ - alarm.setAlarm(root.globaloptions.syncinterval); - } +// if (root.globaloptions.hasOwnProperty("syncinterval") && root.globaloptions.syncinterval !=null && root.globaloptions.syncinterval !=0){ +// alarm.setAlarm(root.globaloptions.syncinterval); +// } } } diff --git a/source-linux/qml/genericqml/MButton.qml b/source-linux/qml/genericqml/MButton.qml index 08932ae..5e87376 100644 --- a/source-linux/qml/genericqml/MButton.qml +++ b/source-linux/qml/genericqml/MButton.qml @@ -28,7 +28,7 @@ // // You should have received a copy of the GNU General Public License // along with this program. If not, see . - +import QtQuick 2.6 import QtQuick.Controls 2.4 Button{ id: mButton @@ -36,4 +36,5 @@ Button{ height: 6*mm //color: Material.grey font.pixelSize: 3*mm + background: Rectangle{color:"#F8F8F8"} } diff --git a/source-linux/qml/newsqml/Conversation.qml b/source-linux/qml/newsqml/Conversation.qml index 036d2ef..54c8cda 100644 --- a/source-linux/qml/newsqml/Conversation.qml +++ b/source-linux/qml/newsqml/Conversation.qml @@ -40,7 +40,7 @@ Rectangle { id:conversationList // width:root.width-5*mm // height:root.height-12*mm - //property var news + property var news:[] // y:1 // z:2 color: "white" @@ -83,7 +83,7 @@ Rectangle { } else { conversationBusy.running=false; conversationModel.clear(); var currentTime= new Date(); - var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'options':globaloptions}; + var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'method':'refresh', 'options':globaloptions}; conversationWorker.sendMessage(msg) //conversationsymbol.color="grey" } @@ -176,15 +176,17 @@ Rectangle { text: "\uf057" onClicked: { //newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning); - newsStack.pop() + + newstab.conversation=[]; + //newsStack.pop() //conversationList.destroy(); //conversationsymbol.color="grey" } } -// Component.onCompleted: { -// if (news){var currentTime= new Date(); -// var msg = {'currentTime': currentTime, 'model': conversationModel,'news':news}; -// conversationWorker.sendMessage(msg)} -// } + Component.onCompleted: { + if (news.length>0){var currentTime= new Date(); + var msg = {'currentTime': currentTime, 'model': conversationModel,'news':news,'appendnews':true, 'options':globaloptions}; + conversationWorker.sendMessage(msg)} + } } diff --git a/source-linux/qml/newsqml/MessageSend.qml b/source-linux/qml/newsqml/MessageSend.qml index 80cae44..6c8ee89 100644 --- a/source-linux/qml/newsqml/MessageSend.qml +++ b/source-linux/qml/newsqml/MessageSend.qml @@ -148,7 +148,7 @@ Rectangle{ reply_to_user=newsitemobject.user.screen_name; parentId=newsitemobject.id } else { - messageSend.state="" + messageSend.state=""; reply_to_user=""; parentId=""; bodyField.text=""; @@ -482,7 +482,6 @@ Rectangle{ SmileyDialog{id:smileyDialog;x:mm;visible: false} } Component.onCompleted:{ - // //parentId=conversationModel.get(conversationModel.count-1).newsitemobject.id //if(attachImageURLs.length>0){attachImage(attachImageURLs[0])} newsStack.replySignal.connect(setParent); diff --git a/source-linux/qml/newsqml/MoreComments.qml b/source-linux/qml/newsqml/MoreComments.qml new file mode 100644 index 0000000..93ad6fb --- /dev/null +++ b/source-linux/qml/newsqml/MoreComments.qml @@ -0,0 +1,63 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// 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 . + +import QtQuick 2.0 +Rectangle{ + id: moreComments + width: parent.width + height: 5*mm + color:"white" + property int comments:0 +// border.color:"grey" +// border.width:1 + signal clicked + state:"" + + Text{ + id:mainText + color: "grey" + anchors.right: parent.right + anchors.margins: mm + width: contentWidth + height: contentHeight + font.family:fontAwesome.name + //font.pixelSize: 3*mm + text: qsTr("Show all comments")+" (" +comments + ")" //"\uf0dc" + } + MouseArea{ + id:buttonArea + anchors.fill:parent + onClicked: { + pushConversation(); + } + } +} + diff --git a/source-linux/qml/newsqml/NewsImage.qml b/source-linux/qml/newsqml/NewsImage.qml index b587e22..3aa3d56 100644 --- a/source-linux/qml/newsqml/NewsImage.qml +++ b/source-linux/qml/newsqml/NewsImage.qml @@ -31,7 +31,7 @@ import QtQuick 2.9 AnimatedImage {id:gif; - width:newscolumn.width; + width:toprow.width; property string mimetype:"" fillMode: Image.PreserveAspectFit; onStatusChanged: playing = (status == AnimatedImage.Ready); diff --git a/source-linux/qml/newsqml/NewsStack.qml b/source-linux/qml/newsqml/NewsStack.qml index b987ce3..6f2a667 100644 --- a/source-linux/qml/newsqml/NewsStack.qml +++ b/source-linux/qml/newsqml/NewsStack.qml @@ -121,9 +121,7 @@ StackView{ function showNews(newsToShow){ - try{ - if (newsStack.depth>1){newsStack.pop()} - }catch(e){} + try{if (newsStack.depth>1){newsStack.pop()}}catch(e){} newsBusy.running=false; var currentTime= new Date(); // downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now(); @@ -192,7 +190,8 @@ StackView{ } onSuccess:{ // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now(); - Service.processNews(api,data); + Service.processNews(api,data) + replySignal("") } } @@ -224,179 +223,8 @@ StackView{ id:newslistRectangle y:1 color: "white" + //anchors.fill:parent -// Button{ -// id:newstabstatusButton -// anchors.top: parent.top -// anchors.topMargin: 0.5*mm -// height: 8*mm -// text: qsTr(newstab.newstabstatus) -// visible: newsStack.parent.stacktype=="standard" -// onClicked: {print(newsStack.parent.stacktype); -// newstabmenu.popup(2*mm,6*mm) -// } - -// Menu{id:newstabmenu -// width: 40*mm - -// delegate:MenuItem{ -// contentItem: Text{ -// font.pixelSize: 3.5*mm -// text:parent.text -// } -// background: Rectangle { -// implicitWidth: 40*mm; implicitHeight: 5*mm -// color: "#ffffff" -// border.color: "grey" -// } -// } -// Action { -// text: qsTr("Timeline") -// onTriggered: { - -// } -// Action { -// text: qsTr("Conversations") -// onTriggered:{ -// //newsModel.clear(); -// newstab.newstabstatus="Conversations"; -// Newsjs.chatsfromdb(db,root.login,function(news){showNews(news)}) -// } -// } -// Action { -// text: qsTr("Favorites") -// onTriggered:{ -// newsStack.updateMethodNews="refresh"; -// newstab.newstabstatus="Favorites"; -// Service.updateView("Favorites") -// } -// } -// Action { -// text: qsTr("Replies") -// onTriggered:{ -// newsStack.updateMethodNews="refresh"; -// newstab.newstabstatus="Replies"; -// Service.updateView("Replies") -// } -// } -// Action { -// text: qsTr("Public timeline") -// onTriggered:{ -// newsStack.updateMethodNews="refresh"; -// newstab.newstabstatus="Public Timeline"; -// Service.updateView("Public Timeline") -// } -// } - -//// Action { -//// text: qsTr("Direct Messages") -//// onTriggered:{ -//// newsStack.updateMethodNews="refresh"; -//// newstab.newstabstatus="Direct Messages"; -//// Service.updateView("Direct Messages") -//// } -//// } -//// Action { -//// text: qsTr("Notifications") -//// onTriggered:{ -//// newsStack.updateMethodNews="refresh"; -//// newstab.newstabstatus="Notifications"; -//// Service.updateView("Notifications") -//// } -//// } -// Action { - -// text: qsTr("Group news") -// onTriggered: -// { -// newsStack.updateMethodNews="refresh"; -// Service.showGroups(); -// } -// } -// Action { - -// text: qsTr("Settings") -// onTriggered: -// { -// leftDrawer.open() -// } -// } - -// Action { -// text: qsTr("Quit") -// onTriggered:{ -// Service.cleanNews(root.db,function(){ -// Service.cleanContacts(root.login,root.db,function(){ -// Qt.quit()}) -// }) -// } -// } -// } -// } - -// Row{ -// spacing: mm -// anchors.top: parent.top -// anchors.topMargin: 0.5*mm -// anchors.right: parent.right - -// Button { -// id: searchButton -// height: 8*mm -// text: "\uf002" -// visible: newsStack.parent.stacktype=="standard" -// onClicked: { -// newsView.anchors.topMargin=18*mm; -// var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml"); -// var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm}); -// } -// } - -// Button { -// id: newMessageButton -// text: "\uf040" -// height: 8*mm -// onClicked: { -// var groups=[]; -// Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){ -// groups=groupobject -// }); -// newstab.newstabstatus="SendMessage"; -// Helperjs.readData(root.db,"contacts",root.login.username,function(friends){ -// newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"contacts": friends,"login":root.login}) -// },"isFriend",1); -// } -// } -// BlueButton { -// id: quitButton -// text: "\uf08b" -// onClicked: {Service.cleanNews(root.db,function(){ -// Service.cleanContacts(root.login,root.db,function(){ -// Qt.quit() }) -// })} -// } -// Button { -// id: update -// height: 8*mm -// text: "\uf021" -// onClicked: { -// if (newstab.newstabstatus=="Timeline"){ -// newsStack.updateMethodNews="append" -// } else {newsStack.updateMethodNews="refresh"} -// //root.contactLoadType="news"; -// if (newsStack.parent.stacktype=="standard"){ -// Service.updateView(newstab.newstabstatus) -// } -// else if (newsStack.parent.stacktype=="directmessage"){ -// Service.updateView("Direct Messages") -// } -// else if (newsStack.parent.stacktype=="notifications"){ -// Service.updateView("Notifications") -// } -// } -// } - -// } Component { id:footerComponent Rectangle{ border.color: "#EEEEEE" @@ -411,21 +239,26 @@ StackView{ MouseArea{ anchors.fill:parent onClicked:{ - getOldNews(); + 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();} } } } } - - -// Label{ -// text:qsTr(stacktype) -// font.pixelSize: 3* mm -// anchors.horizontalCenter: parent.horizontalCenter -// anchors.margins: mm -// } - ListView { id: newsView property real oldContentY:0 @@ -434,9 +267,6 @@ StackView{ property string viewtype: "news" anchors.fill: parent anchors.margins: mm - //anchors.topMargin: 6*mm -// anchors.leftMargin: mm; anchors.rightMargin: mm -// anchors.bottomMargin: mm clip: true spacing: 0 header: MessageSend{id:messagesend;onHeightChanged: newsView.positionViewAtBeginning()} @@ -565,13 +395,6 @@ StackView{ newsSwipeview.height=rootStackItem.height-12*mm; newsSwipeview.y=5*mm; rootStackItem.state="" - -// xhr.setLogin(login.username+":"+Qt.atob(login.password)); -// xhr.setUrl(login.server); -// if((newsStack.parent.stacktype=="standard") && (root.news.length>0)){ -// showNews(root.news) -// } - //else{ login.hasOwnProperty("newsViewType")?newstab.newstabstatus=login.newsViewType:"Conversations" var messagetype=0; switch(newsSwipeview.stacktype){ diff --git a/source-linux/qml/newsqml/NewsVideo.qml b/source-linux/qml/newsqml/NewsVideo.qml index c58620c..9e0af3d 100644 --- a/source-linux/qml/newsqml/NewsVideo.qml +++ b/source-linux/qml/newsqml/NewsVideo.qml @@ -37,8 +37,8 @@ import QtQuick 2.9 Rectangle{ color:"black" //border.color: "light grey" - width:newscolumn.width/2; - height:newscolumn.width/3//video.hasVideo?newscolumn.width/4*3:10*mm + width:toprow.width/2; + height:toprow.width/3//video.hasVideo?newscolumn.width/4*3:10*mm property var attachment:({}) Text{ id:noticeText @@ -54,11 +54,13 @@ Rectangle{ MouseArea {anchors.fill:parent; onClicked:{ if(attachment.mimetype=="video/youtube"){ - var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml"); - var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype}); + root.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype}); +// var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml"); +// var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype}); } else { - var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml"); - var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype}); + root.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"source": attachment.url,"mimetype": attachment.mimetype}); +// var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml"); +// var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype}); } } } diff --git a/source-linux/qml/newsqml/NewsVideoLarge.qml b/source-linux/qml/newsqml/NewsVideoLarge.qml index 8aba428..c08d343 100644 --- a/source-linux/qml/newsqml/NewsVideoLarge.qml +++ b/source-linux/qml/newsqml/NewsVideoLarge.qml @@ -64,7 +64,8 @@ Rectangle{ MouseArea { anchors.fill:parent; onClicked:{ - newsvideofullscreen.destroy(); + root.pop() + //newsvideofullscreen.destroy(); } } } diff --git a/source-linux/qml/newsqml/NewsYplayer.qml b/source-linux/qml/newsqml/NewsYplayer.qml index 7b8614b..a5b9a90 100644 --- a/source-linux/qml/newsqml/NewsYplayer.qml +++ b/source-linux/qml/newsqml/NewsYplayer.qml @@ -69,7 +69,10 @@ Rectangle{ opacity = 0 } onTitleChanged: { - if (title==2){newsYplayer.destroy()} + if (title==2){ + root.pop(); + //newsYplayer.destroy( + } } } } diff --git a/source-linux/qml/newsqml/Newsitem.qml b/source-linux/qml/newsqml/Newsitem.qml index b44629f..b73bbdb 100644 --- a/source-linux/qml/newsqml/Newsitem.qml +++ b/source-linux/qml/newsqml/Newsitem.qml @@ -31,7 +31,6 @@ import QtQuick 2.0 import QtQuick.Controls 2.4 -//import QtQuick.Controls.Styles 1.4 import "qrc:/js/news.js" as Newsjs import "qrc:/js/helper.js" as Helperjs import "qrc:/qml/genericqml" @@ -39,9 +38,9 @@ import "qrc:/qml/genericqml" Item { id: newsitem width: parent.width - height:toprow.height+friendicaActivities.height+controlrow.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 var newsitemobject:model.newsitemobject property string attending: "" onAttendingChanged: {attendLabel.visible=true; attendLabel.text= qsTr("attending: ")+ qsTr(attending)} @@ -57,6 +56,14 @@ Item { return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g) } + function pushConversation(){ + if (model.newsitemobject.hasOwnProperty("currentconversation")){ + newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})} + else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")}; + showConversation(index,newsitemobject) + } + + Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} Rectangle{ @@ -64,97 +71,106 @@ Item { height:newsitem.height-1 color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white" - Row{id:toprow - Column { - id: authorcolumn - width: 8*mm +// Row{id:toprow +// Column { +// id: authorcolumn +// width: 8*mm - 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 - width: 7*mm - height: 7*mm + +// } + Column { + id:toprow //newscolumn + width: newsitem.width//-8*mm + + Item{ + height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm) + width: parent.width MouseArea{ anchors.fill: parent onClicked:{ showContact(newsitemobject.user)} } - onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} - } - Label { - id:user_name - color: "grey" - width:parent.width - font.pixelSize: 1.5*mm - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: newsitemobject.user.name+forumname - } - } - Column { - id:newscolumn - width: newsitem.width-8*mm + Image { + id:profileImage + source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url + x:1 + y:1 + width: 7*mm + height: 7*mm + //radius:mm - Flow{ - id:topFlow - spacing: mm - width:parent.width - Label { - id:messageTypeLabel - color: "grey" - text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source} - font.pixelSize: 1.5*mm + onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} } - Label { - id:createdAtLabel - color: "grey" - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: dateDiff - } - Label { - id:replytoLabel - color: "grey" - font.pixelSize: 1.5*mm - font.family: "Noto Sans" - horizontalAlignment: Label.AlignRight - text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name - }catch(e){" "} + 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 } - Label { - id:newscountLabel - visible:((newstabstatus=="Conversations")&&(newsitemobject.newscount>1))?true:false - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - font.bold: true - horizontalAlignment: Label.AlignRight - text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "} - MouseArea{ - anchors.fill:parent - onClicked: { - newsStack.push("qrc:/qml/newsqml/Conversation.qml"); - showConversation(index,newsitemobject) + Label { + id:messageTypeLabel + color: "grey" + text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source} + font.pixelSize: 1.5*mm + } + Label { + id:createdAtLabel + color: "grey" + font.pixelSize: 1.5*mm + horizontalAlignment: Label.AlignRight + text: newsitemobject.dateDiff + } + Label { + id:replytoLabel + color: "grey" + font.pixelSize: 1.5*mm + font.family: "Noto Sans" + horizontalAlignment: Label.AlignRight + text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name + }catch(e){" "} } - } + + // Label { + // id:newscountLabel + // visible:((newstabstatus=="Conversations")&&(newsitemobject.newscount>1))?true:false + // color: "grey" + // height:3.5*mm + // font.pixelSize: 1.5*mm + // font.bold: true + // horizontalAlignment: Label.AlignRight + // text: try {(newsitemobject.newscount-1)+qsTr(" comments") }catch(e){" "} + // MouseArea{ + // anchors.fill:parent + // onClicked: { + // pushConversation(); + // } + // } + // } } } - - Column{ id: messageColumn - //anchors.top:topFlow.bottom - width:parent.width - spacing:mm - clip:true - height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height) - MouseArea{ - width: newsitem.width-8*mm-2 - height: itemMessage.height - onPressAndHold: { - newsStack.push("qrc:/qml/newsqml/Conversation.qml"); - showConversation(index,newsitemobject) - } +// Column{ id: messageColumn +// //anchors.top:topFlow.bottom +// width:parent.width +// spacing:mm +// clip:true +// height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height) + MouseArea{ + width: newsitem.width-8*mm-2 + height: itemMessage.height + onPressAndHold: { + pushConversation(); + } Text { color: "#404040" linkColor: "light green" @@ -162,12 +178,12 @@ Item { textFormat: Text.RichText font.family: "Noto Sans" text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html - width: newsitem.width-8*mm-2 - height: implicitHeight + width: newsitem.width-2 + height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height) + //height: implicitHeight wrapMode: Text.Wrap clip:true - //MouseArea{anchors.fill:parent;onClicked: print("Test")} - onLinkActivated:{ + onLinkActivated:{ Qt.openUrlExternally(link)} Component.onCompleted:{ if (newsitemobject.messagetype==0){ @@ -182,27 +198,35 @@ Item { for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){ var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); - var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); + var imageQml = component.createObject(toprow,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); } else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){ var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml"); - var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url}); + 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(messageColumn,{"attachment":newsitemobject.attachmentList[attachments]}); + var videoQml = component.createObject(toprow,{"attachment":newsitemobject.attachmentList[attachments]}); } } } + + if (newsitemobject.hasOwnProperty("lastcomment")){ + var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml"); + var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1}); + + var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml"); + var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment}); + } } }} - } + //} BlueButton{ width: newsitem.width-8*mm-2 height:5*mm //anchors.bottom: messageColumn.bottom//itemMessage.bottom - visible: messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height + visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height text:"\uf078" fontColor:"grey" border.color: "transparent" @@ -214,15 +238,15 @@ Item { radius:0 onClicked: { if (text=="\uf078"){ - messageColumn.height=messageColumn.implicitHeight+10*mm;text="\uf077" + itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077" } else { - messageColumn.height=Math.min(messageColumn.implicitHeight,3/4*root.height); + itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height); text="\uf078"; newsView.positionViewAtIndex(index,ListView.Beginning); } } } - } + //} } Flow{ id:friendicaActivities @@ -233,7 +257,7 @@ Item { Label{color: "grey" height:3.5*mm font.pixelSize: 1.5*mm - text: friendica_activities.likeText + text: newsitemobject.friendica_activities_view.likeText MouseArea{ anchors.fill: parent onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)} @@ -242,160 +266,156 @@ Item { Label{color: "grey" height:3.5*mm font.pixelSize: 1.5*mm - text: friendica_activities.dislikeText + text: newsitemobject.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.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.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.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: (friendica_activities.self.attending)?(qsTr("Attending: ")+ qsTr(friendica_activities.self.attending)):"" - } - } - Row{id:controlrow - anchors.top:friendicaActivities.bottom - - CheckBox{ - id:likeCheckbox - width:10*mm - visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false - checked:(friendica_activities.self.liked==1)?true:false - //style: CheckBoxStyle { - indicator: Rectangle{ - implicitWidth: 10*mm - implicitHeight:3*mm - Text{ - anchors.centerIn: parent - font.pixelSize: 2.5*mm - font.family:fontAwesome.name - color:likeCheckbox.checked?"black": "grey" - text:likeCheckbox.checked?"\uf118"+"!":"\uf118" - } - } - //} - onClicked: { - if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 } - else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.friendica_activities.self.liked=1}} - } - CheckBox{ - id: dislikeCheckbox - width:10*mm - visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false - checked: (friendica_activities.self.disliked==1)?true:false - //style: CheckBoxStyle { + Label{color: "grey" + height:3.5*mm + font.pixelSize: 1.5*mm + text: newsitemobject.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: newsitemobject.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: newsitemobject.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)):"" + } + } + 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:(newsitemobject.friendica_activities_view.self.liked==1)?true:false indicator: Rectangle{ - implicitWidth: 10*mm - implicitHeight:3*mm + implicitWidth: newsitem.width/5 //10*mm + implicitHeight:4*mm Text{ anchors.centerIn: parent - font.pixelSize: 2.5*mm + font.pixelSize: 3*mm + font.family:fontAwesome.name + color:likeCheckbox.checked?"black": "grey" + text:likeCheckbox.checked?"\uf118"+"!":"\uf118" + } + } + onClicked: { + if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.newsitemobject.friendica_activities_view.self.liked=0 } + else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.newsitemobject.friendica_activities_view.self.liked=1}} + } + CheckBox{ + id: dislikeCheckbox + width:newsitem.width/5 //10*mm + height: parent.height + visible: ((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3))? true:false + checked: (newsitemobject.friendica_activities_view.self.disliked==1)?true:false + indicator: Rectangle{ + implicitWidth: newsitem.width/5 //10*mm + implicitHeight:4*mm + Text{ + anchors.centerIn: parent + font.pixelSize: 3*mm font.family:fontAwesome.name color:dislikeCheckbox.checked?"black": "grey" text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119" } } - //} - onClicked: { - if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0} - else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.friendica_activities.self.disliked=1}} - } + onClicked: { + if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.newsitemobject.friendica_activities_view.self.disliked=0} + else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.newsitemobject.friendica_activities_view.self.disliked=1}} + } - CheckBox { - id:favoritedCheckbox - visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3)) - width: 10*mm - //style: CheckBoxStyle { - indicator:Rectangle{ - x:4*mm - width: 3*mm - implicitHeight:4*mm - Text{ - color: favoritedCheckbox.checked?"black":"grey" - font.pixelSize: 2.5*mm - text:"\uf005" - } - } - //} - checked:(newsitemobject.favorited>0) - onClicked:{ - if(favoritedCheckbox.checkedState==Qt.Checked){ - Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1} - else if(favoritedCheckbox.checkedState==Qt.Unchecked){ - Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0} - } - } - Rectangle{ - width: 10*mm - height: 4*mm + CheckBox { + id:favoritedCheckbox + visible:((newsitemobject.messagetype==0)||(newsitemobject.messagetype==3)) + width: newsitem.width/5 // 10*mm + height: parent.height + indicator:Rectangle{ + implicitWidth: newsitem.width/5 //10*mm + implicitHeight:4*mm + Text{ + anchors.centerIn: parent + font.pixelSize: 3*mm + font.family:fontAwesome.name + color: favoritedCheckbox.checked?"black":"grey" + text:"\uf005" + } + } + checked:(newsitemobject.favorited>0) + onClicked:{ + if(favoritedCheckbox.checkedState==Qt.Checked){ + Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1} + else if(favoritedCheckbox.checkedState==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: 2.5*mm + font.pixelSize: 3*mm font.family:fontAwesome.name text: "\uf142" } MouseArea{ anchors.fill:parent onClicked: {newsmenu.popup()}} - } - Rectangle{ - width: 10*mm - height: 4*mm - visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation") - color:"transparent" - Text{ - id:conversationsymbol - color: "grey" - anchors.centerIn: parent - font.pixelSize: 2.5*mm - font.family: fontAwesome.name - text: "\uf086" - } - MouseArea{ - anchors.fill:parent - onClicked:{ - //conversationsymbol.color="black"; -// var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); -// var conversationItem = component.createObject(friendicaActivities); - newsStack.push("qrc:/qml/newsqml/Conversation.qml") - showConversation(index,newsitemobject) - } - } } +// Rectangle{ +// width: 10*mm +// height: 4*mm +// visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation") +// color:"transparent" +// Text{ +// id:conversationsymbol +// color: "grey" +// anchors.centerIn: parent +// font.pixelSize: 2.5*mm +// font.family: fontAwesome.name +// text: "\uf086" +// } +// MouseArea{ +// anchors.fill:parent +// onClicked:{ +// if (newsitemobject.hasOwnProperty("currentconversation")){newsStack.push("qrc:/qml/newsqml/Conversation.qml",{"news": newsitemobject.currentconversation})} +// else{newsStack.push("qrc:/qml/newsqml/Conversation.qml")}; +// showConversation(index,newsitemobject) +// } +// } +// } } @@ -437,10 +457,7 @@ Item { Action { text: qsTr("Conversation") onTriggered: { - conversationsymbol.color="black"; - var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); - var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray}); - showConversation(index,newsitemobject) + pushConversation(); } } @@ -456,17 +473,17 @@ Item { Action{ text:qsTr("yes") onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){ - model.friendica_activities.self.attending="yes";attending="yes"}) + 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.friendica_activities.self.attending="maybe";attending="maybe"}) + 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.friendica_activities.self.attending="no";attending="no"})} + model.newsitemobject.friendica_activities_view.self.attending="no";attending="no"})} } } @@ -485,4 +502,11 @@ Item { // onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject //} } -}} + Column{ + id:conversationColumn + anchors.top:controlrow.bottom + anchors.right: parent.right + width: newsitem.width-5*mm + } +} +} diff --git a/source-linux/translations/friendiqa-de.qm b/source-linux/translations/friendiqa-de.qm index 642a180..ae9f284 100644 Binary files a/source-linux/translations/friendiqa-de.qm and b/source-linux/translations/friendiqa-de.qm differ diff --git a/source-linux/translations/friendiqa-de.ts b/source-linux/translations/friendiqa-de.ts index 4b790e7..7b249e3 100644 --- a/source-linux/translations/friendiqa-de.ts +++ b/source-linux/translations/friendiqa-de.ts @@ -5,8 +5,8 @@ AccountPage - - + + User Name @@ -37,8 +37,8 @@ - - + + Error Fehler @@ -48,52 +48,52 @@ Kurznamen mit @ Zeichen werden derzeit nicht unterstützt. - + Confirm Bestätigen - + No server given! Kein Server angegeben! - + No nickname given! Kein Kurzname angegeben! - + No password given! Kein Passwort angegeben! - + No image directory given! Kein Verzeichnis für Bilder angegeben! - + Wrong password! Falsches Passwort! - + Success Bestätigt - + Name Name - + Timeline Chronologisch - + Conversations Unterhaltungen @@ -119,7 +119,12 @@ Max. Nachr. - + + Hide #nsfw? + #nsfw minimieren? + + + Sync Autom. Aktualisierung @@ -234,7 +239,7 @@ ContactComponent - + Connect Kontaktanfrage @@ -308,22 +313,22 @@ FriendsTab - + Me Ich - + Friends Freunde - + Contacts Kontakte - + Groups Gruppen @@ -360,22 +365,22 @@ Beschreibung - + Upload Hochladen - + Change Ändern - + Error Fehler - + No album name given Kein Albumname angegeben @@ -383,51 +388,56 @@ MessageSend - - - - + to: an: - + Title (optional) Überschrift (optional) - + What's on your mind? Woran denkst du gerade? - - + + Error Fehler - + Only one attachment supported at the moment. Remove other attachment first! Nur ein Anhang derzeit unterstützt. Lösche zuerst den anderen Anhang! - + No receiver supplied! Kein Empfänger angegeben! + + MoreComments + + + Show all comments + Alle Kommentare + + NewsStack - + Network Error Netzwerk-Fehler - + More Mehr @@ -490,82 +500,81 @@ Newsitem - + attending: Teilnahme - + Source: Quelle: - + Direct Message Direktnachricht - + In reply to Antwort an - comments - Kommentare + Kommentare - + Attending: Teilnahme: - + Reply Antworten - + DM Direktnachricht - + Repost Teilen - + Success! Erledigt! - + Conversation Unterhaltung - + Attending Teilnahme - + yes ja - + maybe vielleicht - + no nein - + Delete Löschen @@ -879,7 +888,7 @@ Akt.-intervall (0=keine) - + Min. Min. @@ -887,57 +896,57 @@ friendiqa - + Refresh Aktualisieren - + Timeline Chronologisch - + Conversations Unterhaltungen - + Favorites Markierte News - + Replies Interaktionen - + Public Timeline öff. Timeline - + Group news News Gruppe - + Search Suche - + Settings Einstellungen - + Accounts Konten - + Quit Schliessen @@ -945,131 +954,131 @@ newsworker - + likes this. mag das. - + like this. mögen das. - + doesn't like this. mag das nicht. - + don't like this. mögen das nicht. - + will attend. nehmen teil. - + persons will attend. Personen nehmen teil. - + will not attend. nimmt nicht teil. - + persons will not attend. Personen nehmen nicht teil. - + may attend. nimmt vielleicht teil. - + persons may attend. Personen nehmen vielleicht teil. - + yes ja - + no nein - + maybe vielleicht - + seconds Sekunden - - - - - - - - - - + + + + + + + + + + ago her - + minute Minute - + minutes Minuten - + hour Stunde - + hours Stunden - + day Tag - + days Tage - + month Monat - + months Monate - + years @@ -1081,12 +1090,12 @@ Fehler - + Undefined Array Error Antwort-Array ungültig - + JSON status Error Server-Antwort: Fehler diff --git a/source-linux/translations/friendiqa-es.qm b/source-linux/translations/friendiqa-es.qm index 8408157..2040a61 100644 Binary files a/source-linux/translations/friendiqa-es.qm and b/source-linux/translations/friendiqa-es.qm differ diff --git a/source-linux/translations/friendiqa-es.ts b/source-linux/translations/friendiqa-es.ts index 89d0223..9e3866b 100644 --- a/source-linux/translations/friendiqa-es.ts +++ b/source-linux/translations/friendiqa-es.ts @@ -5,8 +5,8 @@ AccountPage - - + + User Usuario @@ -37,63 +37,63 @@ - - + + Error Error Nicknames containing @ symbol currently not supported - + No se admiten los apodos que contienen el símbolo @ actualmente - + Confirm Confirmar - + No server given! ¡Servidor no encontrado! - + No nickname given! ¡Usuario incorrecto! - + No password given! ¡Contraseña incorrecta! - + No image directory given! ¡No se ha encontrado el directorio de imágenes! - + Wrong password! ¡Contraseña incorrecta! - + Success éxito! - + Name Nombre - + Timeline Cronología - + Conversations Conversaciones @@ -119,9 +119,14 @@ Nº Max. de noticias. - + + Hide #nsfw? + Ocultar #nsfw? + + + Sync - + Sincronización @@ -218,7 +223,7 @@ ContactComponent - + Connect Conectar @@ -292,22 +297,22 @@ FriendsTab - + Me Yo - + Friends Amigos - + Contacts Contactos - + Groups Grupos @@ -333,22 +338,22 @@ Descripción - + Upload Subir - + Change Cambiar - + Error Error - + No album name given ¡Nombre del álbum no encontrado! @@ -356,51 +361,56 @@ MessageSend - - - - + to: - + a: - + Title (optional) Título (opcional) - + What's on your mind? - + ¿Qué tienes en mente? - - + + Error Error - + Only one attachment supported at the moment. Remove other attachment first! Solo se admite adjuntar un solo archivo en este momento. ¡Elimine y deje un archivo adjunto! - + No receiver supplied! - + No se ha suministrado ningún receptor! + + + + MoreComments + + + Show all comments + todos comentarios NewsStack - + Network Error Fallo de red - + More Mas @@ -459,82 +469,81 @@ Newsitem - + attending: Asistiendo: - + Source: Fuente: - + Direct Message Mensaje directo - + In reply to En respuesta a - comments - comentarios + comentarios - + Attending: Asistiendo: - + Reply Respuesta - + DM Mensaje directo - + Repost Volver a publicar - + Success! éxito! - + Conversation Conversación - + Attending Asistiendo - + yes si - + maybe quizás - + no no - + Delete Borrar @@ -848,7 +857,7 @@ - + Min. @@ -856,57 +865,57 @@ friendiqa - + Refresh - + Actualizar - + Timeline Cronología - + Conversations Conversaciones - + Favorites Favoritos - + Replies - + Respuestas - + Public Timeline Cronología pública - + Group news Grupos - + Search Busca - + Settings Ajustes - + Accounts - + Cuentas - + Quit Salida @@ -914,131 +923,131 @@ newsworker - + likes this. le gusta esto. - + like this. me gusta esto. - + doesn't like this. no de ése. - + don't like this. no me gusta. - + will attend. asistirá. - + persons will attend. Personas que asistirán. - + will not attend. no asistirá. - + persons will not attend. Personas que no asistirán.. - + may attend. Puede asistir. - + persons may attend. Personas que pueden asistir. - + yes si - + no no - + maybe quizás - + seconds Segundos - - - - - - - - - - + + + + + + + + + + ago hace - + minute Minuto - + minutes Minutos - + hour Hora - + hours Horas - + day Dia - + days Dias - + month Mes - + months Meses - + years Años @@ -1050,12 +1059,12 @@ Error - + Undefined Array Error - + JSON status Error diff --git a/source-linux/translations/friendiqa-it.qm b/source-linux/translations/friendiqa-it.qm index bb3841b..3ed5de3 100644 Binary files a/source-linux/translations/friendiqa-it.qm and b/source-linux/translations/friendiqa-it.qm differ diff --git a/source-linux/translations/friendiqa-it.ts b/source-linux/translations/friendiqa-it.ts index a125f79..a5731e7 100644 --- a/source-linux/translations/friendiqa-it.ts +++ b/source-linux/translations/friendiqa-it.ts @@ -5,8 +5,8 @@ AccountPage - - + + User Utente @@ -37,63 +37,63 @@ - - + + Error Errore Nicknames containing @ symbol currently not supported - + I soprannomi contenenti il simbolo @ attualmente non sono supportati - + Confirm Conferma - + No server given! Nessun server inserito! - + No nickname given! Nessun utente inserito! - + No password given! Nessuna password inserita! - + No image directory given! Nessuna directory immagini inserita! - + Wrong password! - + Password sbagliata! - + Success Ha funzionato! - + Name Nome - + Timeline Cronologia - + Conversations Conversazioni @@ -119,9 +119,14 @@ Nº Max. di notizie - + + Hide #nsfw? + Nascondere #nsfw? + + + Sync - + Sync @@ -206,7 +211,7 @@ ContactComponent - + Connect Connetti @@ -280,22 +285,22 @@ FriendsTab - + Me - + Me - + Friends Amici - + Contacts Contatti - + Groups Gruppi @@ -305,7 +310,7 @@ Upload to album - + Carica su album Album @@ -321,22 +326,22 @@ Descrizione - + Upload Carica - + Change - + Modifica - + Error Errore - + No album name given Nessun nome album inserito! @@ -344,51 +349,56 @@ MessageSend - - - - + to: - + a: - + Title (optional) Titolo (opzionale) - + What's on your mind? - + A cosa stai pensando? - - + + Error Errore - + Only one attachment supported at the moment. Remove other attachment first! Solo un allegato è attualmente supportato. Rimuovere prima gli altri allegati! - + No receiver supplied! - + Nessun ricevitore in dotazione! + + + + MoreComments + + + Show all comments + Tutti commenti NewsStack - + Network Error - + Errore di rete - + More Ancora @@ -435,82 +445,81 @@ Newsitem - + attending: attendere: - + Source: Codice: - + Direct Message Messaggio diretto - + In reply to In risposta a - comments - commenti + commenti - + Attending: Attendi: - + Reply Risposta - + DM Messaggio diretto - + Repost Condividi - + Success! Ha funzionato! - + Conversation Conversazione - + Attending Attendi - + yes si - + maybe potrebbe - + no no - + Delete Cancella @@ -538,12 +547,12 @@ All Images - + Tutte immagini Only new - + Solo nuovo @@ -808,12 +817,12 @@ sync - + sync notify - + notificare @@ -824,7 +833,7 @@ Intervallo (0=nessuno) - + Min. Min. @@ -832,189 +841,189 @@ friendiqa - + Refresh - + Aggiorna - + Timeline Cronologia - + Conversations Conversazioni - + Favorites Favoriti - + Replies - + Risposte - + Public Timeline - + Cronologia pubblica - + Group news - Gruppi + Notizie del gruppo - + Search Cerca - + Settings Configurazione - + Accounts - + Conti - + Quit - + Chiudi newsworker - + likes this. mi piace. - + like this. mi piace. - + doesn't like this. non mi piace. - + don't like this. non mi piace. - + will attend. attendere. - + persons will attend. Persone che attendono. - + will not attend. non aspettare. - + persons will not attend. Persone che non aspettano. - + may attend. puoi attendere. - + persons may attend. Persone che possono attendere. - + yes si - + no no - + maybe potrebbe - + seconds secondi - - - - - - - - - - + + + + + + + + + + ago fa - + minute minuti - + minutes minuti - + hour ora - + hours ore - + day giorno - + days giorni - + month mese - + months mesi - + years anni @@ -1026,12 +1035,12 @@ Errore - + Undefined Array Error - + JSON status Error