diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e8db1a..ef2fae8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,55 @@ -## v0.1# - - -# News # - -* Native Android image selector for new message -* Click on contacts shows contact details on news page -* Fix problem with news list after deletion of item - -# Contacts # -* Clean contacts with no news - -# Images # -* Upload pictures with description to album (permissions cannot be set due to API problems) -* Delete pictures or albums from client and server (long press on picture in overview) -* Fix problem when enlarging photo - -# Translations # -* German, Spanish - - - -## v0.1.1# -* FIX: Spanish translation -* FIX: Empty Newsview after deletion of first newsitem - - -## v0.1.2# -* FIX: Include openssl v1.0.2m for SSL connections in Android v7 and above +## v0.1## + + +# News # + +* Native Android image selector for new message +* Click on contacts shows contact details on news page +* Fix problem with news list after deletion of item + +# Contacts # +* Clean contacts with no news + +# Images # +* Upload pictures with description to album (permissions cannot be set due to API problems) +* Delete pictures or albums from client and server (long press on picture in overview) +* Fix problem when enlarging photo + +# Translations # +* German, Spanish + + + +## v0.1.1## +* FIX: Spanish translation +* FIX: Empty Newsview after deletion of first newsitem + + + +## v0.1.2# +* FIX: Include openssl v1.0.2m for SSL connections in Android v7 and above + + +## v0.2 ## +# News # +* Profile image download completely reworked, resulting in speed improvement + +# Contacts # +* New profile tab, data of public and private profiles shown +* Change profile picture +* For friends image button shows private images thanks to new remoteAuth API (Friendica 3.6 server required) --> private holiday pictures have finally arrived! +* For friends calendar button shows private events thanks to new remoteAuth API (Friendica 3.6 server required) +* News button for forum accounts shows news published via that forum + +# Images # +* Complete rework of image download, fixes bug with private images +* Download all or only new images + +# Config # +* Check if nickname exist on server +* Check if password is correct +* Account deletion now also removes news, image data and events from local db + +# Translations # +* Italian thanks to Davide de Prisco + diff --git a/Friendiqa_v0.2.apk b/Friendiqa_v0.2.apk new file mode 100644 index 0000000..d0194c2 Binary files /dev/null and b/Friendiqa_v0.2.apk differ diff --git a/README.md b/README.md index 445fc66..a35d2a4 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ QML based client for the Friendica Social Network. Currently supported: * Shows Posts from friends, favorited messages, Direct Messages and Notifications * Open links in external browser -* Click on contact photo for contact details +* +Click on contact photo for contact details * Click on like text for additional contact info * Deletion, Reposting, Answering of Posts * Liking, disliking, favoriting @@ -32,8 +33,7 @@ Currently supported: ToDo: -* Move picture download into a background process -* Videos and other binary data as attachment (sending and receiving, currently not supported in API) +* Videos and other binary data as attachment (sending and receiving) * More than one attachment (currently not supported in API) * Rich text editing in Send Dialog * Attachments for Direct messages (currently not supported in API) @@ -42,47 +42,54 @@ ToDo: # Friends # Currently supported: -* Tabs for friends, other contacts and groups +* Tabs for own profiles, friends, other contacts and groups +* Show profile(s) of user and change profile picture * Grid of all known contacts with locally downloaded pictures -* Large friend item for addional information and functionality +* Large friend item for additional information and functionality * Show news of contact from local database * Send direct message, if contact is following -* Show public pictures of contact (screenscraping of contact's website, works only with certain theme) +* Show public and private (Friendica 3.6 required) pictures of contact (screenscraping of contact's website, works only with certain theme) +* Show public and private (Friendica 3.6 required) events of contact +* Show members of groups * Open website of contact or connect page (for other contacts) * Clean other contacts with no news ToDo: -* More information for contact from description page, possibly private information for friends (currently not supported in API) +* More information for contact from description page, possibly private information for friends + (needs API change) * Groups: create, change, delete + (needs API change) # Images # Currently supported: -* Download all own images to local directory +* Download public and private own images to local directory +* Upload picture to album with descriptions(public) +* Delete own pictures and albums on client and server * Show albums in grid, show images in album in grid and fullscreen -* Upload pictures to albums with description -* Delete pictures on client and server -* Show albums and images of contacts +* Show public and private (Friendica 3.6 server required) albums and images of contacts * Pinch to zoom, swipe to scroll ToDo: -* Private images of friends -* Support for all themes of friends +* Change name or album of existing picture +* Upload private images # Events # -* download own public events and show public events of Friendica contacts -* list view of events of selected date -* click on event to show details +* Download own public events +* Show public and private events of Friendica contacts (Friendica 3.6 server required) +* List view of events of selected date +* Click on event to show details ToDo -* private events +* Show own private events (needs API) +* Create events (needs API) # Config # Currently supported: * Multiple accounts -* Maximum news (surplus deleted after use of Quit button) +* Maximum news (deleted after use of Quit button) * View mode for news (tree or timeline) ToDo @@ -97,12 +104,14 @@ ToDo # Translations # -* German, Spanish +* German, Spanish, Italian + # Install # -* F-Droid binary repository: [https://www.ma-nic.de/fdroid/repo](https://www.ma-nic.de/fdroid/repo) -* [Google Playstore](https://play.google.com/store/apps/details?id=org.qtproject.friendiqa) - +* F-Droid binary repository: [https://www.ma-nic.de/fdroid/repo](https://www.ma-nic.de/fdroid/repo) +* [Google Playstore](https://play.google.com/store/apps/details?id=org.qtproject.friendiqa) + + ## License ## -Pubished under the [GPL v3](http://gplv3.fsf.org). +Pubished under the [GPL v3](http://gplv3.fsf.org) with the exception of the Openssl library, which is published under OpenSSL License. diff --git a/source-android/android/AndroidManifest.xml b/source-android/android/AndroidManifest.xml index 383738c..87adccf 100644 --- a/source-android/android/AndroidManifest.xml +++ b/source-android/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/source-android/application.qrc b/source-android/application.qrc index 859e7e2..00e0a7c 100644 --- a/source-android/application.qrc +++ b/source-android/application.qrc @@ -210,13 +210,13 @@ translations/friendiqa-es.qm translations/friendiqa-es.ts qml/photoqml/ImageUploadDialog.qml - qml/genericqml/ImageDialog.qml qml/genericqml/PermissionDialog.qml images/addImage.png - common/imageselectandroid.h - common/imageselectandroid.cpp qml/genericqml/ImagePicker.qml - common/quickandroid.h - common/quickandroid.cpp + qml/genericqml/ImagePickerLinux.qml + js/image.js + qml/contactqml/ProfileComponent.qml + translations/friendiqa-it.ts + translations/friendiqa-it.qm diff --git a/source-android/common/filesystem.cpp b/source-android/common/filesystem.cpp index fa29a92..fa4adcf 100644 --- a/source-android/common/filesystem.cpp +++ b/source-android/common/filesystem.cpp @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include "filesystem.h" FILESYSTEM *FILESYSTEM::instance() @@ -29,12 +60,12 @@ QString FILESYSTEM::homePath() const return homeDir; } -QString FILESYSTEM::cameraPath() const -{ -QAndroidJniObject object = QAndroidJniObject::getStaticObjectField("android.os.Environment", "DIRECTORY_DCIM"); -QAndroidJniObject dcim =QAndroidJniObject::callStaticObjectMethod("android.os.Environment","getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", object.object()); - return dcim.toString(); -} +//QString FILESYSTEM::cameraPath() const +//{ +//QAndroidJniObject object = QAndroidJniObject::getStaticObjectField("android.os.Environment", "DIRECTORY_DCIM"); +//QAndroidJniObject dcim =QAndroidJniObject::callStaticObjectMethod("android.os.Environment","getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", object.object()); +// return dcim.toString(); +//} //bool FILESYSTEM::direxist(QString Directory) const @@ -83,46 +114,46 @@ QFileInfoList FILESYSTEM::fileList() return dir.entryInfoList(); } -void FILESYSTEM::searchImage() -{ - QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); - QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); +//void FILESYSTEM::searchImage() +//{ +// QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); +// QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); - QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object(), EXTERNAL_CONTENT_URI.object()); +// QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object(), EXTERNAL_CONTENT_URI.object()); - if (ACTION_PICK.isValid() && intent.isValid()) - { - intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object()); - QtAndroid::startActivity(intent.object(), 101,this); - qDebug() << "OK"; - } - else - { - qDebug() << "ERRO"; - } -} +// if (ACTION_PICK.isValid() && intent.isValid()) +// { +// intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object()); +// QtAndroid::startActivity(intent.object(), 101,this); +// qDebug() << "OK"; +// } +// else +// { +// qDebug() << "ERRO"; +// } +//} -void FILESYSTEM::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) -{ - jint RESULT_OK = QAndroidJniObject::getStaticField("android/app/Activity", "RESULT_OK"); - if (receiverRequestCode == 101 && resultCode == RESULT_OK) - { - QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); - QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); - QAndroidJniEnvironment env; - jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); - jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); - env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); - QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); - QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object(), projecao, NULL, NULL, NULL); - jint columnIndex = cursor.callMethod("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object()); - cursor.callMethod("moveToFirst", "()Z"); - QAndroidJniObject resultUri = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); - QString imageSelect = "file://" + resultUri.toString(); - emit imageselected(imageSelect); - } - else - { - qDebug() << "Select error"; - } -} +//void FILESYSTEM::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) +//{ +// jint RESULT_OK = QAndroidJniObject::getStaticField("android/app/Activity", "RESULT_OK"); +// if (receiverRequestCode == 101 && resultCode == RESULT_OK) +// { +// QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); +// QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); +// QAndroidJniEnvironment env; +// jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); +// jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); +// env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); +// QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); +// QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object(), projecao, NULL, NULL, NULL); +// jint columnIndex = cursor.callMethod("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object()); +// cursor.callMethod("moveToFirst", "()Z"); +// QAndroidJniObject resultUri = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); +// QString imageSelect = "file://" + resultUri.toString(); +// emit imageselected(imageSelect); +// } +// else +// { +// qDebug() << "Select error"; +// } +//} diff --git a/source-android/common/filesystem.h b/source-android/common/filesystem.h index d8b2bac..5f56f2a 100644 --- a/source-android/common/filesystem.h +++ b/source-android/common/filesystem.h @@ -1,18 +1,49 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef FILESYSTEM_H #define FILESYSTEM_H #include #include -#include -#include +//#include +//#include -class FILESYSTEM : public QObject, public QAndroidActivityResultReceiver +class FILESYSTEM : public QObject//, public QAndroidActivityResultReceiver { Q_OBJECT Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged) //Q_PROPERTY(bool direxist READ direxist) Q_PROPERTY(QString homePath READ homePath) - Q_PROPERTY(QString cameraPath READ cameraPath) + //Q_PROPERTY(QString cameraPath READ cameraPath) public: @@ -23,11 +54,11 @@ public: QFileInfoList fileList(); //bool direxist(QString Directory); QString homePath() const; - QString cameraPath() const; - virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data); + //QString cameraPath() const; + // virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data); signals: - void imageselected(QString); + //void imageselected(QString); void directoryChanged(); //void fileListContent(QList data); void success(QString data); @@ -37,7 +68,7 @@ public slots: void makeDir(QString name); void rmDir(); void rmFile(QString name); - void searchImage(); + //void searchImage(); //void fileList(); private: diff --git a/source-android/common/friendiqa.cpp b/source-android/common/friendiqa.cpp index 3ad211e..7e7dea2 100644 --- a/source-android/common/friendiqa.cpp +++ b/source-android/common/friendiqa.cpp @@ -1,15 +1,45 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include #include #include #include "xhr.h" #include "filesystem.h" -//#include "qadrawableprovider.h" -//#include "androidnative.pri/cpp/AndroidNative/systemdispatcher.h" +#include "remoteauthasyncimageprovider.h" #include "AndroidNative/systemdispatcher.h" #include "AndroidNative/environment.h" -#include "AndroidNative/debug.h" +//#include "AndroidNative/debug.h" #include "AndroidNative/mediascannerconnection.h" -//#include "debugwrapper.h" + #ifdef Q_OS_ANDROID #include @@ -30,9 +60,9 @@ int main(int argc, char *argv[]) { QTranslator qtTranslator; qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations"); app.installTranslator(&qtTranslator); - -// qmlRegisterType("SystemDispatcher", 0, 1, "SystemDispatcher"); - + 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(); diff --git a/source-android/common/imageselectandroid.cpp b/source-android/common/imageselectandroid.cpp deleted file mode 100644 index 63a88c1..0000000 --- a/source-android/common/imageselectandroid.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "imageselectandroid.h" - -imageSelectAndroid::imageSelectAndroid() -{ - -} -imageSelectAndroid *imageSelectAndroid::instance() -{ - static imageSelectAndroid imageselectandroid; - return &imageselectandroid; -} - -void imageSelectAndroid::searchImage() -{ - QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); - QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); - - QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object(), EXTERNAL_CONTENT_URI.object()); - - if (ACTION_PICK.isValid() && intent.isValid()) - { - intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object()); - QtAndroid::startActivity(intent.object(), 101, this); - qDebug() << "OK"; - } - else - { - qDebug() << "ERRO"; - } -} - -void imageSelectAndroid::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) -{ qDebug() << "done"; - jint RESULT_OK = QAndroidJniObject::getStaticField("android/app/Activity", "RESULT_OK"); - if (receiverRequestCode == 101 && resultCode == RESULT_OK) - { - qDebug() << "done"; - QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); - QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); - QAndroidJniEnvironment env; - jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); - jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); - env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); - QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); - QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object(), projecao, NULL, NULL, NULL); - jint columnIndex = cursor.callMethod("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object()); - cursor.callMethod("moveToFirst", "()Z"); - QAndroidJniObject resultUri = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); - QString imageSelect = "file://" + resultUri.toString(); - emit imageselected(imageSelect); - } - else - { - qDebug() << "Select error"; - } -} diff --git a/source-android/common/imageselectandroid.h b/source-android/common/imageselectandroid.h deleted file mode 100644 index 5a3690e..0000000 --- a/source-android/common/imageselectandroid.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IMAGEPICKANDROID_H -#define IMAGEPICKANDROID_H -#include -#include - -#include - -class imageSelectAndroid : public QObject, public QAndroidActivityResultReceiver -{ - Q_OBJECT - -public: - imageSelectAndroid(); - static imageSelectAndroid *instance(); - void searchImage(); - - virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject & data); - -signals: - void imageselected(QString); -}; - -#endif // IMAGEPICKANDROID_H diff --git a/source-android/common/qasystemdispatcher.cpp b/source-android/common/qasystemdispatcher.cpp deleted file mode 100644 index d9bd18a..0000000 --- a/source-android/common/qasystemdispatcher.cpp +++ /dev/null @@ -1,348 +0,0 @@ -// Author: Ben Lau (https://github.com/benlau) -#include -#include -#include -#include -#include -#include "qasystemdispatcher.h" - -static QPointer m_instance; - -QString QASystemDispatcher::ACTIVITY_RESUME_MESSAGE = "Activity.onResume"; -QString QASystemDispatcher::ACTIVITY_RESULT_MESSAGE = "Activity.onActivityResult"; - - -#ifdef Q_OS_ANDROID -#include -#include - -#define JCLASS_Name "quickandroid/SystemDispatcher" -#define DISPATCH_SIGNATURE "(Ljava/lang/String;Ljava/util/Map;)V" -#define EMIT_SIGNATURE "(Ljava/lang/String;Ljava/util/Map;)V" - -static QVariantMap createVariantMap(jobject data); -static jobject createHashMap(const QVariantMap &data); - -static QVariant convertToQVariant(QAndroidJniObject value) { - QVariant v; - if (!value.isValid()) { - return v; - } - - QAndroidJniEnvironment env; - - jclass jclass_of_string = env->FindClass("java/lang/String"); - jclass jclass_of_integer = env->FindClass("java/lang/Integer"); - jclass jclass_of_boolean = env->FindClass("java/lang/Boolean"); - jclass jclass_of_list = env->FindClass("java/util/List"); - jclass jclass_of_map = env->FindClass("java/util/Map"); - - if (env->IsInstanceOf(value.object(),jclass_of_boolean)) { - v = QVariant::fromValue(value.callMethod("booleanValue","()Z")); - } else if (env->IsInstanceOf(value.object(),jclass_of_integer)) { - v = value.callMethod("intValue","()I"); - } else if (env->IsInstanceOf(value.object(),jclass_of_string)) { - v = value.toString(); - } else if (env->IsInstanceOf(value.object(), jclass_of_map)) { - v = createVariantMap(value.object()); - } else if (env->IsInstanceOf(value.object(),jclass_of_list)) { - QVariantList list; - int count = value.callMethod("size","()I"); - for (int i = 0 ; i < count ; i++) { - QAndroidJniObject item = value.callObjectMethod("get","(I)Ljava/lang/Object;",i); - list.append(convertToQVariant(item)); - } - v = list; - } - - env->DeleteLocalRef(jclass_of_string); - env->DeleteLocalRef(jclass_of_integer); - env->DeleteLocalRef(jclass_of_boolean); - env->DeleteLocalRef(jclass_of_list); - env->DeleteLocalRef(jclass_of_map); - - return v; -} - -static QVariantMap createVariantMap(jobject data) { - QVariantMap res; - - QAndroidJniEnvironment env; - /* Reference : https://community.oracle.com/thread/1549999 */ - - // Get the HashMap Class - jclass jclass_of_hashmap = (env)->GetObjectClass(data); - - // Get link to Method "entrySet" - jmethodID entrySetMethod = (env)->GetMethodID(jclass_of_hashmap, "entrySet", "()Ljava/util/Set;"); - - // Invoke the "entrySet" method on the HashMap object - jobject jobject_of_entryset = env->CallObjectMethod(data, entrySetMethod); - - // Get the Set Class - jclass jclass_of_set = (env)->FindClass("java/util/Set"); // Problem during compilation !!!!! - - if (jclass_of_set == 0) { - qWarning() << "java/util/Set lookup failed\n"; - return res; - } - - // Get link to Method "iterator" - jmethodID iteratorMethod = env->GetMethodID(jclass_of_set, "iterator", "()Ljava/util/Iterator;"); - - // Invoke the "iterator" method on the jobject_of_entryset variable of type Set - jobject jobject_of_iterator = env->CallObjectMethod(jobject_of_entryset, iteratorMethod); - - // Get the "Iterator" class - jclass jclass_of_iterator = (env)->FindClass("java/util/Iterator"); - - // Get link to Method "hasNext" - jmethodID hasNextMethod = env->GetMethodID(jclass_of_iterator, "hasNext", "()Z"); - - jmethodID nextMethod = env->GetMethodID(jclass_of_iterator, "next", "()Ljava/lang/Object;"); - - while (env->CallBooleanMethod(jobject_of_iterator, hasNextMethod) ) { - jobject jEntry = env->CallObjectMethod(jobject_of_iterator,nextMethod); - QAndroidJniObject entry = QAndroidJniObject(jEntry); - QAndroidJniObject key = entry.callObjectMethod("getKey","()Ljava/lang/Object;"); - QAndroidJniObject value = entry.callObjectMethod("getValue","()Ljava/lang/Object;"); - QString k = key.toString(); - - QVariant v = convertToQVariant(value); - - env->DeleteLocalRef(jEntry); - - if (v.isNull()) { - continue; - } - - res[k] = v; - } - - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - env->ExceptionClear(); - } - - env->DeleteLocalRef(jclass_of_hashmap); - env->DeleteLocalRef(jobject_of_entryset); - env->DeleteLocalRef(jclass_of_set); - env->DeleteLocalRef(jobject_of_iterator); - env->DeleteLocalRef(jclass_of_iterator); - - return res; -} - -static jobject convertToJObject(QVariant v) { - jobject res = 0; - QAndroidJniEnvironment env; - - if (v.type() == QVariant::String) { - QString str = v.toString(); - res = env->NewStringUTF(str.toLocal8Bit().data()); - } else if (v.type() == QVariant::Int) { - jclass integerClass = env->FindClass("java/lang/Integer"); - jmethodID integerConstructor = env->GetMethodID(integerClass, "", "(I)V"); - - res = env->NewObject(integerClass,integerConstructor,v.toInt()); - - env->DeleteLocalRef(integerClass); - } else if (v.type() == QVariant::Bool) { - jclass booleanClass = env->FindClass("java/lang/Boolean"); - jmethodID booleanConstructor = env->GetMethodID(booleanClass,"","(Z)V"); - - res = env->NewObject(booleanClass,booleanConstructor,v.toBool()); - - env->DeleteLocalRef(booleanClass); - - } else if (v.type() == QVariant::Map) { - res = createHashMap(v.toMap()); - } else if (v.type() == QVariant::List){ - QVariantList list = v.value(); - jclass arrayListClass = env->FindClass("java/util/ArrayList"); - jmethodID init = env->GetMethodID(arrayListClass, "", "(I)V"); - res = env->NewObject( arrayListClass, init, list.size()); - - jmethodID add = env->GetMethodID( arrayListClass, "add", - "(Ljava/lang/Object;)Z"); - - for (int i = 0 ; i < list.size() ; i++) { - jobject item = convertToJObject(list.at(i)); - env->CallBooleanMethod(res,add, item); - env->DeleteLocalRef(item); - } - - env->DeleteLocalRef(arrayListClass); - } else { - qWarning() << "QASystemDispatcher: Non-supported data type - " << v.type(); - } - return res; -} - -static jobject createHashMap(const QVariantMap &data) { - QAndroidJniEnvironment env; - - jclass mapClass = env->FindClass("java/util/HashMap"); - - if (mapClass == NULL) { - qWarning() << "Failed to find class" << "java/util/HashMap"; - return NULL; - } - - jsize map_len = data.size(); - - jmethodID init = env->GetMethodID(mapClass, "", "(I)V"); - jobject hashMap = env->NewObject( mapClass, init, map_len); - - jmethodID put = env->GetMethodID( mapClass, "put", - "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); - - QMapIterator iter(data); - while (iter.hasNext()) { - iter.next(); - - QString key = iter.key(); - jstring jkey = env->NewStringUTF(key.toLocal8Bit().data()); - QVariant v = iter.value(); - jobject item = convertToJObject(v); - - if (item == 0) { - continue; - } - - env->CallObjectMethod(hashMap,put,jkey,item); - env->DeleteLocalRef(item); - env->DeleteLocalRef(jkey); - } - - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - env->ExceptionClear(); - } - - env->DeleteLocalRef(mapClass); - - return hashMap; -} - -static void jniEmit(JNIEnv* env,jobject object,jstring name,jobject data) { - Q_UNUSED(object); - Q_UNUSED(env); - - QAndroidJniObject tmp(name); - QString str = tmp.toString(); - - QVariantMap map; - - if (data != 0) { - map = createVariantMap(data); - } - - if (m_instance.isNull()) { - return; - } - - QMetaObject::invokeMethod(m_instance.data(),"dispatched",Qt::AutoConnection, - Q_ARG(QString, str), - Q_ARG(QVariantMap,map)); -} - - -#endif - -QASystemDispatcher::QASystemDispatcher(QObject* parent) : QObject(parent) -{ - -} - -QASystemDispatcher::~QASystemDispatcher() -{ - -} - -QASystemDispatcher *QASystemDispatcher::instance() -{ - if (!m_instance) { - QCoreApplication* app = QCoreApplication::instance(); - m_instance = new QASystemDispatcher(app); - } - return m_instance; -} - -void QASystemDispatcher::dispatch(QString type, QVariantMap message) -{ - Q_UNUSED(type); - Q_UNUSED(message); -#ifdef Q_OS_ANDROID - QAndroidJniEnvironment env; - - jstring jType = env->NewStringUTF(type.toLocal8Bit().data()); - jobject jData = createHashMap(message); - QAndroidJniObject::callStaticMethod(JCLASS_Name, "dispatch", - DISPATCH_SIGNATURE, - jType,jData); - env->DeleteLocalRef(jType); - env->DeleteLocalRef(jData); - -#else - static bool dispatching = false; - static QQueue > queue; - - - if (dispatching) { - queue.enqueue(QPair (type,message) ); - return; - } - - dispatching = true; - emit dispatched(type,message); - - -qWarning() << "QASystemDispatcher: emitted" - - while (queue.size() > 0) { - QPair pair = queue.dequeue(); - emit dispatched(pair.first,pair.second); - } - dispatching = false; -#endif -} - -void QASystemDispatcher::loadClass(QString javaClassName) -{ - QVariantMap message; - message["className"] = javaClassName; - - dispatch("quickandroid.SystemDispatcher.loadClass",message); -} - -void QASystemDispatcher::registerNatives() -{ -#ifdef Q_OS_ANDROID - QAndroidJniEnvironment env; - jclass clazz = env->FindClass(JCLASS_Name); - if (!clazz) - { - qCritical() << QString("Can't find %1 class").arg(QString(JCLASS_Name)); - return ; - } - - JNINativeMethod methods[] = - { - {"jniEmit", EMIT_SIGNATURE, (void *)&jniEmit}, - }; - - int numMethods = sizeof(methods) / sizeof(methods[0]); - if (env->RegisterNatives(clazz, methods, numMethods) < 0) { - if (env->ExceptionOccurred()) { - env->ExceptionDescribe(); - env->ExceptionClear(); - qCritical() << "Exception occurred!!!"; - return; - } - } - - QAndroidJniObject::callStaticMethod(JCLASS_Name, "init", - "()V"); -#endif -} diff --git a/source-android/common/qasystemdispatcher.h b/source-android/common/qasystemdispatcher.h deleted file mode 100644 index 414d18d..0000000 --- a/source-android/common/qasystemdispatcher.h +++ /dev/null @@ -1,47 +0,0 @@ -// Author: Ben Lau (https://github.com/benlau) -#pragma once -#include -#include - -/// QASystemDispatcher provides an simple messaging interface between C/C++/QML and Java code. - -class QASystemDispatcher : public QObject -{ - Q_OBJECT -public: - ~QASystemDispatcher(); - static QASystemDispatcher* instance(); - - /// Dispatch a message via Dispatcher - /** The message will be first passed to Java's SystemDispatcher and invoke - * registered listener. Once it is finished, it will emit the - * "dispatched" signal. - * - */ - Q_INVOKABLE void dispatch(QString type , QVariantMap message = QVariantMap()); - - /// Load a Java class - /** It will dispatch a message to Java and let it to load a Java class. That - * will force to run code in static block. - * - */ - Q_INVOKABLE void loadClass(QString javaClassName); - - /// Register JNI native methods. This function must be called in JNI_OnLoad. Otherwise, the messenger will not be working - static void registerNatives(); - - /// The name of message that will be dispatched during Activity.onActivityResult. - static QString ACTIVITY_RESULT_MESSAGE; - - /// The name of message that will be dispatched during Activity.onResume. - static QString ACTIVITY_RESUME_MESSAGE; - -signals: - /// The signal is emitted when a message is dispatched. - void dispatched(QString type , QVariantMap message); - -public: - explicit QASystemDispatcher(QObject* parent = 0); - -}; - diff --git a/source-android/common/quickandroid.cpp b/source-android/common/quickandroid.cpp deleted file mode 100644 index 2ceb04e..0000000 --- a/source-android/common/quickandroid.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include "quickandroid.h" -//#include "qadevice.h" -//#include "qamousesensor.h" - -#ifdef Q_OS_ANDROID -#include -#include -#endif - -void QuickAndroid::registerTypes() -{ - // "A" has been changed to a QML object. So now this function will do nothing. - // Keep here for compatible purpose only. -} - -//qreal QuickAndroid::dp() -//{ -// return QADevice::readDp(); -//} - diff --git a/source-android/common/quickandroid.h b/source-android/common/quickandroid.h deleted file mode 100644 index 1b0d01b..0000000 --- a/source-android/common/quickandroid.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef QUICKANDROID_H -#define QUICKANDROID_H - -#include -/// Quick Android Context - -class QuickAndroid -{ -public: - static void registerTypes(); - - /// Obtain the detected "dp" value. - /** This function has been deprecated. Please use QADevice::dp() - @deprecated. - * @brief dp - * @return The detected "dp" value - */ - static qreal dp(); -}; - -#endif // QUICKANDROID_H diff --git a/source-android/common/remoteauthasyncimageprovider.cpp b/source-android/common/remoteauthasyncimageprovider.cpp new file mode 100644 index 0000000..66a8b03 --- /dev/null +++ b/source-android/common/remoteauthasyncimageprovider.cpp @@ -0,0 +1,123 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "remoteauthasyncimageprovider.h" +#include +#include + + AsyncImageResponse::AsyncImageResponse(QNetworkRequest req, QSize reqSize) + { + m_reply = m_imageLoader.get(req); + m_requestedSize = reqSize; + connect(m_reply, &QNetworkReply::finished, this, &AsyncImageResponse::onResponseFinished); +} + + + void AsyncImageResponse::onResponseFinished() + { + QByteArray myImageData = m_reply->readAll(); + m_resultImage = QImage::fromData(myImageData); + if (m_requestedSize.isValid()) + { + m_resultImage = m_resultImage.scaled(m_requestedSize); + } + emit finished(); + } + + + QQuickTextureFactory *AsyncImageResponse::textureFactory() const + { + return QQuickTextureFactory::textureFactoryForImage(m_resultImage); + } + + + RemoteAuthAsyncImageProvider::RemoteAuthAsyncImageProvider() + { + } + + + QQuickImageResponse* RemoteAuthAsyncImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize) + { + QUrl iUrl=url()+"/api/friendica/remoteauth?c_url="+contacturl()+"&url="+id; + QByteArray loginData = m_login.toLocal8Bit().toBase64(); + QString headerData = "Basic " + loginData; + + QNetworkRequest request(iUrl); + request.setRawHeader("Authorization", headerData.toLocal8Bit()); + request.setAttribute(QNetworkRequest::FollowRedirectsAttribute,true); + request.setUrl(iUrl); + return new AsyncImageResponse(request, requestedSize); + } + + + void RemoteAuthAsyncImageProvider::setContacturl(QString contacturl) + { + if (contacturl!=m_contacturl) { + m_contacturl = contacturl; + emit contacturlChanged(); + } + } + + + void RemoteAuthAsyncImageProvider::setUrl(QString url) + { + if (url!=m_url) { + m_url = url; + emit urlChanged(); + } + } + + + void RemoteAuthAsyncImageProvider::setLogin(QString login) + { + if (login!=m_login) { + m_login = login; + emit loginChanged(); + } + } + + + QString RemoteAuthAsyncImageProvider::contacturl() const + { + return m_contacturl; + } + + + QString RemoteAuthAsyncImageProvider::url() const + { + return m_url; + } + + + QString RemoteAuthAsyncImageProvider::login() const + { + return m_login; + } diff --git a/source-android/common/remoteauthasyncimageprovider.h b/source-android/common/remoteauthasyncimageprovider.h new file mode 100644 index 0000000..f028ada --- /dev/null +++ b/source-android/common/remoteauthasyncimageprovider.h @@ -0,0 +1,95 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#ifndef REMOTEAUTHIMAGEPROVIDER_H +#define REMOTEAUTHIMAGEPROVIDER_H + +#include +#include +#include +#include +#include +#include + + +class AsyncImageResponse : public QQuickImageResponse +{ + Q_OBJECT +public: + explicit AsyncImageResponse(QNetworkRequest req, QSize requestedSize); + QQuickTextureFactory *textureFactory() const; + +public slots: + void onResponseFinished(); + +protected: + QNetworkAccessManager m_imageLoader; + QNetworkReply* m_reply; + QSize m_requestedSize; + QImage m_resultImage; + int m_index; + QString m_id; + QImage m_image; +}; + +class RemoteAuthAsyncImageProvider : public QObject, public QQuickAsyncImageProvider +{ + Q_OBJECT + Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(QString contacturl READ contacturl WRITE setContacturl NOTIFY contacturlChanged) + Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) + +public: + explicit RemoteAuthAsyncImageProvider(); + QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override; + QString url() const; + QString contacturl() const; + QString login() const; + +signals: + void contacturlChanged(); + void urlChanged(); + void loginChanged(); + +public slots: + void setContacturl(QString contacturl); + void setUrl(QString url); + void setLogin(QString login); + +private: + QByteArray buffer; + QString m_url; + QString m_contacturl; + QString m_login; + QString bufferToString(); +}; + +#endif // REMOTEAUTHIMAGEPROVIDER_H diff --git a/source-android/common/uploadableimage.cpp b/source-android/common/uploadableimage.cpp index 81bea1a..7ef3524 100644 --- a/source-android/common/uploadableimage.cpp +++ b/source-android/common/uploadableimage.cpp @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include "uploadableimage.h" diff --git a/source-android/common/uploadableimage.h b/source-android/common/uploadableimage.h index b4d6876..665bf82 100644 --- a/source-android/common/uploadableimage.h +++ b/source-android/common/uploadableimage.h @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef UPLOADABLEIMAGE_H #define UPLOADABLEIMAGE_H diff --git a/source-android/common/xhr.cpp b/source-android/common/xhr.cpp index 2fe9ceb..dbb872a 100644 --- a/source-android/common/xhr.cpp +++ b/source-android/common/xhr.cpp @@ -1,12 +1,43 @@ -#include "xhr.h" +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "xhr.h" #include #include #include -#include -#include #include #include +#include +#include #include "uploadableimage.h" XHR *XHR::instance() @@ -44,6 +75,29 @@ void XHR::setFilename(QString filename) } } +void XHR::setContactlist(QList contactlist) +{ + if (contactlist!=m_contactlist) { + m_contactlist = contactlist; + emit contactlistChanged(); + } +} + +void XHR::setFilelist(QList 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) { @@ -67,6 +121,21 @@ QString XHR::filename() const return m_filename; } +QList XHR::contactlist() const +{ + return m_contactlist; +} + +QList XHR::filelist() const +{ + return m_filelist; +} + +QString XHR::imagedir() const +{ + return m_imagedir; +} + QString XHR::downloadtype() const { return m_downloadtype; @@ -91,9 +160,14 @@ void XHR::clearParams() 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(); + 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); @@ -117,9 +191,6 @@ void XHR::get() QByteArray loginData = m_login.toLocal8Bit().toBase64(); QString headerData = "Basic " + loginData; request.setRawHeader("Authorization", headerData.toLocal8Bit()); -// QNetworkCookieJar* cJar = new QNetworkCookieJar; -// manager.setCookieJar(cJar); - request.setUrl(requrl); reply = manager.get(request); @@ -129,6 +200,20 @@ void XHR::get() 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;} +} + + void XHR::post() { qDebug() << "start post to " << m_url; @@ -178,7 +263,7 @@ void XHR::post() void XHR::onReplyError(QNetworkReply::NetworkError code) { qDebug() << code; - emit this->error( bufferToString(), (int) code); + emit this->error( bufferToString(), m_url, (int) code); buffer.clear(); reply->deleteLater(); } @@ -194,14 +279,45 @@ void XHR::onReplySuccess() void XHR::onRequestFinished() { // Save the file here - //qDebug() << "buffer downloaded "<error(m_downloadtype,1);} - else {QFile file(m_filename); - file.open(QIODevice::WriteOnly); - file.write(buffer); - buffer.clear(); - file.close(); - emit this->downloaded(m_downloadtype); + if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,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 "<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(); } } @@ -210,15 +326,6 @@ void XHR::onReadyRead() { qDebug() << "."; buffer += reply->readAll(); -// QList list = manager.cookieJar()->cookiesForUrl(m_url); -// QFile f("/home/pankraz/cookie.txt"); -// f.open(QIODevice::ReadWrite); -// for(int i = 0; i < list.size(); ++i){ -// QDataStream s(&f); -// s << list.at(i).toRawForm(); -// } -// f.close(); - } //void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes) diff --git a/source-android/common/xhr.h b/source-android/common/xhr.h index 6e93c6c..f2e0bb6 100644 --- a/source-android/common/xhr.h +++ b/source-android/common/xhr.h @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef XHR_H #define XHR_H @@ -5,6 +36,7 @@ #include #include #include +#include class XHR : public QObject { @@ -12,6 +44,9 @@ class XHR : public QObject Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + Q_PROPERTY(QString imagedir READ imagedir WRITE setImagedir NOTIFY imagedirChanged) + Q_PROPERTY(QList contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged) + Q_PROPERTY(QList filelist READ filelist WRITE setFilelist NOTIFY filelistChanged) Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged) @@ -23,27 +58,38 @@ public: QString url() const; QString login() const; QString filename() const; + QList contactlist() const; + QList filelist() const; + QString imagedir() const; QString downloadtype() const; signals: void urlChanged(); void loginChanged(); void filenameChanged(); + void contactlistChanged(); + void filelistChanged(); + void imagedirChanged(); void downloadtypeChanged(); - void downloaded(QString data); + void downloaded(QString type, QString url, QString filename, int i); + void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); void success(QString data); - void error(QString data, int code); + void error(QString data, QString url, int code); public slots: void setUrl(QString url); void setLogin(QString login); void setDownloadtype(QString downloadtype); void setFilename(QString filename); + void setContactlist(QList filename); + void setFilelist(QList filename); + void setImagedir(QString filename); void setParam(QString name, QString value); void setImageFileParam(QString name, QString url); void clearParams(); void post(); void get(); + void getlist(); void download(); private slots: @@ -62,6 +108,10 @@ private: QString m_downloadtype; QHash params; QHash files; + QList m_filelist; + QList m_contactlist; + QString m_imagedir; + int dlindex; QNetworkAccessManager manager; QNetworkRequest request; diff --git a/source-android/friendiqa.pro b/source-android/friendiqa.pro index de70c9b..edafe5c 100644 --- a/source-android/friendiqa.pro +++ b/source-android/friendiqa.pro @@ -21,6 +21,7 @@ SOURCES += common/friendiqa.cpp \ common/uploadableimage.cpp \ common/xhr.cpp \ common/filesystem.cpp \ + common/remoteauthasyncimageprovider.cpp ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android @@ -42,7 +43,8 @@ TRANSLATIONS += translations/friendiqa-de.ts \ HEADERS += \ common/uploadableimage.h \ common/xhr.h \ - common/filesystem.h + common/filesystem.h \ + common/remoteauthasyncimageprovider.h DISTFILES += \ qml/calendarqml/*.qml \ diff --git a/source-android/js/friendworker.js b/source-android/js/friendworker.js index 6b6c5be..ab6fdf4 100644 --- a/source-android/js/friendworker.js +++ b/source-android/js/friendworker.js @@ -1,3 +1,33 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . WorkerScript.onMessage = function(msg) { msg.model.clear(); for (var j=0;j +// +// 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 . + .pragma library .import QtQuick.LocalStorage 2.0 as Sql @@ -64,6 +95,20 @@ function friendicaWebRequest(url,rootwindow,callback) { xhrequest.send(); } +function friendicaRemoteAuthRequest(login,url,c_url,rootwindow,callback) { + var xhrequest = new XMLHttpRequest(); + xhrequest.onreadystatechange = function() { + if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {} + else if(xhrequest.readyState === XMLHttpRequest.DONE) { + try{callback(xhrequest.responseText)} + catch (e){showMessage("Error",url+" "+e+"\n Return: "+xhrequest.responseText, rootwindow)} + } + } + xhrequest.open("GET", login.server+"/api/friendica/remoteauth?c_url="+c_url+"&url="+url,true,login.username,Qt.atob(login.password)); + xhrequest.send(); +} + + function readData(database,table,username,callback,filter,filtervalue, sort) { // reads and applies data from DB if (filter){ var where = " AND "+ filter +" = '" + filtervalue+"'"; @@ -107,7 +152,8 @@ var where = " AND "+ filter +" = '" + filtervalue+"'"; } function showMessage(header,message,rootwindow){//print("message: "+message); - var cleanmessage=message.replace(/"/g,"-"); + var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage); + if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'} var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}'; var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput"); } diff --git a/source-android/js/image.js b/source-android/js/image.js new file mode 100644 index 0000000..5c48ac3 --- /dev/null +++ b/source-android/js/image.js @@ -0,0 +1,272 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +.pragma library +.import QtQuick.LocalStorage 2.0 as Sql +.import "qrc:/js/helper.js" as Helperjs + +function requestList(login,database,onlynew,rootwindow,callback) { + //get list of own images and call download function + Helperjs.friendicaRequest(login,"/api/friendica/photos/list", rootwindow,function (helperobject){ + //print("return"+helperobject); + var obj=JSON.parse(helperobject); + if (onlynew){Helperjs.readField("id",database,"imageData",login.username,function(AllStoredImages){ + if (AllStoredImages.length>0){ + for(var i=0;i< AllStoredImages.length;i++){ + var position=Helperjs.inArray(obj,"id",AllStoredImages[i]); + if (position>-1){obj.splice(position,1)} + } + } + callback(obj) + })} + else{callback(obj)} +})} + +function dataRequest(login,photoID,database,xhr,rootwindow) { + // check if image exist and call download function + Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photoID, rootwindow, function (image){ + try{ if(image==""){currentimageno=currentimageno+1}else{ + var obj = JSON.parse(image); + var helpfilename=obj.filename.substring(0,obj.filename.lastIndexOf(".")); + var filesuffix=""; + if (obj.type=="image/jpeg"){filesuffix=".jpg"} + else if (obj.type=="image/png"){filesuffix=".png"} + else {filesuffix=""} + if (helpfilename==""){// check if file has any filename + obj.filename=obj["id"]+filesuffix; + } + else{obj.filename=helpfilename+filesuffix} + var link=""; + if(obj["link"][0]){link=obj["link"][0]} else{link=obj["link"]["4"]} + xhr.setUrl(Qt.resolvedUrl(link)); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setFilename(login.imagestore+'albums/'+obj.album+"/"+obj["filename"]); + xhr.setDownloadtype("picture"); + xhr.download(); + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + db.transaction( function(tx) { + var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); + if(result.rows.length === 1) {// use update + result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+obj.id+'", created="'+obj.created+'", edited="'+obj.edited+'", profile="'+obj.profile+'", link="'+obj["link"]["4"]+'", filename="'+obj.filename+'",title="'+obj.title+'", desc="'+obj.desc+'", type="'+obj.type+'", width="'+obj.width+'", height="'+obj.height+'", album="'+obj.album+'", location="file://'+login.imagestore+'albums/'+obj.album+'/" where id="'+obj["id"]+'"'); + } else {// use insert print('... does not exists, create it') + result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,obj.id,obj.created,obj.edited, obj.title, obj.desc, obj.album, obj.filename, obj.type, obj.height, obj.width,obj. profile,obj["link"]["4"],'file://'+login.imagestore+'albums/'+obj.album+"/"]); + } + })}} + catch (e){print("Data retrieval failure! "+ e+obj);} +})} + +function storeImagedata(login,database,imagedata,rootwindow) { + // check if image exist and call download function + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + db.transaction( function(tx) { + var result = tx.executeSql('SELECT * from imageData where id = "'+imagedata["id"]+'"'); + if(result.rows.length === 1) {// use update + result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+imagedata.id+'", created="'+imagedata.created+'", edited="'+imagedata.edited+'", profile="'+imagedata.profile+'", link="'+imagedata.link[0]+'", filename="'+imagedata.filename+'",title="'+imagedata.title+'", desc="'+imagedata.desc+'", type="'+imagedata.type+'", width="'+imagedata.width+'", height="'+imagedata.height+'", album="'+imagedata.album+'", location="file://'+login.imagestore+'albums/'+imagedata.album+'/" where id="'+imagedata["id"]+'"'); + } else {// use insert print('... does not exists, create it') + result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,imagedata.id,imagedata.created,imagedata.edited, imagedata.title, imagedata.desc, imagedata.album, imagedata.filename, imagedata.type, imagedata.height, imagedata.width,imagedata. profile,imagedata.link[0],'file://'+login.imagestore+'albums/'+imagedata.album+"/"]); + } +})} + +function deleteImage(database,login,type,location,filesystem,rootwindow,callback) { // delete image locally and on server + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + var rsfilename=location.substring(location.lastIndexOf("/")+1,location.length); + var rslocation=location.substring(0,location.lastIndexOf("/")+1); + //print(type+" Name "+ rsfilename+" Location: "+rslocation) + db.transaction( function(tx) { + if (type=='image'){ + var rs= tx.executeSql('SELECT * FROM imageData WHERE filename="'+rsfilename+'" AND location="'+rslocation+'"') + var imageId=rs.rows.item(0).id; + Helperjs.friendicaPostRequest(login,"/api/friendica/photo/delete?photo_id="+imageId,"","DELETE",rootwindow, function (obj){ + //var deletereturn = JSON.parse(obj); print(obj); + //if (deletereturn.result=="deleted"){ + db.transaction( function(tx) { + var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+rslocation+'" AND filename="'+rsfilename+'"'); }); + filesystem.Directory=rslocation.substring(7,rslocation.length-1); + filesystem.rmFile(rsfilename) + //} + }) + } + else{ + Helperjs.friendicaPostRequest(login,"/api/friendica/photoalbum/delete?album="+rsfilename,"","DELETE",rootwindow, function (obj){ + //var deletereturn = JSON.parse(obj); + //if (deletereturn.result=="deleted"){ + db.transaction( function(tx) { + var rs= tx.executeSql('SELECT DISTINCT location FROM imageData WHERE album="'+rsfilename+'" AND username="'+login.username+'"'); + var locationstring=rs.rows.item(0).location; + filesystem.Directory=locationstring.substring(7,locationstring.length-1); + filesystem.rmDir(); + var deleters=tx.executeSql('DELETE FROM imageData WHERE album="'+location+'"'); + }) + //} + }) + } + callback(location) + }) +} + +function deleteContacts(database,user,callback) { // does nothing useful at the moment + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + //print(' delete Image Data() for ' + field +"="+selection) + db.transaction( function(tx) { + result1= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); + result2= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); + callback(result)}) +} + +//function requestFriendsAlbumPictures(login,friend,rootwindow,callback){ +//// screenscraping of albums page of contact without user and password +// Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ +// //print(photohtml); +// var photoarray=[]; +// var arr = photohtml.split("sidebar-photos-albums-li"); +// for (var i=2;i')-1); +// var album={'link':albumlink,'name':albumname} +// photoarray.push(album); +// } +// callback(photoarray) +// }) +//} + +function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){ +// screenscraping of albums page of contact with remoteAuth + Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){ + //print("Photohtml: "+photohtml); + try {var obj=JSON.parse(photohtml); + if (obj.hasOwnProperty('status')){ + Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ + getAlbumFromHtml(photohtml,false,rootwindow,callback)}) + }} + catch (e){ + getAlbumFromHtml(photohtml,true,rootwindow,callback) + } + }) +} + +function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){ + var photoarray=[]; + var arr = photohtml.split("sidebar-photos-albums-li"); + for (var i=2;i')-1); + var album={'link':albumlink,'name':albumname}//print(albumlink+" "+albumname); + photoarray.push(album); + } + callback(photoarray,remoteAuthBool) +} + + +function newRequestFriendsPictures(login,link,friend,remoteAuthBool,remoteauth,rootwindow,callback){ +// screenscraping of pictures page for given album + if (remoteAuthBool){ + remoteauth.setUrl(login.server); + remoteauth.setLogin(login.username+":"+Qt.atob(login.password)); + remoteauth.setContacturl(friend.url); + Helperjs.friendicaRemoteAuthRequest(login,link,friend.url,rootwindow,function(photohtml){ + getPictureFromHtml(photohtml,remoteAuthBool,function(photoarray){ + callback(photoarray) + }) + })} + else{ + Helperjs.friendicaWebRequest(link,rootwindow,function(photohtml){ + getPictureFromHtml(photohtml,remoteAuthBool,function(photoarray){ + callback(photoarray) + }) + }) + } +} + +function getPictureFromHtml(photohtml,remoteAuthBool,callback){ + var photoarray=[]; + var basehtml=photohtml.substring(photohtml.indexOf('',photohtml.indexOf('-1){ //theme 1 + var arr = photohtml.split("photo-album-image-wrapper-end");} + +// other themes + if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 + var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) + var arr = photoarea.split("");} + //print("Url: "+login.server+ "Contacturl: "+friend.url) +// remoteauth.setUrl(login.server); +// remoteauth.setLogin(login.username+":"+Qt.atob(login.password)); +// remoteauth.setContacturl(friend.url); + for (var i=0;i-1){ //theme 1 + var arr = photohtml.split("photo-album-image-wrapper-end");} + +// other themes + if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 + var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) + var arr = photoarea.split("");} + + for (var i=0;i +// +// 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 . + function showFriends(db) { Service.readActiveConfig(db,function(login){ Service.requestFriends(login.url,login.user,login.password,displayFriends); diff --git a/source-android/js/news.js b/source-android/js/news.js index 8c1c26c..c058c50 100644 --- a/source-android/js/news.js +++ b/source-android/js/news.js @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + .pragma library .import QtQuick.LocalStorage 2.0 as Sql .import "qrc:/js/helper.js" as Helperjs @@ -10,10 +41,14 @@ function requestFriends(login,database,rootwindow,callback){ Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ var friends=JSON.parse(obj); for (var i=0;i0'); // check for friends var contactlist=[]; for (var i=0;i 0 ) { + for (var i in list) {if (list[i][prop] == val) { + return list[i]; + } + } + } return false; +} + +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); + return cleanedDate } diff --git a/source-android/js/newsworker.js b/source-android/js/newsworker.js index a22e59e..a738ff8 100644 --- a/source-android/js/newsworker.js +++ b/source-android/js/newsworker.js @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + WorkerScript.onMessage = function(msg) { if(msg.deleteId!==undefined) {msg.model.remove(msg.deleteId); diff --git a/source-android/js/photoworker.js b/source-android/js/photoworker.js index 36646c7..76f2129 100644 --- a/source-android/js/photoworker.js +++ b/source-android/js/photoworker.js @@ -1,5 +1,37 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + WorkerScript.onMessage = function(msg) { if (msg.firstalbum==0){msg.model.clear();} + var contact={}; try{contact=msg.friend}catch(e){print(e)} var limit=0; if (msg.albums.length-msg.firstalbum<20){limit=msg.albums.length} else{limit=msg.firstalbum+20} for (var j=msg.firstalbum;j +// +// 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 . + //.pragma library .import QtQuick.LocalStorage 2.0 as Sql .import "qrc:/js/helper.js" as Helperjs .import "qrc:/js/news.js" as Newsjs -// IMAGE FUNCTIONS - -function requestList(login,database,rootwindow,callback) { - //get list of own images and call download function - Helperjs.friendicaRequest(login,"/api/friendica/photos/list", rootwindow,function (helperobject){ - //print("return"+helperobject); - var obj=JSON.parse(helperobject); - Helperjs.readField("id",database,"imageData",login.username,function(AllStoredImages){ - if (AllStoredImages.length>0){ - for(var i=0;i< AllStoredImages.length;i++){ - var position=Helperjs.inArray(obj,"resourceID",AllStoredImages[i]); - if (position>-1){obj.splice(position,1)} - //obj.splice(obj.indexOf(AllStoredImages[i]),1);// list of objects instead of list!!! - }} - callback(obj) - }) -})} - -function dataRequest(login,photoID,database,rootwindow) { - // check if image exist and call download function - Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photoID, rootwindow, function (image){ - try{ if(image==""){currentimageno=currentimageno+1}else{ - var obj = JSON.parse(image); - var helpfilename=obj.filename.substring(0,obj.filename.lastIndexOf(".")); - var filesuffix=""; - if (obj.type=="image/jpeg"){filesuffix=".jpg"} - else if (obj.type=="image/png"){filesuffix=".png"} - else {filesuffix=""} - if (helpfilename==""){// check if file has any filename - obj.filename=obj["id"]+filesuffix; - } - else{obj.filename=helpfilename+filesuffix} - var link=""; - if(obj["link"][0]){link=obj["link"][0]} else{link=obj["link"]["4"]} - xhr.setUrl(Qt.resolvedUrl(link)); - xhr.setFilename(login.imagestore+'albums/'+obj.album+"/"+obj["filename"]); - xhr.setDownloadtype("picture"); - xhr.download(); - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); - if(result.rows.length === 1) {// use update - result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+obj.id+'", created="'+obj.created+'", edited="'+obj.edited+'", profile="'+obj.profile+'", link="'+obj["link"]["4"]+'", filename="'+obj.filename+'",title="'+obj.title+'", desc="'+obj.desc+'", type="'+obj.type+'", width="'+obj.width+'", height="'+obj.height+'", album="'+obj.album+'", location="file://'+login.imagestore+'albums/'+obj.album+'/" where id="'+obj["id"]+'"'); - } else {// use insert print('... does not exists, create it') - result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,obj.id,obj.created,obj.edited, obj.title, obj.desc, obj.album, obj.filename, obj.type, obj.height, obj.width,obj. profile,obj["link"]["4"],'file://'+login.imagestore+'albums/'+obj.album+"/"]); - } - })}} - catch (e){print("Data retrieval failure! "+ e+obj);} -})} - - -function deleteImage(database,login,type,location,rootwindow,callback) { // delete image locally and on server - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - var rsfilename=location.substring(location.lastIndexOf("/")+1,location.length); - var rslocation=location.substring(0,location.lastIndexOf("/")+1); - //print(type+" Name "+ rsfilename+" Location: "+rslocation) - db.transaction( function(tx) { - if (type=='image'){ - var rs= tx.executeSql('SELECT * FROM imageData WHERE filename="'+rsfilename+'" AND location="'+rslocation+'"') - var imageId=rs.rows.item(0).id; - Helperjs.friendicaPostRequest(login,"/api/friendica/photo/delete?photo_id="+imageId,"","DELETE",rootwindow, function (obj){ - //var deletereturn = JSON.parse(obj); print(obj); - //if (deletereturn.result=="deleted"){ - db.transaction( function(tx) { - var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+rslocation+'" AND filename="'+rsfilename+'"'); }); - filesystem.Directory=rslocation.substring(7,rslocation.length-1); - filesystem.rmFile(rsfilename) - //} - }) - } - else{ - Helperjs.friendicaPostRequest(login,"/api/friendica/photoalbum/delete?album="+rsfilename,"","DELETE",rootwindow, function (obj){ - //var deletereturn = JSON.parse(obj); - //if (deletereturn.result=="deleted"){ - db.transaction( function(tx) { - var rs= tx.executeSql('SELECT DISTINCT location FROM imageData WHERE album="'+rsfilename+'" AND username="'+login.username+'"'); - var locationstring=rs.rows.item(0).location; - filesystem.Directory=locationstring.substring(7,locationstring.length-1); - filesystem.rmDir(); - var deleters=tx.executeSql('DELETE FROM imageData WHERE album="'+location+'"'); - }) - //} - }) - } - callback(location) - }) -} - -function deleteContacts(database,user,callback) { // does nothing useful at the moment - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - //print(' delete Image Data() for ' + field +"="+selection) - db.transaction( function(tx) { - result1= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); - result2= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); - callback(result)}) -} - -function requestFriendsAlbumPictures(login,friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ - //print(photohtml); - var photoarray=[]; - var arr = photohtml.split("sidebar-photos-albums-li"); - for (var i=2;i')-1); - var album={'link':albumlink,'name':albumname} - photoarray.push(album); - } - callback(photoarray) - }) -} - -function requestFriendsPictures(link,rootwindow,callback){ -// screenscraping of pictures page for given album - Helperjs.friendicaWebRequest(link,rootwindow,function(photohtml){ - var photoarray=[]; - var basehtml=photohtml.substring(photohtml.indexOf('',photohtml.indexOf('-1){ //theme 1 - var arr = photohtml.split("photo-album-image-wrapper-end");} - -// other themes - if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 - var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) - var arr = photoarea.split("");} - - for (var i=0;icurrentts) || (image_timestamp==0)){ - xhr.setUrl(Qt.resolvedUrl(contact.profile_image_url)); - xhr.setFilename(imagename); - xhr.setDownloadtype("contact"); - xhr.download(); - } var result; result = tx.executeSql('SELECT * from contacts where username="'+login.username+'" AND url = "'+contact.url+'"'); // check for news url if(result.rows.length === 1) {// use update - result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", profile_image="'+imagename+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ Date.parse(Newsjs.cleanDate(contact.created_at))+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ image_timestamp+' where username="'+login.username+'" AND url="'+contact.url+'"'); + result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ Date.parse(Newsjs.cleanDate(contact.created_at))+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ currentTime+' where username="'+login.username+'" AND url="'+contact.url+'"'); } else {// use insert - result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),imagename,contact.url,contact.protected,contact.followers_count, contact.friends_count,Date.parse(Newsjs.cleanDate(contact.created_at)),contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} + result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),"",contact.url,contact.protected,contact.followers_count, contact.friends_count,Date.parse(Newsjs.cleanDate(contact.created_at)),contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} }); -}} +} diff --git a/source-android/js/smiley.js b/source-android/js/smiley.js index c98d918..d840df8 100644 --- a/source-android/js/smiley.js +++ b/source-android/js/smiley.js @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + var core=[ {name:'<3',url: diff --git a/source-android/qml/calendarqml/CalendarDay.qml b/source-android/qml/calendarqml/CalendarDay.qml index 55ecffe..21064df 100644 --- a/source-android/qml/calendarqml/CalendarDay.qml +++ b/source-android/qml/calendarqml/CalendarDay.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.4 diff --git a/source-android/qml/calendarqml/CalendarTab.qml b/source-android/qml/calendarqml/CalendarTab.qml index fe106f5..3f96a62 100644 --- a/source-android/qml/calendarqml/CalendarTab.qml +++ b/source-android/qml/calendarqml/CalendarTab.qml @@ -1,7 +1,39 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 -import QtQuick.Controls 2.1 +import QtQuick.Controls 2.3 import QtQml 2.2 import Qt.labs.calendar 1.0 +import QtQuick.Controls 1.2 as Oldcontrol import QtQuick.Layouts 1.3 import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs @@ -26,8 +58,8 @@ Rectangle { eventdays=dayArray}) } else if (friend!=""){ - calendartab.calendartabstatus=friend.substring(friend.lastIndexOf("/")+1,friend.length) - Service.requestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){ + calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length) + Service.newRequestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){ events=eventArray; eventdays=dayArray}) } @@ -71,18 +103,19 @@ Rectangle { anchors.right: parent.right anchors.rightMargin:2*mm text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus + Oldcontrol.Menu { + id:calendartabmenu + Oldcontrol.MenuItem { + text: qsTr("Own Calendar") + onTriggered: { + calendartab.calendartabstatus="Events"; + // calendartabstatusButton.text=qsTr("own Calendar"); + showEvents("")} + } + } onClicked: {calendartabmenu.popup()} } - Menu { - id:calendartabmenu - MenuItem { - text: qsTr("Own Calendar") - onTriggered: { - calendartab.calendartabstatus="Events"; - // calendartabstatusButton.text=qsTr("own Calendar"); - showEvents("")} - } - } + ListView{ id: calendarView diff --git a/source-android/qml/calendarqml/EventList.qml b/source-android/qml/calendarqml/EventList.qml index fbb1632..8632657 100644 --- a/source-android/qml/calendarqml/EventList.qml +++ b/source-android/qml/calendarqml/EventList.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/js/service.js" as Service @@ -39,8 +70,7 @@ Rectangle{ } Component.onCompleted:{ - //print(JSON.stringify(daylist)) - for (var i=0; i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.2 @@ -23,11 +54,15 @@ StackView{ width:parent.width height:Math.max(90*mm,root.height-12*mm) property var users:[] + property bool registeredUser: true + property var userdata: ({}) + function setServericon(server){ try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){ var serverdata = JSON.parse(obj); servericon.source=serverdata.site.logo})} catch(e){print(e)} } + BlueButton{ id:userButton text:qsTr("User") @@ -39,6 +74,7 @@ StackView{ useritems=useritems+"MenuItem{text:'"+configBackground.users[i].username+ "'; onTriggered: {Service.readConfig(db,function(obj){ + configBackground.registeredUser=true; userButton.text=obj.username; servername.text=obj.server; configBackground.setServericon(obj.server); @@ -60,7 +96,7 @@ StackView{ x: 4*mm; y: 10*mm } Text { - text: qsTr("User") + text: qsTr("Nickname") x: 4*mm; y: 20*mm } @@ -125,25 +161,35 @@ StackView{ } } - Rectangle{ - color: "light grey" + Rectangle{ + color: "light grey" x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; TextInput { - id: username - anchors.fill: parent - selectByMouse: true + id: username + anchors.fill: parent + selectByMouse: true + onEditingFinished:{ + Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ + var screennametest=JSON.parse(obj); + if (screennametest.status.error){ + Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); + configBackground.registeredUser=false; + }else{configBackground.registeredUser=true} + }); + } + } } - } + Rectangle{ color: "light grey" x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit + id: password + anchors.fill: parent + selectByMouse: true + echoMode: TextInput.PasswordEchoOnEdit + } } - } Rectangle{color: "light grey"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} Flickable { @@ -232,34 +278,41 @@ StackView{ var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text,interval: messageIntervalField.text, newsViewType:newsTypeField.text}; var errormessage=""; if (servername.text==""){errormessage=qsTr("No server given! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} + else if (username.text==""){errormessage+=qsTr("No nickname given! ")} + else if ((configBackground.registeredUser==false)){errormessage+=qsTr("Nickname not registered at given server! ")} else if (password.text=="") {errormessage+=qsTr("No password given! ")} else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")} else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")} else {errormessage=""} if (errormessage=="") { - filesystem.Directory=userconfig.imagestore; - filesystem.makeDir("contacts"); - filesystem.makeDir("albums"); - Service.storeConfig(db,userconfig); - Service.readConfig(db,function(userconfig){ - Service.getServerConfig(db,userconfig,root, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - Helperjs.readData(db,"config","",function(storedUsers){ - storedUsers.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - configBackground.users=storedUsers}); - userButton.color="black" - //reset values - root.login=userconfig; - newstab.newstabstatus=userconfig.newsViewType; - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); + Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){ + var credentials=JSON.parse(obj); + if (credentials.hasOwnProperty('status')){ + Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root) +} + else{ + filesystem.Directory=userconfig.imagestore; + filesystem.makeDir("contacts"); + filesystem.makeDir("albums"); + Service.storeConfig(db,userconfig); + Service.readConfig(db,function(userconfig){ + Helperjs.readData(db,"config","",function(storedUsers){ + storedUsers.sort(function(obj1, obj2) { + return obj1.isActive - obj2.isActive; + }); + configBackground.users=storedUsers}); + userButton.color="black" + //reset values + root.login=userconfig; + root.news=[]; + },"isActive",0); + Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc}) + Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root) + } + }); + } - else {Helperjs.show("Error", errormessage,root)} + else {Helperjs.showMessage(qsTr("Error"), errormessage,root)} }} BlueButton { @@ -272,6 +325,7 @@ StackView{ filesystem.rmDir(); filesystem.Directory=imagestore.text+"albums"; filesystem.rmDir(); + configBackground.registeredUser=true; servername.text="https://..."; servericon.source=""; username.text=""; @@ -293,6 +347,7 @@ StackView{ x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; text: "+" onClicked:{ + configBackground.registeredUser=true; servername.text="https://..." servericon.source=""; username.text="" diff --git a/source-android/qml/configqml/InfoBox.qml b/source-android/qml/configqml/InfoBox.qml index b877b6c..bcadcda 100644 --- a/source-android/qml/configqml/InfoBox.qml +++ b/source-android/qml/configqml/InfoBox.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" @@ -12,9 +43,9 @@ Rectangle{ textFormat: Text.RichText width: parent.width wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: "Friendiqa v0.1.2
Licensed under GPL 3 with the exception of OpenSSL
"+ + text: "Friendiqa v0.2
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ + "Sourcecode: https://github.com/LubuWest/Friendiqa
"+ "C++ code by Fabio
"+ "QML and Javascript code by Marco
"+ "Qt Framework www.qt.io
"+ diff --git a/source-android/qml/configqml/OSSettingsAndroid.qml b/source-android/qml/configqml/OSSettingsAndroid.qml index 3dcc4a8..16af1c0 100644 --- a/source-android/qml/configqml/OSSettingsAndroid.qml +++ b/source-android/qml/configqml/OSSettingsAndroid.qml @@ -1,8 +1,40 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick.Window 2.0 import QtQuick 2.0 QtObject{ property int appWidth: Screen.desktopAvailableWidth property int appHeight: Screen.desktopAvailableHeight property int backKey: Qt.Key_Back - property string attachImageDir:filesystem.cameraPath+"/" + //property string attachImageDir:filesystem.cameraPath+"/" + property string imagePickQml: "ImagePicker" } diff --git a/source-android/qml/configqml/OSSettingsLinux.qml b/source-android/qml/configqml/OSSettingsLinux.qml index 567e582..adde0c6 100644 --- a/source-android/qml/configqml/OSSettingsLinux.qml +++ b/source-android/qml/configqml/OSSettingsLinux.qml @@ -1,7 +1,39 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 QtObject{ property real appWidth: 500 property real appHeight: 500 property int backKey: Qt.Key_Escape - property string attachImageDir:filesystem.homePath+"/Pictures/" + //property string attachImageDir:filesystem.homePath+"/Pictures/" + property string imagePickQml: "ImagePickerLinux" } diff --git a/source-android/qml/contactqml/ContactComponent.qml b/source-android/qml/contactqml/ContactComponent.qml index 75112ee..0231094 100644 --- a/source-android/qml/contactqml/ContactComponent.qml +++ b/source-android/qml/contactqml/ContactComponent.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import "qrc:/qml/genericqml" @@ -19,7 +50,7 @@ Rectangle { y:1 width: 10*mm height:10*mm - source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url + source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}} } diff --git a/source-android/qml/contactqml/ContactDetailsComponent.qml b/source-android/qml/contactqml/ContactDetailsComponent.qml index db2da09..9c97def 100644 --- a/source-android/qml/contactqml/ContactDetailsComponent.qml +++ b/source-android/qml/contactqml/ContactDetailsComponent.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import "qrc:/qml/genericqml" @@ -8,7 +39,7 @@ x:mm y:mm property var contact:{} property var createdAtDate: new Date(contact.created_at) -property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( ""+qsTr("Connect")+"
") +property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( ""+qsTr("Connect")+"
") Rectangle { id: wrapper @@ -50,7 +81,7 @@ Rectangle{ frameVisible: true id:namelabelflickable width: root.width-10*mm - height:root.height-50*mm//friendsTabView.height-45*mm + height:root.height-50*mm x: mm clip:true Text{ @@ -82,7 +113,7 @@ Rectangle{ fotostab.phototabstatus="Contact"; root.currentIndex=2; fotostab.active=true; - root.fotoSignal(contact) ; + root.fotoSignal(root.login,contact) ; contactLargeComponent.destroy(); } } @@ -93,7 +124,7 @@ Rectangle{ onClicked:{ root.currentIndex=0; newstab.active=true; - root.messageSignal(contact.id) ; + root.messageSignal(contact) ; contactLargeComponent.destroy(); } } @@ -119,7 +150,7 @@ Rectangle{ root.currentIndex=3; calendartab.active=true; calendartab.calendartabstatus="Friend" - root.eventSignal(contact.url); + root.eventSignal(contact); contactLargeComponent.destroy(); } } diff --git a/source-android/qml/contactqml/ContactDetailsComponentOld.qml b/source-android/qml/contactqml/ContactDetailsComponentOld.qml deleted file mode 100644 index ffdeeae..0000000 --- a/source-android/qml/contactqml/ContactDetailsComponentOld.qml +++ /dev/null @@ -1,91 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.3 -import "qrc:/qml/genericqml" - -Rectangle{ - id: detailsrectangle - anchors.top: namelabel.bottom - anchors.topMargin: 2*mm - - ScrollView{ - horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff - frameVisible: true - id:namelabelflickable - width: root.width-10*mm - height:friendsTabView.height-45*mm - x: mm - clip:true - Text{ - id:namelabeltext - width: namelabelflickable.width - height: implicitHeight - font.pixelSize: 3*mm - textFormat:Text.RichText - wrapMode: Text.Wrap - text:""+qsTr("Description")+": "+Qt.atob(contact.description)+"
"+qsTr("Location")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ - "
"+qsTr("URL")+": "+contact.url+"
"+ - connectUrl+ ""+qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) - onLinkActivated: { - Qt.openUrlExternally(link)} - } - } - - Row{ - anchors.top: namelabelflickable.bottom - anchors.topMargin: 2*mm - x: mm - spacing:4 - - BlueButton{ - id:photobutton - text: "\uf03e" // "Photos" - visible:(contact.network=="dfrn") - onClicked:{ - fotostab.phototabstatus="Contact"; - root.currentIndex=2; - fotostab.active=true; - root.fotoSignal(contact) ; - } - } - - BlueButton{ - id:messagebutton - text: "\uf0e6" //"Messages" - onClicked:{ - root.currentIndex=0; - newstab.active=true; - root.messageSignal(contact.id) ; - } - } - - BlueButton{ - id:dmbutton - visible: (contact.following=="true") - text: "\uf040" //"DM" - onClicked:{ - root.currentIndex=0; - newstab.active=true; - root.directmessageSignal(contact.screen_name); - } - } - - - BlueButton{ - id:eventbutton - visible:(contact.network=="dfrn") - text:"\uf073" - onClicked:{ - root.currentIndex=3; - calendartab.active=true; - calendartab.calendartabstatus="Friend" - root.eventSignal(contact.url); - } - } - - BlueButton{ - id: closeButton - text: "\uf057" //"close" - onClicked:{detailsrectangle.destroy();contactComponent.state="";friendsTabView.contactSignal} - } - } - } diff --git a/source-android/qml/contactqml/Contactlist.qml b/source-android/qml/contactqml/Contactlist.qml index 6aa6991..8e8250e 100644 --- a/source-android/qml/contactqml/Contactlist.qml +++ b/source-android/qml/contactqml/Contactlist.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + // List of people import QtQuick 2.0 import "qrc:/js/helper.js" as Helperjs diff --git a/source-android/qml/contactqml/FriendsTab.qml b/source-android/qml/contactqml/FriendsTab.qml index 2c1e3d7..03a3144 100644 --- a/source-android/qml/contactqml/FriendsTab.qml +++ b/source-android/qml/contactqml/FriendsTab.qml @@ -1,6 +1,38 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 +import QtQuick.LocalStorage 2.0 import "qrc:/js/helper.js" as Helperjs import "qrc:/js/news.js" as Newsjs import "qrc:/js/service.js" as Service @@ -14,15 +46,28 @@ Rectangle { function showContactdetails(contact){ var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml"); if(contact.isFriend){ - friendsTabView.currentIndex=0; + friendsTabView.currentIndex=1; var contactDetails = component.createObject(friendstab,{"contact": contact}) } - else{friendsTabView.currentIndex=1; + else{friendsTabView.currentIndex=2; var contactDetails = component.createObject(friendstab,{"contact": contact}) } } - + function showProfile(callback){ + var profile=({}); + Helperjs.readData(db,"profiles",login.username,function(profileobject){ + var profilearray=[]; + for (var i in profileobject){ + profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata))); + } + profile.profiles=profilearray; + }); + Helperjs.readData(db,"contacts",login.username,function(owner){ + profile.friendica_owner=owner[0]; + },"isFriend",2); + callback(profile) + } TabView{ id:friendsTabView @@ -31,23 +76,23 @@ Rectangle { y:mm width: root.width-2*mm height: root.height-10*mm - currentIndex: 0 + currentIndex: 1 signal contactsSignal(var contact) signal groupsSignal(var username) onCurrentIndexChanged:{ - if (currentIndex==0){ + if (currentIndex==1){ contactsSignal("") } - else if (currentIndex==1){ + else if (currentIndex==2){ contactsSignal("") } - else if (currentIndex==2){groupsSignal(root.login.username)} + else if (currentIndex==3){groupsSignal(root.login.username)} } style: TabViewStyle { frameOverlap: 1 tab: Rectangle { color: "white" - implicitWidth: root.width/3-2*mm + implicitWidth: root.width/4-2*mm implicitHeight: 4*mm Text { id: text anchors.centerIn: parent @@ -61,24 +106,43 @@ Rectangle { tabsAlignment:Qt.AlignHCenter } + Tab{ + id:profileGridTab + title: qsTr("Me") + Component.onCompleted:{ + showProfile(function(profile){ + var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml"); + var profilecomp = component.createObject(profileGridTab,{"profile": profile}); + }); + } + } + Tab{ title: qsTr("Friends") Rectangle{ id: friendsGridTab + property int currentContact:0 function showFriends(contact){ try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db,"contacts",login.username,function(friendsobject){ + Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){ for (var i=0;i1){ friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid } friendsModel.append({"contact":friendsobject[i]}); } - - },"isFriend",1,"screen_name ASC"); } - + Connections{ + target:xhr + onDownloaded:{ + if(type=="contactlist"){ + //print(url+" "+filename+" "+i) + currentContact=i+1; + if(currentContact==root.newContacts.length){showFriends(root.login.username)} + } + } + } BlueButton { id: updateFriendsButton text: "\uf021" @@ -101,8 +165,8 @@ Rectangle { anchors.top: parent.top anchors.right:updateFriendsButton.left anchors.rightMargin:mm - visible: (root.currentContact!=root.newContacts.length)?true:false - value: root.currentContact/root.newContacts.length + visible: (currentContact!=(root.newContacts.length))?true:false + value: currentContact/root.newContacts.length } GridView { @@ -126,7 +190,8 @@ Rectangle { Component.onCompleted: { root.friendsSignal.connect(showFriends); friendsTabView.contactsSignal.connect(showFriends); - showFriends(root.login.username) + showFriends(root.login.username); + root.newContacts=[] } } } @@ -210,17 +275,6 @@ Rectangle { xhr.setParam("user", group.user); xhr.setParam("json",group); xhr.post(); - // Helperjs.friendicaPostRequest(login,api,groupdata,"POST",rootwindow, function (obj){print("groupcreate "+obj); - // var groups=JSON.parse(obj); - // db.transaction( function(tx) { - // var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups - // for (var i=0;i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import "qrc:/js/helper.js" as Helperjs import "qrc:/js/news.js" as Newsjs diff --git a/source-android/qml/contactqml/ProfileComponent.qml b/source-android/qml/contactqml/ProfileComponent.qml new file mode 100644 index 0000000..61a3c5e --- /dev/null +++ b/source-android/qml/contactqml/ProfileComponent.qml @@ -0,0 +1,277 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.0 +import QtQuick.Controls 1.3 +import "qrc:/qml/genericqml" +import "qrc:/js/service.js" as Service + +Rectangle { + width:root.width-2*mm + height:root.height-14*mm + color:"white" + property var profile:({}) + property var attachImageURLs:[] + property var createdAtDate: new Date(profile.friendica_owner.created_at) + + function updateProfileImage(){ + xhr.url= login.server + "/api/account/update_profile_image.json"; + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.clearParams(); + xhr.setImageFileParam("image", photoImage.source ); + xhr.post(); + } + + function buildProfiletext(pobject,callback){ + var profileobject={}; + var profiletext=""; + for (var key in pobject){//print(key+obj[key]) + if(pobject[key]!=""&&key!="users"&&key!="profile_id"){ + var keytext=""; + switch(key){ + case "profile_name":keytext=qsTr("profile name");break; + case "is_default":keytext=qsTr("is default");break; + case "hide_friends":keytext=qsTr("hide friends");break; + case "profile_photo":keytext=qsTr("profile photo");break; + case "profile_thumb":keytext=qsTr("profile thumb");break; + case "publish":keytext=qsTr("publish");break; + case "net_publish":keytext=qsTr("publish in network");break; + case "description":keytext=qsTr("description");break; + case "date_of_birth":keytext=qsTr("date of birth");break; + case "address":keytext=qsTr("address");break; + case "city":keytext=qsTr("city");break; + case "region":keytext=qsTr("region");break; + case "postal_code":keytext=qsTr("postal code");break; + case "country":keytext=qsTr("country");break; + case "hometown":keytext=qsTr("hometown");break; + case "gender":keytext=qsTr("gender");break; + case "marital":keytext=qsTr("marital status");break; + case "marital_with":keytext=qsTr("married with");break; + case "marital_since":keytext=qsTr("married since");break; + case "sexual":keytext=qsTr("sexual");break; + case "politic":keytext=qsTr("politics");break; + case "religion":keytext=qsTr("religion");break; + case "public_keywords":keytext=qsTr("public keywords");break; + case "private_keywords":keytext=qsTr("private keywords");break; + case "likes":keytext=qsTr("likes");break; + case "dislikes":keytext=qsTr("dislikes");break; + case "about":keytext=qsTr("about");break; + case "music":keytext=qsTr("music");break; + case "book":keytext=qsTr("book");break; + case "tv":keytext=qsTr("tv");break; + case "film":keytext=qsTr("film");break; + case "interest":keytext=qsTr("interest");break; + case "romance":keytext=qsTr("romance");break; + case "work":keytext=qsTr("work");break; + case "education":keytext=qsTr("education");break; + case "social_networks":keytext=qsTr("social networks");break; + case "homepage":keytext=qsTr("homepage");break; + default:keytext=key; + } + profiletext=profiletext+(""+keytext+": "+(pobject[key])+"
"); + } + } + callback(profiletext) + } + + BlueButton { + id: update + anchors.top: parent.top + anchors.topMargin: mm + anchors.right: parent.right + text: "\uf021" + onClicked: { + Service.requestProfile(root.login,root.db,root,function(nc){ + root.newContacts=nc; + photoImage.source=""; + showProfile(function(newprofile){ + profile=newprofile; + try {profileModel.clear()} catch(e){print(e)}; + newprofile.profiles.sort(function(obj1, obj2) { + return obj1.profile_id - obj2.profile_id; + }) + for(var i in newprofile.profiles){var obj=newprofile.profiles[i]; + buildProfiletext(obj,function(profiletext){ + profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext}) + }) + } + photoImage.source="file://"+newprofile.friendica_owner.profile_image; + }); + }); + } + } + + + Image { + id: photoImage + x:mm + y:mm + width: 15*mm + height:15*mm + source: "file://"+profile.friendica_owner.profile_image + onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} + MouseArea{ + anchors.fill: parent + onClicked:{ + var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ + osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+ + '}}',profileGridTab,"imagePicker"); + imagePicker.pickImage() + } + } + } + Rectangle{ + id:phototextRectangle + color:"black" + z:3 + opacity: 0.5 + width:6*mm + height: phototext.contentHeight + anchors.top: photoImage.top + anchors.right: photoImage.right + } + Text { + id:phototext + z:4 + text: "\uf040" + width:5*mm + anchors.top: photoImage.top + anchors.right:photoImage.right + color: "white" + font.pixelSize: 4*mm + } + + BlueButton{ + id:updatebutton + height: 5*mm + visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source + text:qsTr("Update") + anchors.left: photoImage.right + anchors.leftMargin: 0.5*mm + anchors.topMargin: mm + anchors.top: parent.top + onClicked:{updateProfileImage()} + } + Label { + id: namelabel + x: mm + width: root.width-6*mm + height: 3*mm + text:(Qt.atob(profile.friendica_owner.name))+" (@"+profile.friendica_owner.screen_name+")" + elide:Text.ElideRight + anchors.topMargin: 0 + anchors.left: photoImage.left + wrapMode: Text.Wrap + color: "#303030" + font.pixelSize: 4*mm + anchors.top: photoImage.bottom + } + + ListModel{id:profileModel} + Component{ + id:profileItem + Rectangle{ + id:profileRect + width:profileView.width + height: 5*mm+profiletextfield.height + Text{ + y:mm + font.pixelSize: 3*mm + text:""+qsTr("profile id")+": "+profileid+"
" + color:"black" + } + Text{ + id:profiletextfield + x:2*mm + y:3.5*mm + width:parent.width-2.5*mm + wrapMode: Text.Wrap + font.pixelSize: 3*mm + text:profiletext + color:"black" + } + } + } + Component{ + id:textcomponent + Text{ + id:namelabeltext + width: namelabelflickable.width + height: implicitHeight + font.pixelSize: 3*mm + textFormat:Text.RichText + wrapMode: Text.Wrap + text:""+qsTr("Description")+": "+(profile.friendica_owner.description)+"
"+qsTr("Location")+": "+profile.friendica_owner.location+"
"+qsTr("Posts")+": "+profile.friendica_owner.statuses_count+ + "
"+qsTr("URL")+": "+profile.friendica_owner.url+"
"+ + ""+qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) + onLinkActivated: { + Qt.openUrlExternally(link)} + } + } + + Rectangle{ + id: detailsrectangle + anchors.top: namelabel.bottom + anchors.topMargin: 2*mm + + ScrollView{ + horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff + frameVisible: true + id:namelabelflickable + width: root.width-10*mm + height:root.height-36*mm//friendsTabView.height-45*mm + x: mm + clip:true + + ListView { + id: profileView + header:textcomponent + width:root.width-10*mm + height: root.height + clip: true + spacing: 0 + model: profileModel + delegate: profileItem + } + } + } + + Component.onCompleted: { + profile.profiles.sort(function(obj1, obj2) { + return obj1.profile_id - obj2.profile_id; + }) + for(var i in profile.profiles){var obj=profile.profiles[i]; + buildProfiletext(obj,function(profiletext){ + profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext}) + }) + } + } +} diff --git a/source-android/qml/friendiqa.qml b/source-android/qml/friendiqa.qml index d9d0032..37a3ea4 100644 --- a/source-android/qml/friendiqa.qml +++ b/source-android/qml/friendiqa.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.LocalStorage 2.0 import QtQuick.Window 2.0 @@ -14,12 +45,13 @@ TabView{ width: osSettings.appWidth height:osSettings.appHeight focus:true + property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000] property var login: Service.readActiveConfig(db) property var contactlist: [] property real mm: Screen.pixelDensity signal messageSignal(var friend) - signal fotoSignal(var friend) + signal fotoSignal(var login, var friend) signal directmessageSignal(var friend) signal newsSignal(var news) signal friendsSignal(var username) @@ -28,7 +60,6 @@ TabView{ property var news:[] property var newContacts:[] - property int currentContact: 0 property string contactLoadType: "" onLoginChanged:{ @@ -38,9 +69,26 @@ TabView{ Newsjs.getCurrentContacts(login,db,function(contacts){ contactlist=contacts})} } - onNewContactsChanged:{//print(JSON.stringify(newContacts)); - if(newContacts.length>0){// download first contact image and update db - Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} + onNewContactsChanged:{ + if(newContacts.length>0){// download contact images and update db + var contacturls=[]; + var contactnames=[]; + for (var link in newContacts){ + contacturls.push(newContacts[link].profile_image_url); + contactnames.push(newContacts[link].screen_name); + Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link]) + contactlist.push(newContacts[link].url); + } + xhr.setDownloadtype("contactlist"); + xhr.setFilelist(contacturls); + xhr.setContactlist(contactnames); + xhr.setImagedir(login.imagestore); + xhr.getlist(); + Service.processNews(function(){ + root.contactLoadType=""; + root.news=[]; + }) + } else if (contactLoadType!=""){ Service.processNews(function(){ root.contactLoadType=""; @@ -48,46 +96,22 @@ TabView{ })} } - onCurrentContactChanged:{// download next contact image after successful download and update db - - if(currentContact +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" @@ -13,21 +44,21 @@ Item { } } - Connections{ - target:root - onCurrentContactChanged:{ - if (root.newContacts.length>0){ - if(root.currentContact0){ +// if(root.currentContact0){showNews(root.news)} + else{ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} } - } + }} } } diff --git a/source-android/qml/newsqml/Newsitem.qml b/source-android/qml/newsqml/Newsitem.qml index 1610f09..c046235 100644 --- a/source-android/qml/newsqml/Newsitem.qml +++ b/source-android/qml/newsqml/Newsitem.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 @@ -35,7 +66,7 @@ Item { Image { id:profileImage - source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url + source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url x:1 width: 7*mm height: 7*mm @@ -295,11 +326,8 @@ Item { anchors.fill:parent onClicked:{ conversationsymbol.color="black"; - - //Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){ var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); - // var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray}); - var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject) + var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject) } } } @@ -334,7 +362,6 @@ Item { text: qsTr("Conversation") onTriggered: { conversationsymbol.color="black"; - //Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){ var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray}); showConversation(index,newsitemobject) diff --git a/source-android/qml/newsqml/PermissionDialog.qml b/source-android/qml/newsqml/PermissionDialog.qml index 5f4df7c..433ea6d 100644 --- a/source-android/qml/newsqml/PermissionDialog.qml +++ b/source-android/qml/newsqml/PermissionDialog.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs diff --git a/source-android/qml/newsqml/SmileyDialog.qml b/source-android/qml/newsqml/SmileyDialog.qml index 1356af5..a0be90c 100644 --- a/source-android/qml/newsqml/SmileyDialog.qml +++ b/source-android/qml/newsqml/SmileyDialog.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 diff --git a/source-android/qml/photoqml/ImageUploadDialog.qml b/source-android/qml/photoqml/ImageUploadDialog.qml index 8c29c5f..23b37c6 100644 --- a/source-android/qml/photoqml/ImageUploadDialog.qml +++ b/source-android/qml/photoqml/ImageUploadDialog.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Controls 1.4 import "qrc:/js/service.js" as Service @@ -6,7 +37,7 @@ import "qrc:/qml/genericqml" Rectangle{ id:imageDialog - //property var attachImageURLs: [] + property var attachImageURLs: [] property var contacts: [] property var groups: [] property var contact_allow:login.permissions[0] @@ -21,15 +52,18 @@ Rectangle{ xhr.clearParams(); xhr.setParam("desc",imageUploadModel.get(inumber).description); xhr.setParam("album", album.currentText); - xhr.setParam("contact_allow","27"); - if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))}; - if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))}; + //if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))}; + //if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))}; //if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))}; - if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; + //if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl ); xhr.post(); } + function attachImage(url){ + imageUploadModel.append({"imageUrl":url,"description":""}) + } + z:2 border.color: "grey" width: parent.width-4*mm @@ -38,19 +72,6 @@ Rectangle{ y:10*mm property string directory: "" - - ImagePicker { - id: imagePicker; - multiple : true - onReady: {//var urlstring=decodeURIComponent(imagePicker.imageUrl); - //var fileurl="file://"+urlstring.substring(5); - for (var n in imagePicker.imageUrls){ - imageUploadModel.append({"imageUrl":imagePicker.imageUrls[n].toString(),"description":""}) - } - } - } - - Connections{ target:xhr onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}} @@ -172,11 +193,10 @@ Rectangle{ MouseArea{ anchors.fill: parent onClicked:{ - //var defaultDirectory="file://"+osSettings.attachImageDir; - //var component = Qt.createComponent("qrc:/qml/genericqml/ImageDialog.qml"); - //var imagedialog = component.createObject(imageDialog,{"directory": defaultDirectory, "multiSelection": true}) - // filesystem.search - imagePicker.pickImage() + var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ + osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+ + 'attachImage(imageUrl)}}',imageDialog,"imagePicker"); + imagePicker.pickImage() } } } @@ -226,7 +246,6 @@ Rectangle{ Component.onCompleted:{ albumModel.append({"text":""}); try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){ - //print(JSON.stringify(storedAlbums)) for (var n in storedAlbums){ albumModel.append({"text":storedAlbums[n]})} })} diff --git a/source-android/qml/photoqml/PhotoComponent.qml b/source-android/qml/photoqml/PhotoComponent.qml index 8ea3559..2e4f29b 100644 --- a/source-android/qml/photoqml/PhotoComponent.qml +++ b/source-android/qml/photoqml/PhotoComponent.qml @@ -1,4 +1,35 @@ -import QtQuick 2.0 +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.7 import QtQuick.Controls 1.2 Package { @@ -20,12 +51,14 @@ Package { BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } Image { id: realImage; + visible: (albumWrapper.state != '')||(index==0) width: photoWrapper.width; height: photoWrapper.height antialiasing: true; asynchronous: true + autoTransform:true cache: false fillMode: Image.PreserveAspectFit; - source: imageLocation + source: (albumWrapper.state == '')&&(index>0)?"":imageLocation } Rectangle{ id:phototextRectangle diff --git a/source-android/qml/photoqml/PhotoTab.qml b/source-android/qml/photoqml/PhotoTab.qml index 6745e60..c42b23e 100644 --- a/source-android/qml/photoqml/PhotoTab.qml +++ b/source-android/qml/photoqml/PhotoTab.qml @@ -1,51 +1,95 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 -//import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 +import QtQuick.Controls 1.2 import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service +import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs import "qrc:/qml/photoqml" import "qrc:/qml/genericqml" Rectangle { id:fotorectangle - y:1 width:root.width-mm height:root.height-5*mm color: '#fff' property var newimages:[] property int currentimageno: 0 + property bool remoteContact: false onNewimagesChanged:{ if(newimages.length>0){ + //print("newimages "+JSON.stringify(newimages)); + var ownimagelist=[]; Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ for (var i=0;i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service +//import "qrc:/js/service.js" as Service +import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs Package { @@ -72,7 +104,7 @@ Package { Component.onCompleted:{ try {photoModel.clear()}catch (e){print(e)} if(foreignPicture){ - Service.requestFriendsPictures(albumlink,fotostab,function(obj){ + Imagejs.newRequestFriendsPictures(login,albumlink,friend,remoteContact,remoteauth,root,function(obj){ if (obj) { for (var k=0;k CalendarTab - + Events Termine - + Own Calendar Eigener Kalender @@ -17,80 +17,120 @@ ConfigTab - - - - + + + User Name - + Server Server - + + Nickname + Kurzname + + + Password Passwort - + Image dir. Bildverz. - + Max. News Max. Nachr. - + News as Anzeige - + Interval (0=None) Intervall (0=keins) - + + + + Error + Fehler + + + + Nickname not registered at given server! + Name auf der Seite nicht registriert! + + + Confirm Bestätigen - + No server given! Kein Server angegeben! - - No username given! - Kein Nutzername angegeben! + + No nickname given! + Kein Kurzname angegeben! - + + Nickname not registered at given server! + Name auf der Seite nicht registriert! + + + No username given! + Kein Nutzername angegeben! + + + No password given! Kein Passwort angegeben! - + No image directory given! Kein Verzeichnis für Bilder angegeben! - + No maximum news number given! Maximale News-Anzahl nicht angegeben! - + + Wrong password! + Falsches Passwort! + + + + Success + Bestätigt + + + + Name + Name + + + Timeline Chronologisch - + Conversations Unterhaltungen @@ -98,7 +138,7 @@ ContactComponent - + Connect Kontaktanfrage @@ -106,32 +146,32 @@ ContactDetailsComponent - + Connect Kontaktanfrage - + Description Beschreibung - + Location Ort - + Posts Beiträge - + URL Profilseite - + Created at Erstellt @@ -139,17 +179,22 @@ FriendsTab - + + Me + Ich + + + Friends Freunde - + Contacts Kontakte - + Groups Gruppen @@ -168,32 +213,32 @@ ImageUploadDialog - + Album Album - + Image Bild - + Description Beschreibung - + Upload Hochladen - + Error Fehler - + No album name given Kein Albumname angegeben @@ -201,17 +246,17 @@ MessageSend - + Title (optional) Überschrift (optional) - + Error Fehler - + Only one attachment supported at the moment. Remove other attachment first! Nur ein Anhang derzeit unterstützt. @@ -221,32 +266,31 @@ NewsTab - Download profile image for - Lade Profilbild für + Lade Profilbild für - + More Mehr - + Timeline Chronologisch - + Favorites Markierte News - + Conversations Unterhaltungen - + Notifications Meldungen @@ -254,82 +298,82 @@ Newsitem - + attending: Teilnahme - + Source: Quelle: - + Direct Message Direktnachricht - + In reply to Antwort an - + comments Kommentare - + Attending: Teilnahme: - + Reply Antworten - + DM Direktnachricht - + Repost Teilen - + Success! Erledigt! - + Conversation Unterhaltung - + Attending Teilnahme - + yes ja - + maybe vielleicht - + no nein - + Delete Löschen @@ -337,12 +381,12 @@ PermissionDialog - + Friends Freunde - + Groups Gruppen @@ -350,36 +394,269 @@ PhotoTab - + 's images s Bilder - - + + All Images + Alle Bilder + + + + Only new + Nur neue + + + + Own Images Eigene Bilder - + More Mehr + + ProfileComponent + + + profile name + Profilname + + + + is default + Hauptprofil + + + + hide friends + Verberge Freunde + + + + profile photo + Profilbild + + + + profile thumb + Mini-Profilbild + + + + publish + öffentlich + + + + publish in network + Öffentlich im Netzwerk + + + + description + Beschreibung + + + + date of birth + Geburtstag + + + + address + Adresse + + + + city + Stadt + + + + region + Region + + + + postal code + Postleitzahl + + + + country + Land + + + + hometown + Heimatstadt + + + + gender + Geschlecht + + + + marital status + Beziehungsstatus + + + + married with + verheiratet mit + + + + married since + verheiratet seit + + + + sexual + Sex + + + + politics + Politik + + + + religion + Religion + + + + public keywords + öffentliche Schlagwörter + + + + private keywords + private Schlagwörter + + + + likes + Vorlieben + + + + dislikes + Abneigungen + + + + about + über + + + + music + Musik + + + + book + Bücher + + + + tv + TV + + + + film + Filme + + + + interest + Interessen + + + + romance + Liebschaften + + + + work + Arbeit + + + + education + Bildung + + + + social networks + Soziale Netzwerke + + + + homepage + Homepage + + + + Update + Aktualisieren + + + + profile id + Profil-Nummer + + + + Description + Beschreibung + + + + Location + Ort + + + + Posts + Beiträge + + + + URL + Profilseite + + + + Created at + Erstellt + + SmileyDialog - + Standard Standard - + Addon Addon - + Adult XXX @@ -387,131 +664,131 @@ newsworker - + likes this. mag das. - + like this. mögen das. - + doesn't like this. mag das nicht. - + don't like this. mögen das nicht. - + will attend. nehmen teil. - + persons will attend. Personen nehmen teil. - + will not attend. nimmt nicht teil. - + persons will not attend. Personen nehmen nicht teil. - + may attend. nimmt vielleicht teil. - + persons may attend. Personen nehmen vielleicht teil. - + yes ja - + no nein - + maybe vielleicht - + seconds Sekunden - - - - - - - - - - + + + + + + + + + + ago her - + minute Minute - + minutes Minuten - + hour Stunde - + hours Stunden - + day Tag - + days Tage - + month Monat - + months Monate - + years diff --git a/source-android/translations/friendiqa-es.qm b/source-android/translations/friendiqa-es.qm index 853f462..f2e5dc3 100644 Binary files a/source-android/translations/friendiqa-es.qm and b/source-android/translations/friendiqa-es.qm differ diff --git a/source-android/translations/friendiqa-es.ts b/source-android/translations/friendiqa-es.ts index 8022119..34d2d15 100644 --- a/source-android/translations/friendiqa-es.ts +++ b/source-android/translations/friendiqa-es.ts @@ -4,12 +4,12 @@ CalendarTab - + Events Eventos - + Own Calendar Calendario propio @@ -17,80 +17,120 @@ ConfigTab - - - - + + + User Usuario - + Server Servidor - + + Nickname + + + + Password Contraseña - + Image dir. Dir. de imágenes - + Max. News Nº Max. de noticias. - + News as Noticias como - + Interval (0=None) Intervalo (0=ningún) - + + + + Error + Error + + + + Nickname not registered at given server! + + + + Confirm Confirmar - + No server given! ¡Servidor no encontrado! - - No username given! - ¡Usuario incorrecto! + + No nickname given! + - + + Nickname not registered at given server! + + + + No username given! + ¡Usuario incorrecto! + + + No password given! ¡Contraseña incorrecta! - + No image directory given! ¡No se ha encontrado el directorio de imágenes! - + No maximum news number given! ¡Nº máximo de noticias incorrecto! - + + Wrong password! + + + + + Success + + + + + Name + + + + Timeline Cronología - + Conversations Conversaciones @@ -98,7 +138,7 @@ ContactComponent - + Connect Conectar @@ -106,32 +146,32 @@ ContactDetailsComponent - + Connect Conectar - + Description Descripción - + Location Localización - + Posts Mensajes - + URL URL - + Created at Creado en @@ -139,17 +179,22 @@ FriendsTab - + + Me + + + + Friends Amigos - + Contacts Contactos - + Groups Grupos @@ -157,32 +202,32 @@ ImageUploadDialog - + Album álbum - + Image imagen - + Description Descripción - + Upload Subir - + Error Error - + No album name given ¡Nombre del álbum no encontrado! @@ -190,17 +235,17 @@ MessageSend - + Title (optional) Título (opcional) - + Error Error - + Only one attachment supported at the moment. Remove other attachment first! Solo se admite adjuntar un solo archivo en este momento. @@ -210,32 +255,31 @@ NewsTab - Download profile image for - Descargar la imagen del perfil para + Descargar la imagen del perfil para - + More Mas - + Timeline Cronología - + Favorites Favoritos - + Conversations Conversaciones - + Notifications Notificaciones @@ -243,82 +287,82 @@ Newsitem - + attending: Asistiendo: - + Source: Fuente: - + Direct Message Mensaje directo - + In reply to En respuesta a - + comments comentarios - + Attending: Asistiendo: - + Reply Respuesta - + DM Mensaje directo - + Repost Volver a publicar - + Success! éxito! - + Conversation Conversación - + Attending Asistiendo - + yes si - + maybe quizás - + no no - + Delete Borrar @@ -326,12 +370,12 @@ PermissionDialog - + Friends Amigos - + Groups Grupos @@ -339,36 +383,269 @@ PhotoTab - + 's images s Imágenes - - + + All Images + + + + + Only new + + + + + Own Images Mis imágenes - + More Mas + + ProfileComponent + + + profile name + + + + + is default + + + + + hide friends + + + + + profile photo + + + + + profile thumb + + + + + publish + + + + + publish in network + + + + + description + + + + + date of birth + + + + + address + + + + + city + + + + + region + + + + + postal code + + + + + country + + + + + hometown + + + + + gender + + + + + marital status + + + + + married with + + + + + married since + + + + + sexual + + + + + politics + + + + + religion + + + + + public keywords + + + + + private keywords + + + + + likes + + + + + dislikes + + + + + about + + + + + music + + + + + book + + + + + tv + + + + + film + + + + + interest + + + + + romance + + + + + work + + + + + education + + + + + social networks + + + + + homepage + + + + + Update + + + + + profile id + + + + + Description + Descripción + + + + Location + Localización + + + + Posts + Mensajes + + + + URL + URL + + + + Created at + Creado en + + SmileyDialog - + Standard Standard - + Addon Addon - + Adult XXX @@ -376,131 +653,131 @@ newsworker - + likes this. le gusta esto. - + like this. me gusta esto. - + doesn't like this. no de ése. - + don't like this. no me gusta. - + will attend. asistirá. - + persons will attend. Personas que asistirán. - + will not attend. no asistirá. - + persons will not attend. Personas que no asistirán.. - + may attend. Puede asistir. - + persons may attend. Personas que pueden asistir. - + yes si - + no no - + maybe quizás - + seconds Segundos - - - - - - - - - - + + + + + + + + + + ago hace - + minute Minuto - + minutes Minutos - + hour Hora - + hours Horas - + day Dia - + days Dias - + month Mes - + months Meses - + years Años diff --git a/source-android/translations/friendiqa-it.qm b/source-android/translations/friendiqa-it.qm new file mode 100644 index 0000000..ab27823 Binary files /dev/null and b/source-android/translations/friendiqa-it.qm differ diff --git a/source-android/translations/friendiqa-it.ts b/source-android/translations/friendiqa-it.ts new file mode 100644 index 0000000..0be61b7 --- /dev/null +++ b/source-android/translations/friendiqa-it.ts @@ -0,0 +1,785 @@ + + + + + CalendarTab + + + Events + Eventi + + + + Own Calendar + Calendario + + + + ConfigTab + + + + + User + Utente + + + + Server + Server + + + + Nickname + + + + + Password + Password + + + + Image dir. + Directory immagini + + + + Max. News + Nº Max. di notizie + + + + News as + News come + + + + Interval (0=None) + Intervallo (0=nessuno) + + + + + + Error + Errore + + + + Nickname not registered at given server! + + + + + Confirm + Conferma + + + + No server given! + Nessun server inserito! + + + + No nickname given! + + + + + Nickname not registered at given server! + + + + No username given! + Nessun utente inserito! + + + + No password given! + Nessuna password inserita! + + + + No image directory given! + Nessuna directory immagini inserita! + + + + No maximum news number given! + Nessun numero massimo di news inserito! + + + + Wrong password! + + + + + Success + + + + + Name + + + + + Timeline + Cronologia + + + + Conversations + Conversazioni + + + + ContactComponent + + + Connect + Connetti + + + + ContactDetailsComponent + + + Connect + Connetti + + + + Description + Descrizione + + + + Location + Località + + + + Posts + Messaggi + + + + URL + URL + + + + Created at + Creato il + + + + FriendsTab + + + Me + + + + + Friends + Amici + + + + Contacts + Contatti + + + + Groups + Gruppi + + + + ImageUploadDialog + + + Album + Album + + + + Image + Immagine + + + + Description + Descrizione + + + + Upload + Carica + + + + Error + Errore + + + + No album name given + Nessun nome album inserito! + + + + MessageSend + + + Title (optional) + Titolo (opzionale) + + + + Error + Errore + + + + Only one attachment supported at the moment. + Remove other attachment first! + Solo un allegato è attualmente supportato. + Rimuovere prima gli altri allegati! + + + + NewsTab + + Download profile image for + Download immagine profilo per + + + + More + Ancora + + + + Timeline + Cronologia + + + + Favorites + Favoriti + + + + Conversations + Conversazioni + + + + Notifications + Notifiche + + + + Newsitem + + + attending: + attendere: + + + + Source: + Codice: + + + + Direct Message + Messaggio diretto + + + + In reply to + In risposta a + + + + comments + commenti + + + + Attending: + Attendi: + + + + Reply + Risposta + + + + DM + Messaggio diretto + + + + Repost + Condividi + + + + Success! + Ha funzionato! + + + + Conversation + Conversazione + + + + Attending + Attendi + + + + yes + si + + + + maybe + potrebbe + + + + no + no + + + + Delete + Cancella + + + + PermissionDialog + + + Friends + Amici + + + + Groups + Gruppi + + + + PhotoTab + + + 's images + Immagini + + + + All Images + + + + + Only new + + + + + + Own Images + Mie immagini + + + + More + Ancora + + + + ProfileComponent + + + profile name + + + + + is default + + + + + hide friends + + + + + profile photo + + + + + profile thumb + + + + + publish + + + + + publish in network + + + + + description + + + + + date of birth + + + + + address + + + + + city + + + + + region + + + + + postal code + + + + + country + + + + + hometown + + + + + gender + + + + + marital status + + + + + married with + + + + + married since + + + + + sexual + + + + + politics + + + + + religion + + + + + public keywords + + + + + private keywords + + + + + likes + + + + + dislikes + + + + + about + + + + + music + + + + + book + + + + + tv + + + + + film + + + + + interest + + + + + romance + + + + + work + + + + + education + + + + + social networks + + + + + homepage + + + + + Update + + + + + profile id + + + + + Description + Descrizione + + + + Location + Località + + + + Posts + Messaggi + + + + URL + URL + + + + Created at + Creato il + + + + SmileyDialog + + + Standard + Standard + + + + Addon + Addon + + + + Adult + XXX + + + + newsworker + + + likes this. + mi piace. + + + + like this. + mi piace. + + + + doesn't like this. + non mi piace. + + + + don't like this. + non mi piace. + + + + will attend. + attendere. + + + + persons will attend. + Persone che attendono. + + + + will not attend. + non aspettare. + + + + persons will not attend. + Persone che non aspettano. + + + + may attend. + puoi attendere. + + + + persons may attend. + Persone che possono attendere. + + + + yes + si + + + + no + no + + + + maybe + potrebbe + + + + seconds + secondi + + + + + + + + + + + + + ago + fa + + + + minute + minuti + + + + minutes + minuti + + + + hour + ora + + + + hours + ore + + + + day + giorno + + + + days + giorni + + + + month + mese + + + + months + mesi + + + + years + anni + + + diff --git a/source-linux/application.qrc b/source-linux/application.qrc index baf9e0a..6cfb777 100644 --- a/source-linux/application.qrc +++ b/source-linux/application.qrc @@ -207,10 +207,15 @@ qml/calendarqml/EventList.qml translations/friendiqa-de.qm translations/friendiqa-de.ts + translations/friendiqa-es.qm + translations/friendiqa-es.ts qml/photoqml/ImageUploadDialog.qml - qml/genericqml/AttachmentDialog.qml - qml/genericqml/ImageDialog.qml qml/genericqml/PermissionDialog.qml images/addImage.png + qml/genericqml/ImagePicker.qml + qml/genericqml/ImagePickerLinux.qml + js/image.js + qml/contactqml/ProfileComponent.qml + translations/friendiqa-it.ts diff --git a/source-linux/common/filesystem.cpp b/source-linux/common/filesystem.cpp index f37ba97..ef27ee7 100644 --- a/source-linux/common/filesystem.cpp +++ b/source-linux/common/filesystem.cpp @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include "filesystem.h" FILESYSTEM *FILESYSTEM::instance() @@ -33,7 +64,7 @@ QString FILESYSTEM::homePath() const //{ //QAndroidJniObject object = QAndroidJniObject::getStaticObjectField("android.os.Environment", "DIRECTORY_DCIM"); //QAndroidJniObject dcim =QAndroidJniObject::callStaticObjectMethod("android.os.Environment","getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;", object.object()); -// return dcim.toString; +// return dcim.toString(); //} diff --git a/source-linux/common/filesystem.h b/source-linux/common/filesystem.h index b05b596..5f56f2a 100644 --- a/source-linux/common/filesystem.h +++ b/source-linux/common/filesystem.h @@ -1,17 +1,49 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef FILESYSTEM_H #define FILESYSTEM_H #include #include //#include +//#include -class FILESYSTEM : public QObject +class FILESYSTEM : public QObject//, public QAndroidActivityResultReceiver { Q_OBJECT Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged) //Q_PROPERTY(bool direxist READ direxist) Q_PROPERTY(QString homePath READ homePath) -//Q_PROPERTY(QString cameraPath READ cameraPath) + //Q_PROPERTY(QString cameraPath READ cameraPath) public: @@ -22,9 +54,11 @@ public: QFileInfoList fileList(); //bool direxist(QString Directory); QString homePath() const; - QString cameraPath() const; + //QString cameraPath() const; + // virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data); signals: + //void imageselected(QString); void directoryChanged(); //void fileListContent(QList data); void success(QString data); @@ -34,6 +68,7 @@ public slots: void makeDir(QString name); void rmDir(); void rmFile(QString name); + //void searchImage(); //void fileList(); private: diff --git a/source-linux/common/friendiqa.cpp b/source-linux/common/friendiqa.cpp index 06bcaf0..0e4a348 100644 --- a/source-linux/common/friendiqa.cpp +++ b/source-linux/common/friendiqa.cpp @@ -1,16 +1,68 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include #include #include #include "xhr.h" #include "filesystem.h" +#include "remoteauthasyncimageprovider.h" +//#include "AndroidNative/systemdispatcher.h" +//#include "AndroidNative/environment.h" +//#include "AndroidNative/debug.h" +//#include "AndroidNative/mediascannerconnection.h" + + +#ifdef Q_OS_ANDROID +#include +#include +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[]) { 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(); diff --git a/source-linux/common/imagepickerandroid.cpp b/source-linux/common/imagepickerandroid.cpp deleted file mode 100644 index 58f59df..0000000 --- a/source-linux/common/imagepickerandroid.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include "imagepickerandroid.h" - -imagePickerAndroid::imagePickerAndroid() -{ - -} - -void imagePickerAndroid::buscaImagem() -{ - QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); - QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); - - QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object(), EXTERNAL_CONTENT_URI.object()); - - if (ACTION_PICK.isValid() && intent.isValid()) - { - intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object()); - QtAndroid::startActivity(intent.object(), 101, this); - qDebug() << "OK"; - } - else - { - qDebug() << "ERRO"; - } -} - -void imagePickerAndroid::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) -{ - jint RESULT_OK = QAndroidJniObject::getStaticField("android/app/Activity", "RESULT_OK"); - if (receiverRequestCode == 101 && resultCode == RESULT_OK) - { - QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); - QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); - QAndroidJniEnvironment env; - jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); - jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); - env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); - QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); - QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object(), projecao, NULL, NULL, NULL); - jint columnIndex = cursor.callMethod("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object()); - cursor.callMethod("moveToFirst", "()Z"); - QAndroidJniObject resultado = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); - QString imagemCaminho = "file://" + resultado.toString(); - emit imagemCaminhoSignal(imagemCaminho); - } - else - { - qDebug() << "Caminho errado"; - } -} diff --git a/source-linux/common/imagepickerandroid.h b/source-linux/common/imagepickerandroid.h deleted file mode 100644 index 19b8340..0000000 --- a/source-linux/common/imagepickerandroid.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IMAGEPICKANDROID_H -#define IMAGEPICKANDROID_H -#include -#include - -#include - -class imagePickerAndroid : public QObject, public QAndroidActivityResultReceiver -{ - Q_OBJECT - -public: - imagePickerAndroid(); - - void buscaImagem(); - - virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject & data); - -signals: - void imagemCaminhoSignal(QString); -}; - -#endif // IMAGEPICKANDROID_H diff --git a/source-linux/common/remoteauthasyncimageprovider.cpp b/source-linux/common/remoteauthasyncimageprovider.cpp new file mode 100644 index 0000000..66a8b03 --- /dev/null +++ b/source-linux/common/remoteauthasyncimageprovider.cpp @@ -0,0 +1,123 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "remoteauthasyncimageprovider.h" +#include +#include + + AsyncImageResponse::AsyncImageResponse(QNetworkRequest req, QSize reqSize) + { + m_reply = m_imageLoader.get(req); + m_requestedSize = reqSize; + connect(m_reply, &QNetworkReply::finished, this, &AsyncImageResponse::onResponseFinished); +} + + + void AsyncImageResponse::onResponseFinished() + { + QByteArray myImageData = m_reply->readAll(); + m_resultImage = QImage::fromData(myImageData); + if (m_requestedSize.isValid()) + { + m_resultImage = m_resultImage.scaled(m_requestedSize); + } + emit finished(); + } + + + QQuickTextureFactory *AsyncImageResponse::textureFactory() const + { + return QQuickTextureFactory::textureFactoryForImage(m_resultImage); + } + + + RemoteAuthAsyncImageProvider::RemoteAuthAsyncImageProvider() + { + } + + + QQuickImageResponse* RemoteAuthAsyncImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize) + { + QUrl iUrl=url()+"/api/friendica/remoteauth?c_url="+contacturl()+"&url="+id; + QByteArray loginData = m_login.toLocal8Bit().toBase64(); + QString headerData = "Basic " + loginData; + + QNetworkRequest request(iUrl); + request.setRawHeader("Authorization", headerData.toLocal8Bit()); + request.setAttribute(QNetworkRequest::FollowRedirectsAttribute,true); + request.setUrl(iUrl); + return new AsyncImageResponse(request, requestedSize); + } + + + void RemoteAuthAsyncImageProvider::setContacturl(QString contacturl) + { + if (contacturl!=m_contacturl) { + m_contacturl = contacturl; + emit contacturlChanged(); + } + } + + + void RemoteAuthAsyncImageProvider::setUrl(QString url) + { + if (url!=m_url) { + m_url = url; + emit urlChanged(); + } + } + + + void RemoteAuthAsyncImageProvider::setLogin(QString login) + { + if (login!=m_login) { + m_login = login; + emit loginChanged(); + } + } + + + QString RemoteAuthAsyncImageProvider::contacturl() const + { + return m_contacturl; + } + + + QString RemoteAuthAsyncImageProvider::url() const + { + return m_url; + } + + + QString RemoteAuthAsyncImageProvider::login() const + { + return m_login; + } diff --git a/source-linux/common/remoteauthasyncimageprovider.h b/source-linux/common/remoteauthasyncimageprovider.h new file mode 100644 index 0000000..f028ada --- /dev/null +++ b/source-linux/common/remoteauthasyncimageprovider.h @@ -0,0 +1,95 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#ifndef REMOTEAUTHIMAGEPROVIDER_H +#define REMOTEAUTHIMAGEPROVIDER_H + +#include +#include +#include +#include +#include +#include + + +class AsyncImageResponse : public QQuickImageResponse +{ + Q_OBJECT +public: + explicit AsyncImageResponse(QNetworkRequest req, QSize requestedSize); + QQuickTextureFactory *textureFactory() const; + +public slots: + void onResponseFinished(); + +protected: + QNetworkAccessManager m_imageLoader; + QNetworkReply* m_reply; + QSize m_requestedSize; + QImage m_resultImage; + int m_index; + QString m_id; + QImage m_image; +}; + +class RemoteAuthAsyncImageProvider : public QObject, public QQuickAsyncImageProvider +{ + Q_OBJECT + Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(QString contacturl READ contacturl WRITE setContacturl NOTIFY contacturlChanged) + Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) + +public: + explicit RemoteAuthAsyncImageProvider(); + QQuickImageResponse *requestImageResponse(const QString &id, const QSize &requestedSize) override; + QString url() const; + QString contacturl() const; + QString login() const; + +signals: + void contacturlChanged(); + void urlChanged(); + void loginChanged(); + +public slots: + void setContacturl(QString contacturl); + void setUrl(QString url); + void setLogin(QString login); + +private: + QByteArray buffer; + QString m_url; + QString m_contacturl; + QString m_login; + QString bufferToString(); +}; + +#endif // REMOTEAUTHIMAGEPROVIDER_H diff --git a/source-linux/common/uploadableimage.cpp b/source-linux/common/uploadableimage.cpp index 81bea1a..7ef3524 100644 --- a/source-linux/common/uploadableimage.cpp +++ b/source-linux/common/uploadableimage.cpp @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include "uploadableimage.h" diff --git a/source-linux/common/uploadableimage.h b/source-linux/common/uploadableimage.h index b4d6876..665bf82 100644 --- a/source-linux/common/uploadableimage.h +++ b/source-linux/common/uploadableimage.h @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef UPLOADABLEIMAGE_H #define UPLOADABLEIMAGE_H diff --git a/source-linux/common/xhr.cpp b/source-linux/common/xhr.cpp index 2fe9ceb..dbb872a 100644 --- a/source-linux/common/xhr.cpp +++ b/source-linux/common/xhr.cpp @@ -1,12 +1,43 @@ -#include "xhr.h" +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "xhr.h" #include #include #include -#include -#include #include #include +#include +#include #include "uploadableimage.h" XHR *XHR::instance() @@ -44,6 +75,29 @@ void XHR::setFilename(QString filename) } } +void XHR::setContactlist(QList contactlist) +{ + if (contactlist!=m_contactlist) { + m_contactlist = contactlist; + emit contactlistChanged(); + } +} + +void XHR::setFilelist(QList 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) { @@ -67,6 +121,21 @@ QString XHR::filename() const return m_filename; } +QList XHR::contactlist() const +{ + return m_contactlist; +} + +QList XHR::filelist() const +{ + return m_filelist; +} + +QString XHR::imagedir() const +{ + return m_imagedir; +} + QString XHR::downloadtype() const { return m_downloadtype; @@ -91,9 +160,14 @@ void XHR::clearParams() 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(); + 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); @@ -117,9 +191,6 @@ void XHR::get() QByteArray loginData = m_login.toLocal8Bit().toBase64(); QString headerData = "Basic " + loginData; request.setRawHeader("Authorization", headerData.toLocal8Bit()); -// QNetworkCookieJar* cJar = new QNetworkCookieJar; -// manager.setCookieJar(cJar); - request.setUrl(requrl); reply = manager.get(request); @@ -129,6 +200,20 @@ void XHR::get() 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;} +} + + void XHR::post() { qDebug() << "start post to " << m_url; @@ -178,7 +263,7 @@ void XHR::post() void XHR::onReplyError(QNetworkReply::NetworkError code) { qDebug() << code; - emit this->error( bufferToString(), (int) code); + emit this->error( bufferToString(), m_url, (int) code); buffer.clear(); reply->deleteLater(); } @@ -194,14 +279,45 @@ void XHR::onReplySuccess() void XHR::onRequestFinished() { // Save the file here - //qDebug() << "buffer downloaded "<error(m_downloadtype,1);} - else {QFile file(m_filename); - file.open(QIODevice::WriteOnly); - file.write(buffer); - buffer.clear(); - file.close(); - emit this->downloaded(m_downloadtype); + if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,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 "<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(); } } @@ -210,15 +326,6 @@ void XHR::onReadyRead() { qDebug() << "."; buffer += reply->readAll(); -// QList list = manager.cookieJar()->cookiesForUrl(m_url); -// QFile f("/home/pankraz/cookie.txt"); -// f.open(QIODevice::ReadWrite); -// for(int i = 0; i < list.size(); ++i){ -// QDataStream s(&f); -// s << list.at(i).toRawForm(); -// } -// f.close(); - } //void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes) diff --git a/source-linux/common/xhr.h b/source-linux/common/xhr.h index 6e93c6c..f2e0bb6 100644 --- a/source-linux/common/xhr.h +++ b/source-linux/common/xhr.h @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #ifndef XHR_H #define XHR_H @@ -5,6 +36,7 @@ #include #include #include +#include class XHR : public QObject { @@ -12,6 +44,9 @@ class XHR : public QObject Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + Q_PROPERTY(QString imagedir READ imagedir WRITE setImagedir NOTIFY imagedirChanged) + Q_PROPERTY(QList contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged) + Q_PROPERTY(QList filelist READ filelist WRITE setFilelist NOTIFY filelistChanged) Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged) @@ -23,27 +58,38 @@ public: QString url() const; QString login() const; QString filename() const; + QList contactlist() const; + QList filelist() const; + QString imagedir() const; QString downloadtype() const; signals: void urlChanged(); void loginChanged(); void filenameChanged(); + void contactlistChanged(); + void filelistChanged(); + void imagedirChanged(); void downloadtypeChanged(); - void downloaded(QString data); + void downloaded(QString type, QString url, QString filename, int i); + void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); void success(QString data); - void error(QString data, int code); + void error(QString data, QString url, int code); public slots: void setUrl(QString url); void setLogin(QString login); void setDownloadtype(QString downloadtype); void setFilename(QString filename); + void setContactlist(QList filename); + void setFilelist(QList filename); + void setImagedir(QString filename); void setParam(QString name, QString value); void setImageFileParam(QString name, QString url); void clearParams(); void post(); void get(); + void getlist(); void download(); private slots: @@ -62,6 +108,10 @@ private: QString m_downloadtype; QHash params; QHash files; + QList m_filelist; + QList m_contactlist; + QString m_imagedir; + int dlindex; QNetworkAccessManager manager; QNetworkRequest request; diff --git a/source-linux/friendiqa.pro b/source-linux/friendiqa.pro index 165efae..3449516 100644 --- a/source-linux/friendiqa.pro +++ b/source-linux/friendiqa.pro @@ -10,15 +10,16 @@ # - translation filenames have to be changed # The name of your application +TEMPLATE = app TARGET = friendiqa -CONFIG += debug -QT += qml quick gui widgets +CONFIG += release +QT += qml quick gui widgets SOURCES += common/friendiqa.cpp \ common/uploadableimage.cpp \ common/xhr.cpp \ common/filesystem.cpp \ - common/imagepickerandroid.cpp + common/remoteauthasyncimageprovider.cpp RESOURCES = application.qrc @@ -31,27 +32,22 @@ OTHER_FILES += qml/friendiqa.qml \ qml/configqml/*.qml js/*.js -# German translation is enabled as an example. If you aren't -# planning to localize your app, remember to comment out the -# following TRANSLATIONS line. And also do not forget to -# modify the localized app name in the the .desktop file. - -TRANSLATIONS += translations/friendiqa-de.ts - +TRANSLATIONS += translations/friendiqa-de.ts \ + translations/friendiqa-es.ts \ + translations/friendiqa-it.ts HEADERS += \ common/uploadableimage.h \ common/xhr.h \ - common/filesystem.h \ - common/imagepickerandroid.h - + common/filesystem.h \ + common/remoteauthasyncimageprovider.h + DISTFILES += \ - qml/calendarqml/*.qml - translations/*.ts - qml/*.qml - qml/newsqml/*.qml - qml/contactqml/*.qml - qml/photoqml/*.qml - qml/configqml/*.qml - js/*.js - - + qml/calendarqml/*.qml \ + translations/*.ts \ + translations/*.qm \ + qml/*.qml \ + qml/newsqml/*.qml \ + qml/contactqml/*.qml \ + qml/photoqml/*.qml \ + qml/configqml/*.qml \ + js/*.js \ diff --git a/source-linux/js/friendworker.js b/source-linux/js/friendworker.js index 6b6c5be..ab6fdf4 100644 --- a/source-linux/js/friendworker.js +++ b/source-linux/js/friendworker.js @@ -1,3 +1,33 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . WorkerScript.onMessage = function(msg) { msg.model.clear(); for (var j=0;j +// +// 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 . + .pragma library .import QtQuick.LocalStorage 2.0 as Sql @@ -64,6 +95,20 @@ function friendicaWebRequest(url,rootwindow,callback) { xhrequest.send(); } +function friendicaRemoteAuthRequest(login,url,c_url,rootwindow,callback) { + var xhrequest = new XMLHttpRequest(); + xhrequest.onreadystatechange = function() { + if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) {} + else if(xhrequest.readyState === XMLHttpRequest.DONE) { + try{callback(xhrequest.responseText)} + catch (e){showMessage("Error",url+" "+e+"\n Return: "+xhrequest.responseText, rootwindow)} + } + } + xhrequest.open("GET", login.server+"/api/friendica/remoteauth?c_url="+c_url+"&url="+url,true,login.username,Qt.atob(login.password)); + xhrequest.send(); +} + + function readData(database,table,username,callback,filter,filtervalue, sort) { // reads and applies data from DB if (filter){ var where = " AND "+ filter +" = '" + filtervalue+"'"; @@ -107,7 +152,8 @@ var where = " AND "+ filter +" = '" + filtervalue+"'"; } function showMessage(header,message,rootwindow){//print("message: "+message); - var cleanmessage=message.replace(/"/g,"-"); + var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage); + if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'} var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}'; var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput"); } diff --git a/source-linux/js/image.js b/source-linux/js/image.js new file mode 100644 index 0000000..5c48ac3 --- /dev/null +++ b/source-linux/js/image.js @@ -0,0 +1,272 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +.pragma library +.import QtQuick.LocalStorage 2.0 as Sql +.import "qrc:/js/helper.js" as Helperjs + +function requestList(login,database,onlynew,rootwindow,callback) { + //get list of own images and call download function + Helperjs.friendicaRequest(login,"/api/friendica/photos/list", rootwindow,function (helperobject){ + //print("return"+helperobject); + var obj=JSON.parse(helperobject); + if (onlynew){Helperjs.readField("id",database,"imageData",login.username,function(AllStoredImages){ + if (AllStoredImages.length>0){ + for(var i=0;i< AllStoredImages.length;i++){ + var position=Helperjs.inArray(obj,"id",AllStoredImages[i]); + if (position>-1){obj.splice(position,1)} + } + } + callback(obj) + })} + else{callback(obj)} +})} + +function dataRequest(login,photoID,database,xhr,rootwindow) { + // check if image exist and call download function + Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photoID, rootwindow, function (image){ + try{ if(image==""){currentimageno=currentimageno+1}else{ + var obj = JSON.parse(image); + var helpfilename=obj.filename.substring(0,obj.filename.lastIndexOf(".")); + var filesuffix=""; + if (obj.type=="image/jpeg"){filesuffix=".jpg"} + else if (obj.type=="image/png"){filesuffix=".png"} + else {filesuffix=""} + if (helpfilename==""){// check if file has any filename + obj.filename=obj["id"]+filesuffix; + } + else{obj.filename=helpfilename+filesuffix} + var link=""; + if(obj["link"][0]){link=obj["link"][0]} else{link=obj["link"]["4"]} + xhr.setUrl(Qt.resolvedUrl(link)); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setFilename(login.imagestore+'albums/'+obj.album+"/"+obj["filename"]); + xhr.setDownloadtype("picture"); + xhr.download(); + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + db.transaction( function(tx) { + var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); + if(result.rows.length === 1) {// use update + result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+obj.id+'", created="'+obj.created+'", edited="'+obj.edited+'", profile="'+obj.profile+'", link="'+obj["link"]["4"]+'", filename="'+obj.filename+'",title="'+obj.title+'", desc="'+obj.desc+'", type="'+obj.type+'", width="'+obj.width+'", height="'+obj.height+'", album="'+obj.album+'", location="file://'+login.imagestore+'albums/'+obj.album+'/" where id="'+obj["id"]+'"'); + } else {// use insert print('... does not exists, create it') + result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,obj.id,obj.created,obj.edited, obj.title, obj.desc, obj.album, obj.filename, obj.type, obj.height, obj.width,obj. profile,obj["link"]["4"],'file://'+login.imagestore+'albums/'+obj.album+"/"]); + } + })}} + catch (e){print("Data retrieval failure! "+ e+obj);} +})} + +function storeImagedata(login,database,imagedata,rootwindow) { + // check if image exist and call download function + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + db.transaction( function(tx) { + var result = tx.executeSql('SELECT * from imageData where id = "'+imagedata["id"]+'"'); + if(result.rows.length === 1) {// use update + result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+imagedata.id+'", created="'+imagedata.created+'", edited="'+imagedata.edited+'", profile="'+imagedata.profile+'", link="'+imagedata.link[0]+'", filename="'+imagedata.filename+'",title="'+imagedata.title+'", desc="'+imagedata.desc+'", type="'+imagedata.type+'", width="'+imagedata.width+'", height="'+imagedata.height+'", album="'+imagedata.album+'", location="file://'+login.imagestore+'albums/'+imagedata.album+'/" where id="'+imagedata["id"]+'"'); + } else {// use insert print('... does not exists, create it') + result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,imagedata.id,imagedata.created,imagedata.edited, imagedata.title, imagedata.desc, imagedata.album, imagedata.filename, imagedata.type, imagedata.height, imagedata.width,imagedata. profile,imagedata.link[0],'file://'+login.imagestore+'albums/'+imagedata.album+"/"]); + } +})} + +function deleteImage(database,login,type,location,filesystem,rootwindow,callback) { // delete image locally and on server + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + var rsfilename=location.substring(location.lastIndexOf("/")+1,location.length); + var rslocation=location.substring(0,location.lastIndexOf("/")+1); + //print(type+" Name "+ rsfilename+" Location: "+rslocation) + db.transaction( function(tx) { + if (type=='image'){ + var rs= tx.executeSql('SELECT * FROM imageData WHERE filename="'+rsfilename+'" AND location="'+rslocation+'"') + var imageId=rs.rows.item(0).id; + Helperjs.friendicaPostRequest(login,"/api/friendica/photo/delete?photo_id="+imageId,"","DELETE",rootwindow, function (obj){ + //var deletereturn = JSON.parse(obj); print(obj); + //if (deletereturn.result=="deleted"){ + db.transaction( function(tx) { + var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+rslocation+'" AND filename="'+rsfilename+'"'); }); + filesystem.Directory=rslocation.substring(7,rslocation.length-1); + filesystem.rmFile(rsfilename) + //} + }) + } + else{ + Helperjs.friendicaPostRequest(login,"/api/friendica/photoalbum/delete?album="+rsfilename,"","DELETE",rootwindow, function (obj){ + //var deletereturn = JSON.parse(obj); + //if (deletereturn.result=="deleted"){ + db.transaction( function(tx) { + var rs= tx.executeSql('SELECT DISTINCT location FROM imageData WHERE album="'+rsfilename+'" AND username="'+login.username+'"'); + var locationstring=rs.rows.item(0).location; + filesystem.Directory=locationstring.substring(7,locationstring.length-1); + filesystem.rmDir(); + var deleters=tx.executeSql('DELETE FROM imageData WHERE album="'+location+'"'); + }) + //} + }) + } + callback(location) + }) +} + +function deleteContacts(database,user,callback) { // does nothing useful at the moment + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + //print(' delete Image Data() for ' + field +"="+selection) + db.transaction( function(tx) { + result1= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); + result2= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); + callback(result)}) +} + +//function requestFriendsAlbumPictures(login,friend,rootwindow,callback){ +//// screenscraping of albums page of contact without user and password +// Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ +// //print(photohtml); +// var photoarray=[]; +// var arr = photohtml.split("sidebar-photos-albums-li"); +// for (var i=2;i')-1); +// var album={'link':albumlink,'name':albumname} +// photoarray.push(album); +// } +// callback(photoarray) +// }) +//} + +function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){ +// screenscraping of albums page of contact with remoteAuth + Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){ + //print("Photohtml: "+photohtml); + try {var obj=JSON.parse(photohtml); + if (obj.hasOwnProperty('status')){ + Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ + getAlbumFromHtml(photohtml,false,rootwindow,callback)}) + }} + catch (e){ + getAlbumFromHtml(photohtml,true,rootwindow,callback) + } + }) +} + +function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){ + var photoarray=[]; + var arr = photohtml.split("sidebar-photos-albums-li"); + for (var i=2;i')-1); + var album={'link':albumlink,'name':albumname}//print(albumlink+" "+albumname); + photoarray.push(album); + } + callback(photoarray,remoteAuthBool) +} + + +function newRequestFriendsPictures(login,link,friend,remoteAuthBool,remoteauth,rootwindow,callback){ +// screenscraping of pictures page for given album + if (remoteAuthBool){ + remoteauth.setUrl(login.server); + remoteauth.setLogin(login.username+":"+Qt.atob(login.password)); + remoteauth.setContacturl(friend.url); + Helperjs.friendicaRemoteAuthRequest(login,link,friend.url,rootwindow,function(photohtml){ + getPictureFromHtml(photohtml,remoteAuthBool,function(photoarray){ + callback(photoarray) + }) + })} + else{ + Helperjs.friendicaWebRequest(link,rootwindow,function(photohtml){ + getPictureFromHtml(photohtml,remoteAuthBool,function(photoarray){ + callback(photoarray) + }) + }) + } +} + +function getPictureFromHtml(photohtml,remoteAuthBool,callback){ + var photoarray=[]; + var basehtml=photohtml.substring(photohtml.indexOf('',photohtml.indexOf('-1){ //theme 1 + var arr = photohtml.split("photo-album-image-wrapper-end");} + +// other themes + if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 + var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) + var arr = photoarea.split("");} + //print("Url: "+login.server+ "Contacturl: "+friend.url) +// remoteauth.setUrl(login.server); +// remoteauth.setLogin(login.username+":"+Qt.atob(login.password)); +// remoteauth.setContacturl(friend.url); + for (var i=0;i-1){ //theme 1 + var arr = photohtml.split("photo-album-image-wrapper-end");} + +// other themes + if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 + var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) + var arr = photoarea.split("");} + + for (var i=0;i +// +// 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 . + function showFriends(db) { Service.readActiveConfig(db,function(login){ Service.requestFriends(login.url,login.user,login.password,displayFriends); diff --git a/source-linux/js/news.js b/source-linux/js/news.js index 9015453..c058c50 100644 --- a/source-linux/js/news.js +++ b/source-linux/js/news.js @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + .pragma library .import QtQuick.LocalStorage 2.0 as Sql .import "qrc:/js/helper.js" as Helperjs @@ -10,14 +41,18 @@ function requestFriends(login,database,rootwindow,callback){ Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ var friends=JSON.parse(obj); for (var i=0;i0'); // check for friends var contactlist=[]; for (var i=0;i 0 ) { + for (var i in list) {if (list[i][prop] == val) { + return list[i]; + } + } + } return false; +} + +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); + return cleanedDate } diff --git a/source-linux/js/newsworker.js b/source-linux/js/newsworker.js index b545aa2..a738ff8 100644 --- a/source-linux/js/newsworker.js +++ b/source-linux/js/newsworker.js @@ -1,5 +1,36 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + WorkerScript.onMessage = function(msg) { -if(msg.deleteId) +if(msg.deleteId!==undefined) {msg.model.remove(msg.deleteId); msg.model.sync() } @@ -16,9 +47,12 @@ else{ newsitemobject.user.profile_image_url=""; newsitemobject.user.name=""; } - var forumname="";if (newsitemobject.messagetype==0&&((newsitemobject.friendica_owner)!=(newsitemobject.user.url))){forumname=" via "+Qt.atob(newsitemobject.friendica_owner_object.name)} + var forumname="";try{if (newsitemobject.messagetype==0&&((newsitemobject.friendica_owner)!=(newsitemobject.user.url))){ + //print(newsitemobject.friendica_owner+" Friendica Owner "+JSON.stringify(newsitemobject)); + forumname=" via "+Qt.atob(newsitemobject.friendica_owner_object.name) + }}catch(e){print("forum name "+e)} var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={}; - if (newsitemobject.messagetype==0){ + try{if (newsitemobject.messagetype==0){ if (newsitemobject.like.length>0){ if (newsitemobject.like.length==1){likeText= Qt.atob(newsitemobject.like[0].name)+" "+ qsTr("likes this.")} else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")} @@ -45,16 +79,16 @@ else{ if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1} if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - } + }} catch(e){print("Activities "+e)} var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} - var attachmentList=[];if(newsitemobject.attachments){ + var attachmentList=[];try{if(newsitemobject.attachments){ var attachArray=JSON.parse(Qt.atob(newsitemobject.attachments)); for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){ attachmentList.push(attachArray[image]) } } - } + }}catch(e){print("attachment "+e)} newsitemobject.attachmentList=attachmentList; var seconds=(msg.currentTime-newsitemobject.created_at)/1000; var timestring=""; diff --git a/source-linux/js/photoworker.js b/source-linux/js/photoworker.js index 36646c7..76f2129 100644 --- a/source-linux/js/photoworker.js +++ b/source-linux/js/photoworker.js @@ -1,5 +1,37 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + WorkerScript.onMessage = function(msg) { if (msg.firstalbum==0){msg.model.clear();} + var contact={}; try{contact=msg.friend}catch(e){print(e)} var limit=0; if (msg.albums.length-msg.firstalbum<20){limit=msg.albums.length} else{limit=msg.firstalbum+20} for (var j=msg.firstalbum;j +// +// 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 . + //.pragma library .import QtQuick.LocalStorage 2.0 as Sql .import "qrc:/js/helper.js" as Helperjs .import "qrc:/js/news.js" as Newsjs -// IMAGE FUNCTIONS - -function requestList(login,database,rootwindow,callback) { - //get list of own images and call download function - Helperjs.friendicaRequest(login,"/api/friendica/photos/list", rootwindow,function (helperobject){ - //print("return"+helperobject); - var obj=JSON.parse(helperobject); - Helperjs.readField("id",database,"imageData",login.username,function(AllStoredImages){ - if (AllStoredImages.length>0){ - for(var i=0;i< AllStoredImages.length;i++){ - var position=Helperjs.inArray(obj,"resourceID",AllStoredImages[i]); - if (position>-1){obj.splice(position,1)} - //obj.splice(obj.indexOf(AllStoredImages[i]),1);// list of objects instead of list!!! - }} - callback(obj) - }) -})} - -function dataRequest(login,photoID,database,rootwindow) { - // check if image exist and call download function - Helperjs.friendicaRequest(login,"/api/friendica/photo?photo_id="+photoID, rootwindow, function (image){ - try{ if(image==""){currentimageno=currentimageno+1}else{ - var obj = JSON.parse(image); - var helpfilename=obj.filename.substring(0,obj.filename.lastIndexOf(".")); - var filesuffix=""; - if (obj.type=="image/jpeg"){filesuffix=".jpg"} - else if (obj.type=="image/png"){filesuffix=".png"} - else {filesuffix=""} - if (helpfilename==""){// check if file has any filename - obj.filename=obj["id"]+filesuffix; - } - else{obj.filename=helpfilename+filesuffix} - var link=""; - if(obj["link"][0]){link=obj["link"][0]} else{link=obj["link"]["4"]} - xhr.setUrl(Qt.resolvedUrl(link)); - xhr.setFilename(login.imagestore+'albums/'+obj.album+"/"+obj["filename"]); - xhr.setDownloadtype("picture"); - xhr.download(); - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); - if(result.rows.length === 1) {// use update - result = tx.executeSql('UPDATE imageData SET username ="' +login.username+ '",id="'+obj.id+'", created="'+obj.created+'", edited="'+obj.edited+'", profile="'+obj.profile+'", link="'+obj["link"]["4"]+'", filename="'+obj.filename+'",title="'+obj.title+'", desc="'+obj.desc+'", type="'+obj.type+'", width="'+obj.width+'", height="'+obj.height+'", album="'+obj.album+'", location="file://'+login.imagestore+'albums/'+obj.album+'/" where id="'+obj["id"]+'"'); - } else {// use insert print('... does not exists, create it') - result = tx.executeSql('INSERT INTO imageData VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,obj.id,obj.created,obj.edited, obj.title, obj.desc, obj.album, obj.filename, obj.type, obj.height, obj.width,obj. profile,obj["link"]["4"],'file://'+login.imagestore+'albums/'+obj.album+"/"]); - } - })}} - catch (e){print("Data retrieval failure! "+ e+obj);} -})} - - -function deleteImage(database,login,type,location,rootwindow,callback) { // delete image locally and on server - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - //print(' delete Image Data() for ' + location) - var rsfilename=location.substring(location.lastIndexOf("/")+1,location.length); - var rslocation=location.substring(0,location.lastIndexOf("/")+1); - print(type+" Name "+ rsfilename+" Location: "+rslocation) - db.transaction( function(tx) { - if (type=='image'){ - var rs= tx.executeSql('SELECT * FROM imageData WHERE filename="'+rsfilename+'" AND location="'+rslocation+'"') - print(rs.rows.item(0).id) //); - var imageId=rs.rows.item(0).id; - Helperjs.friendicaPostRequest(login,"/api/friendica/photo/delete?photo_id="+imageId,"","DELETE",rootwindow, function (obj){ - var deletereturn = JSON.parse(obj); print(obj); - if (deletereturn.result=="deleted"){ - db.transaction( function(tx) { - var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+rslocation+'" AND filename="'+rsfilename+'"'); }); - filesystem.Directory=rslocation.substring(7,rslocation.length-1); - filesystem.rmFile(rsfilename) - }}) - } - else{ - Helperjs.friendicaPostRequest(login,"/api/friendica/photoalbum/delete?album="+rsfilename,"","DELETE",rootwindow, function (obj){ - print(" Return "+ obj); - var deletereturn = JSON.parse(obj); - if (deletereturn.result=="deleted"){ - db.transaction( function(tx) { - var rs= tx.executeSql('SELECT DISTINCT location FROM imageData WHERE album="'+rsfilename+'" AND username="'+login.username+'"'); - var locationstring=rs.rows.item(0).location; - filesystem.Directory=locationstring.substring(7,locationstring.length-1); - filesystem.rmDir(); - var deleters=tx.executeSql('DELETE FROM imageData WHERE album="'+location+'"'); - }) - } - }) - } - callback(location) - }) -} - -function deleteContacts(database,user,callback) { // does nothing useful at the moment - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - //print(' delete Image Data() for ' + field +"="+selection) - db.transaction( function(tx) { - result1= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); -result2= tx.executeSql('SELECT * FROM contacts a LEFT OUTER JOIN news b ON a.url==b.uid'); - - - - callback(result)}) -} -function requestFriendsAlbumPictures(login,friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){ - //print(photohtml); - var photoarray=[]; - var arr = photohtml.split("sidebar-photos-albums-li"); - for (var i=2;i')-1); - var album={'link':albumlink,'name':albumname} - photoarray.push(album); - } - callback(photoarray) - }) -} - -function requestFriendsPictures(link,rootwindow,callback){ -// screenscraping of pictures page for given album - Helperjs.friendicaWebRequest(link,rootwindow,function(photohtml){ - var photoarray=[]; - var basehtml=photohtml.substring(photohtml.indexOf('',photohtml.indexOf('-1){ //theme 1 - var arr = photohtml.split("photo-album-image-wrapper-end");} - -// other themes - if (photohtml.indexOf("photo-album-wrapper")>-1){ //theme 2 - var photoarea=photohtml.substring(photohtml.indexOf("photo-album-wrapper"),photohtml.indexOf("photo-album-end")) - var arr = photoarea.split("");} - - for (var i=0;icurrentts) || (image_timestamp==0)){ - xhr.setUrl(Qt.resolvedUrl(contact.profile_image_url)); - xhr.setFilename(imagename); - xhr.setDownloadtype("contact"); - xhr.download(); - } var result; result = tx.executeSql('SELECT * from contacts where username="'+login.username+'" AND url = "'+contact.url+'"'); // check for news url if(result.rows.length === 1) {// use update - result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", profile_image="'+imagename+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ Date.parse(Newsjs.cleanDate(contact.created_at))+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ image_timestamp+' where username="'+login.username+'" AND url="'+contact.url+'"'); + result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ Date.parse(Newsjs.cleanDate(contact.created_at))+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ currentTime+' where username="'+login.username+'" AND url="'+contact.url+'"'); } else {// use insert - result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),imagename,contact.url,contact.protected,contact.followers_count, contact.friends_count,Date.parse(Newsjs.cleanDate(contact.created_at)),contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} + result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),"",contact.url,contact.protected,contact.followers_count, contact.friends_count,Date.parse(Newsjs.cleanDate(contact.created_at)),contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} }); -}} +} diff --git a/source-linux/js/smiley.js b/source-linux/js/smiley.js index c98d918..d840df8 100644 --- a/source-linux/js/smiley.js +++ b/source-linux/js/smiley.js @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + var core=[ {name:'<3',url: diff --git a/source-linux/qml/calendarqml/CalendarDay.qml b/source-linux/qml/calendarqml/CalendarDay.qml index 55ecffe..21064df 100644 --- a/source-linux/qml/calendarqml/CalendarDay.qml +++ b/source-linux/qml/calendarqml/CalendarDay.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.4 diff --git a/source-linux/qml/calendarqml/CalendarTab.qml b/source-linux/qml/calendarqml/CalendarTab.qml index 7127a31..3f96a62 100644 --- a/source-linux/qml/calendarqml/CalendarTab.qml +++ b/source-linux/qml/calendarqml/CalendarTab.qml @@ -1,7 +1,39 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 -import QtQuick.Controls 2.1 +import QtQuick.Controls 2.3 import QtQml 2.2 import Qt.labs.calendar 1.0 +import QtQuick.Controls 1.2 as Oldcontrol import QtQuick.Layouts 1.3 import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs @@ -18,7 +50,7 @@ Rectangle { property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000 property var events:[] property var eventdays:[] - onEventdaysChanged: print(JSON.stringify(eventdays)) + //onEventdaysChanged: print(JSON.stringify(eventdays)) function showEvents(friend){ if(friend=="backButton"){Service.eventsfromdb(db,login.username,function(eventArray,dayArray){ @@ -26,16 +58,16 @@ Rectangle { eventdays=dayArray}) } else if (friend!=""){ - calendartab.calendartabstatus=friend.substring(friend.lastIndexOf("/")+1,friend.length) - Service.requestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){ + calendartab.calendartabstatus=friend.url.substring(friend.url.lastIndexOf("/")+1,friend.url.length) + Service.newRequestFriendsEvents(login,friend,calendartab,function(eventArray,dayArray){ events=eventArray; eventdays=dayArray}) } else {calendartab.calendartabstatus="Events"; - Service.eventsfromdb(db,login.username,function(eventArray,dayArray){ - events=eventArray; - eventdays=dayArray; - calBusy.running=false + Service.eventsfromdb(db,login.username,function(eventArray,dayArray){ + events=eventArray; + eventdays=dayArray; + calBusy.running=false }) } } @@ -71,18 +103,19 @@ Rectangle { anchors.right: parent.right anchors.rightMargin:2*mm text: calendartab.calendartabstatus=="Events"?qsTr("Events"):calendartabstatus + Oldcontrol.Menu { + id:calendartabmenu + Oldcontrol.MenuItem { + text: qsTr("Own Calendar") + onTriggered: { + calendartab.calendartabstatus="Events"; + // calendartabstatusButton.text=qsTr("own Calendar"); + showEvents("")} + } + } onClicked: {calendartabmenu.popup()} } - Menu { - id:calendartabmenu - MenuItem { - text: qsTr("Own Calendar") - onTriggered: { - calendartab.calendartabstatus="Events"; - // calendartabstatusButton.text=qsTr("own Calendar"); - showEvents("")} - } - } + ListView{ id: calendarView diff --git a/source-linux/qml/calendarqml/EventList.qml b/source-linux/qml/calendarqml/EventList.qml index fbb1632..8632657 100644 --- a/source-linux/qml/calendarqml/EventList.qml +++ b/source-linux/qml/calendarqml/EventList.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/js/service.js" as Service @@ -39,8 +70,7 @@ Rectangle{ } Component.onCompleted:{ - //print(JSON.stringify(daylist)) - for (var i=0; i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.2 + import "qrc:/js/service.js" as Service import "qrc:/js/layout.js" as Layoutjs import "qrc:/js/helper.js" as Helperjs @@ -22,11 +54,15 @@ StackView{ width:parent.width height:Math.max(90*mm,root.height-12*mm) property var users:[] + property bool registeredUser: true + property var userdata: ({}) + function setServericon(server){ try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){ var serverdata = JSON.parse(obj); servericon.source=serverdata.site.logo})} catch(e){print(e)} } + BlueButton{ id:userButton text:qsTr("User") @@ -38,6 +74,7 @@ StackView{ useritems=useritems+"MenuItem{text:'"+configBackground.users[i].username+ "'; onTriggered: {Service.readConfig(db,function(obj){ + configBackground.registeredUser=true; userButton.text=obj.username; servername.text=obj.server; configBackground.setServericon(obj.server); @@ -59,7 +96,7 @@ StackView{ x: 4*mm; y: 10*mm } Text { - text: qsTr("User") + text: qsTr("Nickname") x: 4*mm; y: 20*mm } @@ -124,25 +161,35 @@ StackView{ } } - Rectangle{ - color: "light grey" + Rectangle{ + color: "light grey" x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; TextInput { - id: username - anchors.fill: parent - selectByMouse: true + id: username + anchors.fill: parent + selectByMouse: true + onEditingFinished:{ + Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ + var screennametest=JSON.parse(obj); + if (screennametest.status.error){ + Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); + configBackground.registeredUser=false; + }else{configBackground.registeredUser=true} + }); + } + } } - } + Rectangle{ color: "light grey" x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit + id: password + anchors.fill: parent + selectByMouse: true + echoMode: TextInput.PasswordEchoOnEdit + } } - } Rectangle{color: "light grey"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} Flickable { @@ -231,34 +278,41 @@ StackView{ var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text,interval: messageIntervalField.text, newsViewType:newsTypeField.text}; var errormessage=""; if (servername.text==""){errormessage=qsTr("No server given! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} + else if (username.text==""){errormessage+=qsTr("No nickname given! ")} + else if ((configBackground.registeredUser==false)){errormessage+=qsTr("Nickname not registered at given server! ")} else if (password.text=="") {errormessage+=qsTr("No password given! ")} else if (imagestore.text=="") {errormessage+=qsTr("No image directory given!")} else if (maxNewsText.text=="") {errormessage+=qsTr("No maximum news number given!")} else {errormessage=""} if (errormessage=="") { - filesystem.Directory=userconfig.imagestore; - filesystem.makeDir("contacts"); - filesystem.makeDir("albums"); - Service.storeConfig(db,userconfig); - Service.readConfig(db,function(userconfig){ - Service.getServerConfig(db,userconfig,root, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - Helperjs.readData(db,"config","",function(storedUsers){ - storedUsers.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - configBackground.users=storedUsers}); - userButton.color="black" - //reset values - root.login=userconfig; - newstab.newstabstatus=userconfig.newsViewType; - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); + Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials?skip_status=true",root,function(obj){ + var credentials=JSON.parse(obj); + if (credentials.hasOwnProperty('status')){ + Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root) +} + else{ + filesystem.Directory=userconfig.imagestore; + filesystem.makeDir("contacts"); + filesystem.makeDir("albums"); + Service.storeConfig(db,userconfig); + Service.readConfig(db,function(userconfig){ + Helperjs.readData(db,"config","",function(storedUsers){ + storedUsers.sort(function(obj1, obj2) { + return obj1.isActive - obj2.isActive; + }); + configBackground.users=storedUsers}); + userButton.color="black" + //reset values + root.login=userconfig; + root.news=[]; + },"isActive",0); + Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc}) + Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root) + } + }); + } - else {Helperjs.show("Error", errormessage,root)} + else {Helperjs.showMessage(qsTr("Error"), errormessage,root)} }} BlueButton { @@ -271,6 +325,7 @@ StackView{ filesystem.rmDir(); filesystem.Directory=imagestore.text+"albums"; filesystem.rmDir(); + configBackground.registeredUser=true; servername.text="https://..."; servericon.source=""; username.text=""; @@ -292,6 +347,7 @@ StackView{ x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; text: "+" onClicked:{ + configBackground.registeredUser=true; servername.text="https://..." servericon.source=""; username.text="" diff --git a/source-linux/qml/configqml/InfoBox.qml b/source-linux/qml/configqml/InfoBox.qml index cfdfcba..bcadcda 100644 --- a/source-linux/qml/configqml/InfoBox.qml +++ b/source-linux/qml/configqml/InfoBox.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" @@ -10,15 +41,18 @@ Rectangle{ anchors.top:closeButton.bottom anchors.topMargin: mm textFormat: Text.RichText - wrapMode: Text.Wrap - text: "Friendiqa v0.1
Licensed under GPL 3
"+ + width: parent.width + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + text: "Friendiqa v0.2
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ + "Sourcecode: https://github.com/LubuWest/Friendiqa
"+ "C++ code by Fabio
"+ "QML and Javascript code by Marco
"+ "Qt Framework www.qt.io
"+ "Icons by FontAwesome
"+ - "Folder Icon by KDE Breeze Icons" + "Folder Icon by KDE Breeze Icons
"+ + "AndroidNative by Ben Lau
"+ + "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" onLinkActivated:{ Qt.openUrlExternally(link)} } diff --git a/source-linux/qml/configqml/OSSettingsAndroid.qml b/source-linux/qml/configqml/OSSettingsAndroid.qml index 3dcc4a8..16af1c0 100644 --- a/source-linux/qml/configqml/OSSettingsAndroid.qml +++ b/source-linux/qml/configqml/OSSettingsAndroid.qml @@ -1,8 +1,40 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick.Window 2.0 import QtQuick 2.0 QtObject{ property int appWidth: Screen.desktopAvailableWidth property int appHeight: Screen.desktopAvailableHeight property int backKey: Qt.Key_Back - property string attachImageDir:filesystem.cameraPath+"/" + //property string attachImageDir:filesystem.cameraPath+"/" + property string imagePickQml: "ImagePicker" } diff --git a/source-linux/qml/configqml/OSSettingsLinux.qml b/source-linux/qml/configqml/OSSettingsLinux.qml index 567e582..adde0c6 100644 --- a/source-linux/qml/configqml/OSSettingsLinux.qml +++ b/source-linux/qml/configqml/OSSettingsLinux.qml @@ -1,7 +1,39 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 QtObject{ property real appWidth: 500 property real appHeight: 500 property int backKey: Qt.Key_Escape - property string attachImageDir:filesystem.homePath+"/Pictures/" + //property string attachImageDir:filesystem.homePath+"/Pictures/" + property string imagePickQml: "ImagePickerLinux" } diff --git a/source-linux/qml/contactqml/ContactComponent.qml b/source-linux/qml/contactqml/ContactComponent.qml index 2c8a671..0231094 100644 --- a/source-linux/qml/contactqml/ContactComponent.qml +++ b/source-linux/qml/contactqml/ContactComponent.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import "qrc:/qml/genericqml" @@ -19,8 +50,8 @@ Rectangle { y:1 width: 10*mm height:10*mm - source:(contact.profile_image!="")? "file://"+contact.profile_image : contact.profile_image_url - onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} + source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url + onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}} } Label { diff --git a/source-linux/qml/contactqml/ContactDetailsComponent.qml b/source-linux/qml/contactqml/ContactDetailsComponent.qml index db2da09..9c97def 100644 --- a/source-linux/qml/contactqml/ContactDetailsComponent.qml +++ b/source-linux/qml/contactqml/ContactDetailsComponent.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import "qrc:/qml/genericqml" @@ -8,7 +39,7 @@ x:mm y:mm property var contact:{} property var createdAtDate: new Date(contact.created_at) -property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( ""+qsTr("Connect")+"
") +property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( ""+qsTr("Connect")+"
") Rectangle { id: wrapper @@ -50,7 +81,7 @@ Rectangle{ frameVisible: true id:namelabelflickable width: root.width-10*mm - height:root.height-50*mm//friendsTabView.height-45*mm + height:root.height-50*mm x: mm clip:true Text{ @@ -82,7 +113,7 @@ Rectangle{ fotostab.phototabstatus="Contact"; root.currentIndex=2; fotostab.active=true; - root.fotoSignal(contact) ; + root.fotoSignal(root.login,contact) ; contactLargeComponent.destroy(); } } @@ -93,7 +124,7 @@ Rectangle{ onClicked:{ root.currentIndex=0; newstab.active=true; - root.messageSignal(contact.id) ; + root.messageSignal(contact) ; contactLargeComponent.destroy(); } } @@ -119,7 +150,7 @@ Rectangle{ root.currentIndex=3; calendartab.active=true; calendartab.calendartabstatus="Friend" - root.eventSignal(contact.url); + root.eventSignal(contact); contactLargeComponent.destroy(); } } diff --git a/source-linux/qml/contactqml/Contactlist.qml b/source-linux/qml/contactqml/Contactlist.qml index 6aa6991..8e8250e 100644 --- a/source-linux/qml/contactqml/Contactlist.qml +++ b/source-linux/qml/contactqml/Contactlist.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + // List of people import QtQuick 2.0 import "qrc:/js/helper.js" as Helperjs diff --git a/source-linux/qml/contactqml/FriendsTab.qml b/source-linux/qml/contactqml/FriendsTab.qml index e9cdbf3..03a3144 100644 --- a/source-linux/qml/contactqml/FriendsTab.qml +++ b/source-linux/qml/contactqml/FriendsTab.qml @@ -1,6 +1,38 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 +import QtQuick.LocalStorage 2.0 import "qrc:/js/helper.js" as Helperjs import "qrc:/js/news.js" as Newsjs import "qrc:/js/service.js" as Service @@ -14,15 +46,28 @@ Rectangle { function showContactdetails(contact){ var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml"); if(contact.isFriend){ - friendsTabView.currentIndex=0; + friendsTabView.currentIndex=1; var contactDetails = component.createObject(friendstab,{"contact": contact}) } - else{friendsTabView.currentIndex=1; + else{friendsTabView.currentIndex=2; var contactDetails = component.createObject(friendstab,{"contact": contact}) } } - + function showProfile(callback){ + var profile=({}); + Helperjs.readData(db,"profiles",login.username,function(profileobject){ + var profilearray=[]; + for (var i in profileobject){ + profilearray.push(JSON.parse(Qt.atob(profileobject[i].profiledata))); + } + profile.profiles=profilearray; + }); + Helperjs.readData(db,"contacts",login.username,function(owner){ + profile.friendica_owner=owner[0]; + },"isFriend",2); + callback(profile) + } TabView{ id:friendsTabView @@ -31,23 +76,23 @@ Rectangle { y:mm width: root.width-2*mm height: root.height-10*mm - currentIndex: 0 + currentIndex: 1 signal contactsSignal(var contact) signal groupsSignal(var username) onCurrentIndexChanged:{ - if (currentIndex==0){ + if (currentIndex==1){ contactsSignal("") } - else if (currentIndex==1){ + else if (currentIndex==2){ contactsSignal("") } - else if (currentIndex==2){groupsSignal(root.login.username)} + else if (currentIndex==3){groupsSignal(root.login.username)} } style: TabViewStyle { frameOverlap: 1 tab: Rectangle { color: "white" - implicitWidth: root.width/3-2*mm + implicitWidth: root.width/4-2*mm implicitHeight: 4*mm Text { id: text anchors.centerIn: parent @@ -61,24 +106,43 @@ Rectangle { tabsAlignment:Qt.AlignHCenter } + Tab{ + id:profileGridTab + title: qsTr("Me") + Component.onCompleted:{ + showProfile(function(profile){ + var component = Qt.createComponent("qrc:/qml/contactqml/ProfileComponent.qml"); + var profilecomp = component.createObject(profileGridTab,{"profile": profile}); + }); + } + } + Tab{ title: qsTr("Friends") Rectangle{ id: friendsGridTab + property int currentContact:0 function showFriends(contact){ try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db,"contacts",login.username,function(friendsobject){ + Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){ for (var i=0;i1){ friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid } friendsModel.append({"contact":friendsobject[i]}); } - - },"isFriend",1,"screen_name ASC"); } - + Connections{ + target:xhr + onDownloaded:{ + if(type=="contactlist"){ + //print(url+" "+filename+" "+i) + currentContact=i+1; + if(currentContact==root.newContacts.length){showFriends(root.login.username)} + } + } + } BlueButton { id: updateFriendsButton text: "\uf021" @@ -101,8 +165,8 @@ Rectangle { anchors.top: parent.top anchors.right:updateFriendsButton.left anchors.rightMargin:mm - visible: (root.currentContact!=root.newContacts.length)?true:false - value: root.currentContact/root.newContacts.length + visible: (currentContact!=(root.newContacts.length))?true:false + value: currentContact/root.newContacts.length } GridView { @@ -126,7 +190,8 @@ Rectangle { Component.onCompleted: { root.friendsSignal.connect(showFriends); friendsTabView.contactsSignal.connect(showFriends); - showFriends(root.login.username) + showFriends(root.login.username); + root.newContacts=[] } } } @@ -210,17 +275,6 @@ Rectangle { xhr.setParam("user", group.user); xhr.setParam("json",group); xhr.post(); - // Helperjs.friendicaPostRequest(login,api,groupdata,"POST",rootwindow, function (obj){print("groupcreate "+obj); - // var groups=JSON.parse(obj); - // db.transaction( function(tx) { - // var result = tx.executeSql('DELETE from groups where username="'+login.username+'"'); // clean old groups - // for (var i=0;i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import "qrc:/js/helper.js" as Helperjs import "qrc:/js/news.js" as Newsjs @@ -56,7 +87,8 @@ Item { anchors.topMargin: 3 anchors.top: parent.top onClicked:{ - if(group.new){Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){ + //if(group.new){ + Helperjs.readField("members",root.db,"groups",root.login.username,function(groups){ try {groupModel.clear()}catch (e){print(e)} groupmembers=JSON.parse(groups); for (var user in groupmembers){ @@ -64,7 +96,8 @@ Item { if (userdata[0]){groupModel.append({"groupmember":userdata[0]})} },"id",groupmembers[user]) } //catch(e){} - },"groupname",group.groupname);} + },"groupname",group.groupname); + //} groupComponent.state="large" } } @@ -109,14 +142,14 @@ Item { root.contactdetailsSignal(groupmember) } } - BlueButton{ - anchors.left: memberrectangle.right - anchors.margins: 1*mm - text: "\uf056" - onClicked:{ - groupModel.remove(index) - } - } + // BlueButton{ + // anchors.left: memberrectangle.right + // anchors.margins: 1*mm + // text: "\uf056" + // onClicked:{ + // groupModel.remove(index) + // } + // } } } } @@ -139,54 +172,6 @@ Item { anchors.top: groupListView.bottom anchors.topMargin: mm spacing: mm - BlueButton{ - id: deleteButton - text: "\uf056" - onClicked:{ - Newsjs.deleteGroup(root.login,root.db,root,group,function(){ - groupComponent.state=""; - groupsModel.remove(index)}) - } - } - - - BlueButton{ - id: addMembers - text:"\uf234" - onClicked: { - Newsjs.listFriends(root.login,root.db,function(userdata){ - var newlistcontacts=[]; - for (var n in userdata){ - if (groupmembers.indexOf(userdata[n].id)==-1){ - newlistcontacts.push(userdata[n]) - } - } - var component = Qt.createComponent("qrc:/qml/contactqml/Contactlist.qml"); - var contactlistobject = component.createObject(groupListView,{"possibleUsers":newlistcontacts}); - - }) - } - } - - BlueButton{ - id: updateButton - text: "\uf0ee" - onClicked:{ - var groupobject={}; - var groupmembers=[]; - for (var i=0;i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.0 +import QtQuick.Controls 1.3 +import "qrc:/qml/genericqml" +import "qrc:/js/service.js" as Service + +Rectangle { + width:root.width-2*mm + height:root.height-14*mm + color:"white" + property var profile:({}) + property var attachImageURLs:[] + property var createdAtDate: new Date(profile.friendica_owner.created_at) + + function updateProfileImage(){ + xhr.url= login.server + "/api/account/update_profile_image.json"; + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.clearParams(); + xhr.setImageFileParam("image", photoImage.source ); + xhr.post(); + } + + function buildProfiletext(pobject,callback){ + var profileobject={}; + var profiletext=""; + for (var key in pobject){//print(key+obj[key]) + if(pobject[key]!=""&&key!="users"&&key!="profile_id"){ + var keytext=""; + switch(key){ + case "profile_name":keytext=qsTr("profile name");break; + case "is_default":keytext=qsTr("is default");break; + case "hide_friends":keytext=qsTr("hide friends");break; + case "profile_photo":keytext=qsTr("profile photo");break; + case "profile_thumb":keytext=qsTr("profile thumb");break; + case "publish":keytext=qsTr("publish");break; + case "net_publish":keytext=qsTr("publish in network");break; + case "description":keytext=qsTr("description");break; + case "date_of_birth":keytext=qsTr("date of birth");break; + case "address":keytext=qsTr("address");break; + case "city":keytext=qsTr("city");break; + case "region":keytext=qsTr("region");break; + case "postal_code":keytext=qsTr("postal code");break; + case "country":keytext=qsTr("country");break; + case "hometown":keytext=qsTr("hometown");break; + case "gender":keytext=qsTr("gender");break; + case "marital":keytext=qsTr("marital status");break; + case "marital_with":keytext=qsTr("married with");break; + case "marital_since":keytext=qsTr("married since");break; + case "sexual":keytext=qsTr("sexual");break; + case "politic":keytext=qsTr("politics");break; + case "religion":keytext=qsTr("religion");break; + case "public_keywords":keytext=qsTr("public keywords");break; + case "private_keywords":keytext=qsTr("private keywords");break; + case "likes":keytext=qsTr("likes");break; + case "dislikes":keytext=qsTr("dislikes");break; + case "about":keytext=qsTr("about");break; + case "music":keytext=qsTr("music");break; + case "book":keytext=qsTr("book");break; + case "tv":keytext=qsTr("tv");break; + case "film":keytext=qsTr("film");break; + case "interest":keytext=qsTr("interest");break; + case "romance":keytext=qsTr("romance");break; + case "work":keytext=qsTr("work");break; + case "education":keytext=qsTr("education");break; + case "social_networks":keytext=qsTr("social networks");break; + case "homepage":keytext=qsTr("homepage");break; + default:keytext=key; + } + profiletext=profiletext+(""+keytext+": "+(pobject[key])+"
"); + } + } + callback(profiletext) + } + + BlueButton { + id: update + anchors.top: parent.top + anchors.topMargin: mm + anchors.right: parent.right + text: "\uf021" + onClicked: { + Service.requestProfile(root.login,root.db,root,function(nc){ + root.newContacts=nc; + photoImage.source=""; + showProfile(function(newprofile){ + profile=newprofile; + try {profileModel.clear()} catch(e){print(e)}; + newprofile.profiles.sort(function(obj1, obj2) { + return obj1.profile_id - obj2.profile_id; + }) + for(var i in newprofile.profiles){var obj=newprofile.profiles[i]; + buildProfiletext(obj,function(profiletext){ + profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext}) + }) + } + photoImage.source="file://"+newprofile.friendica_owner.profile_image; + }); + }); + } + } + + + Image { + id: photoImage + x:mm + y:mm + width: 15*mm + height:15*mm + source: "file://"+profile.friendica_owner.profile_image + onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} + MouseArea{ + anchors.fill: parent + onClicked:{ + var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ + osSettings.imagePickQml+'{multiple: false;onReady: {photoImage.source=imageUrl;'+ + '}}',profileGridTab,"imagePicker"); + imagePicker.pickImage() + } + } + } + Rectangle{ + id:phototextRectangle + color:"black" + z:3 + opacity: 0.5 + width:6*mm + height: phototext.contentHeight + anchors.top: photoImage.top + anchors.right: photoImage.right + } + Text { + id:phototext + z:4 + text: "\uf040" + width:5*mm + anchors.top: photoImage.top + anchors.right:photoImage.right + color: "white" + font.pixelSize: 4*mm + } + + BlueButton{ + id:updatebutton + height: 5*mm + visible: "file://"+profile.friendica_owner.profile_image!= photoImage.source + text:qsTr("Update") + anchors.left: photoImage.right + anchors.leftMargin: 0.5*mm + anchors.topMargin: mm + anchors.top: parent.top + onClicked:{updateProfileImage()} + } + Label { + id: namelabel + x: mm + width: root.width-6*mm + height: 3*mm + text:(Qt.atob(profile.friendica_owner.name))+" (@"+profile.friendica_owner.screen_name+")" + elide:Text.ElideRight + anchors.topMargin: 0 + anchors.left: photoImage.left + wrapMode: Text.Wrap + color: "#303030" + font.pixelSize: 4*mm + anchors.top: photoImage.bottom + } + + ListModel{id:profileModel} + Component{ + id:profileItem + Rectangle{ + id:profileRect + width:profileView.width + height: 5*mm+profiletextfield.height + Text{ + y:mm + font.pixelSize: 3*mm + text:""+qsTr("profile id")+": "+profileid+"
" + color:"black" + } + Text{ + id:profiletextfield + x:2*mm + y:3.5*mm + width:parent.width-2.5*mm + wrapMode: Text.Wrap + font.pixelSize: 3*mm + text:profiletext + color:"black" + } + } + } + Component{ + id:textcomponent + Text{ + id:namelabeltext + width: namelabelflickable.width + height: implicitHeight + font.pixelSize: 3*mm + textFormat:Text.RichText + wrapMode: Text.Wrap + text:""+qsTr("Description")+": "+(profile.friendica_owner.description)+"
"+qsTr("Location")+": "+profile.friendica_owner.location+"
"+qsTr("Posts")+": "+profile.friendica_owner.statuses_count+ + "
"+qsTr("URL")+": "+profile.friendica_owner.url+"
"+ + ""+qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) + onLinkActivated: { + Qt.openUrlExternally(link)} + } + } + + Rectangle{ + id: detailsrectangle + anchors.top: namelabel.bottom + anchors.topMargin: 2*mm + + ScrollView{ + horizontalScrollBarPolicy:Qt.ScrollBarAlwaysOff + frameVisible: true + id:namelabelflickable + width: root.width-10*mm + height:root.height-36*mm//friendsTabView.height-45*mm + x: mm + clip:true + + ListView { + id: profileView + header:textcomponent + width:root.width-10*mm + height: root.height + clip: true + spacing: 0 + model: profileModel + delegate: profileItem + } + } + } + + Component.onCompleted: { + profile.profiles.sort(function(obj1, obj2) { + return obj1.profile_id - obj2.profile_id; + }) + for(var i in profile.profiles){var obj=profile.profiles[i]; + buildProfiletext(obj,function(profiletext){ + profileModel.append({"profileid":obj.profile_id,"profiletext":profiletext}) + }) + } + } +} diff --git a/source-linux/qml/friendiqa.qml b/source-linux/qml/friendiqa.qml index 5186524..e2513fa 100644 --- a/source-linux/qml/friendiqa.qml +++ b/source-linux/qml/friendiqa.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.LocalStorage 2.0 import QtQuick.Window 2.0 @@ -14,12 +45,13 @@ TabView{ width: osSettings.appWidth height:osSettings.appHeight focus:true + property var db: ["Friendiqa", "1.0", "Stores Friendica data", 100000000] property var login: Service.readActiveConfig(db) property var contactlist: [] property real mm: Screen.pixelDensity signal messageSignal(var friend) - signal fotoSignal(var friend) + signal fotoSignal(var login, var friend) signal directmessageSignal(var friend) signal newsSignal(var news) signal friendsSignal(var username) @@ -28,7 +60,6 @@ TabView{ property var news:[] property var newContacts:[] - property int currentContact: 0 property string contactLoadType: "" onLoginChanged:{ @@ -38,9 +69,26 @@ TabView{ Newsjs.getCurrentContacts(login,db,function(contacts){ contactlist=contacts})} } - onNewContactsChanged:{//print(JSON.stringify(newContacts)); - if(newContacts.length>0){// download first contact image and update db - Service.updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} + onNewContactsChanged:{ + if(newContacts.length>0){// download contact images and update db + var contacturls=[]; + var contactnames=[]; + for (var link in newContacts){ + contacturls.push(newContacts[link].profile_image_url); + contactnames.push(newContacts[link].screen_name); + Service.updateContactInDB(login,db,newContacts[link].isFriend,newContacts[link]) + contactlist.push(newContacts[link].url); + } + xhr.setDownloadtype("contactlist"); + xhr.setFilelist(contacturls); + xhr.setContactlist(contactnames); + xhr.setImagedir(login.imagestore); + xhr.getlist(); + Service.processNews(function(){ + root.contactLoadType=""; + root.news=[]; + }) + } else if (contactLoadType!=""){ Service.processNews(function(){ root.contactLoadType=""; @@ -48,46 +96,22 @@ TabView{ })} } - onCurrentContactChanged:{// download next contact image after successful download and update db - - if(currentContact +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" @@ -13,33 +44,36 @@ Item { } } - Connections{ - target:root - onCurrentContactChanged:{ - if (root.newContacts.length>0){ - if(root.currentContact0){ +// if(root.currentContact0){showNews(root.news)} + else{ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} } - } + }} } } diff --git a/source-linux/qml/newsqml/Newsitem.qml b/source-linux/qml/newsqml/Newsitem.qml index 2f8ffec..c046235 100644 --- a/source-linux/qml/newsqml/Newsitem.qml +++ b/source-linux/qml/newsqml/Newsitem.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 @@ -35,7 +66,7 @@ Item { Image { id:profileImage - source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url + source: ((newsitemobject.user.profile_image!="") && (typeof(newsitemobject.user.profile_image)=="string"))? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url x:1 width: 7*mm height: 7*mm @@ -43,7 +74,7 @@ Item { anchors.fill: parent onClicked:{showContact(newsitemobject.user)} } - onStatusChanged: if (profileImage.status == Image.Error) {print("Image Failed "+"file://"+newsitemobject.user.profile_image);source="qrc:/images/defaultcontact.jpg"} + onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} } Label { id:user_name @@ -295,11 +326,8 @@ Item { anchors.fill:parent onClicked:{ conversationsymbol.color="black"; - - //Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){ var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); - // var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray}); - var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject) + var conversationItem = component.createObject(friendicaActivities); showConversation(index,newsitemobject) } } } @@ -326,14 +354,14 @@ Item { text: qsTr("Repost") onTriggered: { Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){ - print(reply)}) + Helperjs.showMessage("Repost",qsTr("Success!"),root) + }) } } MenuItem { text: qsTr("Conversation") onTriggered: { conversationsymbol.color="black"; - //Newsjs.conversationfromdb(db,login.username,newsitemobject.conversation_id,function(conversation){ var component = Qt.createComponent("qrc:/qml/newsqml/Conversation.qml"); var conversationItem = component.createObject(friendicaActivities,{"news":newsitemobject.chatArray}); showConversation(index,newsitemobject) @@ -363,7 +391,6 @@ Item { text: qsTr("Delete") onTriggered: { Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){ - // newsModel.remove(index) var msg = {'deleteId': index, 'model': newsModel}; newsWorker.sendMessage(msg); }) diff --git a/source-linux/qml/newsqml/PermissionDialog.qml b/source-linux/qml/newsqml/PermissionDialog.qml new file mode 100644 index 0000000..433ea6d --- /dev/null +++ b/source-linux/qml/newsqml/PermissionDialog.qml @@ -0,0 +1,220 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.0 +import "qrc:/js/service.js" as Service +import "qrc:/js/helper.js" as Helperjs +import "qrc:/qml/genericqml" + +Rectangle{ + id:permissionDialog + x: mm + width: messageColumn.width-5*mm + height:root.height/3 + function updatePerms(){ + for (var i=0;i-1){contactstatus="positive"} + else if (contact_deny.indexOf(contacts[name].cid)>-1){contactstatus="negative"} + contactModel.append({"contact":contacts[name],"contactstatus":contactstatus}) + }},"isFriend",1); + + Helperjs.readData(db,"groups",login.username,function(owngroups){ + for (var number in owngroups){ + var groupstatus= "neutral"; + if (group_allow.indexOf(owngroups[number].gid)>-1){groupstatus="positive"} + else if (group_deny.indexOf(owngroups[number].gid)>-1){groupstatus="negative"} + groupModel.append({"group":owngroups[number],"groupstatus":groupstatus}) + }}); + } +} diff --git a/source-linux/qml/newsqml/SmileyDialog.qml b/source-linux/qml/newsqml/SmileyDialog.qml index 1356af5..a0be90c 100644 --- a/source-linux/qml/newsqml/SmileyDialog.qml +++ b/source-linux/qml/newsqml/SmileyDialog.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 diff --git a/source-linux/qml/photoqml/ImageUploadDialog.qml b/source-linux/qml/photoqml/ImageUploadDialog.qml index dd38705..23b37c6 100644 --- a/source-linux/qml/photoqml/ImageUploadDialog.qml +++ b/source-linux/qml/photoqml/ImageUploadDialog.qml @@ -1,3 +1,34 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.7 import QtQuick.Controls 1.4 import "qrc:/js/service.js" as Service @@ -15,28 +46,24 @@ Rectangle{ property var group_deny:login.permissions[3] property int imageNo: 0 - function attachImage(url){ - var attachIndex=attachImageURLs.indexOf(url); - if(attachIndex>-1){ - imageUploadModel.append({"imageUrl":url.toString(),"description":""}) - } - else{imageUploadModel.remove(attachImage)} - } - function uploadSelectedImage(inumber){ xhr.url= login.server + "/api/friendica/photo/create.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.clearParams(); xhr.setParam("desc",imageUploadModel.get(inumber).description); xhr.setParam("album", album.currentText); - if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))}; - if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))}; - if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))}; - if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; + //if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))}; + //if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))}; + //if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))}; + //if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))}; xhr.setImageFileParam("media", imageUploadModel.get(inumber).imageUrl ); xhr.post(); } + function attachImage(url){ + imageUploadModel.append({"imageUrl":url,"description":""}) + } + z:2 border.color: "grey" width: parent.width-4*mm @@ -48,8 +75,7 @@ Rectangle{ Connections{ target:xhr onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}} - onSuccess:{//print("Bild hochgeladen "+data+" aktuelleBild "+imageNo); - print(imageNo+" "+imageUploadModel.count); + onSuccess:{ imageNo=imageNo+1; if(imageNo0){ + if (imageUploadModel.count>0){ uploadSelectedImage(0) }} } @@ -209,13 +240,12 @@ Rectangle{ anchors.right:buttonRow.left anchors.rightMargin:mm visible: false - value: imageNo/attachImageURLs.length + value: imageNo/imageUploadModel.count } Component.onCompleted:{ albumModel.append({"text":""}); try{Helperjs.readField("album",db,"imageData",login.username,function(storedAlbums){ - //print(JSON.stringify(storedAlbums)) for (var n in storedAlbums){ albumModel.append({"text":storedAlbums[n]})} })} diff --git a/source-linux/qml/photoqml/PhotoComponent.qml b/source-linux/qml/photoqml/PhotoComponent.qml index 918df55..2e4f29b 100644 --- a/source-linux/qml/photoqml/PhotoComponent.qml +++ b/source-linux/qml/photoqml/PhotoComponent.qml @@ -1,4 +1,35 @@ -import QtQuick 2.0 +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.7 import QtQuick.Controls 1.2 Package { @@ -20,12 +51,14 @@ Package { BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } Image { id: realImage; + visible: (albumWrapper.state != '')||(index==0) width: photoWrapper.width; height: photoWrapper.height antialiasing: true; asynchronous: true + autoTransform:true cache: false fillMode: Image.PreserveAspectFit; - source: imageLocation + source: (albumWrapper.state == '')&&(index>0)?"":imageLocation } Rectangle{ id:phototextRectangle @@ -48,9 +81,8 @@ Package { } MouseArea { width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage - onPressAndHold:{print("Pressed"); + onPressAndHold:{ var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}"; - print (menuString); var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput") imagemenuObject.popup() } diff --git a/source-linux/qml/photoqml/PhotoTab.qml b/source-linux/qml/photoqml/PhotoTab.qml index 42392a5..c42b23e 100644 --- a/source-linux/qml/photoqml/PhotoTab.qml +++ b/source-linux/qml/photoqml/PhotoTab.qml @@ -1,51 +1,95 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 -//import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 +import QtQuick.Controls 1.2 import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service +import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs import "qrc:/qml/photoqml" import "qrc:/qml/genericqml" Rectangle { id:fotorectangle - y:1 width:root.width-mm height:root.height-5*mm color: '#fff' property var newimages:[] property int currentimageno: 0 + property bool remoteContact: false onNewimagesChanged:{ if(newimages.length>0){ + //print("newimages "+JSON.stringify(newimages)); + var ownimagelist=[]; Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ for (var i=0;i +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + import QtQuick 2.0 import QtQuick.Controls 1.3 import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service +//import "qrc:/js/service.js" as Service +import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs Package { @@ -72,7 +104,7 @@ Package { Component.onCompleted:{ try {photoModel.clear()}catch (e){print(e)} if(foreignPicture){ - Service.requestFriendsPictures(albumlink,fotostab,function(obj){ + Imagejs.newRequestFriendsPictures(login,albumlink,friend,remoteContact,remoteauth,root,function(obj){ if (obj) { for (var k=0;k CalendarTab - + Events Termine - + Own Calendar Eigener Kalender @@ -17,80 +17,120 @@ ConfigTab - - - - + + + User Name - + Server Server - + + Nickname + Kurzname + + + Password Passwort - + Image dir. Bildverz. - + Max. News Max. Nachr. - + News as Anzeige - + Interval (0=None) Intervall (0=keins) - + + + + Error + Fehler + + + + Nickname not registered at given server! + Name auf der Seite nicht registriert! + + + Confirm Bestätigen - + No server given! Kein Server angegeben! - - No username given! - Kein Nutzername angegeben! + + No nickname given! + Kein Kurzname angegeben! - + + Nickname not registered at given server! + Name auf der Seite nicht registriert! + + + No username given! + Kein Nutzername angegeben! + + + No password given! Kein Passwort angegeben! - + No image directory given! Kein Verzeichnis für Bilder angegeben! - + No maximum news number given! Maximale News-Anzahl nicht angegeben! - + + Wrong password! + Falsches Passwort! + + + + Success + Bestätigt + + + + Name + Name + + + Timeline Chronologisch - + Conversations Unterhaltungen @@ -98,7 +138,7 @@ ContactComponent - + Connect Kontaktanfrage @@ -106,32 +146,32 @@ ContactDetailsComponent - + Connect Kontaktanfrage - + Description Beschreibung - + Location Ort - + Posts Beiträge - + URL Profilseite - + Created at Erstellt @@ -139,17 +179,22 @@ FriendsTab - + + Me + Ich + + + Friends Freunde - + Contacts Kontakte - + Groups Gruppen @@ -157,45 +202,43 @@ GroupComponent - Error - Fehler + Fehler - No name given - Kein Name angegeben + Kein Name angegeben ImageUploadDialog - + Album Album - + Image Bild - + Description Beschreibung - + Upload Hochladen - + Error Fehler - + No album name given Kein Albumname angegeben @@ -203,17 +246,17 @@ MessageSend - + Title (optional) Überschrift (optional) - + Error Fehler - + Only one attachment supported at the moment. Remove other attachment first! Nur ein Anhang derzeit unterstützt. @@ -223,32 +266,31 @@ NewsTab - Download profile image for - Lade Profilbild für + Lade Profilbild für - + More Mehr - + Timeline Chronologisch - + Favorites Markierte News - + Conversations Unterhaltungen - + Notifications Meldungen @@ -256,77 +298,82 @@ Newsitem - + attending: Teilnahme - + Source: Quelle: - + Direct Message Direktnachricht - + In reply to Antwort an - + comments Kommentare - + Attending: Teilnahme: - + Reply Antworten - + DM Direktnachricht - + Repost Teilen - + + Success! + Erledigt! + + + Conversation Unterhaltung - + Attending Teilnahme - + yes ja - + maybe vielleicht - + no nein - + Delete Löschen @@ -334,12 +381,12 @@ PermissionDialog - + Friends Freunde - + Groups Gruppen @@ -347,36 +394,269 @@ PhotoTab - + 's images s Bilder - - + + All Images + Alle Bilder + + + + Only new + Nur neue + + + + Own Images Eigene Bilder - + More Mehr + + ProfileComponent + + + profile name + Profilname + + + + is default + Hauptprofil + + + + hide friends + Verberge Freunde + + + + profile photo + Profilbild + + + + profile thumb + Mini-Profilbild + + + + publish + öffentlich + + + + publish in network + Öffentlich im Netzwerk + + + + description + Beschreibung + + + + date of birth + Geburtstag + + + + address + Adresse + + + + city + Stadt + + + + region + Region + + + + postal code + Postleitzahl + + + + country + Land + + + + hometown + Heimatstadt + + + + gender + Geschlecht + + + + marital status + Beziehungsstatus + + + + married with + verheiratet mit + + + + married since + verheiratet seit + + + + sexual + Sex + + + + politics + Politik + + + + religion + Religion + + + + public keywords + öffentliche Schlagwörter + + + + private keywords + private Schlagwörter + + + + likes + Vorlieben + + + + dislikes + Abneigungen + + + + about + über + + + + music + Musik + + + + book + Bücher + + + + tv + TV + + + + film + Filme + + + + interest + Interessen + + + + romance + Liebschaften + + + + work + Arbeit + + + + education + Bildung + + + + social networks + Soziale Netzwerke + + + + homepage + Homepage + + + + Update + Aktualisieren + + + + profile id + Profil-Nummer + + + + Description + Beschreibung + + + + Location + Ort + + + + Posts + Beiträge + + + + URL + Profilseite + + + + Created at + Erstellt + + SmileyDialog - + Standard Standard - + Addon Addon - + Adult XXX @@ -384,131 +664,131 @@ newsworker - + likes this. mag das. - + like this. mögen das. - + doesn't like this. mag das nicht. - + don't like this. mögen das nicht. - + will attend. nehmen teil. - + persons will attend. Personen nehmen teil. - + will not attend. nimmt nicht teil. - + persons will not attend. Personen nehmen nicht teil. - + may attend. nimmt vielleicht teil. - + persons may attend. Personen nehmen vielleicht teil. - + yes ja - + no nein - + maybe vielleicht - + seconds Sekunden - - - - - - - - - - + + + + + + + + + + ago her - + minute Minute - + minutes Minuten - + hour Stunde - + hours Stunden - + day Tag - + days Tage - + month Monat - + months Monate - + years diff --git a/source-linux/translations/friendiqa-es.qm b/source-linux/translations/friendiqa-es.qm index 168374a..f2e5dc3 100644 Binary files a/source-linux/translations/friendiqa-es.qm and b/source-linux/translations/friendiqa-es.qm differ diff --git a/source-linux/translations/friendiqa-es.ts b/source-linux/translations/friendiqa-es.ts index 33c9667..34d2d15 100644 --- a/source-linux/translations/friendiqa-es.ts +++ b/source-linux/translations/friendiqa-es.ts @@ -4,12 +4,12 @@ CalendarTab - + Events Eventos - + Own Calendar Calendario propio @@ -17,80 +17,120 @@ ConfigTab - - - - + + + User Usuario - + Server Servidor - + + Nickname + + + + Password Contraseña - + Image dir. Dir. de imágenes - + Max. News Nº Max. de noticias. - + News as Noticias como - + Interval (0=None) Intervalo (0=ningún) - + + + + Error + Error + + + + Nickname not registered at given server! + + + + Confirm Confirmar - + No server given! ¡Servidor no encontrado! - - No username given! - ¡Usuario incorrecto! + + No nickname given! + - + + Nickname not registered at given server! + + + + No username given! + ¡Usuario incorrecto! + + + No password given! ¡Contraseña incorrecta! - + No image directory given! ¡No se ha encontrado el directorio de imágenes! - + No maximum news number given! ¡Nº máximo de noticias incorrecto! - + + Wrong password! + + + + + Success + + + + + Name + + + + Timeline Cronología - + Conversations Conversaciones @@ -98,7 +138,7 @@ ContactComponent - + Connect Conectar @@ -106,32 +146,32 @@ ContactDetailsComponent - + Connect Conectar - + Description Descripción - + Location Localización - + Posts Mensajes - + URL URL - + Created at Creado en @@ -139,35 +179,73 @@ FriendsTab - + + Me + + + + Friends Amigos - + Contacts Contactos - + Groups Grupos - MessageSend + ImageUploadDialog - - Title (optional) - Título (opcional) + + Album + álbum - + + Image + imagen + + + + Description + Descripción + + + + Upload + Subir + + + Error Error - + + No album name given + ¡Nombre del álbum no encontrado! + + + + MessageSend + + + Title (optional) + Título (opcional) + + + + Error + Error + + + Only one attachment supported at the moment. Remove other attachment first! Solo se admite adjuntar un solo archivo en este momento. @@ -177,32 +255,31 @@ NewsTab - Download profile image for - Descargar la imagen del perfil para + Descargar la imagen del perfil para - + More Mas - + Timeline Cronología - + Favorites Favoritos - + Conversations Conversaciones - + Notifications Notificaciones @@ -210,77 +287,82 @@ Newsitem - + attending: Asistiendo: - + Source: Fuente: - + Direct Message Mensaje directo - + In reply to En respuesta a - + comments comentarios - + Attending: Asistiendo: - + Reply Respuesta - + DM Mensaje directo - + Repost Volver a publicar - + + Success! + éxito! + + + Conversation Conversación - + Attending Asistiendo - + yes si - + maybe quizás - + no no - + Delete Borrar @@ -288,12 +370,12 @@ PermissionDialog - + Friends Amigos - + Groups Grupos @@ -301,36 +383,269 @@ PhotoTab - + 's images s Imágenes - - + + All Images + + + + + Only new + + + + + Own Images Mis imágenes - + More Mas + + ProfileComponent + + + profile name + + + + + is default + + + + + hide friends + + + + + profile photo + + + + + profile thumb + + + + + publish + + + + + publish in network + + + + + description + + + + + date of birth + + + + + address + + + + + city + + + + + region + + + + + postal code + + + + + country + + + + + hometown + + + + + gender + + + + + marital status + + + + + married with + + + + + married since + + + + + sexual + + + + + politics + + + + + religion + + + + + public keywords + + + + + private keywords + + + + + likes + + + + + dislikes + + + + + about + + + + + music + + + + + book + + + + + tv + + + + + film + + + + + interest + + + + + romance + + + + + work + + + + + education + + + + + social networks + + + + + homepage + + + + + Update + + + + + profile id + + + + + Description + Descripción + + + + Location + Localización + + + + Posts + Mensajes + + + + URL + URL + + + + Created at + Creado en + + SmileyDialog - + Standard Standard - + Addon Addon - + Adult XXX @@ -338,131 +653,131 @@ newsworker - + likes this. le gusta esto. - + like this. me gusta esto. - + doesn't like this. no de ése. - + don't like this. no me gusta. - + will attend. asistirá. - + persons will attend. Personas que asistirán. - + will not attend. no asistirá. - + persons will not attend. Personas que no asistirán.. - + may attend. Puede asistir. - + persons may attend. Personas que pueden asistir. - + yes si - + no no - + maybe quizás - + seconds Segundos - - - - - - - - - - + + + + + + + + + + ago hace - + minute Minuto - + minutes Minutos - + hour Hora - + hours Horas - + day Dia - + days Dias - + month Mes - + months Meses - + years Años diff --git a/source-linux/translations/friendiqa-it.qm b/source-linux/translations/friendiqa-it.qm new file mode 100644 index 0000000..ab27823 Binary files /dev/null and b/source-linux/translations/friendiqa-it.qm differ diff --git a/source-linux/translations/friendiqa-it.ts b/source-linux/translations/friendiqa-it.ts new file mode 100644 index 0000000..0be61b7 --- /dev/null +++ b/source-linux/translations/friendiqa-it.ts @@ -0,0 +1,785 @@ + + + + + CalendarTab + + + Events + Eventi + + + + Own Calendar + Calendario + + + + ConfigTab + + + + + User + Utente + + + + Server + Server + + + + Nickname + + + + + Password + Password + + + + Image dir. + Directory immagini + + + + Max. News + Nº Max. di notizie + + + + News as + News come + + + + Interval (0=None) + Intervallo (0=nessuno) + + + + + + Error + Errore + + + + Nickname not registered at given server! + + + + + Confirm + Conferma + + + + No server given! + Nessun server inserito! + + + + No nickname given! + + + + + Nickname not registered at given server! + + + + No username given! + Nessun utente inserito! + + + + No password given! + Nessuna password inserita! + + + + No image directory given! + Nessuna directory immagini inserita! + + + + No maximum news number given! + Nessun numero massimo di news inserito! + + + + Wrong password! + + + + + Success + + + + + Name + + + + + Timeline + Cronologia + + + + Conversations + Conversazioni + + + + ContactComponent + + + Connect + Connetti + + + + ContactDetailsComponent + + + Connect + Connetti + + + + Description + Descrizione + + + + Location + Località + + + + Posts + Messaggi + + + + URL + URL + + + + Created at + Creato il + + + + FriendsTab + + + Me + + + + + Friends + Amici + + + + Contacts + Contatti + + + + Groups + Gruppi + + + + ImageUploadDialog + + + Album + Album + + + + Image + Immagine + + + + Description + Descrizione + + + + Upload + Carica + + + + Error + Errore + + + + No album name given + Nessun nome album inserito! + + + + MessageSend + + + Title (optional) + Titolo (opzionale) + + + + Error + Errore + + + + Only one attachment supported at the moment. + Remove other attachment first! + Solo un allegato è attualmente supportato. + Rimuovere prima gli altri allegati! + + + + NewsTab + + Download profile image for + Download immagine profilo per + + + + More + Ancora + + + + Timeline + Cronologia + + + + Favorites + Favoriti + + + + Conversations + Conversazioni + + + + Notifications + Notifiche + + + + Newsitem + + + attending: + attendere: + + + + Source: + Codice: + + + + Direct Message + Messaggio diretto + + + + In reply to + In risposta a + + + + comments + commenti + + + + Attending: + Attendi: + + + + Reply + Risposta + + + + DM + Messaggio diretto + + + + Repost + Condividi + + + + Success! + Ha funzionato! + + + + Conversation + Conversazione + + + + Attending + Attendi + + + + yes + si + + + + maybe + potrebbe + + + + no + no + + + + Delete + Cancella + + + + PermissionDialog + + + Friends + Amici + + + + Groups + Gruppi + + + + PhotoTab + + + 's images + Immagini + + + + All Images + + + + + Only new + + + + + + Own Images + Mie immagini + + + + More + Ancora + + + + ProfileComponent + + + profile name + + + + + is default + + + + + hide friends + + + + + profile photo + + + + + profile thumb + + + + + publish + + + + + publish in network + + + + + description + + + + + date of birth + + + + + address + + + + + city + + + + + region + + + + + postal code + + + + + country + + + + + hometown + + + + + gender + + + + + marital status + + + + + married with + + + + + married since + + + + + sexual + + + + + politics + + + + + religion + + + + + public keywords + + + + + private keywords + + + + + likes + + + + + dislikes + + + + + about + + + + + music + + + + + book + + + + + tv + + + + + film + + + + + interest + + + + + romance + + + + + work + + + + + education + + + + + social networks + + + + + homepage + + + + + Update + + + + + profile id + + + + + Description + Descrizione + + + + Location + Località + + + + Posts + Messaggi + + + + URL + URL + + + + Created at + Creato il + + + + SmileyDialog + + + Standard + Standard + + + + Addon + Addon + + + + Adult + XXX + + + + newsworker + + + likes this. + mi piace. + + + + like this. + mi piace. + + + + doesn't like this. + non mi piace. + + + + don't like this. + non mi piace. + + + + will attend. + attendere. + + + + persons will attend. + Persone che attendono. + + + + will not attend. + non aspettare. + + + + persons will not attend. + Persone che non aspettano. + + + + may attend. + puoi attendere. + + + + persons may attend. + Persone che possono attendere. + + + + yes + si + + + + no + no + + + + maybe + potrebbe + + + + seconds + secondi + + + + + + + + + + + + + ago + fa + + + + minute + minuti + + + + minutes + minuti + + + + hour + ora + + + + hours + ore + + + + day + giorno + + + + days + giorni + + + + month + mese + + + + months + mesi + + + + years + anni + + +