Browse Source

v0.5.1

master v0.5.1
LubuWest 2 years ago
parent
commit
7119d5bdf4
  1. 17
      source-android/android/AndroidManifest.xml
  2. 7
      source-android/android/build.gradle
  3. 69
      source-android/android/build.gradle.backup
  4. BIN
      source-android/android/libcrypto_1_1.so
  5. BIN
      source-android/android/libssl_1_1.so
  6. 1
      source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java
  7. 1
      source-android/androidnative.pri/java/src/androidnative/ImagePicker.java
  8. 3
      source-android/androidnative.pri/java/src/androidnative/Util.java
  9. 235
      source-android/application.qrc
  10. 1
      source-android/application.qrc
  11. 60
      source-android/common/alarm.h
  12. 1
      source-android/common/alarm.h
  13. 62
      source-android/common/alarmandroid.cpp
  14. 1
      source-android/common/alarmandroid.cpp
  15. 73
      source-android/common/alarmlinux.cpp
  16. 1
      source-android/common/alarmlinux.cpp
  17. 119
      source-android/common/filesystem.cpp
  18. 1
      source-android/common/filesystem.cpp
  19. 81
      source-android/common/filesystem.h
  20. 1
      source-android/common/filesystem.h
  21. 11
      source-android/common/friendiqa.cpp
  22. 123
      source-android/common/remoteauthasyncimageprovider.cpp
  23. 1
      source-android/common/remoteauthasyncimageprovider.cpp
  24. 95
      source-android/common/remoteauthasyncimageprovider.h
  25. 1
      source-android/common/remoteauthasyncimageprovider.h
  26. 568
      source-android/common/updatenews.cpp
  27. 1
      source-android/common/updatenews.cpp
  28. 100
      source-android/common/updatenews.h
  29. 1
      source-android/common/updatenews.h
  30. 121
      source-android/common/uploadableimage.cpp
  31. 1
      source-android/common/uploadableimage.cpp
  32. 71
      source-android/common/uploadableimage.h
  33. 1
      source-android/common/uploadableimage.h
  34. 369
      source-android/common/xhr.cpp
  35. 1
      source-android/common/xhr.cpp
  36. 134
      source-android/common/xhr.h
  37. 1
      source-android/common/xhr.h
  38. 6
      source-android/friendiqa.pro
  39. 1
      source-android/images
  40. BIN
      source-android/images/addImage.png
  41. BIN
      source-android/images/defaultcontact.jpg
  42. BIN
      source-android/images/folder-blue.png
  43. BIN
      source-android/images/fontawesome-webfont.ttf
  44. BIN
      source-android/images/smileys/adult/bong.gif
  45. BIN
      source-android/images/smileys/adult/drunk.gif
  46. BIN
      source-android/images/smileys/adult/finger.gif
  47. BIN
      source-android/images/smileys/adult/sperm.gif
  48. BIN
      source-android/images/smileys/adult/tits.gif
  49. BIN
      source-android/images/smileys/animals/bee.gif
  50. BIN
      source-android/images/smileys/animals/bigspider.gif
  51. BIN
      source-android/images/smileys/animals/bunny.gif
  52. BIN
      source-android/images/smileys/animals/bunnyflowers.gif
  53. BIN
      source-android/images/smileys/animals/cat.gif
  54. BIN
      source-android/images/smileys/animals/chick.gif
  55. BIN
      source-android/images/smileys/animals/cow.gif
  56. BIN
      source-android/images/smileys/animals/crab.gif
  57. BIN
      source-android/images/smileys/animals/dog.gif
  58. BIN
      source-android/images/smileys/animals/dolphin.gif
  59. BIN
      source-android/images/smileys/animals/dragonfly.gif
  60. BIN
      source-android/images/smileys/animals/elephant.gif
  61. BIN
      source-android/images/smileys/animals/fish.gif
  62. BIN
      source-android/images/smileys/animals/frog.gif
  63. BIN
      source-android/images/smileys/animals/giraffe.gif
  64. BIN
      source-android/images/smileys/animals/hamster.gif
  65. BIN
      source-android/images/smileys/animals/horse.gif
  66. BIN
      source-android/images/smileys/animals/ladybird.gif
  67. BIN
      source-android/images/smileys/animals/monkey.gif
  68. BIN
      source-android/images/smileys/animals/parrot.gif
  69. BIN
      source-android/images/smileys/animals/pig.gif
  70. BIN
      source-android/images/smileys/animals/sheep.gif
  71. BIN
      source-android/images/smileys/animals/snail.gif
  72. BIN
      source-android/images/smileys/animals/tux.gif
  73. BIN
      source-android/images/smileys/babies/baby.gif
  74. BIN
      source-android/images/smileys/babies/babycot.gif
  75. BIN
      source-android/images/smileys/babies/pregnant.gif
  76. BIN
      source-android/images/smileys/babies/stork.gif
  77. BIN
      source-android/images/smileys/confused/confused.gif
  78. BIN
      source-android/images/smileys/confused/dazed.gif
  79. BIN
      source-android/images/smileys/confused/shrug.gif
  80. BIN
      source-android/images/smileys/confused/stupid.gif
  81. BIN
      source-android/images/smileys/cool/affro.gif
  82. BIN
      source-android/images/smileys/cool/cool.gif
  83. BIN
      source-android/images/smileys/core/beer_mug.gif
  84. BIN
      source-android/images/smileys/core/coffee.gif
  85. BIN
      source-android/images/smileys/core/dislike.gif
  86. BIN
      source-android/images/smileys/core/friendica-16.png
  87. BIN
      source-android/images/smileys/core/like.gif
  88. BIN
      source-android/images/smileys/core/rm-16.png
  89. BIN
      source-android/images/smileys/core/smiley-Oo.gif
  90. BIN
      source-android/images/smileys/core/smiley-bangheaddesk.gif
  91. BIN
      source-android/images/smileys/core/smiley-brokenheart.gif
  92. BIN
      source-android/images/smileys/core/smiley-cool.gif
  93. BIN
      source-android/images/smileys/core/smiley-cry.gif
  94. BIN
      source-android/images/smileys/core/smiley-embarassed.gif
  95. BIN
      source-android/images/smileys/core/smiley-facepalm.gif
  96. BIN
      source-android/images/smileys/core/smiley-foot-in-mouth.gif
  97. BIN
      source-android/images/smileys/core/smiley-frown.gif
  98. BIN
      source-android/images/smileys/core/smiley-heart.gif
  99. BIN
      source-android/images/smileys/core/smiley-kiss.gif
  100. BIN
      source-android/images/smileys/core/smiley-laughing.gif

17
source-android/android/AndroidManifest.xml

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5" android:versionCode="13" android:installLocation="auto">
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5.1" android:versionCode="14" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:vmSafeMode="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:icon="@drawable/friendiqa" android:logo="@drawable/friendiqa" android:theme="@android:style/Theme.Holo.Light">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTask" android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
@ -50,6 +50,7 @@
<!-- Background running -->
</activity>
<service android:name="androidnative.friendiqa.FriendiqaService" android:permission="android.permission.BIND_JOB_SERVICE">
<meta-data android:name="android.app.background_running" android:value="true"/>
</service>
@ -61,31 +62,31 @@
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>
</service>
<service android:process=":qt" android:name="androidnative.friendiqa.FriendiqaStopService" android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true">
<meta-data android:name="android.app.background_running" android:value="true"/>
</service>
</application>
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="26"/>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.

7
source-android/android/build.gradle

@ -11,6 +11,9 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
@ -23,11 +26,11 @@ dependencies {
//apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:support-v4:25.4.0'
}
dependencies {
compile 'com.android.support:support-compat:25.3.1'
compile 'com.android.support:support-compat:25.4.0'
}
android {

69
source-android/android/build.gradle.backup

@ -0,0 +1,69 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
//apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:25.3.1'
}
dependencies {
compile 'com.android.support:support-compat:25.3.1'
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
}
apply from: "androidnative.gradle"
setAndroidNativePath("/../androidnative.pri");

BIN
source-android/android/libcrypto_1_1.so

BIN
source-android/android/libssl_1_1.so

1
source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java

@ -43,6 +43,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
SystemDispatcher.onActivityResume();
} else {
Intent data = getIntent();
if ((data!=null) && (data.getType() != null) && !(data.getBooleanExtra("used",false))){
String type = data.getType();

1
source-android/androidnative.pri/java/src/androidnative/ImagePicker.java

@ -62,6 +62,7 @@ public class ImagePicker {
// >= API 18
activity.startActivityForResult(intent, PICK_IMAGE_ACTION);
}
static void takePhoto(Map message) {

3
source-android/androidnative.pri/java/src/androidnative/Util.java

@ -139,6 +139,9 @@ public class Util {
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();

235
source-android/application.qrc

@ -1,235 +0,0 @@
<RCC>
<qresource prefix="/">
<file>qtquickcontrols2.conf</file>
<file>qml/friendiqa.qml</file>
<file>qml/newsqml/NewsTab.qml</file>
<file>qml/newsqml/Newsitem.qml</file>
<file>qml/newsqml/MessageSend.qml</file>
<file>qml/newsqml/Conversation.qml</file>
<file>qml/newsqml/FriendicaActivities.qml</file>
<file>qml/contactqml/FriendsTab.qml</file>
<file>qml/contactqml/GroupComponent.qml</file>
<file>qml/contactqml/ContactComponent.qml</file>
<file>qml/contactqml/ContactDetailsComponent.qml</file>
<file>qml/contactqml/Contactlist.qml</file>
<file>qml/genericqml/BlueButton.qml</file>
<file>qml/photoqml/PhotoComponent.qml</file>
<file>qml/photoqml/PhotogroupComponent.qml</file>
<file>qml/photoqml/PhotoTab.qml</file>
<file>qml/configqml/InfoBox.qml</file>
<file>qml/configqml/ConfigPage.qml</file>
<file>js/layout.js</file>
<file>js/photoworker.js</file>
<file>js/service.js</file>
<file>js/news.js</file>
<file>js/newsworker.js</file>
<file>js/helper.js</file>
<file>images/defaultcontact.jpg</file>
<file>images/fontawesome-webfont.ttf</file>
<file>images/folder-blue.png</file>
<file>qml/configqml/OSSettingsAndroid.qml</file>
<file>qml/genericqml/MButton.qml</file>
<file>qml/configqml/OSSettingsLinux.qml</file>
<file>qml/newsqml/SmileyDialog.qml</file>
<file>js/smiley.js</file>
<file>images/smileys/animals/bee.gif</file>
<file>images/smileys/animals/bigspider.gif</file>
<file>images/smileys/animals/bunny.gif</file>
<file>images/smileys/animals/bunnyflowers.gif</file>
<file>images/smileys/animals/cat.gif</file>
<file>images/smileys/animals/chick.gif</file>
<file>images/smileys/animals/cow.gif</file>
<file>images/smileys/animals/crab.gif</file>
<file>images/smileys/animals/dog.gif</file>
<file>images/smileys/animals/dolphin.gif</file>
<file>images/smileys/animals/dragonfly.gif</file>
<file>images/smileys/animals/elephant.gif</file>
<file>images/smileys/animals/fish.gif</file>
<file>images/smileys/animals/frog.gif</file>
<file>images/smileys/animals/giraffe.gif</file>
<file>images/smileys/animals/hamster.gif</file>
<file>images/smileys/animals/horse.gif</file>
<file>images/smileys/animals/ladybird.gif</file>
<file>images/smileys/animals/monkey.gif</file>
<file>images/smileys/animals/parrot.gif</file>
<file>images/smileys/animals/pig.gif</file>
<file>images/smileys/animals/sheep.gif</file>
<file>images/smileys/animals/snail.gif</file>
<file>images/smileys/animals/tux.gif</file>
<file>images/smileys/babies/baby.gif</file>
<file>images/smileys/babies/babycot.gif</file>
<file>images/smileys/babies/pregnant.gif</file>
<file>images/smileys/babies/stork.gif</file>
<file>images/smileys/confused/confused.gif</file>
<file>images/smileys/confused/dazed.gif</file>
<file>images/smileys/confused/shrug.gif</file>
<file>images/smileys/confused/stupid.gif</file>
<file>images/smileys/cool/affro.gif</file>
<file>images/smileys/cool/cool.gif</file>
<file>images/smileys/devilangel/angel.gif</file>
<file>images/smileys/devilangel/blondedevil.gif</file>
<file>images/smileys/devilangel/catdevil.gif</file>
<file>images/smileys/devilangel/cherub.gif</file>
<file>images/smileys/devilangel/daseesaw.gif</file>
<file>images/smileys/devilangel/devil.gif</file>
<file>images/smileys/devilangel/graveside.gif</file>
<file>images/smileys/devilangel/saint.gif</file>
<file>images/smileys/devilangel/turnevil.gif</file>
<file>images/smileys/disgust/fartblush.gif</file>
<file>images/smileys/disgust/fartinbed.gif</file>
<file>images/smileys/disgust/toilet.gif</file>
<file>images/smileys/disgust/vomit.gif</file>
<file>images/smileys/drink/tea.gif</file>
<file>images/smileys/drool/drool.gif</file>
<file>images/smileys/fantasy/alienmonster.gif</file>
<file>images/smileys/fantasy/barbarian.gif</file>
<file>images/smileys/fantasy/dinosaur.gif</file>
<file>images/smileys/fantasy/dragon.gif</file>
<file>images/smileys/fantasy/dragonwhelp.gif</file>
<file>images/smileys/fantasy/ghost.gif</file>
<file>images/smileys/fantasy/mummy.gif</file>
<file>images/smileys/fight/2guns.gif</file>
<file>images/smileys/fight/acid.gif</file>
<file>images/smileys/fight/alienfight.gif</file>
<file>images/smileys/fight/alpha.png</file>
<file>images/smileys/fight/army.gif</file>
<file>images/smileys/fight/arrowhead.gif</file>
<file>images/smileys/fight/bfg.gif</file>
<file>images/smileys/fight/bowman.gif</file>
<file>images/smileys/fight/chainsaw.gif</file>
<file>images/smileys/fight/crossbow.gif</file>
<file>images/smileys/fight/crusader.gif</file>
<file>images/smileys/fight/dead.gif</file>
<file>images/smileys/fight/gangs.gif</file>
<file>images/smileys/fight/hammersplat.gif</file>
<file>images/smileys/fight/lasergun.gif</file>
<file>images/smileys/fight/machinegun.gif</file>
<file>images/smileys/fight/marine.gif</file>
<file>images/smileys/fight/sabre.gif</file>
<file>images/smileys/fight/samurai.gif</file>
<file>images/smileys/fight/tank.gif</file>
<file>images/smileys/fight/viking.gif</file>
<file>images/smileys/food/apple.gif</file>
<file>images/smileys/food/banana.gif</file>
<file>images/smileys/food/birthdaycake.gif</file>
<file>images/smileys/food/broccoli.gif</file>
<file>images/smileys/food/cake.gif</file>
<file>images/smileys/food/carrot.gif</file>
<file>images/smileys/food/cooking.gif</file>
<file>images/smileys/food/fryegg.gif</file>
<file>images/smileys/food/popcorn.gif</file>
<file>images/smileys/food/tomato.gif</file>
<file>images/smileys/happy/cloud9.gif</file>
<file>images/smileys/happy/tearsofjoy.gif</file>
<file>images/smileys/laugh/hahaha.gif</file>
<file>images/smileys/laugh/loltv.gif</file>
<file>images/smileys/laugh/rofl.gif</file>
<file>images/smileys/love/iloveyou.gif</file>
<file>images/smileys/love/inlove.gif</file>
<file>images/smileys/love/love.gif</file>
<file>images/smileys/love/lovebear.gif</file>
<file>images/smileys/love/lovebed.gif</file>
<file>images/smileys/love/loveheart.gif</file>
<file>images/smileys/music/dj.gif</file>
<file>images/smileys/music/drums.gif</file>
<file>images/smileys/music/elvis.gif</file>
<file>images/smileys/music/guitar.gif</file>
<file>images/smileys/music/trumpet.gif</file>
<file>images/smileys/music/violin.gif</file>
<file>images/smileys/oldcore/beard.png</file>
<file>images/smileys/oldcore/headbang.gif</file>
<file>images/smileys/oldcore/laughing.gif</file>
<file>images/smileys/oldcore/shaka.gif</file>
<file>images/smileys/oldcore/surprised.gif</file>
<file>images/smileys/oldcore/whitebeard.png</file>
<file>images/smileys/respect/bow.gif</file>
<file>images/smileys/respect/bravo.gif</file>
<file>images/smileys/respect/hailking.gif</file>
<file>images/smileys/respect/number1.gif</file>
<file>images/smileys/sad/crying.png</file>
<file>images/smileys/sad/prisoner.gif</file>
<file>images/smileys/sad/sigh.gif</file>
<file>images/smileys/smoking/smoking.gif</file>
<file>images/smileys/sport/archery.gif</file>
<file>images/smileys/sport/basketball.gif</file>
<file>images/smileys/sport/bowling.gif</file>
<file>images/smileys/sport/cycling.gif</file>
<file>images/smileys/sport/darts.gif</file>
<file>images/smileys/sport/fencing.gif</file>
<file>images/smileys/sport/football.gif</file>
<file>images/smileys/sport/golf.gif</file>
<file>images/smileys/sport/horseriding.gif</file>
<file>images/smileys/sport/juggling.gif</file>
<file>images/smileys/sport/skipping.gif</file>
<file>images/smileys/sport/snooker.gif</file>
<file>images/smileys/sport/surfing.gif</file>
<file>images/smileys/sport/tennis.gif</file>
<file>images/smileys/tired/countsheep.gif</file>
<file>images/smileys/tired/hammock.gif</file>
<file>images/smileys/tired/pillow.gif</file>
<file>images/smileys/tired/yawn.gif</file>
<file>images/smileys/core/beer_mug.gif</file>
<file>images/smileys/core/coffee.gif</file>
<file>images/smileys/core/dislike.gif</file>
<file>images/smileys/core/friendica-16.png</file>
<file>images/smileys/core/like.gif</file>
<file>images/smileys/core/rm-16.png</file>
<file>images/smileys/core/smiley-bangheaddesk.gif</file>
<file>images/smileys/core/smiley-brokenheart.gif</file>
<file>images/smileys/core/smiley-cool.gif</file>
<file>images/smileys/core/smiley-cry.gif</file>
<file>images/smileys/core/smiley-embarassed.gif</file>
<file>images/smileys/core/smiley-facepalm.gif</file>
<file>images/smileys/core/smiley-foot-in-mouth.gif</file>
<file>images/smileys/core/smiley-heart.gif</file>
<file>images/smileys/core/smiley-kiss.gif</file>
<file>images/smileys/core/smiley-laughing.gif</file>
<file>images/smileys/core/smiley-Oo.gif</file>
<file>images/smileys/core/smiley-smile.gif</file>
<file>images/smileys/core/smiley-surprised.gif</file>
<file>images/smileys/core/smiley-thumbsup.gif</file>
<file>images/smileys/core/smiley-tongue-out.gif</file>
<file>images/smileys/core/smiley-undecided.gif</file>
<file>images/smileys/core/smiley-wink.gif</file>
<file>images/smileys/core/smiley-frown.gif</file>
<file>images/smileys/adult/bong.gif</file>
<file>images/smileys/adult/drunk.gif</file>
<file>images/smileys/adult/finger.gif</file>
<file>images/smileys/adult/sperm.gif</file>
<file>images/smileys/adult/tits.gif</file>
<file>common/filesystem.cpp</file>
<file>common/filesystem.h</file>
<file>common/friendiqa.cpp</file>
<file>common/uploadableimage.cpp</file>
<file>common/uploadableimage.h</file>
<file>common/xhr.cpp</file>
<file>common/xhr.h</file>
<file>qml/calendarqml/CalendarTab.qml</file>
<file>qml/calendarqml/CalendarDay.qml</file>
<file>qml/calendarqml/EventList.qml</file>
<file>translations/friendiqa-de.qm</file>
<file>translations/friendiqa-de.ts</file>
<file>translations/friendiqa-es.qm</file>
<file>translations/friendiqa-es.ts</file>
<file>qml/photoqml/ImageUploadDialog.qml</file>
<file>qml/genericqml/PermissionDialog.qml</file>
<file>images/addImage.png</file>
<file>qml/genericqml/ImagePicker.qml</file>
<file>qml/genericqml/ImagePickerLinux.qml</file>
<file>js/image.js</file>
<file>qml/contactqml/ProfileComponent.qml</file>
<file>translations/friendiqa-it.ts</file>
<file>qml/genericqml/Search.qml</file>
<file>qml/newsqml/Hashtag.qml</file>
<file>qml/genericqml/IntentReceiver.qml</file>
<file>qml/newsqml/NewsImage.qml</file>
<file>qml/newsqml/NewsVideo.qml</file>
<file>qml/newsqml/ContactPage.qml</file>
<file>qml/newsqml/NewsLink.qml</file>
<file>qml/configqml/RegisterPage.qml</file>
<file>qml/configqml/AccountPage.qml</file>
<file>qml/newsqml/NewsStack.qml</file>
<file>qml/configqml/SyncConfig.qml</file>
<file>qml/configqml/SyncComponent.qml</file>
</qresource>
</RCC>

1
source-android/application.qrc

@ -0,0 +1 @@
../source-linux/application.qrc

60
source-android/common/alarm.h

@ -1,60 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef ALARM_H
#define ALARM_H
#include <QObject>
class ALARM : public QObject
{
Q_OBJECT
//Q_PROPERTY(int alarmtime READ alarmtime WRITE setAlarm NOTIFY alarmChanged)
public:
static ALARM *instance();
explicit ALARM(QObject *parent = 0);
//int alarmtime() const;
signals:
void alarmChanged(QString url);
public slots:
void setAlarm(int time);
void notify(QString title, QString text, int id);
private:
int m_time;
};
#endif // UPDATENEWS_H

1
source-android/common/alarm.h

@ -0,0 +1 @@
../../source-linux/common/alarm.h

62
source-android/common/alarmandroid.cpp

@ -1,62 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "alarm.h"
#include <QtCore/QDebug>
#include "AndroidNative/systemdispatcher.h"
ALARM *ALARM::instance()
{
static ALARM alarm;
return &alarm;
}
ALARM::ALARM(QObject *parent) : QObject(parent){}
void ALARM::setAlarm(int interval)
{
QVariantMap message;
message["value"] = interval;
AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setSchedule", message);
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.stopService", message);
}
void ALARM::notify(QString title, QString text, int id)
{
//qDebug() << "notify "<< title << text;
QVariantMap message;
message["title"] = title;
message["message"] = text;
message["id"] = id;
AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setNotification", message);
}

1
source-android/common/alarmandroid.cpp

@ -0,0 +1 @@
../../source-linux/common/alarmandroid.cpp

73
source-android/common/alarmlinux.cpp

@ -1,73 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//#include <QtAndroidExtras/QAndroidJniObject>
//#include <QtAndroidExtras/QAndroidJniEnvironment>
#include "alarm.h"
#include <QtCore/QDebug>
#include <QtDBus/QtDBus>
//#include "AndroidNative/systemdispatcher.h"
ALARM *ALARM::instance()
{
static ALARM alarm;
return &alarm;
}
ALARM::ALARM(QObject *parent) : QObject(parent){}
void ALARM::setAlarm(int interval)
{
qDebug() << interval;
QVariantMap message;
message["value"] = interval;
// AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
// AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setSchedule", message);
//AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.stopService", message);
}
void ALARM::notify(QString title, QString text, int id)
{
qDebug() << title << text;
QVariantMap message;
message["title"] = title;
message["message"] = text;
QDBusConnection bus = QDBusConnection::sessionBus();
QDBusInterface dbus_iface("org.freedesktop.Notifications", "/org/freedesktop/Notifications",
"org.freedesktop.Notifications", bus);
QString appname="Friendiqa";
uint v=12321;
if (dbus_iface.isValid()){
dbus_iface.call("Notify",appname,v,"",title,text,"","",5000);
}
// AndroidNative::SystemDispatcher::instance()->dispatch("Notifier.notify", message);
}

1
source-android/common/alarmlinux.cpp

@ -0,0 +1 @@
../../source-linux/common/alarmlinux.cpp

119
source-android/common/filesystem.cpp

@ -1,119 +0,0 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "filesystem.h"
FILESYSTEM *FILESYSTEM::instance()
{
static FILESYSTEM filesystem;
return &filesystem;
}
FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){}
void FILESYSTEM::setDirectory(QString Directory)
{
if (Directory!=m_Directory) {
m_Directory = Directory;
emit directoryChanged();
}
}
QString FILESYSTEM::Directory() const
{
return m_Directory;
}
QString FILESYSTEM::homePath() const
{
QDir dir(m_Directory);
QString homeDir=dir.homePath();
//qDebug(homeDir);
return homeDir;
}
//QString FILESYSTEM::cameraPath() const
//{
//QAndroidJniObject object = QAndroidJniObject::getStaticObjectField<jstring>("android.os.Environment", "DIRECTORY_DCIM");
//QAndroidJniObject dcim =QAndroidJniObject::callStaticObjectMethod("android.os.Environment","getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", object.object<jobject>());
// return dcim.toString();
//}
//bool FILESYSTEM::direxist(QString Directory) const
//{QDir dir(Directory);
// return dir.exists();
//}
bool FILESYSTEM::fileexist(QString name)
{ return QFile::exists(name);
}
void FILESYSTEM::makeDir(QString name)
{
QDir dir(m_Directory);
if (dir.mkdir(name)){
emit success(name);
}
else {emit error(name,1);}
}
void FILESYSTEM::rmDir()
{
QDir dir(m_Directory);
//qDebug()<<m_Directory;
if (dir.removeRecursively()){
emit success(m_Directory);
}
else {emit error(m_Directory,1);}
}
void FILESYSTEM::rmFile(QString name)
{
QDir dir(m_Directory);
//qDebug()<<m_Directory;
//qDebug(name);
if(dir.remove(name)){
emit success(name);
}
else {emit error(name,1);}
}
QFileInfoList FILESYSTEM::fileList()
{
QDir dir(m_Directory);
QStringList filters;
filters << "*.png" <<"*.PNG" << "*.jpg" << "*.JPG" << "*.JPEG";
dir.setNameFilters(filters);
dir.setSorting(QDir::Time | QDir::Reversed);
//QStringList m_Filelist=dir.entryInfoList();
//qDebug() << "filelist " << m_Filelist;
return dir.entryInfoList();
}

1
source-android/common/filesystem.cpp

@ -0,0 +1 @@
../../source-linux/common/filesystem.cpp

81
source-android/common/filesystem.h

@ -1,81 +0,0 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef FILESYSTEM_H
#define FILESYSTEM_H
#include <QDir>
#include <QObject>
//#include <QtAndroidExtras>
//#include <QAndroidActivityResultReceiver>
class FILESYSTEM : public QObject//, public QAndroidActivityResultReceiver
{
Q_OBJECT
Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged)
//Q_PROPERTY(bool direxist READ direxist)
Q_PROPERTY(QString homePath READ homePath)
//Q_PROPERTY(QString cameraPath READ cameraPath)
public:
static FILESYSTEM *instance();
explicit FILESYSTEM(QObject *parent = 0);
void setDirectory(QString Directory);
QString Directory() const;
QFileInfoList fileList();
//bool direxist(QString Directory);
QString homePath() const;
//QString cameraPath() const;
// virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data);
signals:
//void imageselected(QString);
void directoryChanged();
//void fileListContent(QList data);
void success(QString data);
void error(QString data, int code);
public slots:
bool fileexist(QString name);
void makeDir(QString name);
void rmDir();
void rmFile(QString name);
//void searchImage();
//void fileList();
private:
QString m_Directory;
QString homeDir;
//QList m_Filelist;
};
#endif // FILSYSTEM_H

1
source-android/common/filesystem.h

@ -0,0 +1 @@
../../source-linux/common/filesystem.h

11
source-android/common/friendiqa.cpp

@ -44,7 +44,7 @@
#ifdef Q_OS_ANDROID
#include <QtAndroidExtras/QAndroidJniObject>
#include <QtAndroidExtras/QAndroidJniObject>
#include <QtAndroidExtras/QAndroidJniEnvironment>
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
Q_UNUSED(vm);
@ -52,13 +52,13 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
AndroidNative::SystemDispatcher::registerNatives();
return JNI_VERSION_1_6;
}
}
#endif
int main(int argc, char *argv[]) {
//qDebug()<< "argv Friendiqa"<< argv[0] <<" argv2" <<argv[1];
if (qstrcmp(argv[1],"-service")==0){
//qDebug()<< "argv Friendiqa"<< argv[0]; //<<" argv2" <<argv[1];
if ((argc>1) && (qstrcmp(argv[1],"-service")==0)){
//qDebug()<<"FriendiqaMain Service";
QAndroidService app(argc, argv);
UPDATENEWS* updatenews= UPDATENEWS::instance();
@ -71,6 +71,7 @@ int main(int argc, char *argv[]) {
else{
QApplication app(argc, argv);
QQuickView view;
qDebug()<<"FriendiqaMain started";
QTranslator qtTranslator;
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
app.installTranslator(&qtTranslator);
@ -86,8 +87,10 @@ int main(int argc, char *argv[]) {
UPDATENEWS* updatenews = UPDATENEWS::instance();
view.rootContext()->setContextProperty("updatenews", updatenews);
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
//QtWebEngine::initialize();
view.show();
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
return app.exec();
}
}

123
source-android/common/remoteauthasyncimageprovider.cpp

@ -1,123 +0,0 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "remoteauthasyncimageprovider.h"
#include <QQuickAsyncImageProvider>
#include <QImage>
AsyncImageResponse::AsyncImageResponse(QNetworkRequest req, QSize reqSize)
{
m_reply = m_imageLoader.get(req);
m_requestedSize = reqSize;
connect(m_reply, &QNetworkReply::finished, this, &AsyncImageResponse::onResponseFinished);
}
void AsyncImageResponse::onResponseFinished()
{
QByteArray myImageData = m_reply->readAll();
m_resultImage = QImage::fromData(myImageData);
if (m_requestedSize.isValid())
{
m_resultImage = m_resultImage.scaled(m_requestedSize);
}
emit finished();
}
QQuickTextureFactory *AsyncImageResponse::textureFactory() const
{
return QQuickTextureFactory::textureFactoryForImage(m_resultImage);
}
RemoteAuthAsyncImageProvider::RemoteAuthAsyncImageProvider()
{
}
QQuickImageResponse* RemoteAuthAsyncImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize)
{
QUrl iUrl=url()+"/api/friendica/remoteauth?c_url="+contacturl()+"&url="+id;
QByteArray loginData = m_login.toLocal8Bit().toBase64();
QString headerData = "Basic " + loginData;
QNetworkRequest request(iUrl);
request.setRawHeader("Authorization", headerData.toLocal8Bit());
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute,true);
request.setUrl(iUrl);
return new AsyncImageResponse(request, requestedSize);
}
void RemoteAuthAsyncImageProvider::setContacturl(QString contacturl)
{
if (contacturl!=m_contacturl) {
m_contacturl = contacturl;
emit contacturlChanged();
}
}
void RemoteAuthAsyncImageProvider::setUrl(QString url)
{
if (url!=m_url) {
m_url = url;
emit urlChanged();
}
}
void RemoteAuthAsyncImageProvider::setLogin(QString login)
{
if (login!=m_login) {
m_login = login;
emit loginChanged();
}
}
QString RemoteAuthAsyncImageProvider::contacturl() const
{
return m_contacturl;
}
QString RemoteAuthAsyncImageProvider::url() const
{
return m_url;
}
QString RemoteAuthAsyncImageProvider::login() const
{
return m_login;
}

1
source-android/common/remoteauthasyncimageprovider.cpp

@ -0,0 +1 @@
../../source-linux/common/remoteauthasyncimageprovider.cpp

95
source-android/common/remoteauthasyncimageprovider.h

@ -1,95 +0,0 @@
// This file is part of Friendiqa
// https://github.com/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef REMOTEAUTHIMAGEPROVIDER_H
#define REMOTEAUTHIMAGEPROVIDER_H
#include <QObject>
#include <QQuickAsyncImageProvider>
#include <QImage>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
class AsyncImageResponse : public QQuickImageResponse
{
Q_OBJECT
public:
explicit AsyncImageResponse(QNetworkRequest req, QSize requestedSize);
QQuickTextureFactory *textureFactory() const;
public slots:
void onResponseFinished();
protected:
QNetworkAccessManager m_imageLoader;
QNetworkReply* m_reply;
QSize m_requestedSize;
QImage m_resultImage;
int m_index;
QString m_id;
QImage m_image;
};
class RemoteAuthAsyncImageProvider : public QObject, public QQuickAsyncImageProvider
{
Q_OBJECT
Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY(QString contacturl READ contacturl WRITE setContacturl NOTIFY contacturlChanged)
Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged)
public:
explicit RemoteAuthAsyncImageProvider();
QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override;
QString url() const;
QString contacturl() const;
QString login() const;
signals:
void contacturlChanged();
void urlChanged();
void loginChanged();
public slots:
void setContacturl(QString contacturl);
void setUrl(QString url);
void setLogin(QString login);
private:
QByteArray buffer;
QString m_url;
QString m_contacturl;
QString m_login;
QString bufferToString();
};
#endif // REMOTEAUTHIMAGEPROVIDER_H

1
source-android/common/remoteauthasyncimageprovider.h

@ -0,0 +1 @@
../../source-linux/common/remoteauthasyncimageprovider.h

568
source-android/common/updatenews.cpp

@ -1,568 +0,0 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "updatenews.h"
#include <QHttpPart>
#include <QTextCodec>
#include <QUrlQuery>
#include <QList>
#include <QDataStream>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QQmlEngine>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QSqlDatabase>
#include <QSqlError>
#include <QDateTime>
//#include "AndroidNative/systemdispatcher.h"
UPDATENEWS *UPDATENEWS::instance()
{
static UPDATENEWS udn;
return &udn;
}
UPDATENEWS::UPDATENEWS(QObject *parent) : QObject(parent)
{
}
void UPDATENEWS::setUrl(QString url)
{
if (url!=m_url) {
m_url = url;
xhr.setUrl(url);
emit urlChanged(m_url);
}
}
void UPDATENEWS::setDatabase()
{
static QQmlEngine qe;
QString db_url=qe.offlineStorageDatabaseFilePath("Friendiqa");
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile());
//qDebug() << db_url;
if (!m_db.open())
{
qDebug() << "Error: connection with database fail " << m_db.lastError();
}
}
void UPDATENEWS::login()
{
QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
while (query.next())
{
username = query.value(1).toString();
QByteArray bpassword=query.value(2).toByteArray();
QString password=QByteArray::fromBase64(bpassword);
m_login=username+":"+password ;
xhr.setLogin(m_login);
m_url=query.value(0).toString();
xhr.setUrl(m_url);
m_imagedir=query.value(3).toString();
xhr.setImagedir(m_imagedir);
QString isActive=query.value(7).toString();
}
//m_updateInterval=query.value(5).toInt();
QSqlQuery syncquery("SELECT * FROM globaloptions",m_db);
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
// delquery.exec();
m_updateInterval=0;
syncindex=0;
synclist.clear();
//QSqlQuery syncquery("SELECT * FROM globaloptions WHERE k like 'sync_%' AND v=1",m_db);
while (syncquery.next()){
if (syncquery.value(0).toString()=="syncinterval"){
m_updateInterval=syncquery.value(1).toInt();
}
if (syncquery.value(0).toString().left(5)=="sync_" && syncquery.value(1).toInt()==1){
synclist.append(syncquery.value(0).toString());
//qDebug() << " sync " << syncquery.value(0).toString() << " " <<syncquery.value(1).toString();
}
if (syncquery.value(0).toString().left(7)=="notify_" && syncquery.value(1).toInt()==1){
notifylist.append(syncquery.value(0).toString());
//qDebug() << " notify " << syncquery.value(0).toString() << " " <<syncquery.value(1).toString();
}
}
// QSqlQuery notifyquery("SELECT * FROM globaloptions WHERE k like 'notify_%' AND v=1",m_db);
//qDebug() << "size " << notifyquery.size();
// while (notifyquery.next()){
// notifylist.append(syncquery.value(0).toString());
// qDebug() << " notify " << syncquery.value(0).toString();
//}
}
void UPDATENEWS::startsync()
{ //qDebug()<<"Friendiqa start syncing " <<synclist.length()<<" index "<<syncindex;
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
if (syncindex<synclist.length()){
if (synclist[syncindex]=="sync_Timeline"){
timeline();
} else if (synclist[syncindex]=="sync_Replies") {
replies();
} else if (synclist[syncindex]=="sync_DirectMessages") {
directmessages();
} else if (synclist[syncindex]=="sync_Notifications") {
notifications();
}
} else if (syncindex==synclist.length()) {
m_api="";
if(m_updateInterval!=0){
syncindex=0;
synclist.clear();
m_db.close();
m_db.removeDatabase(m_db.connectionName());
emit quitapp();
alarm.setAlarm(m_updateInterval);
m_updateInterval=0;
}
}
}
void UPDATENEWS::timeline()
{
m_api="/api/statuses/friends_timeline";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=0 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
if (query.isActive() && query.isSelect()){
if (query.first()){
QString lastid=query.value(0).toString();
xhr.setParam("since_id",lastid);
}
}
xhr.setParam("count","50");
xhr.get();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::replies()
{
m_api="/api/statuses/replies";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=3 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
if (query.isActive() && query.isSelect()){
if (query.first()){
QString lastid=query.value(0).toString();
xhr.setParam("since_id",lastid);
}
}
xhr.setParam("count","50");
xhr.get();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::directmessages()
{
m_api="/api/direct_messages/all";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=1 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
if (query.isActive() && query.isSelect()){
if (query.first()){
QString lastid=query.value(0).toString();
xhr.setParam("since_id",lastid);
}
}
xhr.get();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::notifications()
{
m_api="/api/friendica/notifications";
xhr.clearParams();
xhr.setUrl(m_url);
xhr.setApi(m_api);
xhr.get();
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
}
void UPDATENEWS::store(QByteArray serverreply,QString apiname)
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
QJsonDocument news;
//qDebug()<<apiname << serverreply;
QJsonParseError jsonerror;
news=QJsonDocument::fromJson(serverreply,&jsonerror);
if (news.isArray()){
for (int i=0; i < news.array().count();i++){
QJsonValue newsitem=news[i];
if (apiname=="/api/friendica/notifications"){
QSqlQuery testquery("SELECT status_id FROM news WHERE status_id=" + QString::number(newsitem["id"].toInt()) + " AND messagetype=2 AND username='"+ username +"'",m_db);
if (testquery.first()) {continue;}
}
QSqlQuery query(m_db);
query.prepare("INSERT INTO news (username,messagetype,text,created_at,in_reply_to_status_id,source,status_id,in_reply_to_user_id,geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) " "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
query.bindValue(0,username);
query.bindValue(1,"0");
query.bindValue(2, newsitem["text"].toString().toUtf8().toBase64());
QString sourcedate=newsitem["created_at"].toString();
QString formateddate=sourcedate.mid(0,3)+", "+sourcedate.mid(8,3)+sourcedate.mid(4,3)+sourcedate.mid(25,5)+sourcedate.mid(10,15);
query.bindValue(3,QDateTime::fromString(formateddate,Qt::RFC2822Date).toMSecsSinceEpoch() );
if(newsitem["in_reply_to_status_id"]!=QJsonValue::Null){query.bindValue(4, newsitem["in_reply_to_status_id"].toInt());}
query.bindValue(5,newsitem["source"]);
query.bindValue(6,newsitem["id"].toInt());
if(newsitem["in_reply_to_user_id"]!=QJsonValue::Null){ query.bindValue(7,newsitem["in_reply_to_user_id"].toInt());}
query.bindValue(8,newsitem["geo"]);
query.bindValue( 9, newsitem["favorited"].toInt());
query.bindValue(10, newsitem["user"]["id"].toInt());
query.bindValue(11, newsitem["statusnet_html"].toString().toUtf8().toBase64());
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
if (newsitem.toObject().contains("friendica_activities")){
for (int a=0; a < newsitem["friendica_activities"]["like"].toArray().count();a++){
likeArray.append(newsitem["friendica_activities"]["like"][a]["url"].toString());
}
for (int b=0; b < newsitem["friendica_activities"]["dislike"].toArray().count();b++){
dislikeArray.append(newsitem["friendica_activities"]["dislike"][b]["url"].toString());
}
for (int c=0; c < newsitem["friendica_activities"]["attendyes"].toArray().count();c++){
attendyesArray.append(newsitem["friendica_activities"]["attendyes"][c]["url"].toString());
}
for (int d=0; d < newsitem["friendica_activities"]["attendno"].toArray().count();d++){
attendnoArray.append(newsitem["friendica_activities"]["attendno"][d]["url"].toString());
}
for (int e = 0; e < newsitem["friendica_activities"]["attendmaybe"].toArray().count();e++){
attendmaybeArray.append(newsitem["friendica_activities"]["attendmaybe"][e]["url"].toString());
}
}
QJsonArray friendica_activities; friendica_activities={likeArray,dislikeArray,attendyesArray,attendnoArray,attendmaybeArray};
QJsonDocument activities; activities.setArray(friendica_activities);
query.bindValue(13,activities.toJson(QJsonDocument::Compact).toBase64());
query.bindValue(14,"[]");
if (newsitem["attachments"]!=QJsonValue::Undefined){
query.bindValue(15, QJsonDocument(newsitem["attachments"].toArray()).toJson(QJsonDocument::Compact).toBase64());
}else {
query.bindValue(15, "");
}
if (newsitem["friendica_author"]!=QJsonValue::Undefined){
query.bindValue(16, newsitem["friendica_author"]["url"]);
}else {
query.bindValue(16, newsitem["user"]["url"]);
}
if (apiname=="/api/statuses/replies"){
query.bindValue(1,"3");
}
if (apiname == "/api/direct_messages/all"){
query.bindValue(1,"1");
query.bindValue(5,"Friendica");
if(newsitem["recipient"]["id"]!=QJsonValue::Null){ query.bindValue(7,newsitem["recipient"]["id"].toInt());}
query.bindValue(10, newsitem["sender_id"].toInt());
query.bindValue(11, newsitem["text"].toString().toUtf8().toBase64());
if(newsitem["friendica_parent_uri"]!=QJsonValue::Null){ query.bindValue(12,newsitem["friendica_parent_uri"]);}
query.bindValue(16, newsitem["sender"]["url"]);
}
if (apiname == "/api/friendica/notifications"){
query.bindValue(1,"2");
query.bindValue(3,QDateTime::fromString(newsitem["date"].toString(),"yyyy-MM-dd hh:mm:ss").toMSecsSinceEpoch());
query.bindValue(5,"Friendica");
QJsonObject cleancontact= findNotificationContact(newsitem["url"].toString());
query.bindValue(10, cleancontact["id"].toInt());
query.bindValue(11, newsitem["msg_html"].toString().toUtf8().toBase64());
if(newsitem["parent"]!=QJsonValue::Null){ query.bindValue(12,newsitem["parent"]);}
query.bindValue(16, newsitem["url"]);
}
if(!(query.exec())) {qDebug()<<query.lastError();}
// notifications
if (apiname=="/api/statuses/friends_timeline"){
if(notifylist.contains("notify_Timeline")){
alarm.notify("Home: "+ newsitem["user"]["name"].toString(),newsitem["text"].toString(),0);