new version with hashtags
This commit is contained in:
parent
d81ad52031
commit
56bdb80ea0
|
@ -1,3 +1,9 @@
|
||||||
|
## v0.5.4 ##
|
||||||
|
* More Simplification of account page (images are stored in the private app directory, no permission required)
|
||||||
|
* Image attachment for Android 10 repaired
|
||||||
|
* Hashtags are saved after message is sent and can be used in later messages
|
||||||
|
* Bugfixes
|
||||||
|
|
||||||
## v0.5.3 ##
|
## v0.5.3 ##
|
||||||
* Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03
|
* Implementation of new events API (incl. sync and notification) for Friendica version >= 20.03
|
||||||
* Indentation to see replied to newsitem for conversation view
|
* Indentation to see replied to newsitem for conversation view
|
||||||
|
|
|
@ -36,6 +36,7 @@ Currently supported:
|
||||||
* Update fetches new posts (up to last 50) since last in local DB
|
* Update fetches new posts (up to last 50) since last in local DB
|
||||||
* More shows older posts from local DB
|
* More shows older posts from local DB
|
||||||
* Create new Message with images or direct messages, Contact/Group access rights (can be stored), smileys
|
* Create new Message with images or direct messages, Contact/Group access rights (can be stored), smileys
|
||||||
|
* Hashtags are saved after message is sent and can be used in later messages
|
||||||
* Send image from Android gallery
|
* Send image from Android gallery
|
||||||
* Send text or urls from other apps to Friendiqa
|
* Send text or urls from other apps to Friendiqa
|
||||||
* Native Android image dialog
|
* Native Android image dialog
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5.3" android:versionCode="21" android:installLocation="auto">
|
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.5.4" android:versionCode="22" android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29"/>
|
||||||
|
|
||||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||||
|
@ -12,8 +12,15 @@
|
||||||
|
|
||||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
|
|
||||||
<application android:hardwareAccelerated="false" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Friendiqa" android:extractNativeLibs="true" android:icon="@drawable/friendiqa" android:theme="@android:style/Theme.Holo.Light" android:logo="@drawable/friendiqa">
|
<application android:hardwareAccelerated="false"
|
||||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleTask" android:taskAffinity="">
|
android:name="org.qtproject.qt5.android.bindings.QtApplication"
|
||||||
|
android:label="Friendiqa"
|
||||||
|
android:extractNativeLibs="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
|
android:icon="@drawable/friendiqa"
|
||||||
|
android:theme="@android:style/Theme.Holo.Light"
|
||||||
|
android:logo="@drawable/friendiqa">
|
||||||
|
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="androidnative.friendiqa.FriendiqaActivity" android:label="Friendiqa" android:screenOrientation="unspecified" android:launchMode="singleInstance" android:taskAffinity="">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
69
source-android/android/build.gradle.backup
Normal file
69
source-android/android/build.gradle.backup
Normal file
|
@ -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");
|
|
@ -1,4 +1,7 @@
|
||||||
|
# androidBuildToolsVersion=25.0.3
|
||||||
|
# androidCompileSdkVersion=26
|
||||||
buildDir=.build
|
buildDir=.build
|
||||||
|
# qt5AndroidDir=/home/pankraz/Qt/5.11.1/android_armv7/src/android/java
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
android.enforceUniquePackageName=false
|
android.enforceUniquePackageName=false
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.util.Log;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.Manifest.permission;
|
import android.Manifest.permission;
|
||||||
|
@ -18,7 +19,7 @@ import androidx.core.content.ContextCompat;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.QtActivity {
|
public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.QtActivity {
|
||||||
public static final int MY_PERMISSIONS_REQUEST_WRITE_STORAGE = 0x245285a8;
|
public static final int MY_PERMISSIONS_REQUEST_READ_STORAGE = 0x245285a8;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -30,16 +31,16 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
||||||
|
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if (ContextCompat.checkSelfPermission(this,android.Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
//if (ContextCompat.checkSelfPermission(this,android.Manifest.permission.WRITE_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
// Permission is not granted
|
// Permission is not granted
|
||||||
|
|
||||||
ActivityCompat.requestPermissions(this,new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_WRITE_STORAGE);
|
// ActivityCompat.requestPermissions(this,new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_WRITE_STORAGE);
|
||||||
|
|
||||||
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
|
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
|
||||||
// app-defined int constant. The callback method gets the
|
// app-defined int constant. The callback method gets the
|
||||||
// result of the request.
|
// result of the request.
|
||||||
} else {
|
//} else {
|
||||||
|
|
||||||
System.loadLibrary("friendiqa_arm64-v8a");
|
System.loadLibrary("friendiqa_arm64-v8a");
|
||||||
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
|
if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) {
|
||||||
|
@ -68,7 +69,7 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
||||||
} else {
|
} else {
|
||||||
SystemDispatcher.onActivityResume();
|
SystemDispatcher.onActivityResume();
|
||||||
}}
|
}}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,10 +77,12 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt
|
||||||
|
|
||||||
@Override public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) {
|
@Override public void onRequestPermissionsResult(int requestCode,String permissions[], int[] grantResults) {
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case MY_PERMISSIONS_REQUEST_WRITE_STORAGE: {
|
case MY_PERMISSIONS_REQUEST_READ_STORAGE: {
|
||||||
// If request is cancelled, the result arrays are empty.
|
// If request is cancelled, the result arrays are empty.
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
SystemDispatcher.onActivityResume();
|
Map message = new HashMap();
|
||||||
|
message.put("multiple",false);
|
||||||
|
SystemDispatcher.dispatch("androidnative.ImagePicker.pickImage",message);
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package androidnative;
|
package androidnative;
|
||||||
import org.qtproject.qt5.android.QtNative;
|
import org.qtproject.qt5.android.QtNative;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -17,12 +18,20 @@ import android.content.ClipData;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.Manifest.permission;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ImagePicker {
|
public class ImagePicker {
|
||||||
|
|
||||||
// Random
|
// Random
|
||||||
public static final int PICK_IMAGE_ACTION = 0x245285a3;
|
public static final int PICK_IMAGE_ACTION = 0x245285a3;
|
||||||
public static final int TAKE_PHOTO_ACTION = 0x29fe8748;
|
public static final int TAKE_PHOTO_ACTION = 0x29fe8748;
|
||||||
|
public static final int MY_PERMISSIONS_REQUEST_READ_STORAGE = 0x245285a8;
|
||||||
public static final String PICK_IMAGE_MESSAGE = "androidnative.ImagePicker.pickImage";
|
public static final String PICK_IMAGE_MESSAGE = "androidnative.ImagePicker.pickImage";
|
||||||
public static final String TAKE_PHOTO_MESSAGE = "androidnative.ImagePicker.takePhoto";
|
public static final String TAKE_PHOTO_MESSAGE = "androidnative.ImagePicker.takePhoto";
|
||||||
public static final String CHOSEN_MESSAGE = "androidnative.ImagePicker.chosen";
|
public static final String CHOSEN_MESSAGE = "androidnative.ImagePicker.chosen";
|
||||||
|
@ -47,8 +56,15 @@ public class ImagePicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pickImage(Map message) {
|
static void pickImage(Map message) {
|
||||||
|
Context context;
|
||||||
|
context = QtNative.activity().getApplicationContext();
|
||||||
|
Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
||||||
|
if (ContextCompat.checkSelfPermission(context,android.Manifest.permission.READ_EXTERNAL_STORAGE)!= PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// Permission is not granted
|
||||||
|
ActivityCompat.requestPermissions(activity,new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE},MY_PERMISSIONS_REQUEST_READ_STORAGE);
|
||||||
|
} else {
|
||||||
Boolean multiple = false;
|
Boolean multiple = false;
|
||||||
Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
//Activity activity = org.qtproject.qt5.android.QtNative.activity();
|
||||||
|
|
||||||
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||||
|
|
||||||
|
@ -63,7 +79,7 @@ public class ImagePicker {
|
||||||
// >= API 18
|
// >= API 18
|
||||||
activity.startActivityForResult(intent, PICK_IMAGE_ACTION);
|
activity.startActivityForResult(intent, PICK_IMAGE_ACTION);
|
||||||
|
|
||||||
}
|
}}
|
||||||
|
|
||||||
static void takePhoto(Map message) {
|
static void takePhoto(Map message) {
|
||||||
if (message.containsKey("broadcast")) {
|
if (message.containsKey("broadcast")) {
|
||||||
|
|
115
source-android/common/filesystemandroid.cpp
Normal file
115
source-android/common/filesystemandroid.cpp
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
// This file is part of Friendiqa
|
||||||
|
// https://github.com/lubuwest/Friendiqa
|
||||||
|
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// In addition, as a special exception, the copyright holders give
|
||||||
|
// permission to link the code of portions of this program with the
|
||||||
|
// OpenSSL library under certain conditions as described in each
|
||||||
|
// individual source file, and distribute linked combinations including
|
||||||
|
// the two.
|
||||||
|
//
|
||||||
|
// You must obey the GNU General Public License in all respects for all
|
||||||
|
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||||
|
// exception, you may extend this exception to your version of the
|
||||||
|
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||||
|
// so, delete this exception statement from your version. If you delete
|
||||||
|
// this exception statement from all source files in the program, then
|
||||||
|
// also delete it here.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "filesystem.h"
|
||||||
|
#include <QtAndroidExtras>
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
QAndroidJniObject activity =QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative","activity", "()Landroid/app/Activity;");
|
||||||
|
QAndroidJniObject dir = activity.callObjectMethod("getExternalFilesDir", "(Ljava/lang/String;)Ljava/io/File;", NULL);
|
||||||
|
QString homeDir=dir.toString();
|
||||||
|
return homeDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
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::makePath(QString name)
|
||||||
|
{
|
||||||
|
QDir dir(m_Directory);
|
||||||
|
if (dir.mkpath(name)){
|
||||||
|
emit success(name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emit error(name,1);}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FILESYSTEM::rmDir()
|
||||||
|
{
|
||||||
|
QDir dir(m_Directory);
|
||||||
|
if (dir.removeRecursively()){
|
||||||
|
emit success(m_Directory);
|
||||||
|
}
|
||||||
|
else {emit error(m_Directory,1);}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FILESYSTEM::rmFile(QString name)
|
||||||
|
{
|
||||||
|
QDir dir(m_Directory);
|
||||||
|
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);
|
||||||
|
return dir.entryInfoList();
|
||||||
|
}
|
|
@ -38,9 +38,6 @@
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "remoteauthasyncimageprovider.h"
|
#include "remoteauthasyncimageprovider.h"
|
||||||
#include "AndroidNative/systemdispatcher.h"
|
#include "AndroidNative/systemdispatcher.h"
|
||||||
//#include "AndroidNative/environment.h"
|
|
||||||
//#include "AndroidNative/debug.h"
|
|
||||||
//#include "AndroidNative/mediascannerconnection.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
|
@ -87,7 +84,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) {
|
||||||
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||||
view.rootContext()->setContextProperty("updatenews", updatenews);
|
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||||
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
|
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
|
||||||
//QtWebEngine::initialize();
|
|
||||||
view.show();
|
view.show();
|
||||||
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ QT += qml quick gui widgets androidextras sql webview #webengine
|
||||||
include(androidnative.pri/androidnative.pri)
|
include(androidnative.pri/androidnative.pri)
|
||||||
|
|
||||||
SOURCES += common/friendiqa.cpp \
|
SOURCES += common/friendiqa.cpp \
|
||||||
common/uploadableimage.cpp \
|
common/uploadableimage.cpp \
|
||||||
common/xhr.cpp \
|
common/xhr.cpp \
|
||||||
common/filesystem.cpp \
|
common/filesystemandroid.cpp \
|
||||||
common/remoteauthasyncimageprovider.cpp \
|
common/remoteauthasyncimageprovider.cpp \
|
||||||
common/updatenews.cpp \
|
common/updatenews.cpp \
|
||||||
common/alarmandroid.cpp
|
common/alarmandroid.cpp
|
||||||
|
@ -84,3 +84,6 @@ DISTFILES += \
|
||||||
android/src/FriendiqaService.java
|
android/src/FriendiqaService.java
|
||||||
|
|
||||||
ANDROID_EXTRA_LIBS = $$PWD/android/arm/libcrypto_1_1.so $$PWD/android/arm/libssl_1_1.so $$PWD/android/arm64/libcrypto_1_1.so $$PWD/android/arm64/libssl_1_1.so
|
ANDROID_EXTRA_LIBS = $$PWD/android/arm/libcrypto_1_1.so $$PWD/android/arm/libssl_1_1.so $$PWD/android/arm64/libcrypto_1_1.so $$PWD/android/arm64/libssl_1_1.so
|
||||||
|
|
||||||
|
ANDROID_ABIS = arm64-v8a
|
||||||
|
android: include(/home/pankraz/git/android_openssl/openssl.pri)
|
||||||
|
|
|
@ -237,5 +237,6 @@
|
||||||
<file>common/xhr.cpp</file>
|
<file>common/xhr.cpp</file>
|
||||||
<file>common/xhr.h</file>
|
<file>common/xhr.h</file>
|
||||||
<file>qml/newsqml/MoreComments.qml</file>
|
<file>qml/newsqml/MoreComments.qml</file>
|
||||||
|
<file>common/filesystemandroid.cpp</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
// 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);
|
||||||
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
FILESYSTEM *FILESYSTEM::instance()
|
FILESYSTEM *FILESYSTEM::instance()
|
||||||
{
|
{
|
||||||
|
@ -54,8 +55,9 @@ QString FILESYSTEM::Directory() const
|
||||||
|
|
||||||
QString FILESYSTEM::homePath() const
|
QString FILESYSTEM::homePath() const
|
||||||
{
|
{
|
||||||
QDir dir(m_Directory);
|
//QDir dir(m_Directory);
|
||||||
QString homeDir=dir.homePath();
|
//
|
||||||
|
QString homeDir=QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);;
|
||||||
//qDebug(homeDir);
|
//qDebug(homeDir);
|
||||||
return homeDir;
|
return homeDir;
|
||||||
}
|
}
|
||||||
|
@ -81,9 +83,25 @@ void FILESYSTEM::makeDir(QString name)
|
||||||
{
|
{
|
||||||
QDir dir(m_Directory);
|
QDir dir(m_Directory);
|
||||||
if (dir.mkdir(name)){
|
if (dir.mkdir(name)){
|
||||||
|
qDebug() << "makedir success" <<name;
|
||||||
emit success(name);
|
emit success(name);
|
||||||
}
|
}
|
||||||
else {emit error(name,1);}
|
else {
|
||||||
|
qDebug() << "makedir error" <<name;
|
||||||
|
emit error(name,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FILESYSTEM::makePath(QString name)
|
||||||
|
{
|
||||||
|
QDir dir(m_Directory);
|
||||||
|
if (dir.mkpath(name)){
|
||||||
|
qDebug() << "makepath success" <<name;
|
||||||
|
emit success(name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << "makepath error" <<name;
|
||||||
|
emit error(name,1);}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FILESYSTEM::rmDir()
|
void FILESYSTEM::rmDir()
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
//#include <QtAndroidExtras>
|
//#include <QtAndroidExtras>
|
||||||
//#include <QAndroidActivityResultReceiver>
|
//#include <QAndroidActivityResultReceiver>
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
bool fileexist(QString name);
|
bool fileexist(QString name);
|
||||||
void makeDir(QString name);
|
void makeDir(QString name);
|
||||||
|
void makePath(QString name);
|
||||||
void rmDir();
|
void rmDir();
|
||||||
void rmFile(QString name);
|
void rmFile(QString name);
|
||||||
//void searchImage();
|
//void searchImage();
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
// 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 <QApplication>
|
||||||
|
#include <QtQml/QQmlEngine>
|
||||||
|
//#include <QAndroidService>
|
||||||
|
//#include <QtAndroid>
|
||||||
|
#include <QtQuick>
|
||||||
|
#include "xhr.h"
|
||||||
|
#include "updatenews.h"
|
||||||
|
#include "filesystem.h"
|
||||||
|
#include "remoteauthasyncimageprovider.h"
|
||||||
|
//#include "alarm.h"
|
||||||
|
//#include "AndroidNative/systemdispatcher.h"
|
||||||
|
//#include "AndroidNative/environment.h"
|
||||||
|
//#include "AndroidNative/debug.h"
|
||||||
|
//#include "AndroidNative/mediascannerconnection.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Q_OS_ANDROID
|
||||||
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
|
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||||
|
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void*) {
|
||||||
|
Q_UNUSED(vm);
|
||||||
|
qDebug("NativeInterface::JNI_OnLoad()"); // It must call this function within JNI_OnLoad to enable System Dispatcher
|
||||||
|
|
||||||
|
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()<<"FriendiqaMain Service";
|
||||||
|
//QAndroidService app(argc, argv);
|
||||||
|
UPDATENEWS* updatenews= UPDATENEWS::instance();
|
||||||
|
updatenews->setDatabase();
|
||||||
|
updatenews->login();
|
||||||
|
updatenews->startsync();
|
||||||
|
//app.connect (updatenews,SIGNAL(quitapp()),&app,SLOT(quit()));
|
||||||
|
//QtAndroid::androidService().callMethod<void>("stopSelf");
|
||||||
|
//return app.exec();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
QQuickView view;
|
||||||
|
QTranslator qtTranslator;
|
||||||
|
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
|
||||||
|
app.installTranslator(&qtTranslator);
|
||||||
|
RemoteAuthAsyncImageProvider *imageProvider = new RemoteAuthAsyncImageProvider;
|
||||||
|
view.engine()->addImageProvider("remoteauthimage",imageProvider);
|
||||||
|
view.rootContext()->setContextProperty("remoteauth", imageProvider);
|
||||||
|
XHR* xhr = XHR::instance();
|
||||||
|
view.rootContext()->setContextProperty("xhr", xhr);
|
||||||
|
FILESYSTEM* filesystem = FILESYSTEM::instance();
|
||||||
|
view.rootContext()->setContextProperty("filesystem", filesystem);
|
||||||
|
ALARM* alarm = ALARM::instance();
|
||||||
|
view.rootContext()->setContextProperty("alarm", alarm);
|
||||||
|
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||||
|
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||||
|
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
|
||||||
|
view.show();
|
||||||
|
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
//#include "AndroidNative/systemdispatcher.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +109,6 @@ void UPDATENEWS::login()
|
||||||
m_updateInterval=0;
|
m_updateInterval=0;
|
||||||
syncindex=0;
|
syncindex=0;
|
||||||
synclist.clear();
|
synclist.clear();
|
||||||
//QSqlQuery syncquery("SELECT * FROM globaloptions WHERE k like 'sync_%' AND v=1",m_db);
|
|
||||||
while (syncquery.next()){
|
while (syncquery.next()){
|
||||||
if (syncquery.value(0).toString()=="syncinterval"){
|
if (syncquery.value(0).toString()=="syncinterval"){
|
||||||
m_updateInterval=syncquery.value(1).toInt();
|
m_updateInterval=syncquery.value(1).toInt();
|
||||||
|
@ -129,9 +127,7 @@ void UPDATENEWS::login()
|
||||||
if (synctimequery.next()){
|
if (synctimequery.next()){
|
||||||
QSqlQuery synctimequery2("UPDATE globaloptions SET v='"+QString::number(QDateTime::currentSecsSinceEpoch()) + "' WHERE k = 'lastsync'",m_db);
|
QSqlQuery synctimequery2("UPDATE globaloptions SET v='"+QString::number(QDateTime::currentSecsSinceEpoch()) + "' WHERE k = 'lastsync'",m_db);
|
||||||
if(!(synctimequery2.exec())) {qDebug()<<" synctimequery2 " << synctimequery2.lastError();}
|
if(!(synctimequery2.exec())) {qDebug()<<" synctimequery2 " << synctimequery2.lastError();}
|
||||||
//qDebug() << " synctimequery ";
|
|
||||||
} else {
|
} else {
|
||||||
//qDebug() << "INSERT INTO globaloptions(k,v) VALUES('lastsync','"+QString::number(QDateTime::currentSecsSinceEpoch()) + "'";
|
|
||||||
QSqlQuery synctimequery3("INSERT INTO globaloptions(k,v) VALUES('lastsync','"+QString::number(QDateTime::currentSecsSinceEpoch()) + "')",m_db);
|
QSqlQuery synctimequery3("INSERT INTO globaloptions(k,v) VALUES('lastsync','"+QString::number(QDateTime::currentSecsSinceEpoch()) + "')",m_db);
|
||||||
if(!(synctimequery3.exec())) {qDebug() << " synctimequery3 " << synctimequery3.lastError();}
|
if(!(synctimequery3.exec())) {qDebug() << " synctimequery3 " << synctimequery3.lastError();}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +256,6 @@ void UPDATENEWS::events()
|
||||||
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
||||||
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(storeEvents(QByteArray,QString)));
|
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(storeEvents(QByteArray,QString)));
|
||||||
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
||||||
//QObject::connect(&xhr, SIGNAL(downloaded(QString, QString, QString, int)), this, SLOT(updateImageLocation(QString,QString, QString, int)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -293,7 +288,10 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
query.bindValue(8,newsitem["geo"]);
|
query.bindValue(8,newsitem["geo"]);
|
||||||
query.bindValue( 9, newsitem["favorited"].toInt());
|
query.bindValue( 9, newsitem["favorited"].toInt());
|
||||||
query.bindValue(10, newsitem["user"]["id"].toInt());
|
query.bindValue(10, newsitem["user"]["id"].toInt());
|
||||||
query.bindValue(11, newsitem["statusnet_html"].toString().toUtf8().toBase64());
|
if (newsitem["friendica_title"]!="") {
|
||||||
|
QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
|
||||||
|
query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
|
||||||
|
else{query.bindValue(11, newsitem["friendica_html"].toString().toUtf8().toBase64());}
|
||||||
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
|
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
|
||||||
QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
|
QJsonArray likeArray;QJsonArray dislikeArray;QJsonArray attendyesArray;QJsonArray attendnoArray;QJsonArray attendmaybeArray;
|
||||||
if (newsitem.toObject().contains("friendica_activities")){
|
if (newsitem.toObject().contains("friendica_activities")){
|
||||||
|
@ -382,7 +380,6 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QList<QJsonValue> newcontacts=findNewContacts(news);
|
QList<QJsonValue> newcontacts=findNewContacts(news);
|
||||||
//qDebug()<< "new contacts count " << newcontacts.size();
|
|
||||||
if (newcontacts.size()>0){
|
if (newcontacts.size()>0){
|
||||||
updateContacts(newcontacts);
|
updateContacts(newcontacts);
|
||||||
startImagedownload();
|
startImagedownload();
|
||||||
|
@ -410,7 +407,6 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
|
||||||
if (downloadtype=="contactlist"){
|
if (downloadtype=="contactlist"){
|
||||||
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||||
testquery.first();
|
testquery.first();
|
||||||
//qDebug()<< "update imageurl for " <<imageurl << " from " <<testquery.value(0).toString() <<" to "<< filename <<" index " << index << " newcontactnames.length " <<newcontactnames.length();
|
|
||||||
QSqlQuery query("UPDATE contacts SET profile_image='"+ filename +"' WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
QSqlQuery query("UPDATE contacts SET profile_image='"+ filename +"' WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||||
if(!(query.exec())) {qDebug()<< "updateImagelocation " << query.lastError();}
|
if(!(query.exec())) {qDebug()<< "updateImagelocation " << query.lastError();}
|
||||||
if (index==(newcontactnames.length()-1)){
|
if (index==(newcontactnames.length()-1)){
|
||||||
|
@ -441,7 +437,6 @@ QList <QJsonValue> UPDATENEWS::findNewContacts(QJsonDocument news){
|
||||||
imageurls.append(query.value(0).toString());
|
imageurls.append(query.value(0).toString());
|
||||||
}
|
}
|
||||||
QList<QJsonValue> newcontacts;
|
QList<QJsonValue> newcontacts;
|
||||||
//qDebug()<<"updatenews findcontacts news count "<<news.array().count();
|
|
||||||
|
|
||||||
for (int i=0; i<news.array().count();i++){
|
for (int i=0; i<news.array().count();i++){
|
||||||
//main contacts
|
//main contacts
|
||||||
|
@ -505,7 +500,6 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
||||||
QJsonValue contact=contacts[i];
|
QJsonValue contact=contacts[i];
|
||||||
QSqlQuery query(m_db);
|
QSqlQuery query(m_db);
|
||||||
try{
|
try{
|
||||||
//qDebug() << "updatecontact " << contact["screen_name"];
|
|
||||||
QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db);
|
QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db);
|
||||||
if (testquery.first()){
|
if (testquery.first()){
|
||||||
query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?,"
|
query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?,"
|
||||||
|
@ -595,7 +589,6 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
||||||
void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
|
void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
|
||||||
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
|
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
|
||||||
QJsonDocument events;
|
QJsonDocument events;
|
||||||
//qDebug()<<apiname << serverreply;
|
|
||||||
QJsonParseError jsonerror;
|
QJsonParseError jsonerror;
|
||||||
events=QJsonDocument::fromJson(serverreply,&jsonerror);
|
events=QJsonDocument::fromJson(serverreply,&jsonerror);
|
||||||
if (events.isArray()){
|
if (events.isArray()){
|
||||||
|
@ -650,7 +643,6 @@ QString UPDATENEWS::url() const
|
||||||
|
|
||||||
void UPDATENEWS::startImagedownload()
|
void UPDATENEWS::startImagedownload()
|
||||||
{
|
{
|
||||||
//qDebug() << "start image download";
|
|
||||||
xhr.setDownloadtype("contactlist");
|
xhr.setDownloadtype("contactlist");
|
||||||
xhr.setFilelist(newcontactimagelinks);
|
xhr.setFilelist(newcontactimagelinks);
|
||||||
xhr.setContactlist(newcontactnames);
|
xhr.setContactlist(newcontactnames);
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
// 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 "uploadableimage.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
void UploadableImage::setSource(const QString &a) {
|
||||||
|
if (a != m_source) {
|
||||||
|
m_source = a;
|
||||||
|
//m_base64 = "";
|
||||||
|
m_mimetype = "";
|
||||||
|
m_filename = "";
|
||||||
|
|
||||||
|
qDebug() << "UploadableImage::setSource : " << m_source;
|
||||||
|
|
||||||
|
if (m_source=="") {
|
||||||
|
emit sourceChanged();
|
||||||
|
//emit base64Changed();
|
||||||
|
emit mimetypeChanged();
|
||||||
|
emit filenameChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage fullimage = QImage(QUrl(m_source).toLocalFile());
|
||||||
|
if (fullimage.width() > 800 || fullimage.height() > 800) {
|
||||||
|
if (fullimage.width() > fullimage.height()) {
|
||||||
|
m_image = fullimage.scaledToWidth(800);
|
||||||
|
} else {
|
||||||
|
m_image = fullimage.scaledToHeight(800);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_image = fullimage;
|
||||||
|
}
|
||||||
|
qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height();
|
||||||
|
emit sourceChanged();
|
||||||
|
|
||||||
|
QFileInfo fi(m_source);
|
||||||
|
|
||||||
|
m_filename = fi.fileName();
|
||||||
|
emit filenameChanged();
|
||||||
|
|
||||||
|
QString filetype = fi.suffix().toUpper();
|
||||||
|
if (filetype!="PNG" && filetype!="JPG") {
|
||||||
|
filetype = "JPG";
|
||||||
|
}
|
||||||
|
qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype;
|
||||||
|
|
||||||
|
m_mimetype = "image/"+filetype.toLower();
|
||||||
|
emit mimetypeChanged();
|
||||||
|
|
||||||
|
/*
|
||||||
|
QByteArray byteArray;
|
||||||
|
QBuffer buffer(&byteArray);
|
||||||
|
m_image.save(&buffer, filetype.toLatin1().constData());
|
||||||
|
QString b64 = QString::fromLatin1(byteArray.toBase64().data());
|
||||||
|
|
||||||
|
for(int k=0; k<b64.length(); k+=76) {
|
||||||
|
m_base64 += b64.mid(k,76) + "\n";
|
||||||
|
}
|
||||||
|
m_base64 = m_base64.trimmed();
|
||||||
|
|
||||||
|
emit base64Changed();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString UploadableImage::source() const {
|
||||||
|
return m_source;
|
||||||
|
}
|
||||||
|
|
||||||
|
//QString UploadableImage::base64() const {
|
||||||
|
// return m_base64;
|
||||||
|
//}
|
||||||
|
|
||||||
|
QString UploadableImage::filename() const {
|
||||||
|
return m_filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString UploadableImage::mimetype() const {
|
||||||
|
return m_mimetype;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray UploadableImage::bytes() {
|
||||||
|
QByteArray byteArray;
|
||||||
|
QBuffer buffer(&byteArray);
|
||||||
|
m_image.save(&buffer, "PNG");
|
||||||
|
return byteArray;
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
// 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 UPLOADABLEIMAGE_H
|
||||||
|
#define UPLOADABLEIMAGE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQuickItem>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
|
class UploadableImage : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
|
||||||
|
//Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed)
|
||||||
|
Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged)
|
||||||
|
Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged)
|
||||||
|
Q_PROPERTY(QByteArray bytes READ bytes)
|
||||||
|
|
||||||
|
public:
|
||||||
|
void setSource(const QString &a);
|
||||||
|
QString source() const;
|
||||||
|
|
||||||
|
//QString base64() const;
|
||||||
|
QString filename() const;
|
||||||
|
QString mimetype() const;
|
||||||
|
|
||||||
|
QByteArray bytes();
|
||||||
|
signals:
|
||||||
|
void sourceChanged();
|
||||||
|
//void base64Changed();
|
||||||
|
void filenameChanged();
|
||||||
|
void mimetypeChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_source;
|
||||||
|
QImage m_image;
|
||||||
|
//QString m_base64;
|
||||||
|
QString m_filename;
|
||||||
|
QString m_mimetype;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UPLOADABLEIMAGE_H
|
369
source-linux/common/xhr (conflicted copy 2019-06-24 214813).cpp
Normal file
369
source-linux/common/xhr (conflicted copy 2019-06-24 214813).cpp
Normal file
|
@ -0,0 +1,369 @@
|
||||||
|
// 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 "xhr.h"
|
||||||
|
|
||||||
|
#include <QHttpPart>
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QUrlQuery>
|
||||||
|
#include <QList>
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include "uploadableimage.h"
|
||||||
|
|
||||||
|
XHR *XHR::instance()
|
||||||
|
{
|
||||||
|
static XHR xhr;
|
||||||
|
return &xhr;
|
||||||
|
}
|
||||||
|
|
||||||
|
XHR::XHR(QObject *parent) : QObject(parent)
|
||||||
|
{
|
||||||
|
request.setSslConfiguration(QSslConfiguration::defaultConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setUrl(QString url)
|
||||||
|
{
|
||||||
|
if (url!=m_url) {
|
||||||
|
m_url = url;
|
||||||
|
emit urlChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setApi(QString api)
|
||||||
|
{
|
||||||
|
if (api!=m_api) {
|
||||||
|
m_api = api;
|
||||||
|
emit apiChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setLogin(QString login)
|
||||||
|
{
|
||||||
|
if (login!=m_login) {
|
||||||
|
m_login = login;
|
||||||
|
emit loginChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setFilename(QString filename)
|
||||||
|
{
|
||||||
|
if (filename!=m_filename) {
|
||||||
|
m_filename = filename;
|
||||||
|
emit filenameChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setContactlist(QList<QString> contactlist)
|
||||||
|
{
|
||||||
|
if (contactlist!=m_contactlist) {
|
||||||
|
m_contactlist = contactlist;
|
||||||
|
emit contactlistChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setFilelist(QList<QString> filelist)
|
||||||
|
{
|
||||||
|
if (filelist!=m_filelist) {
|
||||||
|
m_filelist = filelist;
|
||||||
|
emit filelistChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setImagedir(QString imagedir)
|
||||||
|
{
|
||||||
|
if (imagedir!=m_imagedir) {
|
||||||
|
m_imagedir = imagedir;
|
||||||
|
emit imagedirChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void XHR::setDownloadtype(QString downloadtype)
|
||||||
|
{
|
||||||
|
if (downloadtype!=m_downloadtype) {
|
||||||
|
m_downloadtype = downloadtype;
|
||||||
|
emit downloadtypeChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::url() const
|
||||||
|
{
|
||||||
|
return m_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::api() const
|
||||||
|
{
|
||||||
|
return m_api;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::login() const
|
||||||
|
{
|
||||||
|
return m_login;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::filename() const
|
||||||
|
{
|
||||||
|
return m_filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> XHR::contactlist() const
|
||||||
|
{
|
||||||
|
return m_contactlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QString> XHR::filelist() const
|
||||||
|
{
|
||||||
|
return m_filelist;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::imagedir() const
|
||||||
|
{
|
||||||
|
return m_imagedir;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::downloadtype() const
|
||||||
|
{
|
||||||
|
return m_downloadtype;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::networktype()
|
||||||
|
{
|
||||||
|
return nc.bearerTypeFamily() + nc.bearerTypeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setParam(QString name, QString value)
|
||||||
|
{
|
||||||
|
params.insert(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::setImageFileParam(QString name, QString url)
|
||||||
|
{
|
||||||
|
files.insert(name, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::clearParams()
|
||||||
|
{
|
||||||
|
files.clear();
|
||||||
|
params.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::download()
|
||||||
|
{
|
||||||
|
QUrl requrl(m_url);
|
||||||
|
if(m_downloadtype=="picturelist"){
|
||||||
|
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
||||||
|
QString headerData = "Basic " + loginData;
|
||||||
|
request.setRawHeader("Authorization", headerData.toLocal8Bit());
|
||||||
|
}
|
||||||
|
request.setUrl(requrl);
|
||||||
|
reply = manager.get(request);
|
||||||
|
reply->ignoreSslErrors();
|
||||||
|
connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead);
|
||||||
|
//connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64)));
|
||||||
|
connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished);
|
||||||
|
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
|
||||||
|
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::get()
|
||||||
|
{
|
||||||
|
QUrlQuery query;
|
||||||
|
|
||||||
|
QHashIterator<QString, QString> i(params);
|
||||||
|
while(i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
query.addQueryItem(i.key(), i.value());
|
||||||
|
//qDebug()<<i.key() << " value "<< i.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl requrl(m_url+m_api);
|
||||||
|
//qDebug() << "API "<< requrl<<m_api;
|
||||||
|
requrl.setQuery(query);
|
||||||
|
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
||||||
|
QString headerData = "Basic " + loginData;
|
||||||
|
request.setRawHeader("Authorization", headerData.toLocal8Bit());
|
||||||
|
request.setUrl(requrl);
|
||||||
|
reply = manager.get(request);
|
||||||
|
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess);
|
||||||
|
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||||
|
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
|
||||||
|
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::getlist()
|
||||||
|
{
|
||||||
|
if(dlindex < m_filelist.size()) {
|
||||||
|
QString cleanfilename;
|
||||||
|
if (m_downloadtype=="contactlist"){cleanfilename = m_contactlist.at(dlindex)+"-"+ m_filelist.at(dlindex).section('/',-1).section('?',0,0);
|
||||||
|
XHR::setFilename(imagedir()+"contacts/"+cleanfilename);
|
||||||
|
XHR::setUrl(m_filelist.at(dlindex));}
|
||||||
|
else {
|
||||||
|
XHR::setUrl(m_filelist.at(dlindex));}
|
||||||
|
XHR::download();
|
||||||
|
} else {dlindex=0;m_downloadtype="";m_contactlist.clear();m_filelist.clear();}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void XHR::post()
|
||||||
|
{
|
||||||
|
//qDebug() << "start post to " << m_url;
|
||||||
|
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||||
|
|
||||||
|
QHashIterator<QString, QString> iparams(params);
|
||||||
|
while(iparams.hasNext()) {
|
||||||
|
iparams.next();
|
||||||
|
//qDebug() << "\t add param " << iparams.key() << " : " << iparams.value();
|
||||||
|
QHttpPart textPart;
|
||||||
|
textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\""));
|
||||||
|
|
||||||
|
|
||||||
|
textPart.setBody(iparams.value().toUtf8());
|
||||||
|
multiPart->append(textPart);
|
||||||
|
}
|
||||||
|
|
||||||
|
UploadableImage uimg;
|
||||||
|
QHashIterator<QString, QString> ifiles(files);
|
||||||
|
while(ifiles.hasNext()) {
|
||||||
|
ifiles.next();
|
||||||
|
|
||||||
|
uimg.setSource(ifiles.value());
|
||||||
|
//qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key();
|
||||||
|
|
||||||
|
QHttpPart imagePart;
|
||||||
|
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype()));
|
||||||
|
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\""));
|
||||||
|
imagePart.setBody(uimg.bytes());
|
||||||
|
multiPart->append(imagePart);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
||||||
|
QString headerData = "Basic " + loginData;
|
||||||
|
request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit());
|
||||||
|
|
||||||
|
request.setUrl(m_url+m_api);
|
||||||
|
reply = manager.post(request, multiPart);
|
||||||
|
qDebug() << "\t request sent";
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess);
|
||||||
|
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError)));
|
||||||
|
connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead);
|
||||||
|
connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError);
|
||||||
|
qDebug() << "\t reply signals connected";
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::onReplyError(QNetworkReply::NetworkError code)
|
||||||
|
{
|
||||||
|
qDebug() << code;
|
||||||
|
emit this->error( bufferToString(), m_url,m_api, (int) code);
|
||||||
|
buffer.clear();
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::onReplySuccess()
|
||||||
|
{
|
||||||
|
qDebug() << "!";
|
||||||
|
emit this->success(buffer, m_api);
|
||||||
|
buffer.clear();
|
||||||
|
// reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::onRequestFinished()
|
||||||
|
{
|
||||||
|
qDebug()<<"download requestFinished ";
|
||||||
|
// Save the file here
|
||||||
|
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);}
|
||||||
|
else if (m_downloadtype=="picturelist") {
|
||||||
|
QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer);
|
||||||
|
QJsonObject jsonObject = jsonResponse.object();
|
||||||
|
int arraystart=buffer.indexOf('{"data":"')+8;
|
||||||
|
int arraylength=buffer.indexOf('"',9)-arraystart;
|
||||||
|
QByteArray b64=buffer.mid(arraystart,arraylength);
|
||||||
|
QString helpfilename=jsonObject["filename"].toString();
|
||||||
|
QString helpfile=helpfilename.left(helpfilename.lastIndexOf("."));
|
||||||
|
QString filesuffix="";
|
||||||
|
if (jsonObject["type"].toString()=="image/jpeg"){filesuffix=".jpg";}
|
||||||
|
else if (jsonObject["type"].toString()=="image/png"){filesuffix=".png";}
|
||||||
|
else {filesuffix="";}
|
||||||
|
if (helpfilename==""){// check if file has any filename
|
||||||
|
helpfile=jsonObject["id"].toString();
|
||||||
|
setFilename(imagedir()+"albums/"+jsonObject["album"].toString()+"/"+jsonObject["id"].toString()+filesuffix);
|
||||||
|
}
|
||||||
|
else{setFilename(imagedir()+"albums/"+jsonObject["album"].toString()+"/"+helpfile+filesuffix);}
|
||||||
|
//qDebug()<<"Filename "<<m_filename;
|
||||||
|
QFile file(m_filename);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
file.write(QByteArray::fromBase64(b64));
|
||||||
|
buffer.clear();
|
||||||
|
b64.clear();
|
||||||
|
file.close();
|
||||||
|
jsonObject["data"]="";
|
||||||
|
jsonObject["filename"]=helpfile+filesuffix;
|
||||||
|
emit this->downloadedjson(m_downloadtype,m_url,m_filename,dlindex,jsonObject);
|
||||||
|
if(downloadtype()=="picturelist"){dlindex=dlindex+1;XHR::getlist();}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QFile file(m_filename);
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
file.write(buffer);
|
||||||
|
buffer.clear();
|
||||||
|
file.close();
|
||||||
|
emit this->downloaded(m_downloadtype,m_url,m_filename,dlindex);
|
||||||
|
if(downloadtype()=="contactlist"){dlindex=dlindex+1;XHR::getlist();}
|
||||||
|
|
||||||
|
//reply->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void XHR::onReadyRead()
|
||||||
|
{
|
||||||
|
qDebug() << ".";
|
||||||
|
buffer += reply->readAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
//void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
|
//{
|
||||||
|
// qDebug() << "Bytes: " << bytesRead<<" / "<<totalBytes;
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
void XHR::onSSLError(const QList<QSslError> &errors)
|
||||||
|
{
|
||||||
|
qDebug() << "XHR::onSSLError :" ;
|
||||||
|
QListIterator<QSslError> ierrs(errors);
|
||||||
|
while(ierrs.hasNext()) {
|
||||||
|
qDebug() << "\t" << ierrs.next().errorString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString XHR::bufferToString()
|
||||||
|
{
|
||||||
|
return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
|
||||||
|
}
|
|
@ -154,11 +154,6 @@ QString XHR::downloadtype() const
|
||||||
return m_downloadtype;
|
return m_downloadtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString XHR::networktype()
|
|
||||||
{
|
|
||||||
return nc.bearerTypeFamily() + nc.bearerTypeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void XHR::setParam(QString name, QString value)
|
void XHR::setParam(QString name, QString value)
|
||||||
{
|
{
|
||||||
params.insert(name, value);
|
params.insert(name, value);
|
||||||
|
@ -261,19 +256,6 @@ void XHR::post()
|
||||||
imagePart.setBody(uimg.bytes());
|
imagePart.setBody(uimg.bytes());
|
||||||
multiPart->append(imagePart);
|
multiPart->append(imagePart);
|
||||||
}
|
}
|
||||||
// QHashIterator<QString, QString> ifiles(files);
|
|
||||||
// while(ifiles.hasNext()) {
|
|
||||||
// ifiles.next();
|
|
||||||
|
|
||||||
// uimg.setSource(ifiles.value());
|
|
||||||
// //qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key();
|
|
||||||
|
|
||||||
// QHttpPart imagePart;
|
|
||||||
// imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype()));
|
|
||||||
// imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\""));
|
|
||||||
// imagePart.setBody(uimg.bytes());
|
|
||||||
// multiPart->append(imagePart);
|
|
||||||
// }
|
|
||||||
|
|
||||||
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
||||||
QString headerData = "Basic " + loginData;
|
QString headerData = "Basic " + loginData;
|
||||||
|
|
|
@ -49,7 +49,7 @@ class XHR : public QObject
|
||||||
Q_PROPERTY(QList<QString> contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged)
|
Q_PROPERTY(QList<QString> contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged)
|
||||||
Q_PROPERTY(QList<QString> filelist READ filelist WRITE setFilelist NOTIFY filelistChanged)
|
Q_PROPERTY(QList<QString> filelist READ filelist WRITE setFilelist NOTIFY filelistChanged)
|
||||||
Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged)
|
Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged)
|
||||||
Q_PROPERTY(QString networktype READ networktype() NOTIFY networktypeChanged)
|
//Q_PROPERTY(QString networktype READ networktype() NOTIFY networktypeChanged)
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -65,7 +65,7 @@ public:
|
||||||
QList<QString> filelist() const;
|
QList<QString> filelist() const;
|
||||||
QString imagedir() const;
|
QString imagedir() const;
|
||||||
QString downloadtype() const;
|
QString downloadtype() const;
|
||||||
QString networktype();
|
// QString networktype();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void urlChanged();
|
void urlChanged();
|
||||||
|
@ -116,7 +116,7 @@ private:
|
||||||
QString m_login;
|
QString m_login;
|
||||||
QString m_filename;
|
QString m_filename;
|
||||||
QString m_downloadtype;
|
QString m_downloadtype;
|
||||||
QString m_networktype;
|
// QString m_networktype;
|
||||||
QHash<QString, QString> params;
|
QHash<QString, QString> params;
|
||||||
QHash<QString, QString> files;
|
QHash<QString, QString> files;
|
||||||
QList<QString> m_filelist;
|
QList<QString> m_filelist;
|
||||||
|
@ -127,7 +127,7 @@ private:
|
||||||
QNetworkAccessManager manager;
|
QNetworkAccessManager manager;
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
QNetworkReply *reply;
|
QNetworkReply *reply;
|
||||||
QNetworkConfiguration nc;
|
//QNetworkConfiguration nc;
|
||||||
QString bufferToString();
|
QString bufferToString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -172,11 +172,11 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
|
||||||
// })
|
// })
|
||||||
//}
|
//}
|
||||||
|
|
||||||
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){print("newRequestFriendsAlbumPictures");
|
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){//print("newRequestFriendsAlbumPictures");
|
||||||
// screenscraping of albums page of contact with remoteAuth
|
// screenscraping of albums page of contact with remoteAuth
|
||||||
//commented out for broken remoteauth
|
//commented out for broken remoteauth
|
||||||
//Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
||||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
//Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||||
try {var obj=JSON.parse(photohtml);print ("Photohtml: "+photohtml)
|
try {var obj=JSON.parse(photohtml);print ("Photohtml: "+photohtml)
|
||||||
if (obj.hasOwnProperty('status')){
|
if (obj.hasOwnProperty('status')){
|
||||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||||
|
@ -190,7 +190,7 @@ function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){print(
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){
|
function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){
|
||||||
print(photohtml);
|
//print(photohtml);
|
||||||
var photoarray=[];
|
var photoarray=[];
|
||||||
var arr = photohtml.split("sidebar-photos-albums-li");
|
var arr = photohtml.split("sidebar-photos-albums-li");
|
||||||
for (var i=2;i<arr.length;i++){
|
for (var i=2;i<arr.length;i++){
|
||||||
|
|
|
@ -86,6 +86,37 @@ function listFriends(login,database,callback,filter){
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function listHashtags(login,database,callback){
|
||||||
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
|
db.transaction( function(tx) {
|
||||||
|
var result = tx.executeSql('SELECT * from hashtags WHERE username="'+login.username+'" ORDER BY date DESC LIMIT 50');
|
||||||
|
// check for friends
|
||||||
|
var taglist=[];
|
||||||
|
for (var i=0;i<result.rows.length;i++){
|
||||||
|
var tag=result.rows.item(i).tag;
|
||||||
|
tag=Qt.atob(tag);
|
||||||
|
taglist.push(tag)}
|
||||||
|
callback(taglist)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function storeHashtags(login,database,newstext,rootwindow){
|
||||||
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
|
var curDate= Date.now();
|
||||||
|
var hashtags=[];
|
||||||
|
hashtags=findTags(newstext);
|
||||||
|
for (var tag in hashtags){
|
||||||
|
db.transaction( function(tx) {
|
||||||
|
var result = tx.executeSql('SELECT * from hashtags where username="'+login.username+'" AND tag = "'+Qt.btoa(tag)+'"'); // check for tag
|
||||||
|
if(result.rows.length === 1) {// use update
|
||||||
|
result = tx.executeSql('UPDATE hashtags SET tag="'+'", date='+curDate+', ownership=0 where username="'+login.username+'" AND tag="'+Qt.btoa(hashtags[tag])+'"');
|
||||||
|
} else {// use insert
|
||||||
|
result = tx.executeSql('INSERT INTO hashtags (username,tag,date,statuses,ownership) VALUES (?,?,?,?,?)', [login.username,Qt.btoa(hashtags[tag]),curDate,"[]",0])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function deleteGroup(login,database,rootwindow,group, callback){
|
function deleteGroup(login,database,rootwindow,group, callback){
|
||||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
Helperjs.friendicaPostRequest(login,"/api/friendica/group_delete?gid="+group.gid+"&name="+group.groupname,"","POST",rootwindow, function (obj){
|
Helperjs.friendicaPostRequest(login,"/api/friendica/group_delete?gid="+group.gid+"&name="+group.groupname,"","POST",rootwindow, function (obj){
|
||||||
|
@ -199,67 +230,20 @@ function storeNews(login,database,news,rootwindow){
|
||||||
}
|
}
|
||||||
var friendica_activities=[likearray,dislikearray,attendyesarray,attendnoarray,attendmaybearray]
|
var friendica_activities=[likearray,dislikearray,attendyesarray,attendnoarray,attendmaybearray]
|
||||||
var attachments="";if (news[i].attachments){attachments=Qt.btoa(JSON.stringify(news[i].attachments))}
|
var attachments="";if (news[i].attachments){attachments=Qt.btoa(JSON.stringify(news[i].attachments))}
|
||||||
|
|
||||||
|
if (news[i].friendica_title!="") {news[i].statusnet_html="<b>"+news[i].friendica_title +"</b><br><br>"+news[i].friendica_html;}
|
||||||
|
else{news[i].statusnet_html=news[i].friendica_html}
|
||||||
|
|
||||||
db.transaction( function(tx) {
|
db.transaction( function(tx) {
|
||||||
var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+news[i].id+'" AND messagetype='+news[i].messagetype); // check for news id
|
var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+news[i].id+'" AND messagetype='+news[i].messagetype); // check for news id
|
||||||
if(result.rows.length === 1) {// use update
|
if(result.rows.length === 1) {// use update
|
||||||
//print(news[i].id +' news exists, update it'+'UPDATE news SET username="'+login.username+'", messagetype=0, text="'+Qt.btoa(news[i].text)+'", created_at="'+Date.parse(cleanDate(news[i].created_at))+'", in_reply_to_status_id="'+news[i].in_reply_to_status_id+'", source="'+news[i].source+'", status_id="'+news[i].id+'", in_reply_to_user_id="'+news[i].in_reply_to_user_id+'", geo="'+news[i].geo+'", favorited="'+news[i].favorited+'", uid="'+news[i].user.id+'", statusnet_html="'+Qt.btoa(news[i].status_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_owner.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0')
|
//print(news[i].id +' news exists, update it'+'UPDATE news SET username="'+login.username+'", messagetype=0, text="'+Qt.btoa(news[i].text)+'", created_at="'+Date.parse(cleanDate(news[i].created_at))+'", in_reply_to_status_id="'+news[i].in_reply_to_status_id+'", source="'+news[i].source+'", status_id="'+news[i].id+'", in_reply_to_user_id="'+news[i].in_reply_to_user_id+'", geo="'+news[i].geo+'", favorited="'+news[i].favorited+'", uid="'+news[i].user.id+'", statusnet_html="'+Qt.btoa(news[i].status_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_owner.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0')
|
||||||
result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype='+news[i].messagetype+', text="'+Qt.btoa(news[i].text)+'", created_at="'+news[i].created_at+'", in_reply_to_status_id="'+news[i].in_reply_to_status_id+'", source="'+news[i].source+'", status_id="'+news[i].id+'", in_reply_to_user_id="'+news[i].in_reply_to_user_id+'", geo="'+news[i].geo+'", favorited="'+news[i].favorited+'", uid="'+news[i].user.id+'", statusnet_html="'+Qt.btoa(news[i].status_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_author.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0');
|
result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype='+news[i].messagetype+', text="'+Qt.btoa(news[i].text)+'", created_at="'+news[i].created_at+'", in_reply_to_status_id="'+news[i].in_reply_to_status_id+'", source="'+news[i].source+'", status_id="'+news[i].id+'", in_reply_to_user_id="'+news[i].in_reply_to_user_id+'", geo="'+news[i].geo+'", favorited="'+news[i].favorited+'", uid="'+news[i].user.id+'", statusnet_html="'+Qt.btoa(news[i].statusnet_html)+'", statusnet_conversation_id="'+news[i].statusnet_conversation_id+'",friendica_activities="'+Qt.btoa(JSON.stringify(friendica_activities))+'",attachments="'+attachments+'",friendica_owner="'+news[i].friendica_author.url+'" where username="'+login.username+'" AND status_id="'+news[i].status_id+'" AND messagetype=0');
|
||||||
} else {// use insert
|
} else {// use insert
|
||||||
result = tx.executeSql('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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,news[i].messagetype,Qt.btoa(news[i].text),news[i].created_at, news[i].in_reply_to_status_id, news[i].source, news[i].id,news[i].in_reply_to_user_id,news[i].geo,news[i].favorited, news[i].user.id,Qt.btoa(news[i].statusnet_html),news[i].statusnet_conversation_id, Qt.btoa(JSON.stringify(friendica_activities)),"[]",attachments,news[i].friendica_author.url])}})
|
result = tx.executeSql('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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,news[i].messagetype,Qt.btoa(news[i].text),news[i].created_at, news[i].in_reply_to_status_id, news[i].source, news[i].id,news[i].in_reply_to_user_id,news[i].geo,news[i].favorited, news[i].user.id,Qt.btoa(news[i].statusnet_html),news[i].statusnet_conversation_id, Qt.btoa(JSON.stringify(friendica_activities)),"[]",attachments,news[i].friendica_author.url])}})
|
||||||
}
|
}
|
||||||
// getDirectMessage(login,database,rootwindow,callback)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//function getDirectMessage(login,database,rootwindow,callback){
|
|
||||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
|
||||||
// var parameter = "";
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=1 ORDER BY status_id DESC LIMIT 1'); // check for last news id
|
|
||||||
// try{parameter="&since_id="+result.rows.item(0).status_id;}catch(e){};})
|
|
||||||
// Helperjs.friendicaRequest(login,"/api/direct_messages/all"+parameter,rootwindow, function (obj){
|
|
||||||
// var messages=JSON.parse(obj);
|
|
||||||
// for (var i=0;i<messages.length;i++){
|
|
||||||
// //print('store message data for '+JSON.stringify(messages[i]));
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// var result = tx.executeSql('SELECT * from news where username= "'+login.username+'" AND status_id = "'+messages[i].id+'" AND messagetype=1'); // check for news id
|
|
||||||
// if(result.rows.length === 1) {// use update
|
|
||||||
// print(messages[i].id +' directmessage exists, update it')
|
|
||||||
// result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype=1, text="'+Qt.btoa(messages[i].text)+'", created_at="'+Date.parse(cleanDate(messages[i].created_at))+'", source="Friendica", status_id="'+messages[i].id+'", uid="'+messages[i].sender.id+'", statusnet_html="'+Qt.btoa(messages[i].text)+'", statusnet_conversation_id="'+messages[i].friendica_parent_uri+'" where username="'+login.username+'" AND status_id="'+messages[i].status_id+'" AND messagetype=1');
|
|
||||||
// } else {// use insert
|
|
||||||
// result = tx.executeSql('INSERT INTO news (username,messagetype,text,created_at,source,status_id,uid,statusnet_html,statusnet_conversation_id) VALUES (?,?,?,?,?,?,?,?,?)', [login.username,1,Qt.btoa(messages[i].text),Date.parse(cleanDate(messages[i].created_at)), "Friendica", messages[i].id, messages[i].sender.id,Qt.btoa(messages[i].text),messages[i].friendica_parent_uri])}
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// callback()
|
|
||||||
//// if(login.newsViewType=="Timeline"){newsfromdb(database,login.username,callback)}
|
|
||||||
//// else{chatsfromdb(database,login.username,callback)}
|
|
||||||
//}
|
|
||||||
|
|
||||||
//function getNotifications(login,database,rootwindow,callback){
|
|
||||||
// Helperjs.friendicaRequest(login,"/api/friendica/notifications", rootwindow,function (obj){
|
|
||||||
// var messages=JSON.parse(obj);
|
|
||||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
|
||||||
// for (var i=0;i<messages.length;i++){
|
|
||||||
// //print('store message data for '+JSON.stringify(messages[i]));
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// var result = tx.executeSql('SELECT * from news where username="'+login.username+'" AND status_id = "'+messages[i].id+'" AND messagetype=2'); // check for news id
|
|
||||||
// if(result.rows.length === 1) {// use update
|
|
||||||
// print(messages[i].id +' Notification exists, update it')
|
|
||||||
// result = tx.executeSql('UPDATE news SET username="'+login.username+'", messagetype=2, text="'+Qt.btoa(messages[i].msg_html)+'", created_at="'+Date.parse(messages[i].date)+'", source="Friendica", status_id="'+messages[i].id+'", uid="'+messages[i].uid+'", statusnet_html="'+Qt.btoa(messages[i].msg_html)+'", statusnet_conversation_id="'+messages[i].parent+'" where username="'+login.username+'" AND status_id="'+messages[i].id+'" AND messagetype=2');
|
|
||||||
// } else {// use insert
|
|
||||||
// result = tx.executeSql('INSERT INTO news (username,messagetype,text,created_at,source,status_id, uid,statusnet_html,statusnet_conversation_id) VALUES (?,?,?,?,?,?,?,?,?)', [login.username,2,Qt.btoa(messages[i].msg_html),Date.parse(messages[i].date),"Friendica", messages[i].id, messages[i].uid,Qt.btoa(messages[i].msg_html),messages[i].parent])}
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// var newsrs=tx.executeSql('select * from news WHERE username="'+login.username+'" AND messagetype=2 ORDER BY status_id DESC LIMIT 20');
|
|
||||||
// var newsArray=[];
|
|
||||||
// for(var j = 0; j < newsrs.rows.length; j++) {
|
|
||||||
// newsArray.push(newsrs.rows.item(j));
|
|
||||||
// newsArray[j].statusnet_html=Qt.atob(newsArray[j].statusnet_html);
|
|
||||||
// callback(newsArray);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
//})}
|
|
||||||
|
|
||||||
function getActivitiesUserData(allcontacts,userUrlArray){//print(JSON.stringify(userUrlArray));
|
function getActivitiesUserData(allcontacts,userUrlArray){//print(JSON.stringify(userUrlArray));
|
||||||
var helpArray=[];
|
var helpArray=[];
|
||||||
|
@ -341,9 +325,9 @@ function retweetNews(login,database,newsid,rootwindow,callback){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function favorite(login,favorite,newsid,rootwindow){
|
function favorite(login,favorited,newsid,rootwindow){
|
||||||
// toggle favorites
|
// toggle favorites
|
||||||
if(favorite){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
|
if(favorited){ Helperjs.friendicaPostRequest(login,"/api/favorites/create?id="+newsid,"","POST", rootwindow,function (obj){
|
||||||
})}
|
})}
|
||||||
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
|
else {Helperjs.friendicaPostRequest(login,"/api/favorites/destroy?id="+newsid,"","POST",rootwindow,function (obj){
|
||||||
})}
|
})}
|
||||||
|
@ -443,21 +427,6 @@ function requestFavorites(login,database,contacts,rootwindow,callback){
|
||||||
callback(news,newContacts)
|
callback(news,newContacts)
|
||||||
})}
|
})}
|
||||||
|
|
||||||
//function favoritesfromdb(database,user,callback){
|
|
||||||
// var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// //print('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
|
|
||||||
// var newsrs=tx.executeSql('select * from news WHERE username="'+user+'" AND favorited=1 ORDER BY status_id DESC');
|
|
||||||
// var newsArray=[];
|
|
||||||
// var allcontacts=getAllContacts(database,user);
|
|
||||||
// for(var i = 0; i < newsrs.rows.length; i++) {
|
|
||||||
// newsArray.push(newsrs.rows.item(i));
|
|
||||||
// newsArray[i].statusnet_html=Qt.atob(newsArray[i].statusnet_html);
|
|
||||||
// newsArray[i].id=newsArray[i].status_id;
|
|
||||||
// newsArray[i]=fetchUsersForNews(database,user,newsArray[i],allcontacts);
|
|
||||||
// if (newsArray[i].attachments!==null){newsArray[i].attachments=JSON.parse(Qt.atob(newsArray[i].attachments))};
|
|
||||||
// callback(newsArray);
|
|
||||||
// }})}
|
|
||||||
|
|
||||||
function chatsfromdb(database,login,messagetype,callback,stop_time){
|
function chatsfromdb(database,login,messagetype,callback,stop_time){
|
||||||
|
|
||||||
|
@ -598,3 +567,7 @@ function cleanDate(date){
|
||||||
var cleanedDate= date.slice(0,3)+", "+date.slice(8,11)+date.slice(4,7)+date.slice(25,30)+date.slice(10,25);
|
var cleanedDate= date.slice(0,3)+", "+date.slice(8,11)+date.slice(4,7)+date.slice(25,30)+date.slice(10,25);
|
||||||
return cleanedDate
|
return cleanedDate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function findTags(fulltext){
|
||||||
|
return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g)
|
||||||
|
}
|
||||||
|
|
|
@ -144,6 +144,7 @@ else{
|
||||||
|
|
||||||
if (newsitemobject.hasOwnProperty("currentconversation")&&(newsitemobject.currentconversation.length>1)){
|
if (newsitemobject.hasOwnProperty("currentconversation")&&(newsitemobject.currentconversation.length>1)){
|
||||||
newsitemobject.lastcomment=beautify(newsitemobject.currentconversation[newsitemobject.currentconversation.length-1],msg);
|
newsitemobject.lastcomment=beautify(newsitemobject.currentconversation[newsitemobject.currentconversation.length-1],msg);
|
||||||
|
newsitemobject.lastcomment.indent=1
|
||||||
//print("Currentconversation" + newsitemobject.currentconversation.length+JSON.stringify(newsitemobject.lastcomment))
|
//print("Currentconversation" + newsitemobject.currentconversation.length+JSON.stringify(newsitemobject.lastcomment))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,12 @@ function initDatabase(database) { // initialize the database object
|
||||||
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
|
tx.executeSql('CREATE TABLE IF NOT EXISTS profiles(username TEXT, id INT, profiledata TEXT)');
|
||||||
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
|
tx.executeSql('CREATE TABLE IF NOT EXISTS groups(username TEXT, groupname TEXT, gid INT, members TEXT)');
|
||||||
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
|
tx.executeSql('CREATE TABLE IF NOT EXISTS events(username TEXT, id INT, start INT, end INT, allday INT, title TEXT, j INT, d TEXT, isFirst INT, uid INT, cid INT, uri TEXT, created INT, edited INT, desc TEXT, location TEXT, type TEXT, nofinish TEXT, adjust INT, ignore INT, permissions TEXT, guid INT, itemid INT, plink TEXT, authorName TEXT, authorAvatar TEXT, authorLink TEXT, html TEXT)');
|
||||||
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)')
|
tx.executeSql('CREATE TABLE IF NOT EXISTS globaloptions(k TEXT, v TEXT)');
|
||||||
})}
|
tx.executeSql('CREATE TABLE IF NOT EXISTS friendshiprequests(username TEXT, id INT, usernamef TEXT, acct TEXT, display_name TEXT, locked TEXT, created_at INT, followers_count INT, following_count INT, statuses_count INT, note TEXT, url TEXT, avatar TEXT, avatar_static TEXT, header TEXT, header_static TEXT, emojis TEXT, moved TEXT, fields TEXT, bot TEXT, groupf TEXT, discoverable TEXT, last_status_at INT)');
|
||||||
|
tx.executeSql('CREATE TABLE IF NOT EXISTS hashtags(username TEXT, tag TEXT,date INT, statuses TEXT, ownership INT )');
|
||||||
|
tx.executeSql('CREATE TABLE IF NOT EXISTS drafts(username TEXT, header TEXT, statushtml TEXT, attachments TEXT, permissions TEXT, sendtime INT)');
|
||||||
|
|
||||||
|
})}
|
||||||
|
|
||||||
function cleanPermissions(oldperms){
|
function cleanPermissions(oldperms){
|
||||||
var newperms=oldperms.replace("<","");newperms=newperms.replace(">","");newperms="["+newperms+"]";
|
var newperms=oldperms.replace("<","");newperms=newperms.replace(">","");newperms="["+newperms+"]";
|
||||||
|
@ -263,16 +267,9 @@ try {Helperjs.friendicaRequest(login,"/api/statusnet/config",rootwindow, functio
|
||||||
"\nFriendica version: "+serverconfig.site.friendica.FRIENDICA_VERSION+"\nDFRN version: "+serverconfig.site.friendica.DFRN_PROTOCOL_VERSION +
|
"\nFriendica version: "+serverconfig.site.friendica.FRIENDICA_VERSION+"\nDFRN version: "+serverconfig.site.friendica.DFRN_PROTOCOL_VERSION +
|
||||||
"\nDB Update version: "+serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
|
"\nDB Update version: "+serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
|
||||||
|
|
||||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
db.transaction( function(tx) {
|
db.transaction( function(tx) {
|
||||||
var result = tx.executeSql('UPDATE config SET APIVersion="'+ serverconfig.site.friendica.FRIENDICA_VERSION+'" WHERE username="'+login.username +'"')})
|
var result = tx.executeSql('UPDATE config SET APIVersion="'+ serverconfig.site.friendica.FRIENDICA_VERSION+'" WHERE username="'+login.username +'"')})
|
||||||
|
|
||||||
// Helperjs.friendicaRequest(login,"/friendica/json",rootwindow, function (obj){
|
|
||||||
// var serverData = JSON.parse(obj);var serverAddons=JSON.stringify(serverData.plugins).replace(/"/g,"");
|
|
||||||
// db.transaction( function(tx) {
|
|
||||||
// var result = tx.executeSql('UPDATE config SET addons="'+ serverAddons+'" WHERE username="'+login.username +'"')})
|
|
||||||
|
|
||||||
// })
|
|
||||||
callback(serverconfigString);
|
callback(serverconfigString);
|
||||||
})}
|
})}
|
||||||
catch (e){callback (e);
|
catch (e){callback (e);
|
||||||
|
@ -371,8 +368,7 @@ function updateNewsviewtype(database, newsViewtype){
|
||||||
function cleanNews(database,callback){
|
function cleanNews(database,callback){
|
||||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
db.transaction( function(tx) {
|
db.transaction( function(tx) {
|
||||||
//var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config");
|
var maxnewsrs = tx.executeSql("SELECT v FROM globaloptions WHERE k='max_news'");
|
||||||
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};
|
var maxnews=1000; if(maxnewsrs.rows.length>0){ maxnews=maxnewsrs.rows.item(0).v};
|
||||||
for (var i=0; i<6;i++){
|
for (var i=0; i<6;i++){
|
||||||
if (i!=0){var maxnewsa=maxnews/5}else{maxnewsa=maxnews}
|
if (i!=0){var maxnewsa=maxnews/5}else{maxnewsa=maxnews}
|
||||||
|
@ -381,8 +377,6 @@ function cleanNews(database,callback){
|
||||||
if (newscountrs.rows.length>0){newscount=newscountrs.rows.item(0)["COUNT(*)"]};//print(i+"newscount "+newscount)
|
if (newscountrs.rows.length>0){newscount=newscountrs.rows.item(0)["COUNT(*)"]};//print(i+"newscount "+newscount)
|
||||||
if (newscount>maxnewsa){
|
if (newscount>maxnewsa){
|
||||||
var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(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 lastvalidtime=lastvalidtimers.rows.item(newscount-maxnewsa-1).created_at;
|
||||||
var deleters = tx.executeSql('DELETE from news WHERE messagetype='+i+' AND created_at<='+lastvalidtime)}
|
var deleters = tx.executeSql('DELETE from news WHERE messagetype='+i+' AND created_at<='+lastvalidtime)}
|
||||||
}
|
}
|
||||||
|
@ -406,6 +400,20 @@ function cleanContacts(login,database,callback){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanHashtags(database,callback){
|
||||||
|
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||||
|
db.transaction( function(tx) {
|
||||||
|
var tagcountrs = tx.executeSql('SELECT COUNT(*) from hashtags');
|
||||||
|
var tagcount = 0;
|
||||||
|
if (tagcountrs.rows.length>0){tagcount=tagcountrs.rows.item(0)["COUNT(*)"]};
|
||||||
|
if (tagcount>50){
|
||||||
|
var lastvaliddaters= tx.executeSql('SELECT DISTINCT date FROM hashtags ORDER BY date ASC LIMIT ' +(tagcount-50));
|
||||||
|
var lastvaliddate=lastvaliddaters.rows.item(tagcount-49).date;
|
||||||
|
var deleters = tx.executeSql('DELETE from hashtags WHERE date<='+lastvaliddate)}
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function updateContactInDB(login,database,isFriend,contact){// for newstab and friendstab
|
function updateContactInDB(login,database,isFriend,contact){// for newstab and friendstab
|
||||||
var currentTime=Date.now();
|
var currentTime=Date.now();
|
||||||
var image_timestamp=0;
|
var image_timestamp=0;
|
||||||
|
@ -424,8 +432,6 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f
|
||||||
}
|
}
|
||||||
|
|
||||||
function processNews(api,data){
|
function processNews(api,data){
|
||||||
//print("processNews "+api + data);
|
|
||||||
|
|
||||||
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
|
try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;};
|
||||||
if (data==""){}
|
if (data==""){}
|
||||||
else if (typeof(newslist)=='undefined'){
|
else if (typeof(newslist)=='undefined'){
|
||||||
|
@ -478,6 +484,9 @@ function processNews(api,data){
|
||||||
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
|
if (api=="/api/statuses/replies"){newslist[n].messagetype=3}else{newslist[n].messagetype=0;}
|
||||||
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
|
newslist[n].friendica_author=cleanUser(newslist[n].friendica_author);
|
||||||
newslist[n].user=cleanUser(newslist[n].user);
|
newslist[n].user=cleanUser(newslist[n].user);
|
||||||
|
if (newslist[n].friendica_title!="") {newslist[n].statusnet_html="<b>"+newslist[n].friendica_title +"</b><br><br>"+newslist[n].friendica_html;}
|
||||||
|
else{newslist[n].statusnet_html=newslist[n].friendica_html}
|
||||||
|
|
||||||
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
|
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
|
||||||
if(newslist[n].hasOwnProperty('friendica_activities')){
|
if(newslist[n].hasOwnProperty('friendica_activities')){
|
||||||
for (var m in newslist[n].friendica_activities.like){
|
for (var m in newslist[n].friendica_activities.like){
|
||||||
|
@ -653,12 +662,9 @@ function showGroups(){
|
||||||
|
|
||||||
function setBackgroundsync(){
|
function setBackgroundsync(){
|
||||||
Helperjs.readData(db,"globaloptions","",function(lastsync){
|
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))){
|
if((lastsync.length>0)&&((parseFloat(lastsync[0]["v"])+120)<(Date.now()/1000))){
|
||||||
alarm.setAlarm(root.globaloptions.syncinterval);
|
alarm.setAlarm(root.globaloptions.syncinterval);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},"k","lastsync")
|
},"k","lastsync")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ Item {
|
||||||
id: placeHolder
|
id: placeHolder
|
||||||
color: 'lightblue'; antialiasing: true
|
color: 'lightblue'; antialiasing: true
|
||||||
anchors.fill:parent
|
anchors.fill:parent
|
||||||
|
radius: 0.5*mm
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id:daytext
|
id:daytext
|
||||||
|
|
|
@ -106,7 +106,7 @@ Rectangle {
|
||||||
Connections{
|
Connections{
|
||||||
target: updatenews
|
target: updatenews
|
||||||
|
|
||||||
onSuccess:{
|
function onSuccess(api){
|
||||||
calBusy.running=false;
|
calBusy.running=false;
|
||||||
showEvents("")
|
showEvents("")
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ Rectangle{
|
||||||
height:parent.height-12*mm
|
height:parent.height-12*mm
|
||||||
x:mm
|
x:mm
|
||||||
y:mm
|
y:mm
|
||||||
|
radius: 0.5*mm
|
||||||
property var daylist:[]
|
property var daylist:[]
|
||||||
property int dayint: 0
|
property int dayint: 0
|
||||||
MButton{
|
MButton{
|
||||||
|
@ -88,6 +89,7 @@ Rectangle{
|
||||||
height:eventNameText.height+eventDetailsText.height+mm
|
height:eventNameText.height+eventDetailsText.height+mm
|
||||||
border.color: "light grey"
|
border.color: "light grey"
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
radius: 0.5*mm
|
||||||
Image {
|
Image {
|
||||||
id:profileImage
|
id:profileImage
|
||||||
source: ((event.eventOwner.profile_image!="") && (typeof(event.eventOwner.profile_image)=="string"))? "file://"+event.eventOwner.profile_image : event.eventOwner.profile_image_url
|
source: ((event.eventOwner.profile_image!="") && (typeof(event.eventOwner.profile_image)=="string"))? "file://"+event.eventOwner.profile_image : event.eventOwner.profile_image_url
|
||||||
|
|
|
@ -45,6 +45,8 @@ Page{
|
||||||
height: root.height
|
height: root.height
|
||||||
property var users:[]
|
property var users:[]
|
||||||
property var userdata: ({})
|
property var userdata: ({})
|
||||||
|
property string imagestoredir: ""
|
||||||
|
|
||||||
|
|
||||||
function setServericon(server){
|
function setServericon(server){
|
||||||
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",accountPage, function (obj){
|
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",accountPage, function (obj){
|
||||||
|
@ -57,7 +59,8 @@ Page{
|
||||||
id:userButton
|
id:userButton
|
||||||
height: 8*mm
|
height: 8*mm
|
||||||
text:qsTr("User")
|
text:qsTr("User")
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x: mm
|
x: mm
|
||||||
y: mm
|
y: mm
|
||||||
width: root.width/2
|
width: root.width/2
|
||||||
|
@ -75,6 +78,7 @@ Page{
|
||||||
username.text= obj.username;
|
username.text= obj.username;
|
||||||
password.text=Qt.atob(obj.password);
|
password.text=Qt.atob(obj.password);
|
||||||
imagestore.text=obj.imagestore;
|
imagestore.text=obj.imagestore;
|
||||||
|
imagestoredir=obj.imagestore;
|
||||||
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
|
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
|
||||||
},'username','"+ accountPage.users[i].username+"')}}"
|
},'username','"+ accountPage.users[i].username+"')}}"
|
||||||
}
|
}
|
||||||
|
@ -85,43 +89,32 @@ Page{
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Server")
|
text: qsTr("Server")
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x: 4*mm; y: 10*mm
|
x: 4*mm; y: 10*mm
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Nickname")
|
text: qsTr("Nickname")
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x: 4*mm; y: 20*mm
|
x: 4*mm; y: 20*mm
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Password")
|
text: qsTr("Password")
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x: 4*mm; y: 30*mm
|
x: 4*mm; y: 30*mm
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
|
id: imagedirlabel
|
||||||
|
visible: imagestore.text!=""
|
||||||
text: qsTr("Image dir.")
|
text: qsTr("Image dir.")
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x: 4*mm; y: 40*mm
|
x: 4*mm; y: 40*mm
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text {
|
|
||||||
// text: qsTr("Max. News")
|
|
||||||
// font.pixelSize:3*mm
|
|
||||||
// x: 4*mm; y: 50*mm
|
|
||||||
// }
|
|
||||||
// Text {
|
|
||||||
// text: qsTr("News as")
|
|
||||||
// font.pixelSize:3*mm
|
|
||||||
// x: 4*mm; y: 50*mm
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Text {
|
|
||||||
// text: qsTr("Show Website")
|
|
||||||
// x: 4*mm; y:80*mm; width: 20*mm
|
|
||||||
// }
|
|
||||||
|
|
||||||
Image{
|
Image{
|
||||||
id:servericon
|
id:servericon
|
||||||
x:4*mm;y:13.5*mm
|
x:4*mm;y:13.5*mm
|
||||||
|
@ -141,6 +134,7 @@ Page{
|
||||||
id:serverSearchButton
|
id:serverSearchButton
|
||||||
text:"\uf002"
|
text:"\uf002"
|
||||||
font.pixelSize: 3*mm
|
font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
x:4*mm
|
x:4*mm
|
||||||
y:13.5*mm
|
y:13.5*mm
|
||||||
width: 5*mm; height:5*mm
|
width: 5*mm; height:5*mm
|
||||||
|
@ -160,7 +154,8 @@ Page{
|
||||||
width: servernameFlickable.width
|
width: servernameFlickable.width
|
||||||
height: servernameFlickable.height
|
height: servernameFlickable.height
|
||||||
focus: true
|
focus: true
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
text:"https://"
|
text:"https://"
|
||||||
onEditingFinished:{
|
onEditingFinished:{
|
||||||
if((servername.text).substring(0,11) =="https://http"){
|
if((servername.text).substring(0,11) =="https://http"){
|
||||||
|
@ -178,12 +173,15 @@ Page{
|
||||||
TextInput {
|
TextInput {
|
||||||
id: username
|
id: username
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
onEditingFinished:{
|
onEditingFinished:{
|
||||||
if (username.text.indexOf('@')>-1){
|
if (username.text.indexOf('@')>-1){
|
||||||
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
|
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
|
||||||
}
|
}
|
||||||
|
imagestoredir=filesystem.homePath+"/"+username.text+"/"
|
||||||
|
//if (imagestore.text==filesystem.homePath+"/.friendiqa/"){imagestore.text=filesystem.homePath+"/.friendiqa/"+username.text+"/"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,25 +200,29 @@ Page{
|
||||||
TextInput {
|
TextInput {
|
||||||
id: password
|
id: password
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
|
font.pointSize: 16
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
echoMode: TextInput.PasswordEchoOnEdit
|
echoMode: TextInput.PasswordEchoOnEdit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle{color: "light grey"; x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;}
|
Rectangle{color: "light grey"; x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;visible:imagestore.text!=""}
|
||||||
Flickable {
|
Flickable {
|
||||||
id: imagestoreFlickable
|
id: imagestoreFlickable
|
||||||
|
visible:imagestore.text!="" //filesystem.homePath+"/"+username.text+"/""
|
||||||
x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;
|
x: 4*mm; y: 43.5*mm; width: root.width-14*mm; height: 5*mm;
|
||||||
clip: true
|
clip: true
|
||||||
TextInput {
|
TextInput {
|
||||||
id: imagestore
|
id: imagestore
|
||||||
width: imagestoreFlickable.width
|
width: imagestoreFlickable.width
|
||||||
height: imagestoreFlickable.height
|
height: imagestoreFlickable.height
|
||||||
font.pixelSize:3*mm
|
//font.pixelSize:3*mm
|
||||||
text: (osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
|
font.pointSize: 16
|
||||||
|
text: "" //filesystem.homePath+"/.friendiqa/"+username.text+"/" //(osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
|
||||||
wrapMode: TextEdit.NoWrap
|
wrapMode: TextEdit.NoWrap
|
||||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
|
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
|
||||||
|
onTextChanged: imagestoredir=imagestore.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,81 +240,39 @@ Page{
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
x: root.width-9*mm; y: 43.5*mm; width: 5*mm; height: 5*mm;
|
x: root.width-9*mm; y: 43.5*mm; width: 5*mm; height: 5*mm;
|
||||||
|
visible:imagestore.text!=""
|
||||||
text: "..."
|
text: "..."
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
onClicked:
|
font.pointSize: 16
|
||||||
{imagestoreDialog.open()}
|
onClicked:{imagestoreDialog.open()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Slider{ id: maxNews
|
|
||||||
// x:19*mm; y: 53.5*mm;width: root.width/2;height:5*mm
|
|
||||||
// from: 0;to:2000; stepSize: 100
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// Rectangle{color: "light grey"; x: 4*mm; y: 53.5*mm; width: 9*mm; height: 5*mm;
|
|
||||||
// TextEdit{id:maxNewsText;
|
|
||||||
// anchors.fill: parent
|
|
||||||
// font.pixelSize:3*mm
|
|
||||||
// verticalAlignment:TextEdit.AlignRight
|
|
||||||
// text:maxNews.value
|
|
||||||
// focus: true
|
|
||||||
// selectByMouse: true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Rectangle{
|
|
||||||
// x: 4*mm; y: 53.5*mm; width: newsTypeField.contentWidth+2*mm; height: 5*mm;
|
|
||||||
// color:"light grey"
|
|
||||||
// Text{
|
|
||||||
// id: newsTypeField
|
|
||||||
// anchors.fill: parent
|
|
||||||
// font.pixelSize:3*mm
|
|
||||||
// text:"Conversations"
|
|
||||||
// }
|
|
||||||
// MouseArea{
|
|
||||||
// anchors.fill:parent
|
|
||||||
// onClicked:newstypemenu.popup()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
BusyIndicator{
|
BusyIndicator{
|
||||||
id: accountBusy
|
id: accountBusy
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
y: 63.5*mm
|
y: 53.5*mm
|
||||||
width:10*mm
|
width:10*mm
|
||||||
height: 10*mm
|
height: 10*mm
|
||||||
running: false
|
running: false
|
||||||
}
|
}
|
||||||
// CheckBox{
|
|
||||||
// id:showwebsiteCheckbox
|
|
||||||
// x:35*mm;y:80*mm
|
|
||||||
// onClicked:{
|
|
||||||
// if (checked==true){
|
|
||||||
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","true")
|
|
||||||
// root.globaloptions.showWebsiteForLinks="true"
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// Service.updateglobaloptions(root.db,"showWebsiteForLinks","false")
|
|
||||||
// root.globaloptions.showWebsiteForLinks="false"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
x: 4*mm; y: 63.5*mm
|
x: 4*mm; y: 53.5*mm
|
||||||
height: 8*mm
|
height: 8*mm
|
||||||
text: qsTr("Confirm")
|
text: qsTr("Confirm")
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
onClicked:{
|
onClicked:{
|
||||||
accountBusy.running=true;
|
accountBusy.running=true;
|
||||||
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text, maxnews:"",interval: ""};
|
var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir, maxnews:"",interval: ""};
|
||||||
var errormessage="";
|
var errormessage="";
|
||||||
if (servername.text==""){errormessage=qsTr("No server given! ")}
|
if (servername.text==""){errormessage=qsTr("No server given! ")}
|
||||||
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
|
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
|
||||||
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
|
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
|
||||||
else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
|
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
|
||||||
|
//else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")}
|
||||||
|
|
||||||
//else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
|
//else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")}
|
||||||
else {errormessage=""}
|
else {errormessage=""}
|
||||||
if (errormessage=="") {
|
if (errormessage=="") {
|
||||||
|
@ -324,7 +284,12 @@ Page{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if (users.length==0){Service.setDefaultOptions(db);}
|
if (users.length==0){Service.setDefaultOptions(db);}
|
||||||
filesystem.Directory=userconfig.imagestore;
|
print("imagestore" + userconfig.imagestore + " path "+ filesystem.homePath+"/"+username.text)
|
||||||
|
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
|
||||||
|
{//filesystem.Directory=filesystem.homePath;
|
||||||
|
filesystem.makePath(filesystem.homePath+"/"+username.text);
|
||||||
|
}
|
||||||
|
filesystem.Directory=imagestoredir //userconfig.imagestore;
|
||||||
filesystem.makeDir("contacts");
|
filesystem.makeDir("contacts");
|
||||||
filesystem.makeDir("albums");
|
filesystem.makeDir("albums");
|
||||||
Service.storeConfig(db,userconfig);
|
Service.storeConfig(db,userconfig);
|
||||||
|
@ -356,7 +321,8 @@ Page{
|
||||||
x: parent.width/2+2*mm; y: mm; width: 5*mm; height: 8*mm;
|
x: parent.width/2+2*mm; y: mm; width: 5*mm; height: 8*mm;
|
||||||
visible: users.length>0
|
visible: users.length>0
|
||||||
text: "-"
|
text: "-"
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
onClicked:{
|
onClicked:{
|
||||||
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
|
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
|
||||||
Service.deleteConfig(db,userconfig,function(){
|
Service.deleteConfig(db,userconfig,function(){
|
||||||
|
@ -386,17 +352,15 @@ Page{
|
||||||
x: parent.width/2+8*mm; y: mm; width: 5*mm; height: 8*mm;
|
x: parent.width/2+8*mm; y: mm; width: 5*mm; height: 8*mm;
|
||||||
visible: users.length>0
|
visible: users.length>0
|
||||||
text: "+"
|
text: "+"
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
onClicked:{
|
onClicked:{
|
||||||
servername.text="https://"
|
servername.text="https://"
|
||||||
servericon.visible=false;
|
servericon.visible=false;
|
||||||
servericon.source="";
|
servericon.source="";
|
||||||
username.text=""
|
username.text=""
|
||||||
password.text=""
|
password.text=""
|
||||||
imagestore.text=""
|
imagestore.text="" //filesystem.homePath+"/.friendiqa/"+username.text//""
|
||||||
//maxNews.value=0
|
|
||||||
//newsTypeField.text="Conversations"
|
|
||||||
//messageIntervalSlider.value=30
|
|
||||||
userButton.text=qsTr("User")
|
userButton.text=qsTr("User")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +368,8 @@ Page{
|
||||||
Button {
|
Button {
|
||||||
x: parent.width/2+14*mm; y: mm; width: 5*mm; height: 8*mm;
|
x: parent.width/2+14*mm; y: mm; width: 5*mm; height: 8*mm;
|
||||||
text: "?"
|
text: "?"
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
onClicked:{
|
onClicked:{
|
||||||
root.push("qrc:/qml/configqml/InfoBox.qml");
|
root.push("qrc:/qml/configqml/InfoBox.qml");
|
||||||
}
|
}
|
||||||
|
@ -419,22 +384,11 @@ Page{
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 1*mm
|
anchors.rightMargin: 1*mm
|
||||||
text: "\uf057"
|
text: "\uf057"
|
||||||
font.pixelSize: 3*mm
|
//font.pixelSize: 3*mm
|
||||||
|
font.pointSize: 16
|
||||||
onClicked:{root.pop()}
|
onClicked:{root.pop()}
|
||||||
}
|
}
|
||||||
// Menu {
|
|
||||||
// id:newstypemenu
|
|
||||||
// MenuItem {
|
|
||||||
// font.pixelSize: 3*mm
|
|
||||||
// text: qsTr("Timeline")
|
|
||||||
// onTriggered: {newsTypeField.text="Timeline"}
|
|
||||||
// }
|
|
||||||
// MenuItem {
|
|
||||||
// font.pixelSize: 3*mm
|
|
||||||
// text: qsTr("Conversations")
|
|
||||||
// onTriggered: {newsTypeField.text="Conversations"}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
try{Helperjs.readData(db,"config","",function(storedUsers){
|
try{Helperjs.readData(db,"config","",function(storedUsers){
|
||||||
|
@ -449,19 +403,11 @@ Page{
|
||||||
username.text= obj.username;
|
username.text= obj.username;
|
||||||
password.text=Qt.atob(obj.password);
|
password.text=Qt.atob(obj.password);
|
||||||
imagestore.text=obj.imagestore;
|
imagestore.text=obj.imagestore;
|
||||||
//maxNews.value=obj.maxnews;
|
imagestoredir=obj.imagestore;
|
||||||
//newsTypeField.text=obj.newsViewType;
|
|
||||||
//messageIntervalSlider.value=obj.timerInterval;
|
|
||||||
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
|
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
|
||||||
},"isActive",0)
|
},"isActive",0)
|
||||||
})}
|
})}
|
||||||
catch (e){//print("onCompleted" +users.count +e)
|
catch (e){//print("onCompleted" +users.count +e)
|
||||||
// Helperjs.friendicaWebRequest("https://dir.friendica.social/servers/surprise",accountPage,function(html){
|
|
||||||
// print(html);
|
|
||||||
// var bpos=html.indexOf("base ");
|
|
||||||
// var baseurl=html.substring(html.indexOf("http",bpos),html.indexOf('"',html.indexOf("http",bpos)));
|
|
||||||
// servername.text=baseurl
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ Rectangle{
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
width: root.width-mm
|
width: root.width-mm
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
text: "<b>Friendiqa v0.5.3 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
|
text: "<b>Friendiqa v0.5.4 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
|
||||||
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
|
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
|
||||||
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
|
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
|
||||||
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+
|
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+
|
||||||
|
|
|
@ -48,6 +48,7 @@ Rectangle {
|
||||||
height:root.height-20*mm// friendsTabView.height-15*mm
|
height:root.height-20*mm// friendsTabView.height-15*mm
|
||||||
border.color: "grey"
|
border.color: "grey"
|
||||||
color:"white"
|
color:"white"
|
||||||
|
radius: 0.5*mm
|
||||||
Image {
|
Image {
|
||||||
id: photoImage
|
id: photoImage
|
||||||
x:mm
|
x:mm
|
||||||
|
@ -71,31 +72,31 @@ Rectangle {
|
||||||
font.pixelSize: 4*mm
|
font.pixelSize: 4*mm
|
||||||
anchors.top: photoImage.bottom
|
anchors.top: photoImage.bottom
|
||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id: detailsrectangle
|
id: detailsrectangle
|
||||||
anchors.top: namelabel.bottom
|
anchors.top: namelabel.bottom
|
||||||
anchors.topMargin: 2*mm
|
anchors.topMargin: 2*mm
|
||||||
|
|
||||||
ScrollView{
|
ScrollView{
|
||||||
horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
//frameVisible: true
|
//frameVisible: true
|
||||||
id:namelabelflickable
|
id:namelabelflickable
|
||||||
width: root.width-10*mm
|
width: root.width-10*mm
|
||||||
height:root.height-50*mm
|
height:root.height-50*mm
|
||||||
x: mm
|
x: mm
|
||||||
clip:true
|
clip:true
|
||||||
Text{
|
Text{
|
||||||
id:namelabeltext
|
id:namelabeltext
|
||||||
width: namelabelflickable.width
|
width: namelabelflickable.width
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
font.pixelSize: 3*mm
|
font.pixelSize: 3*mm
|
||||||
textFormat:Text.RichText
|
textFormat:Text.RichText
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
text:"<b>"+qsTr("Description")+": </b> "+contact.description+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
text:"<b>"+qsTr("Description")+": </b> "+contact.description+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
|
||||||
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
|
||||||
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
connectUrl+ "<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
Qt.openUrlExternally(link)}
|
Qt.openUrlExternally(link)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ Rectangle{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Button{
|
MButton{
|
||||||
id:eventbutton
|
id:eventbutton
|
||||||
visible:(contact.network=="dfrn")
|
visible:(contact.network=="dfrn")
|
||||||
height: 6*mm
|
height: 6*mm
|
||||||
|
@ -162,7 +163,7 @@ Rectangle{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button{
|
MButton{
|
||||||
id: closeButton
|
id: closeButton
|
||||||
height: 6*mm
|
height: 6*mm
|
||||||
width: 8*mm
|
width: 8*mm
|
||||||
|
|
|
@ -44,17 +44,6 @@ Rectangle {
|
||||||
y:1
|
y:1
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
// function showContactdetails(contact){
|
|
||||||
// var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
|
||||||
// if(contact.isFriend){
|
|
||||||
// friendsTabView.currentIndex=1;
|
|
||||||
// var contactDetails = component.createObject(friendstab,{"contact": contact})
|
|
||||||
// }
|
|
||||||
// else{friendsTabView.currentIndex=2;
|
|
||||||
// var contactDetails = component.createObject(friendstab,{"contact": contact})
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
function showContactdetails(contact){
|
function showContactdetails(contact){
|
||||||
rootstack.currentIndex=0;
|
rootstack.currentIndex=0;
|
||||||
bar.currentIndex=0;
|
bar.currentIndex=0;
|
||||||
|
@ -85,18 +74,22 @@ Rectangle {
|
||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Me")
|
text: qsTr("Me")
|
||||||
font.pixelSize: 2*mm
|
font.pixelSize: 2*mm
|
||||||
|
height: 7*mm
|
||||||
}
|
}
|
||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Friends")
|
text: qsTr("Friends")
|
||||||
font.pixelSize: 2*mm
|
font.pixelSize: 2*mm
|
||||||
|
height: 7*mm
|
||||||
}
|
}
|
||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Contacts")
|
text: qsTr("Contacts")
|
||||||
font.pixelSize: 2*mm
|
font.pixelSize: 2*mm
|
||||||
|
height: 7*mm
|
||||||
}
|
}
|
||||||
TabButton {
|
TabButton {
|
||||||
text: qsTr("Groups")
|
text: qsTr("Groups")
|
||||||
font.pixelSize: 2*mm
|
font.pixelSize: 2*mm
|
||||||
|
height: 7*mm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StackLayout{
|
StackLayout{
|
||||||
|
@ -119,23 +112,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
else if (currentIndex==3){groupsSignal(root.login.username)}
|
else if (currentIndex==3){groupsSignal(root.login.username)}
|
||||||
}
|
}
|
||||||
// style: TabViewStyle {
|
|
||||||
// frameOverlap: 1
|
|
||||||
// tab: Rectangle {
|
|
||||||
// color: "white"
|
|
||||||
// implicitWidth: root.width/4-2*mm
|
|
||||||
// implicitHeight: 4*mm
|
|
||||||
// Text { id: text
|
|
||||||
// anchors.centerIn: parent
|
|
||||||
// text: styleData.title
|
|
||||||
// color: "dark grey"
|
|
||||||
// font.pixelSize:2.5*mm
|
|
||||||
// font.bold: styleData.selected
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// frame: Rectangle { color: "light grey" }
|
|
||||||
// tabsAlignment:Qt.AlignHCenter
|
|
||||||
// }
|
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
id:profileGridTab
|
id:profileGridTab
|
||||||
|
@ -170,7 +147,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
onDownloaded:{
|
function onDownloaded(type,url,filename,i){
|
||||||
if(type=="contactlist"){
|
if(type=="contactlist"){
|
||||||
//print(url+" "+filename+" "+i)
|
//print(url+" "+filename+" "+i)
|
||||||
friendsGridTab.currentContact=i+1;
|
friendsGridTab.currentContact=i+1;
|
||||||
|
@ -277,6 +254,7 @@ Rectangle {
|
||||||
y:cleanButton.height+2*mm
|
y:cleanButton.height+2*mm
|
||||||
width:contactsGridTab.width-2*mm
|
width:contactsGridTab.width-2*mm
|
||||||
height:contactsGridTab.height-cleanButton.height-2*mm
|
height:contactsGridTab.height-cleanButton.height-2*mm
|
||||||
|
spacing: 2
|
||||||
clip: true
|
clip: true
|
||||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||||
//add: Transition {
|
//add: Transition {
|
||||||
|
@ -324,8 +302,8 @@ Rectangle {
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
|
function onError(data,url,api,code){print(data)}//if (data=="image"){Helperjs.showMessage()}}
|
||||||
onSuccess:{
|
function onSuccess(data,api){
|
||||||
Newsjs.requestGroups(root.login,root.db,root,function(){
|
Newsjs.requestGroups(root.login,root.db,root,function(){
|
||||||
showGroups(root.login.username)});
|
showGroups(root.login.username)});
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ Item {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
width: 16*mm
|
width: 16*mm
|
||||||
height: 15*mm
|
height: 15*mm
|
||||||
border.color: "grey"
|
radius: 0.5*mm
|
||||||
|
border.color: "grey"
|
||||||
color:"white"
|
color:"white"
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
|
|
@ -55,7 +55,7 @@ Rectangle {
|
||||||
var profileobject={};
|
var profileobject={};
|
||||||
var profiletext="";
|
var profiletext="";
|
||||||
for (var key in pobject){//print(key+obj[key])
|
for (var key in pobject){//print(key+obj[key])
|
||||||
if(pobject[key]!=""&&key!="users"&&key!="profile_id"){
|
if(pobject[key]!=""&&pobject[key]!=null&&key!="users"&&key!="profile_id"){
|
||||||
var keytext="";
|
var keytext="";
|
||||||
switch(key){
|
switch(key){
|
||||||
case "profile_name":keytext=qsTr("profile name");break;
|
case "profile_name":keytext=qsTr("profile name");break;
|
||||||
|
@ -178,7 +178,7 @@ Rectangle {
|
||||||
MButton{
|
MButton{
|
||||||
id:updatebutton
|
id:updatebutton
|
||||||
height: 6*mm
|
height: 6*mm
|
||||||
width:8*mm
|
width: 12*mm
|
||||||
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
|
visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source
|
||||||
text:qsTr("Update")
|
text:qsTr("Update")
|
||||||
font.pixelSize: 3*mm
|
font.pixelSize: 3*mm
|
||||||
|
@ -245,10 +245,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rectangle{
|
|
||||||
// id: detailsrectangle
|
|
||||||
|
|
||||||
|
|
||||||
ScrollView{
|
ScrollView{
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
id:namelabelflickable
|
id:namelabelflickable
|
||||||
|
@ -262,15 +258,12 @@ Rectangle {
|
||||||
ListView {
|
ListView {
|
||||||
id: profileView
|
id: profileView
|
||||||
header:textcomponent
|
header:textcomponent
|
||||||
// width:parent.width
|
|
||||||
// height: root.height
|
|
||||||
// clip: true
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
model: profileModel
|
model: profileModel
|
||||||
delegate: profileItem
|
delegate: profileItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
profile.profiles.sort(function(obj1, obj2) {
|
profile.profiles.sort(function(obj1, obj2) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ StackView{
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
onDownloaded:{
|
function onDownloaded(type,url,filename,i){
|
||||||
if(type=="contactlist"){
|
if(type=="contactlist"){
|
||||||
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
var database=LocalStorage.openDatabaseSync(root.db[0],root.db[1],root.db[2],root.db[3]);
|
||||||
var result;
|
var result;
|
||||||
|
@ -123,10 +123,13 @@ StackView{
|
||||||
|
|
||||||
else if (newstab.conversation.length>0){newstab.conversation=[]}
|
else if (newstab.conversation.length>0){newstab.conversation=[]}
|
||||||
else if (root.depth>1){root.pop()}
|
else if (root.depth>1){root.pop()}
|
||||||
else{Service.cleanNews(root.db,function(){
|
else{
|
||||||
Service.cleanContacts(root.login,root.db,function(){
|
Service.cleanNews(root.db,function(){
|
||||||
Qt.quit()})
|
Service.cleanHashtags(root.db,function(){
|
||||||
})}
|
Service.cleanContacts(root.login,root.db,function(){
|
||||||
|
Qt.quit()})
|
||||||
|
})})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (rootstack.currentIndex==2){fotoSignal("backButton")}
|
else if (rootstack.currentIndex==2){fotoSignal("backButton")}
|
||||||
else {rootstack.currentIndex=0}
|
else {rootstack.currentIndex=0}
|
||||||
|
@ -144,7 +147,8 @@ StackView{
|
||||||
width:parent.width-mm
|
width:parent.width-mm
|
||||||
Label{
|
Label{
|
||||||
text: login.hasOwnProperty("username")?login.username:""
|
text: login.hasOwnProperty("username")?login.username:""
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 6*mm
|
height: 6*mm
|
||||||
}
|
}
|
||||||
|
@ -156,7 +160,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf021 " + qsTr("Refresh")
|
text: "\uf021 " + qsTr("Refresh")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -173,7 +178,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf1da " + qsTr("Timeline")
|
text: "\uf1da " + qsTr("Timeline")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -187,7 +193,8 @@ StackView{
|
||||||
Label{
|
Label{
|
||||||
text: "\uf086 " + qsTr("Conversations")
|
text: "\uf086 " + qsTr("Conversations")
|
||||||
width: parent.width
|
width: parent.width
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked:{
|
onClicked:{
|
||||||
|
@ -199,7 +206,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf005 " + qsTr("Favorites")
|
text: "\uf005 " + qsTr("Favorites")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -211,7 +219,8 @@ StackView{
|
||||||
}
|
}
|
||||||
Label{
|
Label{
|
||||||
text: "\uf0ec " + qsTr("Replies")
|
text: "\uf0ec " + qsTr("Replies")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -225,7 +234,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf0ac " + qsTr("Public Timeline")
|
text: "\uf0ac " + qsTr("Public Timeline")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -238,7 +248,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf0c0 " + qsTr("Group news")
|
text: "\uf0c0 " + qsTr("Group news")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -251,7 +262,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf002 " + qsTr("Search")
|
text: "\uf002 " + qsTr("Search")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -264,7 +276,8 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf085 "+ qsTr("Settings")
|
text: "\uf085 "+ qsTr("Settings")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -275,7 +288,8 @@ StackView{
|
||||||
}
|
}
|
||||||
Label{
|
Label{
|
||||||
text: "\uf2bb " + qsTr("Accounts")
|
text: "\uf2bb " + qsTr("Accounts")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -287,15 +301,17 @@ StackView{
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
text: "\uf08b " +qsTr("Quit")
|
text: "\uf08b " +qsTr("Quit")
|
||||||
font.pixelSize: 4*mm
|
//font.pixelSize: 4*mm
|
||||||
|
font.pointSize: 16
|
||||||
width: parent.width
|
width: parent.width
|
||||||
MouseArea{
|
MouseArea{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked:{
|
onClicked:{
|
||||||
Service.cleanNews(root.db,function(){
|
Service.cleanNews(root.db,function(){
|
||||||
Service.cleanContacts(root.login,root.db,function(){
|
Service.cleanHashtags(root.db,function(){
|
||||||
Qt.quit()})
|
Service.cleanContacts(root.login,root.db,function(){
|
||||||
})
|
Qt.quit()})
|
||||||
|
})})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ Item {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
width:parent.width
|
width:parent.width
|
||||||
height: 8*mm
|
height: 8*mm
|
||||||
|
radius: 0.5*mm
|
||||||
border.color: "grey"
|
border.color: "grey"
|
||||||
color:"white"
|
color:"white"
|
||||||
Image {
|
Image {
|
||||||
|
|
|
@ -39,13 +39,7 @@ import "qrc:/qml/genericqml"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:searchComponent
|
id:searchComponent
|
||||||
//onActiveFocusChanged: searchText.forceActiveFocus()
|
|
||||||
//onVisibleChanged: if (visible) searchText.forceActiveFocus()
|
|
||||||
// border.color: "#EEEEEE"
|
|
||||||
// border.width: 1
|
|
||||||
color:"lightgrey"
|
|
||||||
// width:conversationView.width
|
|
||||||
// height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
color: "white"
|
color: "white"
|
||||||
radius:0.5*mm
|
radius:0.5*mm
|
||||||
|
@ -69,19 +63,7 @@ Rectangle {
|
||||||
|
|
||||||
}
|
}
|
||||||
Component.onCompleted: searchText.forceActiveFocus()
|
Component.onCompleted: searchText.forceActiveFocus()
|
||||||
// BlueButton {
|
|
||||||
// id: sendButton
|
|
||||||
// text: "\uf002"
|
|
||||||
// anchors.left: parent.right
|
|
||||||
// anchors.leftMargin:mm
|
|
||||||
// anchors.top:parent.top
|
|
||||||
// //anchors.topMargin: 0.5*mm
|
|
||||||
// color:"white"
|
|
||||||
// onClicked: {
|
|
||||||
// var body=searchText.getText(0,searchText.length);
|
|
||||||
// search(body)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ Rectangle {
|
||||||
}//Component end
|
}//Component end
|
||||||
Connections{
|
Connections{
|
||||||
target:newstab
|
target:newstab
|
||||||
onContactpostsChanged:{
|
function onContactpostsChanged(){
|
||||||
if (newstab.contactposts.length>0){profileimagesource=newstab.contactposts[0].user.profile_image_url_large}
|
if (newstab.contactposts.length>0){profileimagesource=newstab.contactposts[0].user.profile_image_url_large}
|
||||||
contactBusy.running=false;
|
contactBusy.running=false;
|
||||||
contactModel.clear();
|
contactModel.clear();
|
||||||
|
|
|
@ -38,15 +38,9 @@ import "qrc:/qml/newsqml"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:conversationList
|
id:conversationList
|
||||||
// width:root.width-5*mm
|
|
||||||
// height:root.height-12*mm
|
|
||||||
property var news:[]
|
property var news:[]
|
||||||
// y:1
|
|
||||||
// z:2
|
|
||||||
color: "white"
|
color: "white"
|
||||||
// border.color: "grey"
|
|
||||||
// width:root.width-5*mm
|
|
||||||
// height: conversationView.height+10*mm
|
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: conversationView
|
id: conversationView
|
||||||
|
@ -54,11 +48,10 @@ Rectangle {
|
||||||
x:3*mm
|
x:3*mm
|
||||||
y:8*mm
|
y:8*mm
|
||||||
width: conversationList.width-4*mm
|
width: conversationList.width-4*mm
|
||||||
//height: contentHeight
|
|
||||||
height:conversationList.height-10*mm
|
height:conversationList.height-10*mm
|
||||||
clip: true
|
clip: true
|
||||||
spacing: 0
|
spacing: 0
|
||||||
footer: MessageSend{conversation:true}//footerReply
|
footer: MessageSend{conversation:true}
|
||||||
model: conversationModel
|
model: conversationModel
|
||||||
delegate: Newsitem{}
|
delegate: Newsitem{}
|
||||||
}
|
}
|
||||||
|
@ -75,89 +68,17 @@ Rectangle {
|
||||||
Connections{
|
Connections{
|
||||||
target:newstab
|
target:newstab
|
||||||
onConversationChanged:{
|
onConversationChanged:{
|
||||||
//if(newsitem.itemindex==newsStack.conversationIndex){
|
if(newstab.conversation.length==0){
|
||||||
if(newstab.conversation.length==0){
|
newsStack.pop()
|
||||||
newsStack.pop()
|
} else { conversationBusy.running=false;
|
||||||
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
conversationModel.clear();
|
||||||
//conversationList.destroy(); conversationsymbol.color="grey"
|
var currentTime= new Date();
|
||||||
} else { conversationBusy.running=false;
|
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'method':'conversation', 'options':globaloptions};
|
||||||
conversationModel.clear();
|
conversationWorker.sendMessage(msg)
|
||||||
var currentTime= new Date();
|
}
|
||||||
var msg = {'currentTime': currentTime, 'model': conversationModel,'news':newstab.conversation, 'method':'conversation', 'options':globaloptions};
|
|
||||||
conversationWorker.sendMessage(msg)
|
|
||||||
//conversationsymbol.color="grey"
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Component { id:footerReply
|
|
||||||
// Rectangle{
|
|
||||||
// border.color: "#EEEEEE"
|
|
||||||
// border.width: 1
|
|
||||||
// color:"lightgrey"
|
|
||||||
// width:conversationView.width
|
|
||||||
// height:Math.max(replyText.contentHeight+2*mm,6*mm)
|
|
||||||
// Rectangle{
|
|
||||||
// color: "white"
|
|
||||||
// radius:0.5*mm
|
|
||||||
// anchors.left: parent.left
|
|
||||||
// anchors.leftMargin:mm
|
|
||||||
// anchors.top:parent.top
|
|
||||||
// anchors.topMargin: 0.5*mm
|
|
||||||
// width:parent.width-12*mm
|
|
||||||
// height:Math.max( replyText.contentHeight,5*mm)
|
|
||||||
|
|
||||||
// TextInput {
|
|
||||||
// id: replyText
|
|
||||||
// font.pixelSize: 3*mm
|
|
||||||
// wrapMode: Text.Wrap
|
|
||||||
// anchors.fill: parent
|
|
||||||
// selectByMouse: true
|
|
||||||
// onHeightChanged: conversationView.contentY+=4.5*mm
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Button {
|
|
||||||
// id: sendButton
|
|
||||||
// height: 8*mm
|
|
||||||
// width:8*mm
|
|
||||||
// text: "\uf1d9"
|
|
||||||
// anchors.right: parent.right
|
|
||||||
// anchors.rightMargin:mm
|
|
||||||
// anchors.top:parent.top
|
|
||||||
// anchors.topMargin: 0.5*mm
|
|
||||||
// //color:"white"
|
|
||||||
// onClicked: { try{
|
|
||||||
// var body=replyText.getText(0,replyText.length);
|
|
||||||
// newsBusy.running=true;
|
|
||||||
// replyText.text=""
|
|
||||||
// xhr.clearParams();
|
|
||||||
// xhr.setLogin(login.username+":"+Qt.atob(login.password));
|
|
||||||
// if (conversationModel.get(0).newsitemobject.messagetype==0){
|
|
||||||
|
|
||||||
// //xhr.url= login.server + "/api/statuses/update.json";
|
|
||||||
// xhr.setUrl(login.server);
|
|
||||||
// xhr.setApi("/api/statuses/update");
|
|
||||||
// xhr.setParam("source", "Friendiqa");
|
|
||||||
// xhr.setParam("status", body);
|
|
||||||
// xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)}
|
|
||||||
// else {//xhr.url= login.server + "/api/direct_messages/new.json";
|
|
||||||
// xhr.setUrl(login.server);
|
|
||||||
// xhr.setApi("/api/direct_messages/new");
|
|
||||||
// xhr.setParam("text", body);
|
|
||||||
// xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name);
|
|
||||||
// xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id)
|
|
||||||
// }
|
|
||||||
// xhr.post();
|
|
||||||
// } catch(e){Helperjs.showMessage("Error",e.toString(),root)}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ListModel{id: conversationModel}
|
ListModel{id: conversationModel}
|
||||||
|
|
||||||
WorkerScript {
|
WorkerScript {
|
||||||
|
@ -176,11 +97,7 @@ Rectangle {
|
||||||
text: "\uf057"
|
text: "\uf057"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
//newsView.positionViewAtIndex(newsStack.conversationIndex,ListView.Beginning);
|
||||||
|
newstab.conversation=[];
|
||||||
newstab.conversation=[];
|
|
||||||
//newsStack.pop()
|
|
||||||
//conversationList.destroy();
|
|
||||||
//conversationsymbol.color="grey"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,13 +61,6 @@ Rectangle{
|
||||||
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
||||||
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
||||||
|
|
||||||
// onReply_to_userChanged: {
|
|
||||||
// if (reply_to_user!=""){
|
|
||||||
// print("reply "+reply_to_user)
|
|
||||||
// //receiverLabel.visible=true
|
|
||||||
// receiverLabel.text=reply_to_user
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
function directmessagePrepare(friend){
|
function directmessagePrepare(friend){
|
||||||
messageSend.state="active";
|
messageSend.state="active";
|
||||||
|
@ -98,9 +91,6 @@ Rectangle{
|
||||||
|
|
||||||
function attachImage(url){
|
function attachImage(url){
|
||||||
imageAttachment.source=url.toString();
|
imageAttachment.source=url.toString();
|
||||||
// var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
|
||||||
// url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
|
|
||||||
// url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||||
|
@ -125,6 +115,7 @@ Rectangle{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.post();
|
xhr.post();
|
||||||
|
Newsjs.storeHashtags(login,db,status,root)
|
||||||
}
|
}
|
||||||
|
|
||||||
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
function dmUpdate(title,text,replyto,screen_name,attachImageURL) {
|
||||||
|
@ -166,6 +157,16 @@ Rectangle{
|
||||||
contactSelector.visible=true
|
contactSelector.visible=true
|
||||||
},letter);
|
},letter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hashtagmenu(){//print("letter "+letter)
|
||||||
|
Newsjs.listHashtags(login,db,function(tags){
|
||||||
|
tagModel.clear();
|
||||||
|
for (var i=0;i<tags.length;i++){
|
||||||
|
tagModel.append({"tag":tags[i]})
|
||||||
|
}
|
||||||
|
tagSelector.visible=true
|
||||||
|
});
|
||||||
|
}
|
||||||
// Flickable{
|
// Flickable{
|
||||||
// anchors.fill: parent
|
// anchors.fill: parent
|
||||||
// contentHeight: messageColumn.height
|
// contentHeight: messageColumn.height
|
||||||
|
@ -177,46 +178,16 @@ Rectangle{
|
||||||
spacing: 0.5*mm
|
spacing: 0.5*mm
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 10*mm//implicitHeight
|
height: 10*mm//implicitHeight
|
||||||
|
TextArea{
|
||||||
// Row{
|
id:receiverLabel
|
||||||
// x: 0.5*mm
|
width: messageColumn.width//-8*mm
|
||||||
// Label{
|
font.pixelSize: 3*mm
|
||||||
// id:toLabel
|
placeholderText:qsTr("to:")
|
||||||
// width: 7*mm
|
text: ""
|
||||||
// height: 6*mm
|
visible:false
|
||||||
// topPadding: 1.5* mm
|
onTextChanged: {
|
||||||
// font.pixelSize: 3*mm
|
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
|
||||||
// text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:"):""
|
}
|
||||||
// visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
|
||||||
// }
|
|
||||||
TextArea{
|
|
||||||
id:receiverLabel
|
|
||||||
//x: 8*mm
|
|
||||||
width: messageColumn.width//-8*mm
|
|
||||||
font.pixelSize: 3*mm
|
|
||||||
placeholderText:qsTr("to:")
|
|
||||||
text: ""//newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
|
|
||||||
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
|
||||||
//onLengthChanged: contactmenu(text)
|
|
||||||
//onPreeditTextChanged: contactmenu(text)
|
|
||||||
// onActiveFocusChanged:{
|
|
||||||
// if (activeFocus==true){contactmenu("")}
|
|
||||||
// }
|
|
||||||
onTextChanged: {
|
|
||||||
//print (text)
|
|
||||||
contactmenu(text)}
|
|
||||||
// MouseArea{
|
|
||||||
// anchors.fill: parent
|
|
||||||
// onClicked:{print("receiverlabel")
|
|
||||||
// if(newsSwipeview.stacktype=="DirectMessages"){
|
|
||||||
// contactmenu();
|
|
||||||
|
|
||||||
// }}
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: titleField
|
id: titleField
|
||||||
|
@ -309,6 +280,24 @@ Rectangle{
|
||||||
}
|
}
|
||||||
ListModel{id:contactModel}
|
ListModel{id:contactModel}
|
||||||
|
|
||||||
|
ListView{
|
||||||
|
id: tagSelector
|
||||||
|
visible: false
|
||||||
|
z:3
|
||||||
|
x:8*mm
|
||||||
|
width: parent.width-9*mm
|
||||||
|
height: messageSend.height/2
|
||||||
|
model:tagModel
|
||||||
|
clip: true
|
||||||
|
spacing: 0
|
||||||
|
function processTagSelection(hashtag){
|
||||||
|
bodyField.insert(bodyField.cursorPosition, hashtag+" ");
|
||||||
|
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
|
||||||
|
tagSelector.visible=false
|
||||||
|
}
|
||||||
|
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
|
||||||
|
}
|
||||||
|
ListModel{id:tagModel}
|
||||||
|
|
||||||
Item{
|
Item{
|
||||||
id:imageAttachment;
|
id:imageAttachment;
|
||||||
|
@ -351,54 +340,6 @@ Rectangle{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Row{
|
|
||||||
// spacing: 2
|
|
||||||
// width: parent.width
|
|
||||||
// CheckBox{
|
|
||||||
// id:dmCheckbox
|
|
||||||
// text:"DM"
|
|
||||||
// enabled: false
|
|
||||||
// checked: (directmessage==1)?true:false
|
|
||||||
// onClicked:{
|
|
||||||
// if(dmCheckbox.checkedState==Qt.Checked){directmessage=1}
|
|
||||||
// else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Button{
|
|
||||||
// text:"\uf0c1"
|
|
||||||
// height:8*mm
|
|
||||||
// onClicked: {
|
|
||||||
// if(bodyField.selectedText==""){Helperjs.showMessage("Error","No text selected",messageSend)}
|
|
||||||
// else{urlTextEdit.text="";
|
|
||||||
// urlRectangle.visible=true}}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Rectangle{
|
|
||||||
// id:urlRectangle
|
|
||||||
// height: 7*mm //parent.height
|
|
||||||
// width:parent.width-2*mm
|
|
||||||
// visible:false
|
|
||||||
// TextField{
|
|
||||||
// id:urlTextEdit
|
|
||||||
// width:parent.width-7*mm
|
|
||||||
// height:parent.height
|
|
||||||
// }
|
|
||||||
// Button{
|
|
||||||
// anchors.left:urlTextEdit.right
|
|
||||||
// anchors.leftMargin:mm
|
|
||||||
// height:8*mm
|
|
||||||
// text:"\u2713"
|
|
||||||
// onClicked: {if(urlTextEdit.text!=""){
|
|
||||||
// var start = bodyField.selectionStart;
|
|
||||||
// var text=bodyField.selectedText
|
|
||||||
// if(text.lastIndexOf(".jpg")>-1 || text.lastIndexOf(".jpeg")>-1 || text.lastIndexOf(".png")>-1){text="<img src="+text+">"}
|
|
||||||
// text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
|
|
||||||
// bodyField.remove(start,bodyField.selectionEnd);
|
|
||||||
// bodyField.insert(start,text);}
|
|
||||||
// urlRectangle.visible=false}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
Row{
|
Row{
|
||||||
id:buttonRow
|
id:buttonRow
|
||||||
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
||||||
|
@ -440,6 +381,14 @@ Rectangle{
|
||||||
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MButton{
|
||||||
|
id:hastagButton
|
||||||
|
text: "\uf292"
|
||||||
|
height: 6*mm
|
||||||
|
width: 7*mm
|
||||||
|
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
|
||||||
|
}
|
||||||
|
|
||||||
MButton {
|
MButton {
|
||||||
id: cancelButton
|
id: cancelButton
|
||||||
height: 6*mm
|
height: 6*mm
|
||||||
|
@ -483,8 +432,6 @@ Rectangle{
|
||||||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||||
}
|
}
|
||||||
Component.onCompleted:{
|
Component.onCompleted:{
|
||||||
//parentId=conversationModel.get(conversationModel.count-1).newsitemobject.id
|
|
||||||
//if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
|
||||||
newsStack.replySignal.connect(setParent);
|
newsStack.replySignal.connect(setParent);
|
||||||
root.directmessageSignal.connect(directmessagePrepare);
|
root.directmessageSignal.connect(directmessagePrepare);
|
||||||
root.uploadSignal.connect(sendUrls);
|
root.uploadSignal.connect(sendUrls);
|
||||||
|
@ -492,48 +439,34 @@ Rectangle{
|
||||||
if (textfocus==true){bodyField.forceActiveFocus()}
|
if (textfocus==true){bodyField.forceActiveFocus()}
|
||||||
}
|
}
|
||||||
|
|
||||||
states: [ State {
|
states: [
|
||||||
name: "active"
|
State {
|
||||||
PropertyChanges {
|
name: "active"
|
||||||
target: messageColumn; height: implicitHeight
|
PropertyChanges {
|
||||||
}
|
target: messageColumn; height: implicitHeight
|
||||||
PropertyChanges {
|
}
|
||||||
target: buttonRow; visible:true
|
PropertyChanges {
|
||||||
}
|
target: buttonRow; visible:true
|
||||||
PropertyChanges {
|
}
|
||||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
PropertyChanges {
|
||||||
}
|
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")//true
|
||||||
PropertyChanges {
|
}
|
||||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
PropertyChanges {
|
||||||
}
|
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||||
// PropertyChanges {
|
}
|
||||||
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
},
|
||||||
// }
|
State {
|
||||||
},
|
name: "conversation"
|
||||||
State {
|
PropertyChanges {
|
||||||
name: "conversation"
|
target: messageColumn; height: implicitHeight
|
||||||
PropertyChanges {
|
}
|
||||||
target: messageColumn; height: implicitHeight
|
PropertyChanges {
|
||||||
}
|
target: buttonRow; visible:true
|
||||||
PropertyChanges {
|
}
|
||||||
target: buttonRow; visible:true
|
PropertyChanges {
|
||||||
}
|
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
||||||
PropertyChanges {
|
}
|
||||||
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
|
},
|
||||||
}
|
|
||||||
|
|
||||||
// PropertyChanges {
|
|
||||||
// target: receiverLabel; visible:true; text:qsTr("to")+": "+ conversationModel.get(0).newsitemobject.user.name
|
|
||||||
// }
|
|
||||||
|
|
||||||
// PropertyChanges {
|
|
||||||
// target: messageSend; reply_to_user: conversationModel.get(0).newsitemobject.user.screen_name
|
|
||||||
// }
|
|
||||||
|
|
||||||
// PropertyChanges {
|
|
||||||
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
|
|
||||||
State {
|
State {
|
||||||
name: "reply"
|
name: "reply"
|
||||||
|
@ -552,4 +485,3 @@ Rectangle{
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
|
|
|
@ -172,11 +172,6 @@ StackView{
|
||||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||||
newsWorker.sendMessage(msg);
|
newsWorker.sendMessage(msg);
|
||||||
},lastnews_id)}
|
},lastnews_id)}
|
||||||
// else if(newstab.newstabstatus=="Contact"){
|
|
||||||
// Newsjs.newsfromdb(root.db,root.login, function(news){
|
|
||||||
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
|
||||||
// newsWorker.sendMessage(msg);
|
|
||||||
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
|
||||||
else if (newstab.newstabstatus=="Notifications"){}
|
else if (newstab.newstabstatus=="Notifications"){}
|
||||||
else{
|
else{
|
||||||
//newsStack.appendNews=true;
|
//newsStack.appendNews=true;
|
||||||
|
@ -186,11 +181,11 @@ StackView{
|
||||||
}
|
}
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
onError:{
|
function onError(data,url,api,code){
|
||||||
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||||
newsBusy.running=false;
|
newsBusy.running=false;
|
||||||
}
|
}
|
||||||
onSuccess:{
|
function onSuccess(data,api){
|
||||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||||
Service.processNews(api,data)
|
Service.processNews(api,data)
|
||||||
replySignal("")
|
replySignal("")
|
||||||
|
@ -198,7 +193,7 @@ StackView{
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||||
onTriggered: {
|
onTriggered: {"replytimer triggered";
|
||||||
newsBusy.running=true;
|
newsBusy.running=true;
|
||||||
if(newstab.newstabstatus=="Conversation"){
|
if(newstab.newstabstatus=="Conversation"){
|
||||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||||
|
@ -360,6 +355,7 @@ StackView{
|
||||||
anchors.topMargin: 2*mm
|
anchors.topMargin: 2*mm
|
||||||
width:10*mm
|
width:10*mm
|
||||||
height: 10*mm
|
height: 10*mm
|
||||||
|
running: false
|
||||||
}
|
}
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:downloadNotice
|
id:downloadNotice
|
||||||
|
|
|
@ -29,10 +29,7 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//import QtMultimedia 5.8
|
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
//import QtQuick.Controls 2.4
|
|
||||||
//import QtQuick.Controls.Styles 1.4
|
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
color:"black"
|
color:"black"
|
||||||
|
@ -48,28 +45,15 @@ Rectangle{
|
||||||
font.pixelSize: parent.height/2
|
font.pixelSize: parent.height/2
|
||||||
x: (parent.width-contentWidth)/2
|
x: (parent.width-contentWidth)/2
|
||||||
y:parent.height/5
|
y:parent.height/5
|
||||||
//visible: video.playbackState!=MediaPlayer.PlayingState
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {anchors.fill:parent;
|
MouseArea {anchors.fill:parent;
|
||||||
onClicked:{
|
onClicked:{
|
||||||
if(attachment.mimetype=="video/youtube"){
|
if(attachment.mimetype=="video/youtube"){
|
||||||
root.push("qrc:/qml/newsqml/NewsYplayer.qml",{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
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 {
|
} else {
|
||||||
root.push("qrc:/qml/newsqml/NewsVideoLarge.qml",{"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});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Slider{ id: videoSlider
|
|
||||||
// width: parent.width
|
|
||||||
// height: 3*mm
|
|
||||||
// anchors.top: video.bottom
|
|
||||||
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
|
|
||||||
// value: video.position/video.duration
|
|
||||||
// onPressed:video.seek(value*video.duration)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
import QtMultimedia 5.8
|
import QtMultimedia 5.8
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
//import QtQuick.Controls.Styles 1.4
|
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id:newsvideofullscreen
|
id:newsvideofullscreen
|
||||||
|
@ -65,7 +64,6 @@ Rectangle{
|
||||||
anchors.fill:parent;
|
anchors.fill:parent;
|
||||||
onClicked:{
|
onClicked:{
|
||||||
root.pop()
|
root.pop()
|
||||||
//newsvideofullscreen.destroy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,11 +93,6 @@ Rectangle{
|
||||||
anchors.bottom: video.bottom
|
anchors.bottom: video.bottom
|
||||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||||
value: video.bufferProgress
|
value: video.bufferProgress
|
||||||
// style:ProgressBarStyle{
|
|
||||||
// progress: Rectangle{
|
|
||||||
// color:"light grey"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
// Slider{ id: videoSlider
|
// Slider{ id: videoSlider
|
||||||
// width: parent.width
|
// width: parent.width
|
||||||
|
|
|
@ -69,10 +69,7 @@ Rectangle{
|
||||||
opacity = 0
|
opacity = 0
|
||||||
}
|
}
|
||||||
onTitleChanged: {
|
onTitleChanged: {
|
||||||
if (title==2){
|
if (title==2){root.pop()}
|
||||||
root.pop();
|
|
||||||
//newsYplayer.destroy(
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import "qrc:/qml/genericqml"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: newsitem
|
id: newsitem
|
||||||
width: parent.width
|
width: newsView.width //parent.width
|
||||||
height:toprow.height+friendicaActivities.height+controlrow.height+conversationColumn.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
height:toprow.height+friendicaActivities.height+controlrow.height+conversationColumn.height+1//Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm)
|
||||||
property int itemindex: index
|
property int itemindex: index
|
||||||
property var newsitemobject:model.newsitemobject
|
property var newsitemobject:model.newsitemobject
|
||||||
|
@ -54,9 +54,7 @@ Item {
|
||||||
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts});
|
||||||
}
|
}
|
||||||
|
|
||||||
function findTags(fulltext){
|
|
||||||
return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g)
|
|
||||||
}
|
|
||||||
|
|
||||||
function pushConversation(){
|
function pushConversation(){
|
||||||
if (model.newsitemobject.hasOwnProperty("currentconversation")){
|
if (model.newsitemobject.hasOwnProperty("currentconversation")){
|
||||||
|
@ -73,17 +71,10 @@ Item {
|
||||||
height:newsitem.height-1
|
height:newsitem.height-1
|
||||||
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
color: "white"//(newsitemobject.messagetype==1)?"#ffe6e6" : "white"
|
||||||
|
|
||||||
// Row{id:toprow
|
|
||||||
// Column {
|
|
||||||
// id: authorcolumn
|
|
||||||
// width: 8*mm
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
Column {
|
Column {
|
||||||
id:toprow //newscolumn
|
id:toprow //newscolumn
|
||||||
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *newsitemobject.indent):newsitem.width//-8*mm
|
width: newsitemobject.hasOwnProperty("indent")?newsitem.width-(newsitem.width/20 *(newsitemobject.indent+1)):newsitem.width//-8*mm
|
||||||
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*newsitemobject.indent:0
|
x:newsitemobject.hasOwnProperty("indent")?newsitem.width/20*(newsitemobject.indent):0
|
||||||
Item{
|
Item{
|
||||||
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
|
height: Math.max(profileImage.height+mm,topFlow.implicitHeight+mm)
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -100,7 +91,6 @@ Item {
|
||||||
width: 7*mm
|
width: 7*mm
|
||||||
height: 7*mm
|
height: 7*mm
|
||||||
//radius:mm
|
//radius:mm
|
||||||
|
|
||||||
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||||
}
|
}
|
||||||
Flow{
|
Flow{
|
||||||
|
@ -140,140 +130,117 @@ Item {
|
||||||
horizontalAlignment: Label.AlignRight
|
horizontalAlignment: Label.AlignRight
|
||||||
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name
|
||||||
}catch(e){" "}
|
}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
|
MouseArea{
|
||||||
// //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: toprow.width-2
|
|
||||||
height: itemMessage.height
|
|
||||||
onPressAndHold: {
|
|
||||||
pushConversation();
|
|
||||||
}
|
|
||||||
Text {
|
|
||||||
color: "#404040"
|
|
||||||
linkColor: "light green"
|
|
||||||
id: itemMessage
|
|
||||||
textFormat: Text.RichText
|
|
||||||
font.family: "Noto Sans"
|
|
||||||
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
|
||||||
width: toprow.width-2
|
width: toprow.width-2
|
||||||
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
height: itemMessage.height
|
||||||
//height: implicitHeight
|
onPressAndHold: {
|
||||||
wrapMode: Text.Wrap
|
pushConversation();
|
||||||
clip:true
|
}
|
||||||
onLinkActivated:{
|
Text {
|
||||||
Qt.openUrlExternally(link)}
|
color: "#404040"
|
||||||
Component.onCompleted:{
|
linkColor: "light green"
|
||||||
if (newsitemobject.messagetype==0){
|
id: itemMessage
|
||||||
var hashtags=[];
|
textFormat: Text.RichText
|
||||||
hashtags=findTags(newsitemobject.text);
|
font.family: "Noto Sans"
|
||||||
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html
|
||||||
for (var tags in hashtags){
|
width: toprow.width-2
|
||||||
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
height:newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||||
}}
|
//height: implicitHeight
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
clip:true
|
||||||
|
onLinkActivated:{
|
||||||
|
Qt.openUrlExternally(link)}
|
||||||
|
Component.onCompleted:{
|
||||||
|
if (newsitemobject.messagetype==0){
|
||||||
|
var hashtags=[];
|
||||||
|
hashtags=Newsjs.findTags(newsitemobject.text);
|
||||||
|
var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml");
|
||||||
|
for (var tags in hashtags){
|
||||||
|
var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()});
|
||||||
|
}}
|
||||||
|
|
||||||
if (newsitemobject.attachmentList.length>0){
|
if (newsitemobject.attachmentList.length>0){
|
||||||
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url);
|
||||||
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){
|
||||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml");
|
||||||
var imageQml = component.createObject(toprow,{"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"){
|
else if(newsitemobject.attachmentList[attachments].mimetype=="text/html"){
|
||||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
||||||
var linkQml = component.createObject(toprow,{"url":newsitemobject.attachmentList[attachments].url});
|
var linkQml = component.createObject(toprow,{"url":newsitemobject.attachmentList[attachments].url});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
|
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,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||||
var videoQml = component.createObject(toprow,{"attachment":newsitemobject.attachmentList[attachments]});
|
var videoQml = component.createObject(toprow,{"attachment":newsitemobject.attachmentList[attachments]});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (newsitemobject.hasOwnProperty("lastcomment")){
|
if (newsitemobject.hasOwnProperty("lastcomment")){
|
||||||
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
|
var moreComponent = Qt.createComponent("qrc:/qml/newsqml/MoreComments.qml");
|
||||||
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
|
var conversationQml = moreComponent.createObject(conversationColumn,{"comments":newsitemobject.newscount-1});
|
||||||
|
|
||||||
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
|
var commentComponent = Qt.createComponent("qrc:/qml/newsqml/Newsitem.qml");
|
||||||
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
|
var conversationQml = commentComponent.createObject(conversationColumn,{"newsitemobject":newsitemobject.lastcomment});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
//}
|
BlueButton{
|
||||||
BlueButton{
|
width: newsitem.width-8*mm-2
|
||||||
width: newsitem.width-8*mm-2
|
height:5*mm
|
||||||
height:5*mm
|
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
||||||
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
visible: itemMessage.implicitHeight>3/4*root.height || newsitemobject.nsfw//messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||||
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"
|
||||||
text:"\uf078"
|
fontColor:"grey"
|
||||||
fontColor:"grey"
|
border.color: "transparent"
|
||||||
border.color: "transparent"
|
color:"white"
|
||||||
color:"white"
|
|
||||||
// gradient: Gradient {
|
// gradient: Gradient {
|
||||||
// GradientStop { position: 0.0; color: "transparent" }
|
// GradientStop { position: 0.0; color: "transparent" }
|
||||||
// GradientStop { position: 0.5; color: "white" }
|
// GradientStop { position: 0.5; color: "white" }
|
||||||
// }
|
// }
|
||||||
radius:0
|
radius:0
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (text=="\uf078"){
|
if (text=="\uf078"){
|
||||||
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
itemMessage.height=itemMessage.implicitHeight+10*mm;text="\uf077"
|
||||||
} else {
|
} else {
|
||||||
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
itemMessage.height=Math.min(itemMessage.implicitHeight,3/4*root.height);
|
||||||
text="\uf078";
|
text="\uf078";
|
||||||
newsView.positionViewAtIndex(index,ListView.Beginning);
|
newsView.positionViewAtIndex(index,ListView.Beginning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
Flow{
|
|
||||||
id:friendicaActivities
|
|
||||||
anchors.top:toprow.bottom
|
|
||||||
width:parent.width
|
|
||||||
spacing:mm
|
|
||||||
|
|
||||||
Label{color: "grey"
|
// Bottom row for activities
|
||||||
height:3.5*mm
|
Flow{
|
||||||
font.pixelSize: 1.5*mm
|
id:friendicaActivities
|
||||||
text: friendica_activities_view.likeText
|
anchors.top:toprow.bottom
|
||||||
MouseArea{
|
width:parent.width
|
||||||
anchors.fill: parent
|
spacing:mm
|
||||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
|
||||||
}
|
Label{color: "grey"
|
||||||
}
|
height:3.5*mm
|
||||||
Label{color: "grey"
|
font.pixelSize: 1.5*mm
|
||||||
height:3.5*mm
|
text: friendica_activities_view.likeText
|
||||||
font.pixelSize: 1.5*mm
|
MouseArea{
|
||||||
text: friendica_activities_view.dislikeText
|
anchors.fill: parent
|
||||||
MouseArea{
|
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
|
||||||
anchors.fill: parent
|
}
|
||||||
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
}
|
||||||
}
|
Label{color: "grey"
|
||||||
}
|
height:3.5*mm
|
||||||
|
font.pixelSize: 1.5*mm
|
||||||
|
text: friendica_activities_view.dislikeText
|
||||||
|
MouseArea{
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
|
||||||
|
}
|
||||||
|
}
|
||||||
Label{color: "grey"
|
Label{color: "grey"
|
||||||
height:3.5*mm
|
height:3.5*mm
|
||||||
font.pixelSize: 1.5*mm
|
font.pixelSize: 1.5*mm
|
||||||
|
@ -309,6 +276,8 @@ Item {
|
||||||
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
|
text: (newsitemobject.friendica_activities_view.self.attending)?(qsTr("Attending: ")+ qsTr(newsitemobject.friendica_activities_view.self.attending)):""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Bottom row for buttons
|
||||||
Row{id:controlrow
|
Row{id:controlrow
|
||||||
anchors.top:friendicaActivities.bottom
|
anchors.top:friendicaActivities.bottom
|
||||||
height: 4*mm
|
height: 4*mm
|
||||||
|
@ -385,9 +354,9 @@ Item {
|
||||||
}
|
}
|
||||||
checked:(newsitemobject.favorited>0)
|
checked:(newsitemobject.favorited>0)
|
||||||
onClicked:{
|
onClicked:{
|
||||||
if(favoritedCheckbox.checkedState==Qt.Checked){
|
if(favoritedCheckbox.checkState==Qt.Checked){
|
||||||
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
|
Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1}
|
||||||
else if(favoritedCheckbox.checkedState==Qt.Unchecked){
|
else if(favoritedCheckbox.checkState==Qt.Unchecked){
|
||||||
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
|
Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,29 +377,6 @@ Item {
|
||||||
anchors.fill:parent
|
anchors.fill:parent
|
||||||
onClicked: {newsmenu.popup()}}
|
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:{
|
|
||||||
// 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)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
@ -450,8 +396,6 @@ Item {
|
||||||
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
|
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
|
||||||
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
|
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
|
||||||
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
|
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
|
||||||
//replySignal(newsitemobject)
|
|
||||||
//newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
|
@ -511,6 +455,14 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
|
text: qsTr("Show height")
|
||||||
|
onTriggered: {
|
||||||
|
Helperjs.showMessage("Height",itemMessage.height + "toprow: "+ toprow.height,root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//MenuItem{
|
//MenuItem{
|
||||||
// text:qsTr("Show on website")
|
// text:qsTr("Show on website")
|
||||||
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
|
// onTriggered:Qt.openUrlExternally(login.server+"/display/"+newsitemobject
|
||||||
|
@ -519,8 +471,8 @@ Item {
|
||||||
Column{
|
Column{
|
||||||
id:conversationColumn
|
id:conversationColumn
|
||||||
anchors.top:controlrow.bottom
|
anchors.top:controlrow.bottom
|
||||||
anchors.right: parent.right
|
//anchors.right: parent.right
|
||||||
width: newsitem.width-5*mm
|
width: newsitem.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
import QtQuick 2.11
|
import QtQuick 2.11
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick.Layouts 1.11
|
import QtQuick.Layouts 1.11
|
||||||
//import QtQuick.Controls.Styles 1.4
|
|
||||||
import "qrc:/js/smiley.js" as Smileyjs
|
import "qrc:/js/smiley.js" as Smileyjs
|
||||||
import "qrc:/js/helper.js" as Helperjs
|
import "qrc:/js/helper.js" as Helperjs
|
||||||
import "qrc:/qml/genericqml"
|
import "qrc:/qml/genericqml"
|
||||||
|
@ -88,25 +87,7 @@ Rectangle{
|
||||||
anchors.topMargin: 1*mm
|
anchors.topMargin: 1*mm
|
||||||
width: smileyDialog.width-2*mm
|
width: smileyDialog.width-2*mm
|
||||||
height: smileyDialog.height-7*mm
|
height: smileyDialog.height-7*mm
|
||||||
// style: TabViewStyle {
|
Rectangle{
|
||||||
// frameOverlap: 1
|
|
||||||
// tab: Rectangle {
|
|
||||||
// color: "white"
|
|
||||||
// implicitWidth: smileyTabView.width/4-2*mm
|
|
||||||
// implicitHeight: 4*mm
|
|
||||||
// Text { id: text
|
|
||||||
// anchors.centerIn: parent
|
|
||||||
// text: styleData.title
|
|
||||||
// color: "dark grey"
|
|
||||||
// font.pixelSize:2.5*mm
|
|
||||||
// font.bold: styleData.selected
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// frame: Rectangle { color: "light grey" }
|
|
||||||
// tabsAlignment:Qt.AlignHCenter
|
|
||||||
// }
|
|
||||||
|
|
||||||
Rectangle{
|
|
||||||
id: htmlGridTab
|
id: htmlGridTab
|
||||||
GridView {
|
GridView {
|
||||||
id:htmlView
|
id:htmlView
|
||||||
|
|
|
@ -82,16 +82,16 @@ StackView{
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
onDownloadedjson:{
|
function onDownloadedjson(type,url,filename,i,jsonObject){
|
||||||
if(type=="picturelist"){
|
if(type=="picturelist"){
|
||||||
fotorectangle.currentimageno=fotorectangle.currentimageno+1
|
fotorectangle.currentimageno=fotorectangle.currentimageno+1
|
||||||
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
|
Imagejs.storeImagedata(login,db,jsonObject,fotorectangle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onDownloaded:{
|
function onDownloaded(type,url,filename,i){
|
||||||
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
|
if(type=="picture"){fotorectangle.currentimageno=fotorectangle.currentimageno+1}
|
||||||
}
|
}
|
||||||
onError:{if(data=="picturelist"){
|
function onError(data,url,api,code){if(data=="picturelist"){
|
||||||
var requestid=url.substring(url.lastIndexOf("=")+1);
|
var requestid=url.substring(url.lastIndexOf("=")+1);
|
||||||
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle)
|
Imagejs.dataRequest(login,requestid,db,xhr,fotorectangle)
|
||||||
} else {fotorectangle.currentimageno=fotorectangle.currentimageno+1}
|
} else {fotorectangle.currentimageno=fotorectangle.currentimageno+1}
|
||||||
|
|
Loading…
Reference in a new issue