diff --git a/README.md b/README.md index e93a131..3eeeacf 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ QML based client for the Friendica Social Network. Tabs for news (incl. Direct Messages), friends and photos. + Delete old version first when upgrading (due to database changes) OS: currently Linux and Android(4.3). Source code is a QtCreator project. @@ -18,22 +19,22 @@ Source code is a QtCreator project. # News # Currently supported: * Shows Posts from friends, favorited messages, Direct Messages and Notifications -* Show news as timeline or tree (conversation opens in separate window) +* Show news as timeline or tree (conversation opens in same window) * Open links in external browser +* Click on contact phot for additional information * Deletion, Reposting, Answering of Posts * Liking, disliking, favoriting +* Click on like text for additional contact info * Attending events * Update fetches new posts since last in local DB * More shows older posts from local DB -* Create new Message with images or direct messages, Contact/Group access rights - +* Create new Message with images or direct messages, Contact/Group access rights(can be stored), smileys +* New image dialog ToDo: -* Nice symbols for liking, disliking * Videos and other binary data as attachment (sending and receiving) * Rich text editing in Send Dialog * Attachments for Direct messages (currently not supported in API) -* Better image selection (currently ugly file dialog) # Friends # @@ -44,7 +45,7 @@ Currently supported: * 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) -* Open website of contact +* Open website of contact or connect page (for other contacts) ToDo: * More information for contact from description page, possibly private information for friends @@ -56,12 +57,12 @@ Currently supported: * Download all own images to local directory * Show albums in grid, show images in album in grid and fullscreen * Show albums and images of contacts +* Pinch to zoom, swipe to scroll ToDo: * Private images of friends * Support for all themes of friends * Delete downloaded own images -* Pinch to zoom, swipe to scroll # Config # @@ -82,6 +83,15 @@ ToDo * Blingbling +# New in version 0.003 +* improved BackButton behaviour +* click on contact everywhere to get to contact details +* Image dialog automatically opens in Android camera directory +* Smiley Dialog in Message Dialog +* Extensive use of FontAwesome for icons +* Bugfixes + + ## License ## * v0.001 for Friendica < 3.5 * v0.002 for Friendica >= 3.5 diff --git a/v0.002/Release/Friendiqa_v0.002.apk b/android-build-release-signed.apk similarity index 58% rename from v0.002/Release/Friendiqa_v0.002.apk rename to android-build-release-signed.apk index 58f2d46..84fb623 100644 Binary files a/v0.002/Release/Friendiqa_v0.002.apk and b/android-build-release-signed.apk differ diff --git a/v0.002/Release/source-android/android/AndroidManifest.xml b/source-android/android/AndroidManifest.xml similarity index 97% rename from v0.002/Release/source-android/android/AndroidManifest.xml rename to source-android/android/AndroidManifest.xml index a22ecbc..c2da86e 100644 --- a/v0.002/Release/source-android/android/AndroidManifest.xml +++ b/source-android/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/v0.001/source-android/android/build.gradle b/source-android/android/build.gradle similarity index 100% rename from v0.001/source-android/android/build.gradle rename to source-android/android/build.gradle diff --git a/source-android/android/gradle.properties b/source-android/android/gradle.properties new file mode 100644 index 0000000..760ded2 --- /dev/null +++ b/source-android/android/gradle.properties @@ -0,0 +1,4 @@ +androidBuildToolsVersion=23.0.2 +androidCompileSdkVersion=23 +buildDir=.build +qt5AndroidDir=/home/pankraz/Qt/5.8/android_armv7/src/android/java diff --git a/v0.001/source-android/android/gradle/wrapper/gradle-wrapper.jar b/source-android/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from v0.001/source-android/android/gradle/wrapper/gradle-wrapper.jar rename to source-android/android/gradle/wrapper/gradle-wrapper.jar diff --git a/v0.001/source-android/android/gradle/wrapper/gradle-wrapper.properties b/source-android/android/gradle/wrapper/gradle-wrapper.properties similarity index 65% rename from v0.001/source-android/android/gradle/wrapper/gradle-wrapper.properties rename to source-android/android/gradle/wrapper/gradle-wrapper.properties index 1e61d1f..0c71e76 100644 --- a/v0.001/source-android/android/gradle/wrapper/gradle-wrapper.properties +++ b/source-android/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/v0.001/source-android/android/gradlew b/source-android/android/gradlew similarity index 100% rename from v0.001/source-android/android/gradlew rename to source-android/android/gradlew diff --git a/v0.001/source-android/android/gradlew.bat b/source-android/android/gradlew.bat similarity index 100% rename from v0.001/source-android/android/gradlew.bat rename to source-android/android/gradlew.bat diff --git a/source-android/android/local.properties b/source-android/android/local.properties new file mode 100644 index 0000000..daae45e --- /dev/null +++ b/source-android/android/local.properties @@ -0,0 +1 @@ +sdk.dir=/opt/android-sdk diff --git a/v0.001/source-android/android/res/drawable-ldpi/icon.png b/source-android/android/res/drawable-ldpi/icon.png similarity index 100% rename from v0.001/source-android/android/res/drawable-ldpi/icon.png rename to source-android/android/res/drawable-ldpi/icon.png diff --git a/v0.002/Release/source-android/android/res/drawable/friendiqa.png b/source-android/android/res/drawable/friendiqa.png similarity index 100% rename from v0.002/Release/source-android/android/res/drawable/friendiqa.png rename to source-android/android/res/drawable/friendiqa.png diff --git a/v0.002/Develop/source-android/android/res/drawable-ldpi/icon.png b/source-android/android/res/drawable/icon.png similarity index 100% rename from v0.002/Develop/source-android/android/res/drawable-ldpi/icon.png rename to source-android/android/res/drawable/icon.png diff --git a/v0.002/Release/source-android/android/res/drawable/splash.png b/source-android/android/res/drawable/splash.png similarity index 100% rename from v0.002/Release/source-android/android/res/drawable/splash.png rename to source-android/android/res/drawable/splash.png diff --git a/v0.001/source-android/android/res/values/libs.xml b/source-android/android/res/values/libs.xml similarity index 87% rename from v0.001/source-android/android/res/values/libs.xml rename to source-android/android/res/values/libs.xml index 4d68673..77f422c 100644 --- a/v0.001/source-android/android/res/values/libs.xml +++ b/source-android/android/res/values/libs.xml @@ -1,7 +1,7 @@ - https://download.qt-project.org/ministro/android/qt5/qt-5.4 + https://download.qt.io/ministro/android/qt5/qt-5.8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/v0.001/source-android/android/gradle.properties b/v0.001/source-android/android/gradle.properties deleted file mode 100644 index a8fd204..0000000 --- a/v0.001/source-android/android/gradle.properties +++ /dev/null @@ -1,9 +0,0 @@ -## This file is automatically generated by QtCreator. -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. - -androidBuildToolsVersion=23.0.2 -androidCompileSdkVersion=18 -buildDir=.build -qt5AndroidDir=/home/pankraz/bin/Qt5.5.1/5.5/android_armv7/src/android/java diff --git a/v0.001/source-android/android/local.properties b/v0.001/source-android/android/local.properties deleted file mode 100644 index f73784e..0000000 --- a/v0.001/source-android/android/local.properties +++ /dev/null @@ -1,6 +0,0 @@ -## This file is automatically generated by QtCreator. -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. - -sdk.dir=/opt/android-sdk diff --git a/v0.001/source-android/application.qrc b/v0.001/source-android/application.qrc deleted file mode 100644 index a37df49..0000000 --- a/v0.001/source-android/application.qrc +++ /dev/null @@ -1,23 +0,0 @@ - - - js/layout.js - js/photoworker.js - js/service.js - js/news.js - js/newsworker.js - js/helper.js - qml/FriendComponent.qml - qml/MessageSend.qml - qml/Newsitem.qml - qml/PhotoComponent.qml - qml/PhotogroupComponent.qml - qml/PhotoPlaceholder.qml - qml/friendiqa.qml - qml/PhotoTab.qml - qml/ConfigTab.qml - qml/FriendsTab.qml - qml/NewsTab.qml - qml/InfoBox.qml - images/defaultcontact.jpg - - diff --git a/v0.001/source-android/common/friendiqa.cpp b/v0.001/source-android/common/friendiqa.cpp deleted file mode 100644 index 1b25c10..0000000 --- a/v0.001/source-android/common/friendiqa.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include "xhr.h" - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QQuickView view; - - - XHR* xhr = XHR::instance(); - view.rootContext()->setContextProperty("xhr", xhr); - view.setSource(QUrl("qrc:/qml/friendiqa.qml")); - view.show(); - view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit())); - return app.exec(); - -} - diff --git a/v0.001/source-android/common/xhr.cpp b/v0.001/source-android/common/xhr.cpp deleted file mode 100644 index 6877135..0000000 --- a/v0.001/source-android/common/xhr.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include "xhr.h" - -#include -#include -#include - -#include "uploadableimage.h" - -XHR *XHR::instance() -{ - static XHR xhr; - return &xhr; -} - -XHR::XHR(QObject *parent) : QObject(parent) -{ - request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); -} - -void XHR::setUrl(QString url) -{ - if (url!=m_url) { - m_url = url; - emit urlChanged(); - } -} - -void XHR::setLogin(QString login) -{ - if (login!=m_login) { - m_login = login; - emit loginChanged(); - } -} -QString XHR::url() const -{ - return m_url; -} - -QString XHR::login() const -{ - return m_login; -} - -void XHR::setParam(QString name, QString value) -{ - params.insert(name, value); -} - -void XHR::setImageFileParam(QString name, QString url) -{ - files.insert(name, url); -} - -void XHR::clearParams() -{ - files.clear(); - params.clear(); -} - -void XHR::get() -{ - QUrlQuery query; - - QHashIterator i(params); - while(i.hasNext()) { - i.next(); - query.addQueryItem(i.key(), i.value()); - } - - QUrl requrl(m_url); - requrl.setQuery(query); - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader("Authorization", headerData.toLocal8Bit()); - - - request.setUrl(requrl); - reply = manager.get(request); - - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - -} - -void XHR::post() -{ - qDebug() << "start post to " << m_url; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - - QHashIterator iparams(params); - while(iparams.hasNext()) { - iparams.next(); - qDebug() << "\t add param " << iparams.key() << " : " << iparams.value(); - QHttpPart textPart; - textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\"")); - - - textPart.setBody(iparams.value().toUtf8()); - multiPart->append(textPart); - } - - UploadableImage uimg; - QHashIterator ifiles(files); - while(ifiles.hasNext()) { - ifiles.next(); - - uimg.setSource(ifiles.value()); - qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key(); - - QHttpPart imagePart; - imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype())); - imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\"")); - imagePart.setBody(uimg.bytes()); - multiPart->append(imagePart); - } - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - - request.setUrl(m_url); - reply = manager.post(request, multiPart); - qDebug() << "\t request sent"; - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - qDebug() << "\t reply signals connected"; -} - -void XHR::onReplyError(QNetworkReply::NetworkError code) -{ - qDebug() << code; - emit this->error( bufferToString(), (int) code); - reply->deleteLater(); -} - -void XHR::onReplySuccess() -{ - qDebug() << "!"; - emit this->success( bufferToString() ); - reply->deleteLater(); -} - -void XHR::onReadyRead() -{ - qDebug() << "."; - buffer += reply->readAll(); -} - -void XHR::onSSLError(const QList &errors) -{ - qDebug() << "XHR::onSSLError :" ; - QListIterator ierrs(errors); - while(ierrs.hasNext()) { - qDebug() << "\t" << ierrs.next().errorString(); - } -} - -QString XHR::bufferToString() -{ - return QTextCodec::codecForName("utf-8")->toUnicode(buffer); -} - - diff --git a/v0.001/source-android/common/xhr.h b/v0.001/source-android/common/xhr.h deleted file mode 100644 index 3d61f25..0000000 --- a/v0.001/source-android/common/xhr.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef XHR_H -#define XHR_H - -#include -#include -#include -#include - -class XHR : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) - -public: - static XHR *instance(); - - explicit XHR(QObject *parent = 0); - - void setUrl(QString url); - // void setLogin(QString login); - - QString url() const; - QString login() const; - -signals: - void urlChanged(); - void loginChanged(); - void success(QString data); - void error(QString data, int code); - -public slots: - void setLogin(QString login); - void setParam(QString name, QString value); - void setImageFileParam(QString name, QString url); - void clearParams(); - void post(); - void get(); - -private slots: - void onReplyError(QNetworkReply::NetworkError code); - void onReplySuccess(); - void onReadyRead(); - void onSSLError(const QList &errors); - -private: - QByteArray buffer; - QString m_url; - QString m_login; - QHash params; - QHash files; - - QNetworkAccessManager manager; - QNetworkRequest request; - QNetworkReply *reply; - - QString bufferToString(); -}; - -#endif // XHR_H diff --git a/v0.001/source-android/friendiqa.pro b/v0.001/source-android/friendiqa.pro deleted file mode 100644 index 7d62087..0000000 --- a/v0.001/source-android/friendiqa.pro +++ /dev/null @@ -1,49 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = friendiqa -CONFIG += release -QT += qml quick gui widgets - -SOURCES += common/friendiqa.cpp \ - common/uploadableimage.cpp \ - common/xhr.cpp - -RESOURCES = application.qrc - -OTHER_FILES += qml/friendiqa.qml \ - translations/*.ts \ - qml/*.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 - -HEADERS += \ - common/uploadableimage.h \ - common/xhr.h - -DISTFILES += \ - android/AndroidManifest.xml \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradlew \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - - diff --git a/v0.001/source-android/js/helper.js b/v0.001/source-android/js/helper.js deleted file mode 100644 index 0246ad0..0000000 --- a/v0.001/source-android/js/helper.js +++ /dev/null @@ -1,80 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql - -function friendicaRequest(login,api,rootwindow,callback) { - var xhrequest= new XMLHttpRequest(); - xhrequest.onreadystatechange = function() { - if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) { - } else if(xhrequest.readyState === XMLHttpRequest.DONE) { - try{ if (xhrequest.responseText!=""){ - callback(xhrequest.responseText) - }else{ - showMessage("Error",api+" NO RESPONSE",rootwindow) - callback(xhrequest.responseText) - } - } - catch (e){ - showMessage("Error", api+" "+e,rootwindow) -} - } - } - xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password)); - xhrequest.send(); - } - - -function friendicaWebRequest(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, rootwindow) - } - } - } - xhrequest.open("GET", url,true); - xhrequest.send(); - } - -function readData(database,table,callback,filter,filtervalue) { // reads and applies data from DB - if (filter){ - var where = " WHERE "+ filter +" = '" + filtervalue+"'"; - } else { var where="";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { -// print('select * from '+table+where); - var rsArray=[]; - var rs = tx.executeSql('select * from '+table+where); - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - callback(rsArray); - }); -} - -function readField(field,database,table, username, callback,filter,filtervalue) { // reads and applies data from DB -if (filter){ -var where = " AND "+ filter +" = '" + filtervalue+"'"; -} else { var where="";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { -// print('... read from database ' + field) - var rsArray=[]; - print('select DISTINCT '+field+' from '+table+' WHERE username="'+username+'"'+where+' ORDER BY '+field+' ASC'); - var rs = tx.executeSql('select DISTINCT '+field+' from '+table+' WHERE username="'+username+'"'+where+' ORDER BY '+field+' ASC'); - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)[field]) - } - callback(rsArray); - }); -} - -function showMessage(header,message,rootwindow){ - var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+message+'"}'; - var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput"); -} diff --git a/v0.001/source-android/js/layout.js b/v0.001/source-android/js/layout.js deleted file mode 100644 index 51ccfb4..0000000 --- a/v0.001/source-android/js/layout.js +++ /dev/null @@ -1,44 +0,0 @@ -function showFriends(db) { - Service.readActiveConfig(db,function(login){ - Service.requestFriends(login.url,login.user,login.password,displayFriends); - }); -} -function displayFriends(obj){ - for (var i=0; i= c.x) - f.contentX = c.x; - else if (f.contentX+f.width <= c.x+c.width) - f.contentX = c.x+c.width-f.width; - if (f.contentY >= c.y) - f.contentY = c.y; - else if (f.contentY+f.height <= c.y+c.height) - f.contentY = c.y+c.height-f.height; -} - -function createObject(objectQml,qmlParameters,parentitem,callback) { - var component = Qt.createComponent(objectQml); - if (component.status === Component.Ready || component.status === Component.Error) - finishCreation(component,qmlParameters,parentitem,callback); - else - component.statusChanged.connect(finishCreation(qmlParameters)); -} - -function finishCreation(component,qmlParameters,parentitem,callback) { - if (component.status === Component.Ready) { - var createdObject = component.createObject(parentitem, qmlParameters); - if (createdObject === null) - print("Error creating image"); } - else if (component.status === Component.Error) - print("Error loading component:"+component.errorString()); - else {print("created")} - callback(createdObject); -} - diff --git a/v0.001/source-android/js/news.js b/v0.001/source-android/js/news.js deleted file mode 100644 index 366fdb8..0000000 --- a/v0.001/source-android/js/news.js +++ /dev/null @@ -1,227 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql -.import "qrc:/js/helper.js" as Helperjs - -function requestFriends(login,database,rootwindow,callback){ -// return array of friends - Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ - var friends=JSON.parse(obj); - for (var i=0;i 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return true; - } - } - } 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/v0.001/source-android/js/newsworker.js b/v0.001/source-android/js/newsworker.js deleted file mode 100644 index 00ff9ab..0000000 --- a/v0.001/source-android/js/newsworker.js +++ /dev/null @@ -1,24 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if(msg.appendnews!==true){ msg.model.clear()}; - for (var j=0;jobj.height){ //landscape - helpheight=helpwidth*obj.height/obj.width - } else { //portrait - helpwidth=helpheight*obj.width/obj.height - } - var component=Qt.createComponent("qrc:/qml/PhotoPlaceholder.qml"); - var sprite = component.createObject(fotostab, {"x":0,"y":0,"imageName":storagedirectory+obj.filename ,"width":helpwidth,"height":helpheight,"source": "data:image/jpeg;base64,"+obj.data,"downloadtype":"picture"}); -// print("sprite: "+sprite); - callback(obj,sprite) -} - -function deleteImageData(database,user,field,selection,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) { - result = tx.executeSql('UPDATE imageData SET data="" where '+ field +'="'+selection+'"'); - callback(result)}) -} - -function requestFriendsAlbumPictures(friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(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); - } -//print("Album"+JSON.stringify(photoarray)); -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;i0){ - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - var rsObject={server:rsArray[0].server,username:rsArray[0].username, password:rsArray[0].password,imagestore:rsArray[0].imagestore,maxnews:rsArray[0].maxnews,isActive:rsArray[0].isActive}; - } else { - var rsObject="" - } - callback(rsObject);}} - ); -} - -function readActiveConfig(database){ - var obj; - readConfig(database,function(config){ -obj=config},"isActive", 0); - return obj; -} - -function deleteConfig(database,userobj,callback) { // delete user data from DB - print('deleteConfig()') -if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { - print('... read from database '+where) - var rs = tx.executeSql('delete * from config'+where); - print(rs.toString); - callback(rs); - }); -} diff --git a/v0.001/source-android/qml/ConfigTab.qml b/v0.001/source-android/qml/ConfigTab.qml deleted file mode 100644 index 1d007cf..0000000 --- a/v0.001/source-android/qml/ConfigTab.qml +++ /dev/null @@ -1,251 +0,0 @@ -import QtQuick 2.0 -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 -import "qrc:/qml" - -StackView{ - id: configStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem: Flickable{ - width:root.width-5*mm - height:root.height-12*mm - contentHeight: configBackground.height - boundsBehavior: Flickable.StopAtBounds - Rectangle{ - id:configBackground - color: "grey" - width:parent.width - height:Math.max(80*mm,root.height-12*mm) - focus: true - - ComboBox{ - y:mm - width: root.width/2 - model: ListModel{ - id: usermodel - } -onCurrentIndexChanged:{ - try {Service.readConfig(db,function(obj){ - servername.text=obj.server; - username.text= obj.username; - password.text=Qt.atob(obj.password); - imagestore.text=obj.imagestore; - maxNewsText.text=obj.maxnews; - if( obj.isActive==0){isActiveField.text=qsTr("yes")} else {isActiveField.text=qsTr("no")} - },"username",currentText)} - catch (e){print(e)} - } -} - - - Text { - text: "Server" - x: 4*mm; y: 10*mm - } - Text { - text: "User" - x: 4*mm; y: 20*mm - } - - Text { - text: "Password" - x: 4*mm; y: 30*mm - } - Text { - text: "Image dir." - x: 4*mm; y: 40*mm - } - - Text { - text: "Max. News" - x: 4*mm; y: 50*mm - } - Text { - text: "is Active" - x: 4*mm; y: 60*mm - } - - Rectangle{color: "white"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;} - Flickable { - id: servernameFlickable - x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm; - contentWidth: servername.paintedWidth - contentHeight: servername.paintedHeight - clip: true - TextEdit { - id: servername - width: servernameFlickable.width - height: servernameFlickable.height - focus: true - text:"https://..." - //wrapMode: TextEdit.NoWrap - //validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/} - // onEditingFinished:{} - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable) - } - } - - Rectangle{ - color: "white" - x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; - TextInput { - id: username - anchors.fill: parent - selectByMouse: true - } - } - Rectangle{ - color: "white" - x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; - TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit - } - } - - Rectangle{color: "white"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} - Flickable { - id: imagestoreFlickable - x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm; - clip: true - TextInput { - id: imagestore - width: imagestoreFlickable.width - height: imagestoreFlickable.height - wrapMode: TextEdit.NoWrap - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable) - } - } -Slider{ id: maxNews -x:37*mm; y: 50*mm;width: root.width/6;height:5*mm -minimumValue: 0;maximumValue:100000; stepSize: 1000 -} -Rectangle{color: "white"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm; - TextEdit{id:maxNewsText; - anchors.fill: parent - verticalAlignment:TextEdit.AlignRight - text:maxNews.value - focus: true - selectByMouse: true - } -} - - - Rectangle{ - x: 25*mm; y: 60*mm; width: root.width/2; height: 5*mm; - Text{ - id: isActiveField - anchors.fill: parent - } - } - - FileDialog { - id: imagestoreDialog - title: "Please choose a directory" - folder: shortcuts.pictures - selectFolder: true - onAccepted: { - var imagestoreString=imagestoreDialog.folder.toString(); imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/" - imagestore.text=imagestoreString; - console.log("You chose: " + imagestoreDialog.folder) - } - onRejected: { - console.log("Canceled") - } - } - - Button { - x: root.width/2+18*mm; y: 40*mm; width: 7*mm; height: 5*mm; - text: "..." - onClicked: - {imagestoreDialog.open()} - } - - - Button { - x: 25*mm; y: 70*mm; width: implicitWidth; height: implicitHeight; - text: "Update" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text}; - var errormessage=""; - if (servername.text==""){errormessage=qsTr("No server given! ")} - //if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} - 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=="") {Service.storeConfig(db,userconfig); - Service.readConfig(db,function(userconfig){Service.getServerConfig(userconfig,configBackground, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - usermodel.append({text:username.text}); - //reset values - root.login=userconfig; - root.contactlist=[]; - root.news=[] - root.newContacts=[] - root.currentContact= 0 - root.contactLoadType= "" - - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); - //try {newstab.newsModel.clear(); - //friendstab.friendsModel.clear(); - //photostab.photogroupModel.clear();} catch(e){} - } - else {Helperjs.show("Error", errormessage,root)} -}} - - Button { - x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm; - text: "-" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)}; - Service.deleteConfig(db,userconfig); - }} - - Button { - x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; - text: "+" - onClicked:{ - servername.text="https://..." - username.text="" - password.text="" - imagestore.text="" - maxNews.value=1000 - isActiveField.text="" - } - } - - Button { - x: root.width/2+14*mm; y: mm; width: 5*mm; height: 5*mm; - text: "?" - onClicked:{ - configStack.push({item:"qrc:/qml/InfoBox.qml"}); - } - } - - Component.onCompleted: { - try{Helperjs.readData(db,"config",function(users){ - users.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - for (var i=0; i"+qsTr("Description")+": "+Qt.atob(friend.description)+"
"+qsTr("Server Type")+": "+friend.location+"
"+qsTr("Posts")+": "+friend.statuses_count+ - "
"+qsTr("URL")+": "+friend.url+"
"+ - qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) - onLinkActivated: { - Qt.openUrlExternally(link)} - } - - Row{ - anchors.top: namelabeltext.bottom - anchors.topMargin: 2*mm - spacing:4 - - Button{ - id:photobutton - text:"Photos" - visible:friend.location=="Friendica"? 1:0 - onClicked:{root.currentIndex=2; - fotostab.active=true; - root.fotoSignal(friend) ; - } - } - - Button{ - id:messagebutton - text:"Messages" - onClicked:{root.currentIndex=0; - newstab.active=true; - root.messageSignal(friend.id) ; - } - } - - Button{id:dmbutton - visible: friend.following=="true"?true:false - text: "DM" - onClicked:{root.currentIndex=0; - newstab.active=true; - root.directmessageSignal(friend.screen_name); - } - } - - Button{ - id: closeButton - text: "close" - onClicked:{friendComponent.state=""} - } - } - } - } - - states: [ - State { - name: "large" - PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:friendsView.width; text:Qt.atob(friend.name)+" (@"+friend.screen_name+")"} - PropertyChanges { target: friendComponent; z: 2 } - PropertyChanges { target: wrapper; width:friendsView.width;height:friendsView.height -2*mm-1} - PropertyChanges { target: photoImage; width:15*mm;height:15*mm } - PropertyChanges { target:friendComponent.GridView.view ;contentY:friendComponent.y;contentX:friendComponent.x;interactive:false} - PropertyChanges { target: detailsrectangle; opacity:1 } - } - ] -} diff --git a/v0.001/source-android/qml/FriendsTab.qml b/v0.001/source-android/qml/FriendsTab.qml deleted file mode 100644 index be5bce4..0000000 --- a/v0.001/source-android/qml/FriendsTab.qml +++ /dev/null @@ -1,66 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/news.js" as Newsjs -import "qrc:/qml" - -Rectangle { - function showFriends(username){try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db, "contacts",function(friendsobject){ - for (var j=0;jFriendiqa v0.001
Licensed under GPL 3
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ - "C++ code by Fabio
"+ - "QML and Javascript code by Marco" - onLinkActivated:{ - Qt.openUrlExternally(link)} - } - Button{ - text:qsTr("Close") - onClicked:{configStack.pop()} - anchors.top:infoBoxText.bottom - } - } diff --git a/v0.001/source-android/qml/MessageSend.qml b/v0.001/source-android/qml/MessageSend.qml deleted file mode 100644 index bdc7875..0000000 --- a/v0.001/source-android/qml/MessageSend.qml +++ /dev/null @@ -1,132 +0,0 @@ -// message.qml -// message with buttons -import QtQuick 2.0 -import QtQml 2.2 -import QtQuick.Controls 1.3 -import QtQuick.Dialogs 1.2 -import QtQuick.LocalStorage 2.0 -//import "../qml" -import "qrc:/js/service.js" as Service - -Item{ - id:messageSend - property var login - property string parentId: "" - property string reply_to_user:"" - property string attachImageURL: ""; - property int directmessage: 0; - property var contacts: [] - // title: parentId !== "" ? qsTr("Reply to "+reply_to_user) : qsTr("New post") - - function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) { - xhr.url= login.server + "/api/statuses/update.xml"; - xhr.setLogin(login.username+":"+Qt.atob(login.password)); - print("login: "+login.username+":"+Qt.atob(login.password)); - xhr.clearParams(); - xhr.setParam("source", "Friendiqa"); - xhr.setParam("status", status); - if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentid)}; - if (title!=="") {xhr.setParam("title", title)}; - if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )}; - xhr.post(); - } - - function dmUpdate(title,text,replyto,screen_name,attachImageURL) { - xhr.url= login.server + "/api/direct_messages/new.xml"; - xhr.setLogin(login.username+":"+Qt.atob(login.password)); - xhr.clearParams(); - xhr.setParam("text", text); - xhr.setParam("screen_name", screen_name); - if (parentId!="") {xhr.setParam("replyto", replyto)}; - if (title!=="") {xhr.setParam("title", title)}; - if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )}; - xhr.post(); - } - - Column { - id:messageColumn - spacing: 2 - - TextField { - id: titleField - width: parent.width - placeholderText: qsTr("Title (optional)") - visible: messageSend.parentId === "" - } - - TextArea { - id: bodyField - width: parent.width - height: 30*mm - wrapMode: TextEdit.Wrap - } -CheckBox{ - id:dmCheckbox - text:"DM" - enabled: false - checked: (directmessage==1)?true:false - onClicked:{ - if(dmCheckbox.checkedState==Qt.Checked){directmessage=1} - else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0} - } - } - Row{ - spacing:2 - Button { - id: cancelButton - text: qsTr("Cancel") - onClicked: {newsStack.pop()} - } - - Button { - id: attachButton - text: qsTr("Attach") - onClicked: {imageAttachmentDialog.open()} - } - Button{ - id:contactButton - text:qsTr("cc") - visible:(directmessage==0) - onClicked:{ - var contactitems=""; - for (var i=0;imaxnews){var lastvalidtimers= tx.executeSql('select created_at from news ORDER BY created_at DESC LIMIT ' +(newscount-maxnews)); - var lastvalidtime=lastvalidtimers.rows.item(-1); - var deleters = tx.executeSql('DELETE from news WHERE created_at<'+lastvalidtime)} - }); - Qt.quit() - } - - StackView{ - id: newsStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem:Rectangle { - color: "white" - width:root.width-2*mm - height:root.height-8*mm - - Button { - id: newMessageButton - text: qsTr("+") - anchors.top: parent.top - anchors.right: parent.right - onClicked: { - Helperjs.readField("screen_name",root.db,"contacts",root.login.username,function(friends){ - newsStack.push({item:"qrc:/qml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}}) - },"isFriend",1); - } - } - Button { - id: quitButton - text: qsTr("Quit") - anchors.top: parent.top - anchors.right: newMessageButton.left - onClicked: {cleanNews(root.db)} - } - - Component { id:footerComponent - Rectangle{ - border.color: "#EEEEEE" - border.width: 1 - width:parent.width - height:6*mm - Text{ - font.pixelSize: 1.5*mm - anchors.centerIn: parent - text:qsTr("More") - } - MouseArea{anchors.fill:parent - onClicked:{ - var currentTime= new Date(); - if(newstabStatus=="news"){ - var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },false,lastnews_id)} - else if(newstabStatus=="friendmessage"){ - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)} - }} - } - } - ListView { - id: newsView - anchors.fill: parent - anchors.topMargin: 8*root.mm - anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm - anchors.bottomMargin: 1*root.mm - clip: true - spacing: 0 - footer: footerComponent - model: newsModel - delegate: Newsitem{} - } - - ListModel{id: newsModel} - - WorkerScript { - id: newsWorker - source: "qrc:/js/newsworker.js" - } - - Button { - id: update - anchors.top: parent.top - anchors.right: quitButton.left - text: "Update" - onClicked: { //try{newsModel.clear()} catch(e){} - newsBusy.running=true; - root.contactLoadType="news"; - Newsjs.getFriendsTimeline(login,db,contactlist,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc;root.currentContact=0; - if (ns.length==0){ - Newsjs.getDirectMessage(root.login,root.db,root,function(dbnews){showNews(dbnews)}); - newsBusy.running=false} - })} - } - BusyIndicator{ - id: newsBusy - anchors.centerIn:update - //anchors.right: update.left - //anchors.top:parent.top - width:7*mm - height: 7*mm - } - Component.onCompleted: { - root.messageSignal.connect(onFriendsMessages); - root.directmessageSignal.connect(onDirectMessage); - root.newsSignal.connect(showNews); - try{newsModel.clear()} catch(e){} - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - }) - } -} -} -} diff --git a/v0.001/source-android/qml/Newsitem.qml b/v0.001/source-android/qml/Newsitem.qml deleted file mode 100644 index 509ec70..0000000 --- a/v0.001/source-android/qml/Newsitem.qml +++ /dev/null @@ -1,261 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/layout.js" as Layoutjs - - -Item { - id: newsitem - width: newsView.width - height:Math.max((itemMessage.height+createdAtLabel.height+4*mm),profileImage.height+user_name.height+mm) - property bool show_full: false - property string conversation_id: "" - property string attachments:"" - property string attending: "" - onAttendingChanged: {attendLabel.visible=true; - attendLabel.text= qsTr("attending: ")+ qsTr(attending)} - signal replyto(string parent_id) - - Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} - - Rectangle{ - width:newsitem.width - height:newsitem.height-1 - color: (newsitemobject.directmessage)?"#ffe6e6" : "white" - - Column { - id: authorcolumn - width: 8*mm - - Image { - id:profileImage - source: "file://"+newsitemobject.user.profile_image - x:1 - width: 7*mm - height: 7*mm - MouseArea{ - anchors.fill: parent - onPressAndHold: { newsmenu.popup()} - } - onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} - } - Label { - id:user_name - color: "grey" - //height:3.5*mm - width:parent.width - font.pixelSize: 1.5*mm - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name) - } - } - Column { - id:newscolumn - anchors.left: authorcolumn.right - - Row{ - spacing: 5 - Label { - color: "grey" - text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source - } else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"} - font.pixelSize: 1.5*mm - } - Label { - id:createdAtLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: dateDiff - } - CheckBox { - id:favoritedCheckbox - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 6*mm - implicitHeight:2*mm - color:"white" - } - indicator: - Rectangle{x:3*mm - width: 3*mm - implicitHeight:2*mm - Text{ - anchors.centerIn: parent - color:control.checked?"black":"grey" - text:"\u2605" - }} - } - checked:(newsitemobject.favorited>0) - Text{ - anchors.left: parent.right - color: "grey" - font.pixelSize: 1.5*mm - text: (newsitemobject.favorited>0)? newsitemobject.favorited+qsTr(" Favorites"):"" - } - onClicked:{ - if(favoritedCheckbox.checkedState==Qt.Checked) - {Newsjs.favorite(login,true,newsitemobject.status_id,root)} - else - if(favoritedCheckbox.checkedState==Qt.Unchecked) - {Newsjs.favorite(login,false,newsitemobject.status_id,root)} - } - } - - } - - Text { - color: "#404040" - linkColor: "light green" - id: itemMessage - textFormat: Text.RichText - text: Qt.atob(newsitemobject.statusnet_html) - width: newsitem.width-8*mm-2 - height: implicitHeight - wrapMode: Text.Wrap - onLinkActivated:{ print("link "+link); - Qt.openUrlExternally(link)} - } - Row { - CheckBox{id:likeCheckbox - height:3*mm - width:8*mm - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 7*mm - implicitHeight: 3*mm - color:"white" - } - indicator: - Rectangle{ - implicitWidth: 3*mm - implicitHeight:3*mm - color:control.checked?"yellow":"white" - x: 5*mm - Text{ - font.pixelSize: 1.5*mm - color:"grey" - text:":-)" - }} - } - onClicked: { - if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false} - else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root)}} - } - CheckBox{id: dislikeCheckbox - height:3*mm - width:8*mm - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 7*mm - implicitHeight:3*mm - color:"white" - } - indicator: - Rectangle{ - implicitWidth: 3*mm - implicitHeight:3*mm - color:control.checked?"yellow":"white" - x:5*mm - Text{ - font.pixelSize: 1.5*mm - color:"grey" - text:":-(" - }} - } - onClicked: { - if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id);likeCheckbox.checked=false} - else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root)}} - } - Label { - id:replytoLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name - }catch(e){" "} - } - Label { - id:attendLabel - visible: false - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: qsTr("attending: ")+ qsTr(attending) - } - } - } - - Menu { - id:newsmenu - MenuItem { - text: qsTr("Reply") - onTriggered: { - newsStack.push({item:"qrc:/qml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id}}); - } - } -MenuItem { - text: qsTr("DM") - onTriggered: { - root.directmessageSignal(newsitemobject.user.screen_name); - } - } - MenuItem { - text: qsTr("Repost") - onTriggered: { - Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){ - print(reply); - }) - } - } - MenuItem { - text: qsTr("Conversation") - onTriggered: { - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root,function(){ - var currentTime= new Date(); - Newsjs.conversationfromdb(db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){ - newsModel.clear(); - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsarray,'latestmessage':0}; - newsWorker.sendMessage(msg); - }); - } - )} - } - -Menu{ - title: qsTr("Attending") - - MenuItem{text:qsTr("yes") - onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){ - newsitem.attending="yes"; - attendLabel.visible=true})} - } - - MenuItem{text:qsTr("maybe") - onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){ - newsitem.attending="maybe"})} - } - - MenuItem{text:qsTr("no") - onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){ - newsitem.attending="no"})} - } - } - - MenuItem { - text: qsTr("Delete") - onTriggered: { - Newsjs.deleteNews(root.login,db,newsitemobject.status_id,root,function(reply){ - print(JSON.stringify(reply)); - newsModel.remove(index); - }) - } - } -} -}} - diff --git a/v0.001/source-android/qml/PhotoComponent.qml b/v0.001/source-android/qml/PhotoComponent.qml deleted file mode 100644 index 7da5f8b..0000000 --- a/v0.001/source-android/qml/PhotoComponent.qml +++ /dev/null @@ -1,100 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.2 - -Package { - Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm} - Item { id: listItem; Package.name: 'list'; width: root.width-1*mm; height: root.height-8*mm; } - Item { id: gridItem; Package.name: 'grid';} - - Item { - id: photoWrapper - width: 16.5*mm; height: 16.5*mm - z: stackItem.PathView.z - property string hqphotolink: photoLink - - Rectangle { - id: placeHolder - color: 'lightblue'; antialiasing: true - anchors.fill:parent - //width: parent.width; height: parent.height; - } - - BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } - Image { - id: realImage; - // property string hqphotolink: photoLink - width: photoWrapper.width; height: photoWrapper.height - antialiasing: true; - asynchronous: true - cache: false - fillMode: Image.PreserveAspectFit; - source: imageLocation - // onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth) - } - Rectangle{ - id:phototextRectangle - color:"black" - z:3 - opacity: 0.5 - width:phototext.contentWidth - height: phototext.contentHeight - anchors.bottom: photoWrapper.bottom - } - Text { - id:phototext - z:4 - text: photoDescription.trim() - width:15*mm - anchors.bottom: photoWrapper.bottom - color: "white" - font.pixelSize: 2*mm - wrapMode:Text.Wrap - } - MouseArea { - width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage - onClicked: { - if (albumWrapper.state == 'inGrid') { - gridItem.GridView.view.currentIndex = index; - //print("photoLink"+realImage.photoLink) - albumWrapper.state = 'fullscreen' - } else { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'inGrid' - } - } - } - - states: [ - State { - name: 'stacked'; when: albumWrapper.state == '' - ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm } - PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } - PropertyChanges { target: phototext; opacity: 0.0 } - PropertyChanges { target: phototextRectangle; opacity: 0.0 } - }, - State { - name: 'inGrid'; when: albumWrapper.state == 'inGrid' - ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;} - PropertyChanges { target: phototext; opacity: 1.0 } - PropertyChanges { target: phototextRectangle; opacity: 0.5 } - PropertyChanges { target: placeHolder; opacity: 1.0 } - }, - State { - name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' - ParentChange { - target: photoWrapper; parent: listItem; x: 1; y: 1; - width: root.width-mm; height: root.heigh-8*mm - } - PropertyChanges { target: placeHolder; opacity: 0.0 } - PropertyChanges { target: realImage; source: photoWrapper.hqphotolink} - PropertyChanges { target: phototext; anchors.bottom: realImage.bottom} - PropertyChanges { target: phototext; width:realImage.width } - PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom } - PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) } - } - ] - - } -} - diff --git a/v0.001/source-android/qml/PhotoPlaceholder.qml b/v0.001/source-android/qml/PhotoPlaceholder.qml deleted file mode 100644 index 598afc7..0000000 --- a/v0.001/source-android/qml/PhotoPlaceholder.qml +++ /dev/null @@ -1,26 +0,0 @@ -import QtQuick 2.0 -import "qrc:/js/helper.js" as Helperjs - -Image { -id:photoPlaceholder -property string imageName:"x.jpg" -property string downloadtype:"" -fillMode: Image.PreserveAspectFit -onStatusChanged: { - if (photoPlaceholder.status == Image.Ready) { - //print("Photo width"+width+" height"+height+" Ratio "+ fillMode); - var saveprocess=photoPlaceholder.grabToImage(function(result){ - var saveresult=result.saveToFile(imageName.toString()); - if (saveresult){ - if ((downloadtype=="picture")&&(newImages.length>0)){ - photoPlaceholder.destroy(); - currentImageNo=currentImageNo+1 - } - else if ((downloadtype=="contact")&&(root.newContacts.length>0)) - { - photoPlaceholder.destroy(100); - root.currentContact=root.currentContact+1 - } - }}); -}}} - diff --git a/v0.001/source-android/qml/PhotoTab.qml b/v0.001/source-android/qml/PhotoTab.qml deleted file mode 100644 index 1656040..0000000 --- a/v0.001/source-android/qml/PhotoTab.qml +++ /dev/null @@ -1,135 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 -import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/qml" - -Rectangle { - id:fotorectangle -width:root.width-mm - height:root.height-5*mm - color: '#fff' - property var newImages:[] - property int currentImageNo: 0 -//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false}; -// photoWorker.sendMessage(msg); -//} - onNewImagesChanged:{if(newImages.length>0){ Service.dataRequest(root.login,newImages[currentImageNo],root.db,fotorectangle);newImagesProgress.visible=true //download first image -} } - onCurrentImageNoChanged:{ if(currentImageNo0){// download first contact image and update db - //print("newcontact"+JSON.stringify(newContacts[0])); - updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} -} -onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db - if(currentContact - - js/layout.js - js/photoworker.js - js/service.js - qml/FriendComponent.qml - qml/MessageSend.qml - qml/Newsitem.qml - qml/PhotoComponent.qml - qml/PhotogroupComponent.qml - qml/PhotoPlaceholder.qml - qml/friendiqa.qml - qml/PhotoTab.qml - qml/ConfigTab.qml - qml/FriendsTab.qml - qml/NewsTab.qml - js/news.js - js/newsworker.js - js/helper.js - images/defaultcontact.jpg - qml/InfoBox.qml - - diff --git a/v0.001/source-linux/common/friendiqa.cpp b/v0.001/source-linux/common/friendiqa.cpp deleted file mode 100644 index 1b25c10..0000000 --- a/v0.001/source-linux/common/friendiqa.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include "xhr.h" - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QQuickView view; - - - XHR* xhr = XHR::instance(); - view.rootContext()->setContextProperty("xhr", xhr); - view.setSource(QUrl("qrc:/qml/friendiqa.qml")); - view.show(); - view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit())); - return app.exec(); - -} - diff --git a/v0.001/source-linux/common/xhr.cpp b/v0.001/source-linux/common/xhr.cpp deleted file mode 100644 index 6877135..0000000 --- a/v0.001/source-linux/common/xhr.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#include "xhr.h" - -#include -#include -#include - -#include "uploadableimage.h" - -XHR *XHR::instance() -{ - static XHR xhr; - return &xhr; -} - -XHR::XHR(QObject *parent) : QObject(parent) -{ - request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); -} - -void XHR::setUrl(QString url) -{ - if (url!=m_url) { - m_url = url; - emit urlChanged(); - } -} - -void XHR::setLogin(QString login) -{ - if (login!=m_login) { - m_login = login; - emit loginChanged(); - } -} -QString XHR::url() const -{ - return m_url; -} - -QString XHR::login() const -{ - return m_login; -} - -void XHR::setParam(QString name, QString value) -{ - params.insert(name, value); -} - -void XHR::setImageFileParam(QString name, QString url) -{ - files.insert(name, url); -} - -void XHR::clearParams() -{ - files.clear(); - params.clear(); -} - -void XHR::get() -{ - QUrlQuery query; - - QHashIterator i(params); - while(i.hasNext()) { - i.next(); - query.addQueryItem(i.key(), i.value()); - } - - QUrl requrl(m_url); - requrl.setQuery(query); - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader("Authorization", headerData.toLocal8Bit()); - - - request.setUrl(requrl); - reply = manager.get(request); - - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - -} - -void XHR::post() -{ - qDebug() << "start post to " << m_url; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - - QHashIterator iparams(params); - while(iparams.hasNext()) { - iparams.next(); - qDebug() << "\t add param " << iparams.key() << " : " << iparams.value(); - QHttpPart textPart; - textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\"")); - - - textPart.setBody(iparams.value().toUtf8()); - multiPart->append(textPart); - } - - UploadableImage uimg; - QHashIterator ifiles(files); - while(ifiles.hasNext()) { - ifiles.next(); - - uimg.setSource(ifiles.value()); - qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key(); - - QHttpPart imagePart; - imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype())); - imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\"")); - imagePart.setBody(uimg.bytes()); - multiPart->append(imagePart); - } - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - - request.setUrl(m_url); - reply = manager.post(request, multiPart); - qDebug() << "\t request sent"; - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - qDebug() << "\t reply signals connected"; -} - -void XHR::onReplyError(QNetworkReply::NetworkError code) -{ - qDebug() << code; - emit this->error( bufferToString(), (int) code); - reply->deleteLater(); -} - -void XHR::onReplySuccess() -{ - qDebug() << "!"; - emit this->success( bufferToString() ); - reply->deleteLater(); -} - -void XHR::onReadyRead() -{ - qDebug() << "."; - buffer += reply->readAll(); -} - -void XHR::onSSLError(const QList &errors) -{ - qDebug() << "XHR::onSSLError :" ; - QListIterator ierrs(errors); - while(ierrs.hasNext()) { - qDebug() << "\t" << ierrs.next().errorString(); - } -} - -QString XHR::bufferToString() -{ - return QTextCodec::codecForName("utf-8")->toUnicode(buffer); -} - - diff --git a/v0.001/source-linux/common/xhr.h b/v0.001/source-linux/common/xhr.h deleted file mode 100644 index 3d61f25..0000000 --- a/v0.001/source-linux/common/xhr.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef XHR_H -#define XHR_H - -#include -#include -#include -#include - -class XHR : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QString login READ login WRITE setLogin NOTIFY loginChanged) - -public: - static XHR *instance(); - - explicit XHR(QObject *parent = 0); - - void setUrl(QString url); - // void setLogin(QString login); - - QString url() const; - QString login() const; - -signals: - void urlChanged(); - void loginChanged(); - void success(QString data); - void error(QString data, int code); - -public slots: - void setLogin(QString login); - void setParam(QString name, QString value); - void setImageFileParam(QString name, QString url); - void clearParams(); - void post(); - void get(); - -private slots: - void onReplyError(QNetworkReply::NetworkError code); - void onReplySuccess(); - void onReadyRead(); - void onSSLError(const QList &errors); - -private: - QByteArray buffer; - QString m_url; - QString m_login; - QHash params; - QHash files; - - QNetworkAccessManager manager; - QNetworkRequest request; - QNetworkReply *reply; - - QString bufferToString(); -}; - -#endif // XHR_H diff --git a/v0.001/source-linux/friendiqa.pro b/v0.001/source-linux/friendiqa.pro deleted file mode 100644 index 2245e98..0000000 --- a/v0.001/source-linux/friendiqa.pro +++ /dev/null @@ -1,38 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = friendiqa -CONFIG += debug -QT += qml quick gui widgets - -SOURCES += common/friendiqa.cpp \ - common/uploadableimage.cpp \ - common/xhr.cpp - -RESOURCES = application.qrc - -OTHER_FILES += qml/friendiqa.qml \ - translations/*.ts \ - qml/*.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 - -HEADERS += \ - common/uploadableimage.h \ - common/xhr.h - - diff --git a/v0.001/source-linux/js/helper.js b/v0.001/source-linux/js/helper.js deleted file mode 100644 index 0246ad0..0000000 --- a/v0.001/source-linux/js/helper.js +++ /dev/null @@ -1,80 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql - -function friendicaRequest(login,api,rootwindow,callback) { - var xhrequest= new XMLHttpRequest(); - xhrequest.onreadystatechange = function() { - if (xhrequest.readyState === XMLHttpRequest.HEADERS_RECEIVED) { - } else if(xhrequest.readyState === XMLHttpRequest.DONE) { - try{ if (xhrequest.responseText!=""){ - callback(xhrequest.responseText) - }else{ - showMessage("Error",api+" NO RESPONSE",rootwindow) - callback(xhrequest.responseText) - } - } - catch (e){ - showMessage("Error", api+" "+e,rootwindow) -} - } - } - xhrequest.open("GET", login.server+api,true,login.username,Qt.atob(login.password)); - xhrequest.send(); - } - - -function friendicaWebRequest(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, rootwindow) - } - } - } - xhrequest.open("GET", url,true); - xhrequest.send(); - } - -function readData(database,table,callback,filter,filtervalue) { // reads and applies data from DB - if (filter){ - var where = " WHERE "+ filter +" = '" + filtervalue+"'"; - } else { var where="";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { -// print('select * from '+table+where); - var rsArray=[]; - var rs = tx.executeSql('select * from '+table+where); - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - callback(rsArray); - }); -} - -function readField(field,database,table, username, callback,filter,filtervalue) { // reads and applies data from DB -if (filter){ -var where = " AND "+ filter +" = '" + filtervalue+"'"; -} else { var where="";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { -// print('... read from database ' + field) - var rsArray=[]; - print('select DISTINCT '+field+' from '+table+' WHERE username="'+username+'"'+where+' ORDER BY '+field+' ASC'); - var rs = tx.executeSql('select DISTINCT '+field+' from '+table+' WHERE username="'+username+'"'+where+' ORDER BY '+field+' ASC'); - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)[field]) - } - callback(rsArray); - }); -} - -function showMessage(header,message,rootwindow){ - var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+message+'"}'; - var messageObject=Qt.createQmlObject(messageString,rootwindow,"messageOutput"); -} diff --git a/v0.001/source-linux/js/layout.js b/v0.001/source-linux/js/layout.js deleted file mode 100644 index 51ccfb4..0000000 --- a/v0.001/source-linux/js/layout.js +++ /dev/null @@ -1,44 +0,0 @@ -function showFriends(db) { - Service.readActiveConfig(db,function(login){ - Service.requestFriends(login.url,login.user,login.password,displayFriends); - }); -} -function displayFriends(obj){ - for (var i=0; i= c.x) - f.contentX = c.x; - else if (f.contentX+f.width <= c.x+c.width) - f.contentX = c.x+c.width-f.width; - if (f.contentY >= c.y) - f.contentY = c.y; - else if (f.contentY+f.height <= c.y+c.height) - f.contentY = c.y+c.height-f.height; -} - -function createObject(objectQml,qmlParameters,parentitem,callback) { - var component = Qt.createComponent(objectQml); - if (component.status === Component.Ready || component.status === Component.Error) - finishCreation(component,qmlParameters,parentitem,callback); - else - component.statusChanged.connect(finishCreation(qmlParameters)); -} - -function finishCreation(component,qmlParameters,parentitem,callback) { - if (component.status === Component.Ready) { - var createdObject = component.createObject(parentitem, qmlParameters); - if (createdObject === null) - print("Error creating image"); } - else if (component.status === Component.Error) - print("Error loading component:"+component.errorString()); - else {print("created")} - callback(createdObject); -} - diff --git a/v0.001/source-linux/js/news.js b/v0.001/source-linux/js/news.js deleted file mode 100644 index 366fdb8..0000000 --- a/v0.001/source-linux/js/news.js +++ /dev/null @@ -1,227 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql -.import "qrc:/js/helper.js" as Helperjs - -function requestFriends(login,database,rootwindow,callback){ -// return array of friends - Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ - var friends=JSON.parse(obj); - for (var i=0;i 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return true; - } - } - } 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/v0.001/source-linux/js/newsworker.js b/v0.001/source-linux/js/newsworker.js deleted file mode 100644 index 00ff9ab..0000000 --- a/v0.001/source-linux/js/newsworker.js +++ /dev/null @@ -1,24 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if(msg.appendnews!==true){ msg.model.clear()}; - for (var j=0;jobj.height){ //landscape - helpheight=helpwidth*obj.height/obj.width - } else { //portrait - helpwidth=helpheight*obj.width/obj.height - } - var component=Qt.createComponent("qrc:/qml/PhotoPlaceholder.qml"); - var sprite = component.createObject(fotostab, {"x":0,"y":0,"imageName":storagedirectory+obj.filename ,"width":helpwidth,"height":helpheight,"source": "data:image/jpeg;base64,"+obj.data,"downloadtype":"picture"}); -// print("sprite: "+sprite); - callback(obj,sprite) -} - -function deleteImageData(database,user,field,selection,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) { - result = tx.executeSql('UPDATE imageData SET data="" where '+ field +'="'+selection+'"'); - callback(result)}) -} - -function requestFriendsAlbumPictures(friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(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); - } -//print("Album"+JSON.stringify(photoarray)); -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;i0){ - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - var rsObject={server:rsArray[0].server,username:rsArray[0].username, password:rsArray[0].password,imagestore:rsArray[0].imagestore,maxnews:rsArray[0].maxnews,isActive:rsArray[0].isActive}; - } else { - var rsObject="" - } - callback(rsObject);}} - ); -} - -function readActiveConfig(database){ - var obj; - readConfig(database,function(config){ -obj=config},"isActive", 0); - return obj; -} - -function deleteConfig(database,userobj,callback) { // delete user data from DB - print('deleteConfig()') -if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { - print('... read from database '+where) - var rs = tx.executeSql('delete * from config'+where); - print(rs.toString); - callback(rs); - }); -} diff --git a/v0.001/source-linux/qml/ConfigTab.qml b/v0.001/source-linux/qml/ConfigTab.qml deleted file mode 100644 index 1d007cf..0000000 --- a/v0.001/source-linux/qml/ConfigTab.qml +++ /dev/null @@ -1,251 +0,0 @@ -import QtQuick 2.0 -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 -import "qrc:/qml" - -StackView{ - id: configStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem: Flickable{ - width:root.width-5*mm - height:root.height-12*mm - contentHeight: configBackground.height - boundsBehavior: Flickable.StopAtBounds - Rectangle{ - id:configBackground - color: "grey" - width:parent.width - height:Math.max(80*mm,root.height-12*mm) - focus: true - - ComboBox{ - y:mm - width: root.width/2 - model: ListModel{ - id: usermodel - } -onCurrentIndexChanged:{ - try {Service.readConfig(db,function(obj){ - servername.text=obj.server; - username.text= obj.username; - password.text=Qt.atob(obj.password); - imagestore.text=obj.imagestore; - maxNewsText.text=obj.maxnews; - if( obj.isActive==0){isActiveField.text=qsTr("yes")} else {isActiveField.text=qsTr("no")} - },"username",currentText)} - catch (e){print(e)} - } -} - - - Text { - text: "Server" - x: 4*mm; y: 10*mm - } - Text { - text: "User" - x: 4*mm; y: 20*mm - } - - Text { - text: "Password" - x: 4*mm; y: 30*mm - } - Text { - text: "Image dir." - x: 4*mm; y: 40*mm - } - - Text { - text: "Max. News" - x: 4*mm; y: 50*mm - } - Text { - text: "is Active" - x: 4*mm; y: 60*mm - } - - Rectangle{color: "white"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;} - Flickable { - id: servernameFlickable - x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm; - contentWidth: servername.paintedWidth - contentHeight: servername.paintedHeight - clip: true - TextEdit { - id: servername - width: servernameFlickable.width - height: servernameFlickable.height - focus: true - text:"https://..." - //wrapMode: TextEdit.NoWrap - //validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/} - // onEditingFinished:{} - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable) - } - } - - Rectangle{ - color: "white" - x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; - TextInput { - id: username - anchors.fill: parent - selectByMouse: true - } - } - Rectangle{ - color: "white" - x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; - TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit - } - } - - Rectangle{color: "white"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} - Flickable { - id: imagestoreFlickable - x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm; - clip: true - TextInput { - id: imagestore - width: imagestoreFlickable.width - height: imagestoreFlickable.height - wrapMode: TextEdit.NoWrap - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable) - } - } -Slider{ id: maxNews -x:37*mm; y: 50*mm;width: root.width/6;height:5*mm -minimumValue: 0;maximumValue:100000; stepSize: 1000 -} -Rectangle{color: "white"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm; - TextEdit{id:maxNewsText; - anchors.fill: parent - verticalAlignment:TextEdit.AlignRight - text:maxNews.value - focus: true - selectByMouse: true - } -} - - - Rectangle{ - x: 25*mm; y: 60*mm; width: root.width/2; height: 5*mm; - Text{ - id: isActiveField - anchors.fill: parent - } - } - - FileDialog { - id: imagestoreDialog - title: "Please choose a directory" - folder: shortcuts.pictures - selectFolder: true - onAccepted: { - var imagestoreString=imagestoreDialog.folder.toString(); imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/" - imagestore.text=imagestoreString; - console.log("You chose: " + imagestoreDialog.folder) - } - onRejected: { - console.log("Canceled") - } - } - - Button { - x: root.width/2+18*mm; y: 40*mm; width: 7*mm; height: 5*mm; - text: "..." - onClicked: - {imagestoreDialog.open()} - } - - - Button { - x: 25*mm; y: 70*mm; width: implicitWidth; height: implicitHeight; - text: "Update" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text}; - var errormessage=""; - if (servername.text==""){errormessage=qsTr("No server given! ")} - //if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} - 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=="") {Service.storeConfig(db,userconfig); - Service.readConfig(db,function(userconfig){Service.getServerConfig(userconfig,configBackground, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - usermodel.append({text:username.text}); - //reset values - root.login=userconfig; - root.contactlist=[]; - root.news=[] - root.newContacts=[] - root.currentContact= 0 - root.contactLoadType= "" - - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); - //try {newstab.newsModel.clear(); - //friendstab.friendsModel.clear(); - //photostab.photogroupModel.clear();} catch(e){} - } - else {Helperjs.show("Error", errormessage,root)} -}} - - Button { - x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm; - text: "-" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)}; - Service.deleteConfig(db,userconfig); - }} - - Button { - x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; - text: "+" - onClicked:{ - servername.text="https://..." - username.text="" - password.text="" - imagestore.text="" - maxNews.value=1000 - isActiveField.text="" - } - } - - Button { - x: root.width/2+14*mm; y: mm; width: 5*mm; height: 5*mm; - text: "?" - onClicked:{ - configStack.push({item:"qrc:/qml/InfoBox.qml"}); - } - } - - Component.onCompleted: { - try{Helperjs.readData(db,"config",function(users){ - users.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - for (var i=0; i"+qsTr("Description")+": "+Qt.atob(friend.description)+"
"+qsTr("Server Type")+": "+friend.location+"
"+qsTr("Posts")+": "+friend.statuses_count+ - "
"+qsTr("URL")+": "+friend.url+"
"+ - qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) - onLinkActivated: { - Qt.openUrlExternally(link)} - } - - Row{ - anchors.top: namelabeltext.bottom - anchors.topMargin: 2*mm - spacing:4 - - Button{ - id:photobutton - text:"Photos" - visible:friend.location=="Friendica"? 1:0 - onClicked:{root.currentIndex=2; - fotostab.active=true; - root.fotoSignal(friend) ; - } - } - - Button{ - id:messagebutton - text:"Messages" - onClicked:{root.currentIndex=0; - newstab.active=true; - root.messageSignal(friend.id) ; - } - } - - Button{id:dmbutton - visible: friend.following=="true"?true:false - text: "DM" - onClicked:{root.currentIndex=0; - newstab.active=true; - root.directmessageSignal(friend.screen_name); - } - } - - Button{ - id: closeButton - text: "close" - onClicked:{friendComponent.state=""} - } - } - } - } - - states: [ - State { - name: "large" - PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:friendsView.width; text:Qt.atob(friend.name)+" (@"+friend.screen_name+")"} - PropertyChanges { target: friendComponent; z: 2 } - PropertyChanges { target: wrapper; width:friendsView.width;height:friendsView.height -2*mm-1} - PropertyChanges { target: photoImage; width:15*mm;height:15*mm } - PropertyChanges { target:friendComponent.GridView.view ;contentY:friendComponent.y;contentX:friendComponent.x;interactive:false} - PropertyChanges { target: detailsrectangle; opacity:1 } - } - ] -} diff --git a/v0.001/source-linux/qml/FriendsTab.qml b/v0.001/source-linux/qml/FriendsTab.qml deleted file mode 100644 index be5bce4..0000000 --- a/v0.001/source-linux/qml/FriendsTab.qml +++ /dev/null @@ -1,66 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/news.js" as Newsjs -import "qrc:/qml" - -Rectangle { - function showFriends(username){try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db, "contacts",function(friendsobject){ - for (var j=0;jFriendiqa v0.001
Licensed under GPL 3
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ - "C++ code by Fabio
"+ - "QML and Javascript code by Marco" - onLinkActivated:{ - Qt.openUrlExternally(link)} - } - Button{ - text:qsTr("Close") - onClicked:{configStack.pop()} - anchors.top:infoBoxText.bottom - } - } diff --git a/v0.001/source-linux/qml/MessageSend.qml b/v0.001/source-linux/qml/MessageSend.qml deleted file mode 100644 index bdc7875..0000000 --- a/v0.001/source-linux/qml/MessageSend.qml +++ /dev/null @@ -1,132 +0,0 @@ -// message.qml -// message with buttons -import QtQuick 2.0 -import QtQml 2.2 -import QtQuick.Controls 1.3 -import QtQuick.Dialogs 1.2 -import QtQuick.LocalStorage 2.0 -//import "../qml" -import "qrc:/js/service.js" as Service - -Item{ - id:messageSend - property var login - property string parentId: "" - property string reply_to_user:"" - property string attachImageURL: ""; - property int directmessage: 0; - property var contacts: [] - // title: parentId !== "" ? qsTr("Reply to "+reply_to_user) : qsTr("New post") - - function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) { - xhr.url= login.server + "/api/statuses/update.xml"; - xhr.setLogin(login.username+":"+Qt.atob(login.password)); - print("login: "+login.username+":"+Qt.atob(login.password)); - xhr.clearParams(); - xhr.setParam("source", "Friendiqa"); - xhr.setParam("status", status); - if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentid)}; - if (title!=="") {xhr.setParam("title", title)}; - if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )}; - xhr.post(); - } - - function dmUpdate(title,text,replyto,screen_name,attachImageURL) { - xhr.url= login.server + "/api/direct_messages/new.xml"; - xhr.setLogin(login.username+":"+Qt.atob(login.password)); - xhr.clearParams(); - xhr.setParam("text", text); - xhr.setParam("screen_name", screen_name); - if (parentId!="") {xhr.setParam("replyto", replyto)}; - if (title!=="") {xhr.setParam("title", title)}; - if (attachImageURL!=="") {xhr.setImageFileParam("media", attachImageURL )}; - xhr.post(); - } - - Column { - id:messageColumn - spacing: 2 - - TextField { - id: titleField - width: parent.width - placeholderText: qsTr("Title (optional)") - visible: messageSend.parentId === "" - } - - TextArea { - id: bodyField - width: parent.width - height: 30*mm - wrapMode: TextEdit.Wrap - } -CheckBox{ - id:dmCheckbox - text:"DM" - enabled: false - checked: (directmessage==1)?true:false - onClicked:{ - if(dmCheckbox.checkedState==Qt.Checked){directmessage=1} - else if(dmCheckbox.checkedState==Qt.Unchecked){directmessage=0} - } - } - Row{ - spacing:2 - Button { - id: cancelButton - text: qsTr("Cancel") - onClicked: {newsStack.pop()} - } - - Button { - id: attachButton - text: qsTr("Attach") - onClicked: {imageAttachmentDialog.open()} - } - Button{ - id:contactButton - text:qsTr("cc") - visible:(directmessage==0) - onClicked:{ - var contactitems=""; - for (var i=0;imaxnews){var lastvalidtimers= tx.executeSql('select created_at from news ORDER BY created_at DESC LIMIT ' +(newscount-maxnews)); - var lastvalidtime=lastvalidtimers.rows.item(-1); - var deleters = tx.executeSql('DELETE from news WHERE created_at<'+lastvalidtime)} - }); - Qt.quit() - } - - StackView{ - id: newsStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem:Rectangle { - color: "white" - width:root.width-2*mm - height:root.height-8*mm - - Button { - id: newMessageButton - text: qsTr("+") - anchors.top: parent.top - anchors.right: parent.right - onClicked: { - Helperjs.readField("screen_name",root.db,"contacts",root.login.username,function(friends){ - newsStack.push({item:"qrc:/qml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}}) - },"isFriend",1); - } - } - Button { - id: quitButton - text: qsTr("Quit") - anchors.top: parent.top - anchors.right: newMessageButton.left - onClicked: {cleanNews(root.db)} - } - - Component { id:footerComponent - Rectangle{ - border.color: "#EEEEEE" - border.width: 1 - width:parent.width - height:6*mm - Text{ - font.pixelSize: 1.5*mm - anchors.centerIn: parent - text:qsTr("More") - } - MouseArea{anchors.fill:parent - onClicked:{ - var currentTime= new Date(); - if(newstabStatus=="news"){ - var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },false,lastnews_id)} - else if(newstabStatus=="friendmessage"){ - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)} - }} - } - } - ListView { - id: newsView - anchors.fill: parent - anchors.topMargin: 8*root.mm - anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm - anchors.bottomMargin: 1*root.mm - clip: true - spacing: 0 - footer: footerComponent - model: newsModel - delegate: Newsitem{} - } - - ListModel{id: newsModel} - - WorkerScript { - id: newsWorker - source: "qrc:/js/newsworker.js" - } - - Button { - id: update - anchors.top: parent.top - anchors.right: quitButton.left - text: "Update" - onClicked: { //try{newsModel.clear()} catch(e){} - newsBusy.running=true; - root.contactLoadType="news"; - Newsjs.getFriendsTimeline(login,db,contactlist,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc;root.currentContact=0; - if (ns.length==0){ - Newsjs.getDirectMessage(root.login,root.db,root,function(dbnews){showNews(dbnews)}); - newsBusy.running=false} - })} - } - BusyIndicator{ - id: newsBusy - anchors.centerIn:update - //anchors.right: update.left - //anchors.top:parent.top - width:7*mm - height: 7*mm - } - Component.onCompleted: { - root.messageSignal.connect(onFriendsMessages); - root.directmessageSignal.connect(onDirectMessage); - root.newsSignal.connect(showNews); - try{newsModel.clear()} catch(e){} - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - }) - } -} -} -} diff --git a/v0.001/source-linux/qml/Newsitem.qml b/v0.001/source-linux/qml/Newsitem.qml deleted file mode 100644 index 509ec70..0000000 --- a/v0.001/source-linux/qml/Newsitem.qml +++ /dev/null @@ -1,261 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/layout.js" as Layoutjs - - -Item { - id: newsitem - width: newsView.width - height:Math.max((itemMessage.height+createdAtLabel.height+4*mm),profileImage.height+user_name.height+mm) - property bool show_full: false - property string conversation_id: "" - property string attachments:"" - property string attending: "" - onAttendingChanged: {attendLabel.visible=true; - attendLabel.text= qsTr("attending: ")+ qsTr(attending)} - signal replyto(string parent_id) - - Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} - - Rectangle{ - width:newsitem.width - height:newsitem.height-1 - color: (newsitemobject.directmessage)?"#ffe6e6" : "white" - - Column { - id: authorcolumn - width: 8*mm - - Image { - id:profileImage - source: "file://"+newsitemobject.user.profile_image - x:1 - width: 7*mm - height: 7*mm - MouseArea{ - anchors.fill: parent - onPressAndHold: { newsmenu.popup()} - } - onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} - } - Label { - id:user_name - color: "grey" - //height:3.5*mm - width:parent.width - font.pixelSize: 1.5*mm - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name) - } - } - Column { - id:newscolumn - anchors.left: authorcolumn.right - - Row{ - spacing: 5 - Label { - color: "grey" - text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source - } else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"} - font.pixelSize: 1.5*mm - } - Label { - id:createdAtLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: dateDiff - } - CheckBox { - id:favoritedCheckbox - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 6*mm - implicitHeight:2*mm - color:"white" - } - indicator: - Rectangle{x:3*mm - width: 3*mm - implicitHeight:2*mm - Text{ - anchors.centerIn: parent - color:control.checked?"black":"grey" - text:"\u2605" - }} - } - checked:(newsitemobject.favorited>0) - Text{ - anchors.left: parent.right - color: "grey" - font.pixelSize: 1.5*mm - text: (newsitemobject.favorited>0)? newsitemobject.favorited+qsTr(" Favorites"):"" - } - onClicked:{ - if(favoritedCheckbox.checkedState==Qt.Checked) - {Newsjs.favorite(login,true,newsitemobject.status_id,root)} - else - if(favoritedCheckbox.checkedState==Qt.Unchecked) - {Newsjs.favorite(login,false,newsitemobject.status_id,root)} - } - } - - } - - Text { - color: "#404040" - linkColor: "light green" - id: itemMessage - textFormat: Text.RichText - text: Qt.atob(newsitemobject.statusnet_html) - width: newsitem.width-8*mm-2 - height: implicitHeight - wrapMode: Text.Wrap - onLinkActivated:{ print("link "+link); - Qt.openUrlExternally(link)} - } - Row { - CheckBox{id:likeCheckbox - height:3*mm - width:8*mm - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 7*mm - implicitHeight: 3*mm - color:"white" - } - indicator: - Rectangle{ - implicitWidth: 3*mm - implicitHeight:3*mm - color:control.checked?"yellow":"white" - x: 5*mm - Text{ - font.pixelSize: 1.5*mm - color:"grey" - text:":-)" - }} - } - onClicked: { - if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false} - else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root)}} - } - CheckBox{id: dislikeCheckbox - height:3*mm - width:8*mm - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 7*mm - implicitHeight:3*mm - color:"white" - } - indicator: - Rectangle{ - implicitWidth: 3*mm - implicitHeight:3*mm - color:control.checked?"yellow":"white" - x:5*mm - Text{ - font.pixelSize: 1.5*mm - color:"grey" - text:":-(" - }} - } - onClicked: { - if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id);likeCheckbox.checked=false} - else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root)}} - } - Label { - id:replytoLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: try {qsTr("In reply to ")+newsitemobject.reply_user.screen_name - }catch(e){" "} - } - Label { - id:attendLabel - visible: false - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: qsTr("attending: ")+ qsTr(attending) - } - } - } - - Menu { - id:newsmenu - MenuItem { - text: qsTr("Reply") - onTriggered: { - newsStack.push({item:"qrc:/qml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id}}); - } - } -MenuItem { - text: qsTr("DM") - onTriggered: { - root.directmessageSignal(newsitemobject.user.screen_name); - } - } - MenuItem { - text: qsTr("Repost") - onTriggered: { - Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){ - print(reply); - }) - } - } - MenuItem { - text: qsTr("Conversation") - onTriggered: { - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root,function(){ - var currentTime= new Date(); - Newsjs.conversationfromdb(db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){ - newsModel.clear(); - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsarray,'latestmessage':0}; - newsWorker.sendMessage(msg); - }); - } - )} - } - -Menu{ - title: qsTr("Attending") - - MenuItem{text:qsTr("yes") - onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){ - newsitem.attending="yes"; - attendLabel.visible=true})} - } - - MenuItem{text:qsTr("maybe") - onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){ - newsitem.attending="maybe"})} - } - - MenuItem{text:qsTr("no") - onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){ - newsitem.attending="no"})} - } - } - - MenuItem { - text: qsTr("Delete") - onTriggered: { - Newsjs.deleteNews(root.login,db,newsitemobject.status_id,root,function(reply){ - print(JSON.stringify(reply)); - newsModel.remove(index); - }) - } - } -} -}} - diff --git a/v0.001/source-linux/qml/PhotoComponent.qml b/v0.001/source-linux/qml/PhotoComponent.qml deleted file mode 100644 index 7da5f8b..0000000 --- a/v0.001/source-linux/qml/PhotoComponent.qml +++ /dev/null @@ -1,100 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.2 - -Package { - Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm} - Item { id: listItem; Package.name: 'list'; width: root.width-1*mm; height: root.height-8*mm; } - Item { id: gridItem; Package.name: 'grid';} - - Item { - id: photoWrapper - width: 16.5*mm; height: 16.5*mm - z: stackItem.PathView.z - property string hqphotolink: photoLink - - Rectangle { - id: placeHolder - color: 'lightblue'; antialiasing: true - anchors.fill:parent - //width: parent.width; height: parent.height; - } - - BusyIndicator { anchors.centerIn: parent; running: realImage.status != Image.Ready } - Image { - id: realImage; - // property string hqphotolink: photoLink - width: photoWrapper.width; height: photoWrapper.height - antialiasing: true; - asynchronous: true - cache: false - fillMode: Image.PreserveAspectFit; - source: imageLocation - // onStatusChanged: if (realImage.status == Image.Ready) print(realImage.paintedHeight+"x"+realImage.paintedWidth) - } - Rectangle{ - id:phototextRectangle - color:"black" - z:3 - opacity: 0.5 - width:phototext.contentWidth - height: phototext.contentHeight - anchors.bottom: photoWrapper.bottom - } - Text { - id:phototext - z:4 - text: photoDescription.trim() - width:15*mm - anchors.bottom: photoWrapper.bottom - color: "white" - font.pixelSize: 2*mm - wrapMode:Text.Wrap - } - MouseArea { - width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage - onClicked: { - if (albumWrapper.state == 'inGrid') { - gridItem.GridView.view.currentIndex = index; - //print("photoLink"+realImage.photoLink) - albumWrapper.state = 'fullscreen' - } else { - gridItem.GridView.view.currentIndex = index; - albumWrapper.state = 'inGrid' - } - } - } - - states: [ - State { - name: 'stacked'; when: albumWrapper.state == '' - ParentChange { target: photoWrapper; parent: stackItem; }//x: 1*mm; y: 1*mm } - PropertyChanges { target: photoWrapper; opacity: stackItem.PathView.onPath ? 1.0 : 0.0 } - PropertyChanges { target: phototext; opacity: 0.0 } - PropertyChanges { target: phototextRectangle; opacity: 0.0 } - }, - State { - name: 'inGrid'; when: albumWrapper.state == 'inGrid' - ParentChange { target: photoWrapper; parent: gridItem; x: 1*mm; y: 1*mm;} - PropertyChanges { target: phototext; opacity: 1.0 } - PropertyChanges { target: phototextRectangle; opacity: 0.5 } - PropertyChanges { target: placeHolder; opacity: 1.0 } - }, - State { - name: 'fullscreen'; when: albumWrapper.state == 'fullscreen' - ParentChange { - target: photoWrapper; parent: listItem; x: 1; y: 1; - width: root.width-mm; height: root.heigh-8*mm - } - PropertyChanges { target: placeHolder; opacity: 0.0 } - PropertyChanges { target: realImage; source: photoWrapper.hqphotolink} - PropertyChanges { target: phototext; anchors.bottom: realImage.bottom} - PropertyChanges { target: phototext; width:realImage.width } - PropertyChanges { target: phototextRectangle; anchors.bottom: realImage.bottom } - PropertyChanges { target: realImage; width: Math.min(listItem.width,sourceSize.width);height: Math.min(listItem.height,sourceSize.height) } - } - ] - - } -} - diff --git a/v0.001/source-linux/qml/PhotoPlaceholder.qml b/v0.001/source-linux/qml/PhotoPlaceholder.qml deleted file mode 100644 index 598afc7..0000000 --- a/v0.001/source-linux/qml/PhotoPlaceholder.qml +++ /dev/null @@ -1,26 +0,0 @@ -import QtQuick 2.0 -import "qrc:/js/helper.js" as Helperjs - -Image { -id:photoPlaceholder -property string imageName:"x.jpg" -property string downloadtype:"" -fillMode: Image.PreserveAspectFit -onStatusChanged: { - if (photoPlaceholder.status == Image.Ready) { - //print("Photo width"+width+" height"+height+" Ratio "+ fillMode); - var saveprocess=photoPlaceholder.grabToImage(function(result){ - var saveresult=result.saveToFile(imageName.toString()); - if (saveresult){ - if ((downloadtype=="picture")&&(newImages.length>0)){ - photoPlaceholder.destroy(); - currentImageNo=currentImageNo+1 - } - else if ((downloadtype=="contact")&&(root.newContacts.length>0)) - { - photoPlaceholder.destroy(100); - root.currentContact=root.currentContact+1 - } - }}); -}}} - diff --git a/v0.001/source-linux/qml/PhotoTab.qml b/v0.001/source-linux/qml/PhotoTab.qml deleted file mode 100644 index 1656040..0000000 --- a/v0.001/source-linux/qml/PhotoTab.qml +++ /dev/null @@ -1,135 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 -import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/qml" - -Rectangle { - id:fotorectangle -width:root.width-mm - height:root.height-5*mm - color: '#fff' - property var newImages:[] - property int currentImageNo: 0 -//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false}; -// photoWorker.sendMessage(msg); -//} - onNewImagesChanged:{if(newImages.length>0){ Service.dataRequest(root.login,newImages[currentImageNo],root.db,fotorectangle);newImagesProgress.visible=true //download first image -} } - onCurrentImageNoChanged:{ if(currentImageNo0){// download first contact image and update db - //print("newcontact"+JSON.stringify(newContacts[0])); - updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} -} -onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db - if(currentContact - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/v0.002/Develop/source-android/android/build.gradle b/v0.002/Develop/source-android/android/build.gradle deleted file mode 100644 index ef416b0..0000000 --- a/v0.002/Develop/source-android/android/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -buildscript { - repositories { - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:1.1.0' - } -} - -allprojects { - repositories { - jcenter() - } -} - -apply plugin: 'com.android.application' - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion androidBuildToolsVersion - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - lintOptions { - abortOnError false - } -} diff --git a/v0.002/Develop/source-android/android/gradle.properties b/v0.002/Develop/source-android/android/gradle.properties deleted file mode 100644 index a8fd204..0000000 --- a/v0.002/Develop/source-android/android/gradle.properties +++ /dev/null @@ -1,9 +0,0 @@ -## This file is automatically generated by QtCreator. -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. - -androidBuildToolsVersion=23.0.2 -androidCompileSdkVersion=18 -buildDir=.build -qt5AndroidDir=/home/pankraz/bin/Qt5.5.1/5.5/android_armv7/src/android/java diff --git a/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.jar b/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 8c0fb64..0000000 Binary files a/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.properties b/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1f..0000000 --- a/v0.002/Develop/source-android/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/v0.002/Develop/source-android/android/gradlew b/v0.002/Develop/source-android/android/gradlew deleted file mode 100644 index 91a7e26..0000000 --- a/v0.002/Develop/source-android/android/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/v0.002/Develop/source-android/android/gradlew.bat b/v0.002/Develop/source-android/android/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/v0.002/Develop/source-android/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/v0.002/Develop/source-android/android/local.properties b/v0.002/Develop/source-android/android/local.properties deleted file mode 100644 index f73784e..0000000 --- a/v0.002/Develop/source-android/android/local.properties +++ /dev/null @@ -1,6 +0,0 @@ -## This file is automatically generated by QtCreator. -# -# This file must *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. - -sdk.dir=/opt/android-sdk diff --git a/v0.002/Develop/source-android/android/res/values/libs.xml b/v0.002/Develop/source-android/android/res/values/libs.xml deleted file mode 100644 index 4d68673..0000000 --- a/v0.002/Develop/source-android/android/res/values/libs.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - https://download.qt-project.org/ministro/android/qt5/qt-5.4 - - - - - - - - - - - - - - - - - - - - diff --git a/v0.002/Develop/source-android/application.qrc b/v0.002/Develop/source-android/application.qrc deleted file mode 100644 index 7becb3a..0000000 --- a/v0.002/Develop/source-android/application.qrc +++ /dev/null @@ -1,28 +0,0 @@ - - - qml/friendiqa.qml - qml/newsqml/NewsTab.qml - qml/newsqml/Newsitem.qml - qml/newsqml/MessageSend.qml - qml/newsqml/PermissionDialog.qml - qml/contactqml/FriendsTab.qml - qml/contactqml/GroupComponent.qml - qml/contactqml/ContactComponent.qml - qml/contactqml/ContactDetailsComponent.qml - qml/photoqml/PhotoComponent.qml - qml/photoqml/PhotogroupComponent.qml - qml/photoqml/PhotoPlaceholder.qml - qml/photoqml/PhotoTab.qml - qml/configqml/InfoBox.qml - qml/configqml/ConfigTab.qml - js/layout.js - js/photoworker.js - js/service.js - js/news.js - js/newsworker.js - js/helper.js - images/defaultcontact.jpg - - - - diff --git a/v0.002/Develop/source-android/common/filesystem.cpp b/v0.002/Develop/source-android/common/filesystem.cpp deleted file mode 100644 index b828c8d..0000000 --- a/v0.002/Develop/source-android/common/filesystem.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "filesystem.h" - -FILESYSTEM *FILESYSTEM::instance() -{ - static FILESYSTEM filesystem; - return &filesystem; -} - -FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){} - -void FILESYSTEM::setDirectory(QString Directory) -{ - if (Directory!=m_Directory) { - m_Directory = Directory; - emit directoryChanged(); - } -} - -QString FILESYSTEM::Directory() const -{ - return m_Directory; -} - -void FILESYSTEM::makeDir(QString name) -{ - QDir dir(m_Directory); - if (dir.mkdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmDir(QString name) -{ - QDir dir(m_Directory); - if (dir.rmdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmFile(QString name) -{ - QDir dir(m_Directory); - if(dir.remove(name)){ - emit success(name); - } - else {emit error(name,1);} -} diff --git a/v0.002/Develop/source-android/common/filesystem.h b/v0.002/Develop/source-android/common/filesystem.h deleted file mode 100644 index f0aebb3..0000000 --- a/v0.002/Develop/source-android/common/filesystem.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef FILESYSTEM_H -#define FILESYSTEM_H - -#include -#include - -class FILESYSTEM : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged) - -public: - static FILESYSTEM *instance(); - explicit FILESYSTEM(QObject *parent = 0); - void setDirectory(QString Directory); - QString Directory() const; - -signals: - void directoryChanged(); - void success(QString data); - void error(QString data, int code); - -public slots: - //void setDirectory(QString Directory); - void makeDir(QString name); - void rmDir(QString name); - void rmFile(QString name); - -private slots: - //void onReplyError(QNetworkReply::NetworkError code); - // void onReplySuccess(); - //void onReadyRead(); - // void onSSLError(const QList &errors); - -private: - //QByteArray buffer; - QString m_Directory; - //QString m_login; - //QHash params; - //QHash files; - - //QNetworkAccessManager manager; - //QNetworkRequest request; - //QNetworkReply *reply; - - //QString bufferToString(); -}; - -#endif // FILSYSTEM_H diff --git a/v0.002/Develop/source-android/common/uploadableimage.cpp b/v0.002/Develop/source-android/common/uploadableimage.cpp deleted file mode 100644 index 81bea1a..0000000 --- a/v0.002/Develop/source-android/common/uploadableimage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "uploadableimage.h" - - -#include -#include -#include -#include - -void UploadableImage::setSource(const QString &a) { - if (a != m_source) { - m_source = a; - //m_base64 = ""; - m_mimetype = ""; - m_filename = ""; - - qDebug() << "UploadableImage::setSource : " << m_source; - - if (m_source=="") { - emit sourceChanged(); - //emit base64Changed(); - emit mimetypeChanged(); - emit filenameChanged(); - return; - } - - QImage fullimage = QImage(QUrl(m_source).toLocalFile()); - if (fullimage.width() > 800 || fullimage.height() > 800) { - if (fullimage.width() > fullimage.height()) { - m_image = fullimage.scaledToWidth(800); - } else { - m_image = fullimage.scaledToHeight(800); - } - } else { - m_image = fullimage; - } - qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height(); - emit sourceChanged(); - - QFileInfo fi(m_source); - - m_filename = fi.fileName(); - emit filenameChanged(); - - QString filetype = fi.suffix().toUpper(); - if (filetype!="PNG" && filetype!="JPG") { - filetype = "JPG"; - } - qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype; - - m_mimetype = "image/"+filetype.toLower(); - emit mimetypeChanged(); - - /* - QByteArray byteArray; - QBuffer buffer(&byteArray); - m_image.save(&buffer, filetype.toLatin1().constData()); - QString b64 = QString::fromLatin1(byteArray.toBase64().data()); - - for(int k=0; k -#include -#include - -class UploadableImage : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) - //Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed) - Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged) - Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged) - Q_PROPERTY(QByteArray bytes READ bytes) - -public: - void setSource(const QString &a); - QString source() const; - - //QString base64() const; - QString filename() const; - QString mimetype() const; - - QByteArray bytes(); -signals: - void sourceChanged(); - //void base64Changed(); - void filenameChanged(); - void mimetypeChanged(); - -private: - QString m_source; - QImage m_image; - //QString m_base64; - QString m_filename; - QString m_mimetype; -}; - -#endif // UPLOADABLEIMAGE_H diff --git a/v0.002/Develop/source-android/common/xhr.cpp b/v0.002/Develop/source-android/common/xhr.cpp deleted file mode 100644 index cf9aeb6..0000000 --- a/v0.002/Develop/source-android/common/xhr.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "xhr.h" - -#include -#include -#include - -#include "uploadableimage.h" - -XHR *XHR::instance() -{ - static XHR xhr; - return &xhr; -} - -XHR::XHR(QObject *parent) : QObject(parent) -{ - request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); -} - -void XHR::setUrl(QString url) -{ - if (url!=m_url) { - m_url = url; - emit urlChanged(); - } -} - -void XHR::setLogin(QString login) -{ - if (login!=m_login) { - m_login = login; - emit loginChanged(); - } -} - -void XHR::setFilename(QString filename) -{ - if (filename!=m_filename) { - m_filename = filename; - emit filenameChanged(); - } -} - -QString XHR::url() const -{ - return m_url; -} - -QString XHR::login() const -{ - return m_login; -} - -QString XHR::filename() const -{ - return m_filename; -} - -void XHR::setParam(QString name, QString value) -{ - params.insert(name, value); -} - -void XHR::setImageFileParam(QString name, QString url) -{ - files.insert(name, url); -} - -void XHR::clearParams() -{ - files.clear(); - params.clear(); -} - -void XHR::download() -{ - QUrl requrl(m_url); -// qDebug() << "start download of " << requrl; - request.setUrl(requrl); - reply = manager.get(request); -// qDebug() << "reply " << reply->header(QNetworkRequest::LocationHeader)<header(QNetworkRequest::LastModifiedHeader); - // qDebug() << "request " << request.url(); -// reply->ignoreSslErrors(); - connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead); - connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64))); - connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); -} - -void XHR::get() -{ - QUrlQuery query; - - QHashIterator i(params); - while(i.hasNext()) { - i.next(); - query.addQueryItem(i.key(), i.value()); - } - - QUrl requrl(m_url); - requrl.setQuery(query); - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader("Authorization", headerData.toLocal8Bit()); - - - request.setUrl(requrl); - reply = manager.get(request); - - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); -} - -void XHR::post() -{ - qDebug() << "start post to " << m_url; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - - QHashIterator iparams(params); - while(iparams.hasNext()) { - iparams.next(); - qDebug() << "\t add param " << iparams.key() << " : " << iparams.value(); - QHttpPart textPart; - textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\"")); - - - textPart.setBody(iparams.value().toUtf8()); - multiPart->append(textPart); - } - - UploadableImage uimg; - QHashIterator ifiles(files); - while(ifiles.hasNext()) { - ifiles.next(); - - uimg.setSource(ifiles.value()); - qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key(); - - QHttpPart imagePart; - imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype())); - imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\"")); - imagePart.setBody(uimg.bytes()); - multiPart->append(imagePart); - } - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - - request.setUrl(m_url); - reply = manager.post(request, multiPart); - qDebug() << "\t request sent"; - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - qDebug() << "\t reply signals connected"; -} - -void XHR::onReplyError(QNetworkReply::NetworkError code) -{ - qDebug() << code; - emit this->error( bufferToString(), (int) code); - reply->deleteLater(); -} - -void XHR::onReplySuccess() -{ - qDebug() << "!"; - emit this->success( bufferToString() ); - reply->deleteLater(); -} - -void XHR::onRequestFinished() -{ - // Save the file here - //qDebug() << "buffer downloaded "<error("image empty",1); reply->deleteLater();} - else {QFile file(m_filename); - file.open(QIODevice::WriteOnly); - //image.save(&file, "JPG"); - file.write(buffer); - buffer.clear(); - file.close(); - //qDebug() << m_url << "File downloaded "<downloaded(); - //reply->deleteLater(); - } -} - -void XHR::onReadyRead() -{ - qDebug() << "."; - buffer += reply->readAll(); -} - -void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes) -{ - qDebug() << "Bytes: " << bytesRead<<" / "< &errors) -{ - qDebug() << "XHR::onSSLError :" ; - QListIterator ierrs(errors); - while(ierrs.hasNext()) { - qDebug() << "\t" << ierrs.next().errorString(); - } -} - -QString XHR::bufferToString() -{ - return QTextCodec::codecForName("utf-8")->toUnicode(buffer); -} - - diff --git a/v0.002/Develop/source-android/common/xhr.h b/v0.002/Develop/source-android/common/xhr.h deleted file mode 100644 index 547e7d6..0000000 --- a/v0.002/Develop/source-android/common/xhr.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef XHR_H -#define XHR_H - -#include -#include -#include -#include - -class XHR : public QObject -{ - Q_OBJECT - 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) -public: - static XHR *instance(); - - explicit XHR(QObject *parent = 0); - - QString url() const; - QString login() const; - QString filename() const; - -signals: - void urlChanged(); - void loginChanged(); - void filenameChanged(); - void downloaded(); - void success(QString data); - void error(QString data, int code); - -public slots: - void setUrl(QString url); - void setLogin(QString login); - void setFilename(QString filename); - void setParam(QString name, QString value); - void setImageFileParam(QString name, QString url); - void clearParams(); - void post(); - void get(); - void download(); - -private slots: - void onReplyError(QNetworkReply::NetworkError code); - void onReplySuccess(); - void onRequestFinished(); - void onReadyRead(); - void onSSLError(const QList &errors); - void updateDownloadProgress(qint64 bytesRead, qint64 totalBytes); - -private: - QByteArray buffer; - QString m_url; - QString m_login; - QString m_filename; - QHash params; - QHash files; - - QNetworkAccessManager manager; - QNetworkRequest request; - QNetworkReply *reply; - - QString bufferToString(); -}; - -#endif // XHR_H diff --git a/v0.002/Develop/source-android/friendiqa.pro b/v0.002/Develop/source-android/friendiqa.pro deleted file mode 100644 index 8b4c352..0000000 --- a/v0.002/Develop/source-android/friendiqa.pro +++ /dev/null @@ -1,56 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = friendiqa -CONFIG += debug -QT += qml quick gui widgets - -SOURCES += common/friendiqa.cpp \ - common/uploadableimage.cpp \ - common/xhr.cpp \ - common/filesystem.cpp - -RESOURCES = application.qrc - -OTHER_FILES += qml/friendiqa.qml \ - translations/*.ts \ - qml/*.qml - qml/newsqml/*.qml - qml/contactqml/*.qml - qml/photoqml/*.qml - qml/configqml/*.qml - js/*.js - images/*.* - -# 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 - -HEADERS += \ - common/uploadableimage.h \ - common/xhr.h \ - common/filesystem.h - -DISTFILES += \ - android/AndroidManifest.xml \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradlew \ - android/res/values/libs.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - - diff --git a/v0.002/Develop/source-android/images/defaultcontact.jpg b/v0.002/Develop/source-android/images/defaultcontact.jpg deleted file mode 100644 index bb7bce2..0000000 Binary files a/v0.002/Develop/source-android/images/defaultcontact.jpg and /dev/null differ diff --git a/v0.002/Develop/source-android/js/friendworker.js b/v0.002/Develop/source-android/js/friendworker.js deleted file mode 100644 index 6b6c5be..0000000 --- a/v0.002/Develop/source-android/js/friendworker.js +++ /dev/null @@ -1,12 +0,0 @@ -WorkerScript.onMessage = function(msg) { - msg.model.clear(); - for (var j=0;j 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return i; - } - } - } return -1; -} -function cleanArray(array) { -var arraystring=JSON.stringify(array); - arraystring=arraystring.replace(/[\[\]]/g , ''); -return arraystring; -} diff --git a/v0.002/Develop/source-android/js/news.js b/v0.002/Develop/source-android/js/news.js deleted file mode 100644 index 2d2126b..0000000 --- a/v0.002/Develop/source-android/js/news.js +++ /dev/null @@ -1,356 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql -.import "qrc:/js/helper.js" as Helperjs - -function requestFriends(login,database,rootwindow,callback){ -// return array of friends - Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ - var friends=JSON.parse(obj); - for (var i=0;i0){ - // print("Like Contact"+JSON.stringify(news[i].friendica_activities.like)); - for (var j=0;j0){ - //print("DisLike Contact"+JSON.stringify(news[i].friendica_activities.dislike)); - for (var k=0;j 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return true; - } - } - } 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/v0.002/Develop/source-android/js/newsworker.js b/v0.002/Develop/source-android/js/newsworker.js deleted file mode 100644 index f08ba80..0000000 --- a/v0.002/Develop/source-android/js/newsworker.js +++ /dev/null @@ -1,63 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if(msg.appendnews!==true){ msg.model.clear()}; - - for (var j=0;j0){ - if (newsitemobject.like.length==1){likeText= Qt.atob(newsitemobject.like[0].name)+" "+ qsTr("likes this.")} - else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")} - } - if (newsitemobject.dislike.length>0){ - if (newsitemobject.dislike.length==1){dislikeText= QT.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")} - else {dislikeText= newsitemobject.dislike.length+" "+ qsTr("don't like this.")} - } - if (newsitemobject.attendyes.length>0){ - if (newsitemobject.attendyes.length==1){attendyesText= Qt.atob(newsitemobject.attendyes[0].name)+" "+ qsTr("will attend.")} - else {attendyesText= newsitemobject.attendyes.length+" "+ qsTr("persons will attend.")} - } - if (newsitemobject.attendno.length>0){ - if (newsitemobject.attendno.length==1){attendnoText= Qt.atob(newsitemobject.attendno[0].name)+" "+ qsTr("will not attend.")} - else {attendnoText= newsitemobject.attendno.length+" "+ qsTr("persons will not attend.")} - } - if (newsitemobject.attendmaybe.length>0){ - if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")} - else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} - } - var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); - if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} - if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} - if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} - if (friendica_activities_self.indexOf(1)!=-1){self.liked=1} - if (friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - } - var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} - //print(JSON.stringify(friendica_activities) ) ; - var seconds=(msg.currentTime-newsitemobject.created_at)/1000; - var timestring=""; - if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");} - else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");} - else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");} - else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");} - else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");} - else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");} - else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");} - else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");} - else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");} - else {timestring=Math.round(seconds/69984000)+" "+qsTr("years") +" "+qsTr("ago");} - var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities})} - //print("News:"+j+msg.news.length+JSON.stringify(data)); - msg.model.append(data);} - if (j==msg.news.length){ - msg.model.sync() - }; -} diff --git a/v0.002/Develop/source-android/js/photoworker.js b/v0.002/Develop/source-android/js/photoworker.js deleted file mode 100644 index 36646c7..0000000 --- a/v0.002/Develop/source-android/js/photoworker.js +++ /dev/null @@ -1,15 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if (msg.firstalbum==0){msg.model.clear();} - var limit=0; if (msg.albums.length-msg.firstalbum<20){limit=msg.albums.length} else{limit=msg.firstalbum+20} - for (var j=msg.firstalbum;j0){ - 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); - print('storeData() for ' + JSON.stringify(obj)); - // try{sprite.destroy();}catch(e){} -// if (obj["link"]["0"]){var source=obj["link"]["0"]} else {var source=obj["link"]["4"]}//source for profile picture or original size -// print("Source"+source); - obj["source"]=source; - var filename=obj.filename; - if (filename==""){// check if file has any filename - if (obj.type=="image/jpeg") {obj["filename"]=obj["id"]+".jpg"} - else if (obj.type=="image/png") {obj["filename"]=obj["id"]+".png"} - } - // check if text name has valid image format ending, otherwise append appropriate ending - if(["jpg","png"].indexOf(obj["filename"].substring(obj["filename"].lastIndexOf(".")+1,obj["filename"].length))==-1){ - print("falscheEndung: "+obj["filename"].substring(obj["filename"].lastIndexOf(".")+1,obj["filename"].length)); - { if (obj.type=="image/jpeg") {obj["filename"]=obj["filename"]+".jpg"} - else if (obj.type=="image/png") {obj["filename"]=obj["filename"]+".png"} - } - print("obj.Filename: "+obj["filename"]+" filename: "+filename) - } - saveImage(obj,login.imagestore+'albums/'+obj.album,function(obj,sprite){ - //sprite.destroy(500); - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - print('... check if a object exists: '+obj["id"]) - var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); - if(result.rows.length === 1) {// use update - print(obj["id"] +' exists, update it') - 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+"/"]); - print("Inserted");} - })})}} - catch (e){print("Data retrieval failure! "+ e+obj);} -})} - -function saveImage(obj,storagedirectory,callback) { - // create image component from base64 code and save it - print("Storing "+storagedirectory+"/"+obj.filename+obj.width+"x"+obj.height); - var maxSize=Math.max(fotostab.width,fotostab.height); - var helpwidth=(obj.widthobj.height){ //landscape - helpheight=helpwidth*obj.height/obj.width - } else { //portrait - helpwidth=helpheight*obj.width/obj.height - } - var component=Qt.createComponent("qrc:/qml/photoqml/PhotoPlaceholder.qml"); - var sprite = component.createObject(fotostab, {"x":0,"y":0,"imageName":storagedirectory+"/"+obj.filename ,"width":helpwidth,"height":helpheight,"source": obj["link"]["4"],"downloadtype":"picture"}); - callback(obj,sprite) -} - -function deleteImageData(database,user,field,selection,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) { - result = tx.executeSql('UPDATE imageData SET data="" where '+ field +'="'+selection+'"'); - callback(result)}) -} - -function requestFriendsAlbumPictures(friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(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); - } -//print("Album"+JSON.stringify(photoarray)); -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;i0){ - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - var rsObject={server:rsArray[0].server,username:rsArray[0].username, password:rsArray[0].password,imagestore:rsArray[0].imagestore,maxnews:rsArray[0].maxnews,isActive:rsArray[0].isActive}; - } else { - var rsObject="" - } - callback(rsObject);}} - ); -} - -function readActiveConfig(database){ - var obj; - readConfig(database,function(config){ -obj=config},"isActive", 0); - return obj; -} - -function deleteConfig(database,userobj,callback) { // delete user data from DB - print('deleteConfig()') -if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { - print('... read from database '+where) - var rs = tx.executeSql('delete * from config'+where); - print(rs.toString); - callback(rs); - }); -} diff --git a/v0.002/Develop/source-android/qml/configqml/ConfigTab.qml b/v0.002/Develop/source-android/qml/configqml/ConfigTab.qml deleted file mode 100644 index 6cf6bd3..0000000 --- a/v0.002/Develop/source-android/qml/configqml/ConfigTab.qml +++ /dev/null @@ -1,254 +0,0 @@ -import QtQuick 2.0 -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 -import "qrc:/qml/configqml" - -StackView{ - id: configStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem: Flickable{ - width:root.width-5*mm - height:root.height-12*mm - contentHeight: configBackground.height - boundsBehavior: Flickable.StopAtBounds - Rectangle{ - id:configBackground - color: "grey" - width:parent.width - height:Math.max(80*mm,root.height-12*mm) - focus: true - - ComboBox{ - y:mm - width: root.width/2 - model: ListModel{ - id: usermodel - } -onCurrentIndexChanged:{ - try {Service.readConfig(db,function(obj){ - servername.text=obj.server; - username.text= obj.username; - password.text=Qt.atob(obj.password); - imagestore.text=obj.imagestore; - maxNewsText.text=obj.maxnews; - if( obj.isActive==0){isActiveField.text=qsTr("yes")} else {isActiveField.text=qsTr("no")} - },"username",currentText)} - catch (e){print(e)} - } -} - - - Text { - text: "Server" - x: 4*mm; y: 10*mm - } - Text { - text: "User" - x: 4*mm; y: 20*mm - } - - Text { - text: "Password" - x: 4*mm; y: 30*mm - } - Text { - text: "Image dir." - x: 4*mm; y: 40*mm - } - - Text { - text: "Max. News" - x: 4*mm; y: 50*mm - } - Text { - text: "is Active" - x: 4*mm; y: 60*mm - } - - Rectangle{color: "white"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;} - Flickable { - id: servernameFlickable - x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm; - contentWidth: servername.paintedWidth - contentHeight: servername.paintedHeight - clip: true - TextEdit { - id: servername - width: servernameFlickable.width - height: servernameFlickable.height - focus: true - text:"https://..." - //wrapMode: TextEdit.NoWrap - //validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/} - // onEditingFinished:{} - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable) - } - } - - Rectangle{ - color: "white" - x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; - TextInput { - id: username - anchors.fill: parent - selectByMouse: true - } - } - Rectangle{ - color: "white" - x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; - TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit - } - } - - Rectangle{color: "white"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} - Flickable { - id: imagestoreFlickable - x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm; - clip: true - TextInput { - id: imagestore - width: imagestoreFlickable.width - height: imagestoreFlickable.height - wrapMode: TextEdit.NoWrap - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable) - } - } - Slider{ id: maxNews - x:37*mm; y: 50*mm;width: root.width/3;height:5*mm - minimumValue: 0;maximumValue:100000; stepSize: 1000 - } - Rectangle{color: "white"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm; - TextEdit{id:maxNewsText; - anchors.fill: parent - verticalAlignment:TextEdit.AlignRight - text:maxNews.value - focus: true - selectByMouse: true - } - } - - - Rectangle{ - x: 25*mm; y: 60*mm; width: root.width/2; height: 5*mm; - Text{ - id: isActiveField - anchors.fill: parent - } - } - - FileDialog { - id: imagestoreDialog - title: "Please choose a directory" - folder: shortcuts.pictures - selectFolder: true - onAccepted: { - var imagestoreString=imagestoreDialog.folder.toString(); imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/" - imagestore.text=imagestoreString; - console.log("You chose: " + imagestoreDialog.folder) - } - onRejected: { - console.log("Canceled") - } - } - - Button { - x: root.width/2+18*mm; y: 40*mm; width: 7*mm; height: 5*mm; - text: "..." - onClicked: - {imagestoreDialog.open()} - } - - - Button { - x: 25*mm; y: 70*mm; width: implicitWidth; height: implicitHeight; - text: "Update" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text}; - var errormessage=""; - if (servername.text==""){errormessage=qsTr("No server given! ")} - //if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} - 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(userconfig,configBackground, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - Helperjs.readField("username",root.db,"config","",function(users){ - if(users.indexOf(username.text)==-1){usermodel.append({text:username.text})}}); - isActiveField.text="yes" - //reset values - root.login=userconfig; - root.contactlist=[]; - root.news=[] - root.newContacts=[] - root.currentContact= 0 - root.contactLoadType= "" - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); - } - else {Helperjs.show("Error", errormessage,root)} -}} - - Button { - x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm; - text: "-" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)}; - Service.deleteConfig(db,userconfig); - }} - - Button { - x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; - text: "+" - onClicked:{ - servername.text="https://..." - username.text="" - password.text="" - imagestore.text="" - maxNews.value=1000 - isActiveField.text="" - } - } - - Button { - x: root.width/2+14*mm; y: mm; width: 5*mm; height: 5*mm; - text: "?" - onClicked:{ - configStack.push({item:"qrc:/qml/configqml/InfoBox.qml"}); - } - } - - Component.onCompleted: { - try{print("get users"); - Helperjs.readData(db,"config","",function(users){ - users.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - for (var i=0; iFriendiqa v0.002
Licensed under GPL 3
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ - "C++ code by Fabio
"+ - "QML and Javascript code by Marco" - onLinkActivated:{ - Qt.openUrlExternally(link)} - } - Button{ - text:qsTr("Close") - onClicked:{configStack.pop()} - anchors.top:infoBoxText.bottom - } - } diff --git a/v0.002/Develop/source-android/qml/contactqml/ContactComponent.qml b/v0.002/Develop/source-android/qml/contactqml/ContactComponent.qml deleted file mode 100644 index 8d23a19..0000000 --- a/v0.002/Develop/source-android/qml/contactqml/ContactComponent.qml +++ /dev/null @@ -1,65 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.3 -import "qrc:/js/layout.js" as Layoutjs - -Item { -id: contactComponent -property var createdAtDate: new Date(contact.created_at) -property var linkUrl: contact.network!=="dfrn"?contact.url:contact.url.replace("profile","dfrn_request") -Rectangle { - id: wrapper - width: 16*mm - height: 15*mm - border.color: "grey" - color:"white" - Image { - id: photoImage - x:1 - 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"} - } - - Label { - id: namelabel - x: 1 - width: wrapper.width-4 - height: 3*mm - text: contact.screen_name - elide:Text.ElideRight - anchors.topMargin: 0 - anchors.left: photoImage.left - color: "#303030" - font.pixelSize: 3*mm - anchors.top: photoImage.bottom - } - Button{ - id:infobutton - width: 5*mm - height: 5*mm - text:"?" - anchors.left: photoImage.right - anchors.leftMargin: 3 - anchors.topMargin: 3 - anchors.top: parent.top - onClicked:{ - contactComponent.state="large"; - var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml"); - if (component.status== Component.Ready){ - var contactDetails = component.createObject(wrapper,{"contact": contact})} - } - } - } -states: [ - State { - name: "large" - PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:friendsTabView.width-4*mm; text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"} - PropertyChanges { target: contactComponent; z: 2 } - PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-20*mm} - PropertyChanges { target: photoImage; width:15*mm;height:15*mm } - PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false} - } -] -} diff --git a/v0.002/Develop/source-android/qml/contactqml/ContactDetailsComponent.qml b/v0.002/Develop/source-android/qml/contactqml/ContactDetailsComponent.qml deleted file mode 100644 index 1296459..0000000 --- a/v0.002/Develop/source-android/qml/contactqml/ContactDetailsComponent.qml +++ /dev/null @@ -1,77 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.3 - -Rectangle{ - id: detailsrectangle - anchors.top: namelabel.bottom - anchors.topMargin: 2*mm - //opacity: 0 - - Flickable{ - id:namelabelflickable - width: root.width-10*mm - height:friendsTabView.height-55*mm - boundsBehavior:Flickable.StopAtBounds - flickableDirection:Flickable.VerticalFlick - contentWidth:width - contentHeight: namelabeltext.height - 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("Server Type")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ - "
"+qsTr("URL")+": "+linkUrl+"
"+ - qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) - onLinkActivated: { - Qt.openUrlExternally(link)} - } - } - - Row{ - anchors.top: namelabelflickable.bottom - anchors.topMargin: 2*mm - spacing:4 - - Button{ - id:photobutton - text:"Photos" - visible:contact.location=="Friendica"? 1:0 - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=2; - fotostab.active=true; - root.fotoSignal(contact) ; - } - } - - Button{ - id:messagebutton - text:"Messages" - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=0; - newstab.active=true; - root.messageSignal(contact.id) ; - } - } - - Button{ - id:dmbutton - visible: contact.following=="true"?true:false - text: "DM" - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=0; - newstab.active=true; - root.directmessageSignal(contact.screen_name); - } - } - - Button{ - id: closeButton - text: "close" - onClicked:{contactComponent.state="";detailsrectangle.destroy()} - } - } - } diff --git a/v0.002/Develop/source-android/qml/contactqml/FriendsTab.qml b/v0.002/Develop/source-android/qml/contactqml/FriendsTab.qml deleted file mode 100644 index 3ee2399..0000000 --- a/v0.002/Develop/source-android/qml/contactqml/FriendsTab.qml +++ /dev/null @@ -1,194 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/news.js" as Newsjs -import "qrc:/qml/contactqml" - -Rectangle { - y:1 - color: "white" - TabView{ - id:friendsTabView -// property var contacts: [] -// property var groups: [] - - tabPosition: Qt.TopEdge - x:mm - y:mm - width: root.width-2*mm - height: root.height-10*mm - currentIndex: 0 - - signal contactsSignal(var username) - signal groupsSignal(var username) - onCurrentIndexChanged:{ - if (currentIndex==0){root.friendsSignal(root.login.username)} - else if (currentIndex==1){contactsSignal(root.login.username)} - else if (currentIndex==2){groupsSignal(root.login.username)} - } - style: TabViewStyle { - frameOverlap: 1 - tab: Rectangle { - color: "white" - //border.color: "light grey" - implicitWidth: root.width/3-2*mm - implicitHeight: 4*mm - Text { id: text - anchors.centerIn: parent - text: styleData.title - color: "dark grey" - font.pixelSize:2.5*mm - font.bold: styleData.selected - } - } - frame: Rectangle { color: "light grey" } - tabsAlignment:Qt.AlignHCenter - } - - Tab{ - title: qsTr("Friends") - Rectangle{ - id: friendsGridTab - function showFriends(username){ - try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db,"contacts",username,function(friendsobject){ - for (var i=0;i0){// download first contact image and update db -// print("newcontact"+JSON.stringify(newContacts)); - updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} - } - onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db - //print("Current contact"+JSON.stringify(newContacts[currentContact])+newContacts.length); - if(currentContact" + text + ""; - bodyField.remove(start,end); - bodyField.insert(start,text); - urlRectangle.visible=false - } - } - } - } - - - Row{ - spacing:2 - Button{ - visible: (directmessage==1)?false:true - text:qsTr("Permissions") - onClicked: { - var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml"); - var permissions = component.createObject(messageColumn); - }} - Button { - id: attachButton - text: qsTr("Attach") - onClicked: { - try{imageAttachment.visible=false; - imageAttachment.opacity=0;imageAttachment.destroy()}catch(e){} - imageAttachmentDialog.open()} - } - Button{ - id:contactButton - text:qsTr("cc") - visible:(directmessage==0) - onClicked:{ - var contactitems=""; - for (var i=0;i 1) { - stackView.pop(); event.accepted = true; - }} - FileDialog { - id: imageAttachmentDialog - title: "Please choose a picture" - folder: shortcuts.pictures - selectFolder: false - onAccepted: { - attachImageURL=imageAttachmentDialog.fileUrl; - var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment;source:"'+attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit}',messageColumn,"attachedImage"); - //console.log("You chose: " + attachImageURL) - - } - onRejected: { - //console.log("Canceled") - } - } -} diff --git a/v0.002/Develop/source-android/qml/newsqml/NewsTab.qml b/v0.002/Develop/source-android/qml/newsqml/NewsTab.qml deleted file mode 100644 index c5928f2..0000000 --- a/v0.002/Develop/source-android/qml/newsqml/NewsTab.qml +++ /dev/null @@ -1,192 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import QtQuick.LocalStorage 2.0 as Sql -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/helper.js" as Helperjs - -Item { - property string newstabStatus:"news" - - function showNews(newsToShow){ - newsBusy.running=false; - var currentTime= new Date(); - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow}; - newsWorker.sendMessage(msg); - } - - function onFriendsMessages(friend){print(" Friend "+friend); - newstabStatus="friendmessage"; - Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend) - } - - function onDirectMessage(friend){ - print(root.login.server); - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}}); - } - - function cleanNews(database){ - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config"); - var maxnews=maxnewsrs.rows.item(0); - var newscountrs = tx.executeSql('SELECT COUNT(*) from news'); - var newscount = newscountrs.rows.item(0); - if (newscount>maxnews){var lastvalidtimers= tx.executeSql('select created_at from news ORDER BY created_at DESC LIMIT ' +(newscount-maxnews)); - var lastvalidtime=lastvalidtimers.rows.item(-1); - var deleters = tx.executeSql('DELETE from news WHERE created_at<'+lastvalidtime)} - }); - Qt.quit() - } - - StackView{ - id: newsStack - anchors.fill:parent - focus: true - Keys.onReleased: {if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - else if(event.key === Qt.Key_Back &&newstabStatus=="conversation"){ - newstabStatus="news" - newsModel.clear(); - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })} -} - initialItem:Rectangle { - y:1 - color: "white" - width:root.width-2*mm - height:root.height-8*mm - - ComboBox{ - y:mm - width: 8*mm - model: ListModel{ - id: cbModel - ListElement{text: qsTr("News")} - ListElement{text: qsTr("Favorites")} - } - onCurrentIndexChanged:{ - if (currentIndex==0){newsModel.clear(); - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })} - else if (currentIndex==1){ - newsBusy.running=true; - Newsjs.requestFavorites(root.login,db,root,function(news){ - Newsjs.storeNews(root.login,root.db,news,root,function(){ - Newsjs.favoritesfromdb(db,root.login.username,function(newsarray){ - showNews(newsarray) - - }); - } - )}) - } - }} - - Button { - id: newMessageButton - text: qsTr("+") - anchors.top: parent.top - anchors.right: parent.right - onClicked: { - var groups=[]; - Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){ - groups=groupobject}); - Helperjs.readData(root.db,"contacts",root.login.username,function(friends){ - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}}) - },"isFriend",1); - } - } - Button { - id: quitButton - text: qsTr("Quit") - anchors.top: parent.top - anchors.right: newMessageButton.left - onClicked: {cleanNews(root.db)} - } - - Component { id:footerComponent - Rectangle{ - border.color: "#EEEEEE" - border.width: 1 - width:parent.width - height:6*mm - Text{ - font.pixelSize: 1.5*mm - anchors.centerIn: parent - text:qsTr("More") - } - MouseArea{anchors.fill:parent - onClicked:{ - var currentTime= new Date(); - if(newstabStatus=="news"){ - var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },false,lastnews_id)} - else if(newstabStatus=="friendmessage"){ - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)} - }} - } - } - ListView { - id: newsView - anchors.fill: parent - anchors.topMargin: 8*root.mm - anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm - anchors.bottomMargin: 1*root.mm - clip: true - spacing: 0 - footer: footerComponent - model: newsModel - delegate: Newsitem{} - } - - ListModel{id: newsModel} - - WorkerScript { - id: newsWorker - source: "qrc:/js/newsworker.js" - } - - Button { - id: update - anchors.top: parent.top - anchors.right: quitButton.left - text: "Update" - onClicked: { //try{newsModel.clear()} catch(e){} - newsBusy.running=true; - root.contactLoadType="news"; - Newsjs.getFriendsTimeline(login,db,contactlist,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc;root.currentContact=0; - if (ns.length==0){ - Newsjs.getDirectMessage(root.login,root.db,root,function(dbnews){showNews(dbnews)}); - newsBusy.running=false} - })} - } - BusyIndicator{ - id: newsBusy - anchors.horizontalCenter: newsView.horizontalCenter - anchors.top:parent.top - anchors.topMargin: 2*mm - width:7*mm - height: 7*mm - } - Component.onCompleted: { - root.messageSignal.connect(onFriendsMessages); - root.directmessageSignal.connect(onDirectMessage); - root.newsSignal.connect(showNews); - try{newsModel.clear()} catch(e){} - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - }) - } - } -} -} diff --git a/v0.002/Develop/source-android/qml/newsqml/Newsitem.qml b/v0.002/Develop/source-android/qml/newsqml/Newsitem.qml deleted file mode 100644 index 3445ace..0000000 --- a/v0.002/Develop/source-android/qml/newsqml/Newsitem.qml +++ /dev/null @@ -1,336 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/news.js" as Newsjs - - -Item { - id: newsitem - width: newsView.width - height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm) - - property string conversation_id: "" - property string attending: "" - onAttendingChanged: {attendLabel.visible=true; - attendLabel.text= qsTr("attending: ")+ qsTr(attending)} - signal replyto(string parent_id) - - Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} - - Rectangle{ - width:newsitem.width - height:newsitem.height-1 - color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white" - - Column { - id: authorcolumn - width: 8*mm - - Image { - id:profileImage - source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url - x:1 - width: 7*mm - height: 7*mm - MouseArea{ - anchors.fill: parent - onPressAndHold: { newsmenu.popup()} - } - onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} - } - Label { - id:user_name - color: "grey" - //height:3.5*mm - width:parent.width - font.pixelSize: 1.5*mm - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name) - } - } - Column { - id:newscolumn - width: newsitem.width-8*mm - anchors.left: authorcolumn.right - - Flow{ - id:topFlow - spacing: 2*mm - width:parent.width - Label { - color: "grey" - text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source - } else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"} - font.pixelSize: 1.5*mm - } - Label { - id:createdAtLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: dateDiff - } - CheckBox { - id:favoritedCheckbox - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 6*mm - implicitHeight:2*mm - color:"white" - } - indicator: - Rectangle{x:3*mm - width: 3*mm - implicitHeight:2*mm - Text{ - anchors.centerIn: parent - color:control.checked?"black":"grey" - text:"\u2605" - }} - } - checked:(newsitemobject.favorited>0) - onClicked:{ - if(favoritedCheckbox.checkedState==Qt.Checked) - {Newsjs.favorite(login,true,newsitemobject.status_id,root)} - else - if(favoritedCheckbox.checkedState==Qt.Unchecked) - {Newsjs.favorite(login,false,newsitemobject.status_id,root)} - } - } - Rectangle{ - width: 4*mm - height: 3*mm - Text{ - id:newsmenusymbol - color: "grey" - anchors.centerIn: parent - font.pixelSize: 2*mm - font.bold: true - text: "\u22EE" - } - MouseArea{ - anchors.fill:parent - onClicked: {newsmenu.popup()}} - - } - - Rectangle{ - width: 4*mm - height: 3*mm - visible:(newsitemobject.in_reply_to_status_id!="")?true:false - Text{ - id:conversationsymbol - color: "grey" - anchors.centerIn: parent - font.pixelSize: 2*mm - text: "\u21C4" - } - MouseArea{ - anchors.fill:parent - onClicked: { - newsBusy.running=true; - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(news,newContacts){ - for (var i=0;i0)){ - photoPlaceholder.destroy(); - currentImageNo=currentImageNo+1 - } - else if ((downloadtype=="contact")&&(root.newContacts.length>0)) - { - photoPlaceholder.destroy(100); - root.currentContact=root.currentContact+1 - } - }}); -}}} - diff --git a/v0.002/Develop/source-android/qml/photoqml/PhotoTab.qml b/v0.002/Develop/source-android/qml/photoqml/PhotoTab.qml deleted file mode 100644 index b01ca73..0000000 --- a/v0.002/Develop/source-android/qml/photoqml/PhotoTab.qml +++ /dev/null @@ -1,147 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 -import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/qml/photoqml" - -Rectangle { - id:fotorectangle - y:1 - width:root.width-mm - height:root.height-5*mm - color: '#fff' - property var newImages:[] - property int currentImageNo: 0 -//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false}; -// photoWorker.sendMessage(msg); -//} - onNewImagesChanged:{ - Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ - //print("albums"+JSON.stringify(albums)+JSON.stringify(newImages[currentImageNo])); - if(albums.indexOf(newImages[currentImageNo].album)==-1){ - filesystem.Directory=root.login.imagestore+"/albums"; - filesystem.makeDir(newImages[currentImageNo].album);} - }); - if(newImages.length>0){ - print("Current image number"+currentImageNo) - Service.dataRequest(root.login,newImages[currentImageNo].id,root.db,fotorectangle); - newImagesProgress.visible=true //download first image - }} - - onCurrentImageNoChanged:{ - if(currentImageNo - - qml/friendiqa.qml - qml/newsqml/NewsTab.qml - qml/newsqml/Newsitem.qml - qml/newsqml/MessageSend.qml - qml/newsqml/PermissionDialog.qml - qml/contactqml/FriendsTab.qml - qml/contactqml/GroupComponent.qml - qml/contactqml/ContactComponent.qml - qml/contactqml/ContactDetailsComponent.qml - qml/photoqml/PhotoComponent.qml - qml/photoqml/PhotogroupComponent.qml - qml/photoqml/PhotoPlaceholder.qml - qml/photoqml/PhotoTab.qml - qml/configqml/InfoBox.qml - qml/configqml/ConfigTab.qml - js/layout.js - js/photoworker.js - js/service.js - js/news.js - js/newsworker.js - js/helper.js - images/defaultcontact.jpg - - - - diff --git a/v0.002/Develop/source-linux/common/filesystem.cpp b/v0.002/Develop/source-linux/common/filesystem.cpp deleted file mode 100644 index b828c8d..0000000 --- a/v0.002/Develop/source-linux/common/filesystem.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "filesystem.h" - -FILESYSTEM *FILESYSTEM::instance() -{ - static FILESYSTEM filesystem; - return &filesystem; -} - -FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){} - -void FILESYSTEM::setDirectory(QString Directory) -{ - if (Directory!=m_Directory) { - m_Directory = Directory; - emit directoryChanged(); - } -} - -QString FILESYSTEM::Directory() const -{ - return m_Directory; -} - -void FILESYSTEM::makeDir(QString name) -{ - QDir dir(m_Directory); - if (dir.mkdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmDir(QString name) -{ - QDir dir(m_Directory); - if (dir.rmdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmFile(QString name) -{ - QDir dir(m_Directory); - if(dir.remove(name)){ - emit success(name); - } - else {emit error(name,1);} -} diff --git a/v0.002/Develop/source-linux/common/filesystem.h b/v0.002/Develop/source-linux/common/filesystem.h deleted file mode 100644 index f0aebb3..0000000 --- a/v0.002/Develop/source-linux/common/filesystem.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef FILESYSTEM_H -#define FILESYSTEM_H - -#include -#include - -class FILESYSTEM : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString Directory READ Directory WRITE setDirectory NOTIFY directoryChanged) - -public: - static FILESYSTEM *instance(); - explicit FILESYSTEM(QObject *parent = 0); - void setDirectory(QString Directory); - QString Directory() const; - -signals: - void directoryChanged(); - void success(QString data); - void error(QString data, int code); - -public slots: - //void setDirectory(QString Directory); - void makeDir(QString name); - void rmDir(QString name); - void rmFile(QString name); - -private slots: - //void onReplyError(QNetworkReply::NetworkError code); - // void onReplySuccess(); - //void onReadyRead(); - // void onSSLError(const QList &errors); - -private: - //QByteArray buffer; - QString m_Directory; - //QString m_login; - //QHash params; - //QHash files; - - //QNetworkAccessManager manager; - //QNetworkRequest request; - //QNetworkReply *reply; - - //QString bufferToString(); -}; - -#endif // FILSYSTEM_H diff --git a/v0.002/Develop/source-linux/common/uploadableimage.cpp b/v0.002/Develop/source-linux/common/uploadableimage.cpp deleted file mode 100644 index 81bea1a..0000000 --- a/v0.002/Develop/source-linux/common/uploadableimage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "uploadableimage.h" - - -#include -#include -#include -#include - -void UploadableImage::setSource(const QString &a) { - if (a != m_source) { - m_source = a; - //m_base64 = ""; - m_mimetype = ""; - m_filename = ""; - - qDebug() << "UploadableImage::setSource : " << m_source; - - if (m_source=="") { - emit sourceChanged(); - //emit base64Changed(); - emit mimetypeChanged(); - emit filenameChanged(); - return; - } - - QImage fullimage = QImage(QUrl(m_source).toLocalFile()); - if (fullimage.width() > 800 || fullimage.height() > 800) { - if (fullimage.width() > fullimage.height()) { - m_image = fullimage.scaledToWidth(800); - } else { - m_image = fullimage.scaledToHeight(800); - } - } else { - m_image = fullimage; - } - qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height(); - emit sourceChanged(); - - QFileInfo fi(m_source); - - m_filename = fi.fileName(); - emit filenameChanged(); - - QString filetype = fi.suffix().toUpper(); - if (filetype!="PNG" && filetype!="JPG") { - filetype = "JPG"; - } - qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype; - - m_mimetype = "image/"+filetype.toLower(); - emit mimetypeChanged(); - - /* - QByteArray byteArray; - QBuffer buffer(&byteArray); - m_image.save(&buffer, filetype.toLatin1().constData()); - QString b64 = QString::fromLatin1(byteArray.toBase64().data()); - - for(int k=0; k -#include -#include - -class UploadableImage : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) - //Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed) - Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged) - Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged) - Q_PROPERTY(QByteArray bytes READ bytes) - -public: - void setSource(const QString &a); - QString source() const; - - //QString base64() const; - QString filename() const; - QString mimetype() const; - - QByteArray bytes(); -signals: - void sourceChanged(); - //void base64Changed(); - void filenameChanged(); - void mimetypeChanged(); - -private: - QString m_source; - QImage m_image; - //QString m_base64; - QString m_filename; - QString m_mimetype; -}; - -#endif // UPLOADABLEIMAGE_H diff --git a/v0.002/Develop/source-linux/common/xhr.cpp b/v0.002/Develop/source-linux/common/xhr.cpp deleted file mode 100644 index cf9aeb6..0000000 --- a/v0.002/Develop/source-linux/common/xhr.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "xhr.h" - -#include -#include -#include - -#include "uploadableimage.h" - -XHR *XHR::instance() -{ - static XHR xhr; - return &xhr; -} - -XHR::XHR(QObject *parent) : QObject(parent) -{ - request.setSslConfiguration(QSslConfiguration::defaultConfiguration()); -} - -void XHR::setUrl(QString url) -{ - if (url!=m_url) { - m_url = url; - emit urlChanged(); - } -} - -void XHR::setLogin(QString login) -{ - if (login!=m_login) { - m_login = login; - emit loginChanged(); - } -} - -void XHR::setFilename(QString filename) -{ - if (filename!=m_filename) { - m_filename = filename; - emit filenameChanged(); - } -} - -QString XHR::url() const -{ - return m_url; -} - -QString XHR::login() const -{ - return m_login; -} - -QString XHR::filename() const -{ - return m_filename; -} - -void XHR::setParam(QString name, QString value) -{ - params.insert(name, value); -} - -void XHR::setImageFileParam(QString name, QString url) -{ - files.insert(name, url); -} - -void XHR::clearParams() -{ - files.clear(); - params.clear(); -} - -void XHR::download() -{ - QUrl requrl(m_url); -// qDebug() << "start download of " << requrl; - request.setUrl(requrl); - reply = manager.get(request); -// qDebug() << "reply " << reply->header(QNetworkRequest::LocationHeader)<header(QNetworkRequest::LastModifiedHeader); - // qDebug() << "request " << request.url(); -// reply->ignoreSslErrors(); - connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead); - connect(reply,SIGNAL(downloadProgress(qint64,qint64)), this,SLOT(updateDownloadProgress(qint64,qint64))); - connect(reply, &QNetworkReply::finished,this, &XHR::onRequestFinished); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); -} - -void XHR::get() -{ - QUrlQuery query; - - QHashIterator i(params); - while(i.hasNext()) { - i.next(); - query.addQueryItem(i.key(), i.value()); - } - - QUrl requrl(m_url); - requrl.setQuery(query); - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader("Authorization", headerData.toLocal8Bit()); - - - request.setUrl(requrl); - reply = manager.get(request); - - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); -} - -void XHR::post() -{ - qDebug() << "start post to " << m_url; - QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType); - - QHashIterator iparams(params); - while(iparams.hasNext()) { - iparams.next(); - qDebug() << "\t add param " << iparams.key() << " : " << iparams.value(); - QHttpPart textPart; - textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + iparams.key() + "\"")); - - - textPart.setBody(iparams.value().toUtf8()); - multiPart->append(textPart); - } - - UploadableImage uimg; - QHashIterator ifiles(files); - while(ifiles.hasNext()) { - ifiles.next(); - - uimg.setSource(ifiles.value()); - qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key(); - - QHttpPart imagePart; - imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype())); - imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\"")); - imagePart.setBody(uimg.bytes()); - multiPart->append(imagePart); - } - - QByteArray loginData = m_login.toLocal8Bit().toBase64(); - QString headerData = "Basic " + loginData; - request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - - request.setUrl(m_url); - reply = manager.post(request, multiPart); - qDebug() << "\t request sent"; - connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); - connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyError(QNetworkReply::NetworkError))); - connect(reply, &QNetworkReply::readyRead, this, &XHR::onReadyRead); - connect(reply, &QNetworkReply::sslErrors, this, &XHR::onSSLError); - qDebug() << "\t reply signals connected"; -} - -void XHR::onReplyError(QNetworkReply::NetworkError code) -{ - qDebug() << code; - emit this->error( bufferToString(), (int) code); - reply->deleteLater(); -} - -void XHR::onReplySuccess() -{ - qDebug() << "!"; - emit this->success( bufferToString() ); - reply->deleteLater(); -} - -void XHR::onRequestFinished() -{ - // Save the file here - //qDebug() << "buffer downloaded "<error("image empty",1); reply->deleteLater();} - else {QFile file(m_filename); - file.open(QIODevice::WriteOnly); - //image.save(&file, "JPG"); - file.write(buffer); - buffer.clear(); - file.close(); - //qDebug() << m_url << "File downloaded "<downloaded(); - //reply->deleteLater(); - } -} - -void XHR::onReadyRead() -{ - qDebug() << "."; - buffer += reply->readAll(); -} - -void XHR::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes) -{ - qDebug() << "Bytes: " << bytesRead<<" / "< &errors) -{ - qDebug() << "XHR::onSSLError :" ; - QListIterator ierrs(errors); - while(ierrs.hasNext()) { - qDebug() << "\t" << ierrs.next().errorString(); - } -} - -QString XHR::bufferToString() -{ - return QTextCodec::codecForName("utf-8")->toUnicode(buffer); -} - - diff --git a/v0.002/Develop/source-linux/common/xhr.h b/v0.002/Develop/source-linux/common/xhr.h deleted file mode 100644 index 547e7d6..0000000 --- a/v0.002/Develop/source-linux/common/xhr.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef XHR_H -#define XHR_H - -#include -#include -#include -#include - -class XHR : public QObject -{ - Q_OBJECT - 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) -public: - static XHR *instance(); - - explicit XHR(QObject *parent = 0); - - QString url() const; - QString login() const; - QString filename() const; - -signals: - void urlChanged(); - void loginChanged(); - void filenameChanged(); - void downloaded(); - void success(QString data); - void error(QString data, int code); - -public slots: - void setUrl(QString url); - void setLogin(QString login); - void setFilename(QString filename); - void setParam(QString name, QString value); - void setImageFileParam(QString name, QString url); - void clearParams(); - void post(); - void get(); - void download(); - -private slots: - void onReplyError(QNetworkReply::NetworkError code); - void onReplySuccess(); - void onRequestFinished(); - void onReadyRead(); - void onSSLError(const QList &errors); - void updateDownloadProgress(qint64 bytesRead, qint64 totalBytes); - -private: - QByteArray buffer; - QString m_url; - QString m_login; - QString m_filename; - QHash params; - QHash files; - - QNetworkAccessManager manager; - QNetworkRequest request; - QNetworkReply *reply; - - QString bufferToString(); -}; - -#endif // XHR_H diff --git a/v0.002/Develop/source-linux/images/defaultcontact.jpg b/v0.002/Develop/source-linux/images/defaultcontact.jpg deleted file mode 100644 index bb7bce2..0000000 Binary files a/v0.002/Develop/source-linux/images/defaultcontact.jpg and /dev/null differ diff --git a/v0.002/Develop/source-linux/js/friendworker.js b/v0.002/Develop/source-linux/js/friendworker.js deleted file mode 100644 index 6b6c5be..0000000 --- a/v0.002/Develop/source-linux/js/friendworker.js +++ /dev/null @@ -1,12 +0,0 @@ -WorkerScript.onMessage = function(msg) { - msg.model.clear(); - for (var j=0;j 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return i; - } - } - } return -1; -} -function cleanArray(array) { -var arraystring=JSON.stringify(array); - arraystring=arraystring.replace(/[\[\]]/g , ''); -return arraystring; -} diff --git a/v0.002/Develop/source-linux/js/news.js b/v0.002/Develop/source-linux/js/news.js deleted file mode 100644 index 2d2126b..0000000 --- a/v0.002/Develop/source-linux/js/news.js +++ /dev/null @@ -1,356 +0,0 @@ -.pragma library -.import QtQuick.LocalStorage 2.0 as Sql -.import "qrc:/js/helper.js" as Helperjs - -function requestFriends(login,database,rootwindow,callback){ -// return array of friends - Helperjs.friendicaRequest(login,"/api/statuses/friends", rootwindow,function (obj){ - var friends=JSON.parse(obj); - for (var i=0;i0){ - // print("Like Contact"+JSON.stringify(news[i].friendica_activities.like)); - for (var j=0;j0){ - //print("DisLike Contact"+JSON.stringify(news[i].friendica_activities.dislike)); - for (var k=0;j 0 ) { - for (var i in list) { if (list[i][prop] === val) { - return true; - } - } - } 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/v0.002/Develop/source-linux/js/newsworker.js b/v0.002/Develop/source-linux/js/newsworker.js deleted file mode 100644 index f08ba80..0000000 --- a/v0.002/Develop/source-linux/js/newsworker.js +++ /dev/null @@ -1,63 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if(msg.appendnews!==true){ msg.model.clear()}; - - for (var j=0;j0){ - if (newsitemobject.like.length==1){likeText= Qt.atob(newsitemobject.like[0].name)+" "+ qsTr("likes this.")} - else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")} - } - if (newsitemobject.dislike.length>0){ - if (newsitemobject.dislike.length==1){dislikeText= QT.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")} - else {dislikeText= newsitemobject.dislike.length+" "+ qsTr("don't like this.")} - } - if (newsitemobject.attendyes.length>0){ - if (newsitemobject.attendyes.length==1){attendyesText= Qt.atob(newsitemobject.attendyes[0].name)+" "+ qsTr("will attend.")} - else {attendyesText= newsitemobject.attendyes.length+" "+ qsTr("persons will attend.")} - } - if (newsitemobject.attendno.length>0){ - if (newsitemobject.attendno.length==1){attendnoText= Qt.atob(newsitemobject.attendno[0].name)+" "+ qsTr("will not attend.")} - else {attendnoText= newsitemobject.attendno.length+" "+ qsTr("persons will not attend.")} - } - if (newsitemobject.attendmaybe.length>0){ - if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")} - else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} - } - var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); - if (friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} - if (friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} - if (friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} - if (friendica_activities_self.indexOf(1)!=-1){self.liked=1} - if (friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - } - var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} - //print(JSON.stringify(friendica_activities) ) ; - var seconds=(msg.currentTime-newsitemobject.created_at)/1000; - var timestring=""; - if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");} - else if (seconds<90){timestring=Math.round(seconds/60)+" "+qsTr("minute") +" "+qsTr("ago");} - else if (seconds<3600){timestring=Math.round(seconds/60)+" "+qsTr("minutes") +" "+qsTr("ago");} - else if (seconds<5400){timestring=Math.round(seconds/3600)+" "+qsTr("hour") +" "+qsTr("ago");} - else if (seconds<86400){timestring=Math.round(seconds/3600)+" "+qsTr("hours") +" "+qsTr("ago");} - else if (seconds<129600){timestring=Math.round(seconds/86400)+" "+qsTr("day") +" "+qsTr("ago");} - else if (seconds<3888000){timestring=Math.round(seconds/86400)+" "+qsTr("days") +" "+qsTr("ago");} - else if (seconds<5832000){timestring=Math.round(seconds/3888000)+" "+qsTr("month") +" "+qsTr("ago");} - else if (seconds<69984000){timestring=Math.round(seconds/3888000)+" "+qsTr("months") +" "+qsTr("ago");} - else {timestring=Math.round(seconds/69984000)+" "+qsTr("years") +" "+qsTr("ago");} - var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities})} - //print("News:"+j+msg.news.length+JSON.stringify(data)); - msg.model.append(data);} - if (j==msg.news.length){ - msg.model.sync() - }; -} diff --git a/v0.002/Develop/source-linux/js/photoworker.js b/v0.002/Develop/source-linux/js/photoworker.js deleted file mode 100644 index 36646c7..0000000 --- a/v0.002/Develop/source-linux/js/photoworker.js +++ /dev/null @@ -1,15 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if (msg.firstalbum==0){msg.model.clear();} - var limit=0; if (msg.albums.length-msg.firstalbum<20){limit=msg.albums.length} else{limit=msg.firstalbum+20} - for (var j=msg.firstalbum;j0){ - 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); - print('storeData() for ' + JSON.stringify(obj)); - // try{sprite.destroy();}catch(e){} -// if (obj["link"]["0"]){var source=obj["link"]["0"]} else {var source=obj["link"]["4"]}//source for profile picture or original size -// print("Source"+source); - obj["source"]=source; - var filename=obj.filename; - if (filename==""){// check if file has any filename - if (obj.type=="image/jpeg") {obj["filename"]=obj["id"]+".jpg"} - else if (obj.type=="image/png") {obj["filename"]=obj["id"]+".png"} - } - // check if text name has valid image format ending, otherwise append appropriate ending - if(["jpg","png"].indexOf(obj["filename"].substring(obj["filename"].lastIndexOf(".")+1,obj["filename"].length))==-1){ - print("falscheEndung: "+obj["filename"].substring(obj["filename"].lastIndexOf(".")+1,obj["filename"].length)); - { if (obj.type=="image/jpeg") {obj["filename"]=obj["filename"]+".jpg"} - else if (obj.type=="image/png") {obj["filename"]=obj["filename"]+".png"} - } - print("obj.Filename: "+obj["filename"]+" filename: "+filename) - } - saveImage(obj,login.imagestore+'albums/'+obj.album,function(obj,sprite){ - //sprite.destroy(500); - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - print('... check if a object exists: '+obj["id"]) - var result = tx.executeSql('SELECT * from imageData where id = "'+obj["id"]+'"'); - if(result.rows.length === 1) {// use update - print(obj["id"] +' exists, update it') - 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+"/"]); - print("Inserted");} - })})}} - catch (e){print("Data retrieval failure! "+ e+obj);} -})} - -function saveImage(obj,storagedirectory,callback) { - // create image component from base64 code and save it - print("Storing "+storagedirectory+"/"+obj.filename+obj.width+"x"+obj.height); - var maxSize=Math.max(fotostab.width,fotostab.height); - var helpwidth=(obj.widthobj.height){ //landscape - helpheight=helpwidth*obj.height/obj.width - } else { //portrait - helpwidth=helpheight*obj.width/obj.height - } - var component=Qt.createComponent("qrc:/qml/photoqml/PhotoPlaceholder.qml"); - var sprite = component.createObject(fotostab, {"x":0,"y":0,"imageName":storagedirectory+"/"+obj.filename ,"width":helpwidth,"height":helpheight,"source": obj["link"]["4"],"downloadtype":"picture"}); - callback(obj,sprite) -} - -function deleteImageData(database,user,field,selection,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) { - result = tx.executeSql('UPDATE imageData SET data="" where '+ field +'="'+selection+'"'); - callback(result)}) -} - -function requestFriendsAlbumPictures(friend,rootwindow,callback){ -// screenscraping of albums page of contact without user and password - Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(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); - } -//print("Album"+JSON.stringify(photoarray)); -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;i0){ - for(var i = 0; i < rs.rows.length; i++) { - rsArray.push(rs.rows.item(i)) - } - var rsObject={server:rsArray[0].server,username:rsArray[0].username, password:rsArray[0].password,imagestore:rsArray[0].imagestore,maxnews:rsArray[0].maxnews,isActive:rsArray[0].isActive}; - } else { - var rsObject="" - } - callback(rsObject);}} - ); -} - -function readActiveConfig(database){ - var obj; - readConfig(database,function(config){ -obj=config},"isActive", 0); - return obj; -} - -function deleteConfig(database,userobj,callback) { // delete user data from DB - print('deleteConfig()') -if (userobj){var where = " WHERE username='"+ userobj.username+"' and server='"+userobj.server+"'";} else { return "no user selected!";} - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - if(!db) { return; } - db.transaction( function(tx) { - print('... read from database '+where) - var rs = tx.executeSql('delete * from config'+where); - print(rs.toString); - callback(rs); - }); -} diff --git a/v0.002/Develop/source-linux/qml/BlueButton.qml b/v0.002/Develop/source-linux/qml/BlueButton.qml deleted file mode 100644 index e69de29..0000000 diff --git a/v0.002/Develop/source-linux/qml/configqml/ConfigTab.qml b/v0.002/Develop/source-linux/qml/configqml/ConfigTab.qml deleted file mode 100644 index 6cf6bd3..0000000 --- a/v0.002/Develop/source-linux/qml/configqml/ConfigTab.qml +++ /dev/null @@ -1,254 +0,0 @@ -import QtQuick 2.0 -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 -import "qrc:/qml/configqml" - -StackView{ - id: configStack - anchors.fill:parent - focus: true - Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - initialItem: Flickable{ - width:root.width-5*mm - height:root.height-12*mm - contentHeight: configBackground.height - boundsBehavior: Flickable.StopAtBounds - Rectangle{ - id:configBackground - color: "grey" - width:parent.width - height:Math.max(80*mm,root.height-12*mm) - focus: true - - ComboBox{ - y:mm - width: root.width/2 - model: ListModel{ - id: usermodel - } -onCurrentIndexChanged:{ - try {Service.readConfig(db,function(obj){ - servername.text=obj.server; - username.text= obj.username; - password.text=Qt.atob(obj.password); - imagestore.text=obj.imagestore; - maxNewsText.text=obj.maxnews; - if( obj.isActive==0){isActiveField.text=qsTr("yes")} else {isActiveField.text=qsTr("no")} - },"username",currentText)} - catch (e){print(e)} - } -} - - - Text { - text: "Server" - x: 4*mm; y: 10*mm - } - Text { - text: "User" - x: 4*mm; y: 20*mm - } - - Text { - text: "Password" - x: 4*mm; y: 30*mm - } - Text { - text: "Image dir." - x: 4*mm; y: 40*mm - } - - Text { - text: "Max. News" - x: 4*mm; y: 50*mm - } - Text { - text: "is Active" - x: 4*mm; y: 60*mm - } - - Rectangle{color: "white"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;} - Flickable { - id: servernameFlickable - x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm; - contentWidth: servername.paintedWidth - contentHeight: servername.paintedHeight - clip: true - TextEdit { - id: servername - width: servernameFlickable.width - height: servernameFlickable.height - focus: true - text:"https://..." - //wrapMode: TextEdit.NoWrap - //validator: RegExpValidator { regExp: /^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$/} - // onEditingFinished:{} - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,servernameFlickable) - } - } - - Rectangle{ - color: "white" - x: 25*mm; y: 20*mm; width: root.width/2; height: 5*mm; - TextInput { - id: username - anchors.fill: parent - selectByMouse: true - } - } - Rectangle{ - color: "white" - x: 25*mm; y: 30*mm; width: root.width/2; height: 5*mm; - TextInput { - id: password - anchors.fill: parent - selectByMouse: true - echoMode: TextInput.PasswordEchoOnEdit - } - } - - Rectangle{color: "white"; x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm;} - Flickable { - id: imagestoreFlickable - x: 25*mm; y: 40*mm; width: root.width/2-9*mm; height: 5*mm; - clip: true - TextInput { - id: imagestore - width: imagestoreFlickable.width - height: imagestoreFlickable.height - wrapMode: TextEdit.NoWrap - onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable) - } - } - Slider{ id: maxNews - x:37*mm; y: 50*mm;width: root.width/3;height:5*mm - minimumValue: 0;maximumValue:100000; stepSize: 1000 - } - Rectangle{color: "white"; x: 25*mm; y: 50*mm; width: 9*mm; height: 5*mm; - TextEdit{id:maxNewsText; - anchors.fill: parent - verticalAlignment:TextEdit.AlignRight - text:maxNews.value - focus: true - selectByMouse: true - } - } - - - Rectangle{ - x: 25*mm; y: 60*mm; width: root.width/2; height: 5*mm; - Text{ - id: isActiveField - anchors.fill: parent - } - } - - FileDialog { - id: imagestoreDialog - title: "Please choose a directory" - folder: shortcuts.pictures - selectFolder: true - onAccepted: { - var imagestoreString=imagestoreDialog.folder.toString(); imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/" - imagestore.text=imagestoreString; - console.log("You chose: " + imagestoreDialog.folder) - } - onRejected: { - console.log("Canceled") - } - } - - Button { - x: root.width/2+18*mm; y: 40*mm; width: 7*mm; height: 5*mm; - text: "..." - onClicked: - {imagestoreDialog.open()} - } - - - Button { - x: 25*mm; y: 70*mm; width: implicitWidth; height: implicitHeight; - text: "Update" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password:Qt.btoa(password.text), imagestore:imagestore.text,maxnews:maxNewsText.text}; - var errormessage=""; - if (servername.text==""){errormessage=qsTr("No server given! ")} - //if (!servername.acceptableInput){errormessage+=qsTr("Server name not valid! ")} - else if (username.text==""){errormessage+=qsTr("No username given! ")} - 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(userconfig,configBackground, function(obj){ - var serverString=obj; - var serverconfigObject=Qt.createQmlObject(serverString,configBackground,"serverconfigOutput"); - Helperjs.readField("username",root.db,"config","",function(users){ - if(users.indexOf(username.text)==-1){usermodel.append({text:username.text})}}); - isActiveField.text="yes" - //reset values - root.login=userconfig; - root.contactlist=[]; - root.news=[] - root.newContacts=[] - root.currentContact= 0 - root.contactLoadType= "" - root.currentIndex=0; - newstab.active=true; - })},"isActive",0); - } - else {Helperjs.show("Error", errormessage,root)} -}} - - Button { - x: root.width/2+2*mm; y: mm; width: 5*mm; height: 5*mm; - text: "-" - onClicked:{ - var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)}; - Service.deleteConfig(db,userconfig); - }} - - Button { - x: root.width/2+8*mm; y: mm; width: 5*mm; height: 5*mm; - text: "+" - onClicked:{ - servername.text="https://..." - username.text="" - password.text="" - imagestore.text="" - maxNews.value=1000 - isActiveField.text="" - } - } - - Button { - x: root.width/2+14*mm; y: mm; width: 5*mm; height: 5*mm; - text: "?" - onClicked:{ - configStack.push({item:"qrc:/qml/configqml/InfoBox.qml"}); - } - } - - Component.onCompleted: { - try{print("get users"); - Helperjs.readData(db,"config","",function(users){ - users.sort(function(obj1, obj2) { - return obj1.isActive - obj2.isActive; - }); - for (var i=0; iFriendiqa v0.002
Licensed under GPL 3
"+ - "Sourcecode: https://github.com/LubuWest/Friendica
"+ - "C++ code by Fabio
"+ - "QML and Javascript code by Marco" - onLinkActivated:{ - Qt.openUrlExternally(link)} - } - Button{ - text:qsTr("Close") - onClicked:{configStack.pop()} - anchors.top:infoBoxText.bottom - } - } diff --git a/v0.002/Develop/source-linux/qml/contactqml/ContactComponent.qml b/v0.002/Develop/source-linux/qml/contactqml/ContactComponent.qml deleted file mode 100644 index 8d23a19..0000000 --- a/v0.002/Develop/source-linux/qml/contactqml/ContactComponent.qml +++ /dev/null @@ -1,65 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.3 -import "qrc:/js/layout.js" as Layoutjs - -Item { -id: contactComponent -property var createdAtDate: new Date(contact.created_at) -property var linkUrl: contact.network!=="dfrn"?contact.url:contact.url.replace("profile","dfrn_request") -Rectangle { - id: wrapper - width: 16*mm - height: 15*mm - border.color: "grey" - color:"white" - Image { - id: photoImage - x:1 - 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"} - } - - Label { - id: namelabel - x: 1 - width: wrapper.width-4 - height: 3*mm - text: contact.screen_name - elide:Text.ElideRight - anchors.topMargin: 0 - anchors.left: photoImage.left - color: "#303030" - font.pixelSize: 3*mm - anchors.top: photoImage.bottom - } - Button{ - id:infobutton - width: 5*mm - height: 5*mm - text:"?" - anchors.left: photoImage.right - anchors.leftMargin: 3 - anchors.topMargin: 3 - anchors.top: parent.top - onClicked:{ - contactComponent.state="large"; - var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml"); - if (component.status== Component.Ready){ - var contactDetails = component.createObject(wrapper,{"contact": contact})} - } - } - } -states: [ - State { - name: "large" - PropertyChanges { target: namelabel; font.pixelSize: 4*mm; width:friendsTabView.width-4*mm; text:Qt.atob(contact.name)+" (@"+contact.screen_name+")"} - PropertyChanges { target: contactComponent; z: 2 } - PropertyChanges { target: wrapper; width:friendsTabView.width-3*mm;height:friendsTabView.height-20*mm} - PropertyChanges { target: photoImage; width:15*mm;height:15*mm } - PropertyChanges { target:contactComponent.GridView.view;contentY:contactComponent.y;contentX:contactComponent.x;interactive:false} - } -] -} diff --git a/v0.002/Develop/source-linux/qml/contactqml/ContactDetailsComponent.qml b/v0.002/Develop/source-linux/qml/contactqml/ContactDetailsComponent.qml deleted file mode 100644 index 1296459..0000000 --- a/v0.002/Develop/source-linux/qml/contactqml/ContactDetailsComponent.qml +++ /dev/null @@ -1,77 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 1.3 - -Rectangle{ - id: detailsrectangle - anchors.top: namelabel.bottom - anchors.topMargin: 2*mm - //opacity: 0 - - Flickable{ - id:namelabelflickable - width: root.width-10*mm - height:friendsTabView.height-55*mm - boundsBehavior:Flickable.StopAtBounds - flickableDirection:Flickable.VerticalFlick - contentWidth:width - contentHeight: namelabeltext.height - 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("Server Type")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ - "
"+qsTr("URL")+": "+linkUrl+"
"+ - qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) - onLinkActivated: { - Qt.openUrlExternally(link)} - } - } - - Row{ - anchors.top: namelabelflickable.bottom - anchors.topMargin: 2*mm - spacing:4 - - Button{ - id:photobutton - text:"Photos" - visible:contact.location=="Friendica"? 1:0 - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=2; - fotostab.active=true; - root.fotoSignal(contact) ; - } - } - - Button{ - id:messagebutton - text:"Messages" - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=0; - newstab.active=true; - root.messageSignal(contact.id) ; - } - } - - Button{ - id:dmbutton - visible: contact.following=="true"?true:false - text: "DM" - onClicked:{contactComponent.state="";detailsrectangle.destroy(); - root.currentIndex=0; - newstab.active=true; - root.directmessageSignal(contact.screen_name); - } - } - - Button{ - id: closeButton - text: "close" - onClicked:{contactComponent.state="";detailsrectangle.destroy()} - } - } - } diff --git a/v0.002/Develop/source-linux/qml/contactqml/FriendsTab.qml b/v0.002/Develop/source-linux/qml/contactqml/FriendsTab.qml deleted file mode 100644 index 3ee2399..0000000 --- a/v0.002/Develop/source-linux/qml/contactqml/FriendsTab.qml +++ /dev/null @@ -1,194 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/news.js" as Newsjs -import "qrc:/qml/contactqml" - -Rectangle { - y:1 - color: "white" - TabView{ - id:friendsTabView -// property var contacts: [] -// property var groups: [] - - tabPosition: Qt.TopEdge - x:mm - y:mm - width: root.width-2*mm - height: root.height-10*mm - currentIndex: 0 - - signal contactsSignal(var username) - signal groupsSignal(var username) - onCurrentIndexChanged:{ - if (currentIndex==0){root.friendsSignal(root.login.username)} - else if (currentIndex==1){contactsSignal(root.login.username)} - else if (currentIndex==2){groupsSignal(root.login.username)} - } - style: TabViewStyle { - frameOverlap: 1 - tab: Rectangle { - color: "white" - //border.color: "light grey" - implicitWidth: root.width/3-2*mm - implicitHeight: 4*mm - Text { id: text - anchors.centerIn: parent - text: styleData.title - color: "dark grey" - font.pixelSize:2.5*mm - font.bold: styleData.selected - } - } - frame: Rectangle { color: "light grey" } - tabsAlignment:Qt.AlignHCenter - } - - Tab{ - title: qsTr("Friends") - Rectangle{ - id: friendsGridTab - function showFriends(username){ - try {friendsModel.clear()} catch(e){print(e)}; - Helperjs.readData(db,"contacts",username,function(friendsobject){ - for (var i=0;i0){// download first contact image and update db -// print("newcontact"+JSON.stringify(newContacts)); - updateContactInDB(login,db,newContacts[currentContact].isFriend,newContacts[currentContact])} - } - onCurrentContactChanged:{// download next contact image after photoplaceholder is finished saving and update db - //print("Current contact"+JSON.stringify(newContacts[currentContact])+newContacts.length); - if(currentContact" + text + ""; - bodyField.remove(start,end); - bodyField.insert(start,text); - urlRectangle.visible=false - } - } - } - } - - - Row{ - spacing:2 - Button{ - visible: (directmessage==1)?false:true - text:qsTr("Permissions") - onClicked: { - var component = Qt.createComponent("qrc:/qml/newsqml/PermissionDialog.qml"); - var permissions = component.createObject(messageColumn); - }} - Button { - id: attachButton - text: qsTr("Attach") - onClicked: { - try{imageAttachment.visible=false; - imageAttachment.opacity=0;imageAttachment.destroy()}catch(e){} - imageAttachmentDialog.open()} - } - Button{ - id:contactButton - text:qsTr("cc") - visible:(directmessage==0) - onClicked:{ - var contactitems=""; - for (var i=0;i 1) { - stackView.pop(); event.accepted = true; - }} - FileDialog { - id: imageAttachmentDialog - title: "Please choose a picture" - folder: shortcuts.pictures - selectFolder: false - onAccepted: { - attachImageURL=imageAttachmentDialog.fileUrl; - var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment;source:"'+attachImageURL.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit}',messageColumn,"attachedImage"); - //console.log("You chose: " + attachImageURL) - - } - onRejected: { - //console.log("Canceled") - } - } -} diff --git a/v0.002/Develop/source-linux/qml/newsqml/NewsTab.qml b/v0.002/Develop/source-linux/qml/newsqml/NewsTab.qml deleted file mode 100644 index c5928f2..0000000 --- a/v0.002/Develop/source-linux/qml/newsqml/NewsTab.qml +++ /dev/null @@ -1,192 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.2 -import QtQuick.LocalStorage 2.0 as Sql -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/helper.js" as Helperjs - -Item { - property string newstabStatus:"news" - - function showNews(newsToShow){ - newsBusy.running=false; - var currentTime= new Date(); - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow}; - newsWorker.sendMessage(msg); - } - - function onFriendsMessages(friend){print(" Friend "+friend); - newstabStatus="friendmessage"; - Newsjs.newsfromdb(db,root.login.username, function(dbnews){showNews(dbnews)},friend) - } - - function onDirectMessage(friend){ - print(root.login.server); - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}}); - } - - function cleanNews(database){ - var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); - db.transaction( function(tx) { - var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config"); - var maxnews=maxnewsrs.rows.item(0); - var newscountrs = tx.executeSql('SELECT COUNT(*) from news'); - var newscount = newscountrs.rows.item(0); - if (newscount>maxnews){var lastvalidtimers= tx.executeSql('select created_at from news ORDER BY created_at DESC LIMIT ' +(newscount-maxnews)); - var lastvalidtime=lastvalidtimers.rows.item(-1); - var deleters = tx.executeSql('DELETE from news WHERE created_at<'+lastvalidtime)} - }); - Qt.quit() - } - - StackView{ - id: newsStack - anchors.fill:parent - focus: true - Keys.onReleased: {if (event.key === Qt.Key_Back && stackView.depth > 1) { - stackView.pop(); event.accepted = true; - } - else if(event.key === Qt.Key_Back &&newstabStatus=="conversation"){ - newstabStatus="news" - newsModel.clear(); - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })} -} - initialItem:Rectangle { - y:1 - color: "white" - width:root.width-2*mm - height:root.height-8*mm - - ComboBox{ - y:mm - width: 8*mm - model: ListModel{ - id: cbModel - ListElement{text: qsTr("News")} - ListElement{text: qsTr("Favorites")} - } - onCurrentIndexChanged:{ - if (currentIndex==0){newsModel.clear(); - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })} - else if (currentIndex==1){ - newsBusy.running=true; - Newsjs.requestFavorites(root.login,db,root,function(news){ - Newsjs.storeNews(root.login,root.db,news,root,function(){ - Newsjs.favoritesfromdb(db,root.login.username,function(newsarray){ - showNews(newsarray) - - }); - } - )}) - } - }} - - Button { - id: newMessageButton - text: qsTr("+") - anchors.top: parent.top - anchors.right: parent.right - onClicked: { - var groups=[]; - Helperjs.readData(root.db,"groups",root.login.username,function(groupobject){ - groups=groupobject}); - Helperjs.readData(root.db,"contacts",root.login.username,function(friends){ - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"contacts": friends,"login":root.login}}) - },"isFriend",1); - } - } - Button { - id: quitButton - text: qsTr("Quit") - anchors.top: parent.top - anchors.right: newMessageButton.left - onClicked: {cleanNews(root.db)} - } - - Component { id:footerComponent - Rectangle{ - border.color: "#EEEEEE" - border.width: 1 - width:parent.width - height:6*mm - Text{ - font.pixelSize: 1.5*mm - anchors.centerIn: parent - text:qsTr("More") - } - MouseArea{anchors.fill:parent - onClicked:{ - var currentTime= new Date(); - if(newstabStatus=="news"){ - var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },false,lastnews_id)} - else if(newstabStatus=="friendmessage"){ - Newsjs.newsfromdb(root.db,root.login.username, function(news){ - var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; - newsWorker.sendMessage(msg); - },newsModel.get(newsModel.count-1).newsitemobject.uid,newsModel.get(newsModel.count-1).newsitemobject.created_at)} - }} - } - } - ListView { - id: newsView - anchors.fill: parent - anchors.topMargin: 8*root.mm - anchors.leftMargin: 3*root.mm; anchors.rightMargin: root.mm - anchors.bottomMargin: 1*root.mm - clip: true - spacing: 0 - footer: footerComponent - model: newsModel - delegate: Newsitem{} - } - - ListModel{id: newsModel} - - WorkerScript { - id: newsWorker - source: "qrc:/js/newsworker.js" - } - - Button { - id: update - anchors.top: parent.top - anchors.right: quitButton.left - text: "Update" - onClicked: { //try{newsModel.clear()} catch(e){} - newsBusy.running=true; - root.contactLoadType="news"; - Newsjs.getFriendsTimeline(login,db,contactlist,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc;root.currentContact=0; - if (ns.length==0){ - Newsjs.getDirectMessage(root.login,root.db,root,function(dbnews){showNews(dbnews)}); - newsBusy.running=false} - })} - } - BusyIndicator{ - id: newsBusy - anchors.horizontalCenter: newsView.horizontalCenter - anchors.top:parent.top - anchors.topMargin: 2*mm - width:7*mm - height: 7*mm - } - Component.onCompleted: { - root.messageSignal.connect(onFriendsMessages); - root.directmessageSignal.connect(onDirectMessage); - root.newsSignal.connect(showNews); - try{newsModel.clear()} catch(e){} - Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - }) - } - } -} -} diff --git a/v0.002/Develop/source-linux/qml/newsqml/Newsitem.qml b/v0.002/Develop/source-linux/qml/newsqml/Newsitem.qml deleted file mode 100644 index 3445ace..0000000 --- a/v0.002/Develop/source-linux/qml/newsqml/Newsitem.qml +++ /dev/null @@ -1,336 +0,0 @@ -import QtQuick 2.0 -import QtQuick.LocalStorage 2.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import "qrc:/js/news.js" as Newsjs - - -Item { - id: newsitem - width: newsView.width - height:Math.max((itemMessage.height+topFlow.height+friendicaActivities.height+4*mm),profileImage.height+user_name.height+mm) - - property string conversation_id: "" - property string attending: "" - onAttendingChanged: {attendLabel.visible=true; - attendLabel.text= qsTr("attending: ")+ qsTr(attending)} - signal replyto(string parent_id) - - Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} - - Rectangle{ - width:newsitem.width - height:newsitem.height-1 - color: (newsitemobject.messagetype==1)?"#ffe6e6" : "white" - - Column { - id: authorcolumn - width: 8*mm - - Image { - id:profileImage - source: (newsitemobject.user.profile_image!="")? "file://"+newsitemobject.user.profile_image : newsitemobject.user.profile_image_url - x:1 - width: 7*mm - height: 7*mm - MouseArea{ - anchors.fill: parent - onPressAndHold: { newsmenu.popup()} - } - onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} - } - Label { - id:user_name - color: "grey" - //height:3.5*mm - width:parent.width - font.pixelSize: 1.5*mm - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name) - } - } - Column { - id:newscolumn - width: newsitem.width-8*mm - anchors.left: authorcolumn.right - - Flow{ - id:topFlow - spacing: 2*mm - width:parent.width - Label { - color: "grey" - text: if (newsitemobject.messagetype==0){qsTr("Source: ")+newsitemobject.source - } else if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else {" Notification"} - font.pixelSize: 1.5*mm - } - Label { - id:createdAtLabel - color: "grey" - height:3.5*mm - font.pixelSize: 1.5*mm - horizontalAlignment: Label.AlignRight - text: dateDiff - } - CheckBox { - id:favoritedCheckbox - style: CheckBoxStyle { - background: Rectangle { - implicitWidth: 6*mm - implicitHeight:2*mm - color:"white" - } - indicator: - Rectangle{x:3*mm - width: 3*mm - implicitHeight:2*mm - Text{ - anchors.centerIn: parent - color:control.checked?"black":"grey" - text:"\u2605" - }} - } - checked:(newsitemobject.favorited>0) - onClicked:{ - if(favoritedCheckbox.checkedState==Qt.Checked) - {Newsjs.favorite(login,true,newsitemobject.status_id,root)} - else - if(favoritedCheckbox.checkedState==Qt.Unchecked) - {Newsjs.favorite(login,false,newsitemobject.status_id,root)} - } - } - Rectangle{ - width: 4*mm - height: 3*mm - Text{ - id:newsmenusymbol - color: "grey" - anchors.centerIn: parent - font.pixelSize: 2*mm - font.bold: true - text: "\u22EE" - } - MouseArea{ - anchors.fill:parent - onClicked: {newsmenu.popup()}} - - } - - Rectangle{ - width: 4*mm - height: 3*mm - visible:(newsitemobject.in_reply_to_status_id!="")?true:false - Text{ - id:conversationsymbol - color: "grey" - anchors.centerIn: parent - font.pixelSize: 2*mm - text: "\u21C4" - } - MouseArea{ - anchors.fill:parent - onClicked: { - newsBusy.running=true; - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(news,newContacts){ - for (var i=0;i0)){ - photoPlaceholder.destroy(); - currentImageNo=currentImageNo+1 - } - else if ((downloadtype=="contact")&&(root.newContacts.length>0)) - { - photoPlaceholder.destroy(100); - root.currentContact=root.currentContact+1 - } - }}); -}}} - diff --git a/v0.002/Develop/source-linux/qml/photoqml/PhotoTab.qml b/v0.002/Develop/source-linux/qml/photoqml/PhotoTab.qml deleted file mode 100644 index b01ca73..0000000 --- a/v0.002/Develop/source-linux/qml/photoqml/PhotoTab.qml +++ /dev/null @@ -1,147 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.4 -import QtQml.Models 2.1 -import "qrc:/js/service.js" as Service -import "qrc:/js/helper.js" as Helperjs -import "qrc:/qml/photoqml" - -Rectangle { - id:fotorectangle - y:1 - width:root.width-mm - height:root.height-5*mm - color: '#fff' - property var newImages:[] - property int currentImageNo: 0 -//onLoginChanged:{var msg = {'model': photogroupModel,'albums':[],'firstalbum':0,'foreignPicture':false}; -// photoWorker.sendMessage(msg); -//} - onNewImagesChanged:{ - Helperjs.readField("album",root.db,"imageData",root.login.username,function(albums){ - //print("albums"+JSON.stringify(albums)+JSON.stringify(newImages[currentImageNo])); - if(albums.indexOf(newImages[currentImageNo].album)==-1){ - filesystem.Directory=root.login.imagestore+"/albums"; - filesystem.makeDir(newImages[currentImageNo].album);} - }); - if(newImages.length>0){ - print("Current image number"+currentImageNo) - Service.dataRequest(root.login,newImages[currentImageNo].id,root.db,fotorectangle); - newImagesProgress.visible=true //download first image - }} - - onCurrentImageNoChanged:{ - if(currentImageNo - - - https://download.qt-project.org/ministro/android/qt5/qt-5.4 - - - - - - - - - - - - - - - - - - - - diff --git a/v0.002/Release/source-android/application.qrc b/v0.002/Release/source-android/application.qrc deleted file mode 100644 index ecabb77..0000000 --- a/v0.002/Release/source-android/application.qrc +++ /dev/null @@ -1,27 +0,0 @@ - - - qml/friendiqa.qml - qml/newsqml/NewsTab.qml - qml/newsqml/Newsitem.qml - qml/newsqml/MessageSend.qml - qml/newsqml/PermissionDialog.qml - qml/contactqml/FriendsTab.qml - qml/contactqml/GroupComponent.qml - qml/contactqml/ContactComponent.qml - qml/contactqml/ContactDetailsComponent.qml - qml/genericqml/BlueButton.qml - qml/photoqml/PhotoComponent.qml - qml/photoqml/PhotogroupComponent.qml - qml/photoqml/PhotoTab.qml - qml/configqml/InfoBox.qml - qml/configqml/ConfigTab.qml - js/layout.js - js/photoworker.js - js/service.js - js/news.js - js/newsworker.js - js/helper.js - images/defaultcontact.jpg - qml/newsqml/Conversation.qml - - diff --git a/v0.002/Release/source-android/common/filesystem.cpp b/v0.002/Release/source-android/common/filesystem.cpp deleted file mode 100644 index 758f7c8..0000000 --- a/v0.002/Release/source-android/common/filesystem.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "filesystem.h" - -FILESYSTEM *FILESYSTEM::instance() -{ - static FILESYSTEM filesystem; - return &filesystem; -} - -FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){} - -void FILESYSTEM::setDirectory(QString Directory) -{ - if (Directory!=m_Directory) { - m_Directory = Directory; - emit directoryChanged(); - } -} - -QString FILESYSTEM::Directory() const -{ - return m_Directory; -} - -void FILESYSTEM::makeDir(QString name) -{ - QDir dir(m_Directory); - if (dir.mkdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmDir() -{ - QDir dir(m_Directory); - if (dir.removeRecursively()){ - emit success(m_Directory); - } - else {emit error(m_Directory,1);} -} - -void FILESYSTEM::rmFile(QString name) -{ - QDir dir(m_Directory); - if(dir.remove(name)){ - emit success(name); - } - else {emit error(name,1);} -} diff --git a/v0.002/Release/source-android/common/friendiqa.cpp b/v0.002/Release/source-android/common/friendiqa.cpp deleted file mode 100644 index de055f0..0000000 --- a/v0.002/Release/source-android/common/friendiqa.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include -#include "xhr.h" -#include "filesystem.h" - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QQuickView view; - - - XHR* xhr = XHR::instance(); - view.rootContext()->setContextProperty("xhr", xhr); - FILESYSTEM* filesystem = FILESYSTEM::instance(); - view.rootContext()->setContextProperty("filesystem", filesystem); - view.setSource(QUrl("qrc:/qml/friendiqa.qml")); - view.show(); - view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit())); - return app.exec(); - -} - diff --git a/v0.002/Release/source-android/common/uploadableimage.cpp b/v0.002/Release/source-android/common/uploadableimage.cpp deleted file mode 100644 index 81bea1a..0000000 --- a/v0.002/Release/source-android/common/uploadableimage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "uploadableimage.h" - - -#include -#include -#include -#include - -void UploadableImage::setSource(const QString &a) { - if (a != m_source) { - m_source = a; - //m_base64 = ""; - m_mimetype = ""; - m_filename = ""; - - qDebug() << "UploadableImage::setSource : " << m_source; - - if (m_source=="") { - emit sourceChanged(); - //emit base64Changed(); - emit mimetypeChanged(); - emit filenameChanged(); - return; - } - - QImage fullimage = QImage(QUrl(m_source).toLocalFile()); - if (fullimage.width() > 800 || fullimage.height() > 800) { - if (fullimage.width() > fullimage.height()) { - m_image = fullimage.scaledToWidth(800); - } else { - m_image = fullimage.scaledToHeight(800); - } - } else { - m_image = fullimage; - } - qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height(); - emit sourceChanged(); - - QFileInfo fi(m_source); - - m_filename = fi.fileName(); - emit filenameChanged(); - - QString filetype = fi.suffix().toUpper(); - if (filetype!="PNG" && filetype!="JPG") { - filetype = "JPG"; - } - qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype; - - m_mimetype = "image/"+filetype.toLower(); - emit mimetypeChanged(); - - /* - QByteArray byteArray; - QBuffer buffer(&byteArray); - m_image.save(&buffer, filetype.toLatin1().constData()); - QString b64 = QString::fromLatin1(byteArray.toBase64().data()); - - for(int k=0; k -#include -#include - -class UploadableImage : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) - //Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed) - Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged) - Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged) - Q_PROPERTY(QByteArray bytes READ bytes) - -public: - void setSource(const QString &a); - QString source() const; - - //QString base64() const; - QString filename() const; - QString mimetype() const; - - QByteArray bytes(); -signals: - void sourceChanged(); - //void base64Changed(); - void filenameChanged(); - void mimetypeChanged(); - -private: - QString m_source; - QImage m_image; - //QString m_base64; - QString m_filename; - QString m_mimetype; -}; - -#endif // UPLOADABLEIMAGE_H diff --git a/v0.002/Release/source-android/images/defaultcontact.jpg b/v0.002/Release/source-android/images/defaultcontact.jpg deleted file mode 100644 index bb7bce2..0000000 Binary files a/v0.002/Release/source-android/images/defaultcontact.jpg and /dev/null differ diff --git a/v0.002/Release/source-android/js/friendworker.js b/v0.002/Release/source-android/js/friendworker.js deleted file mode 100644 index 6b6c5be..0000000 --- a/v0.002/Release/source-android/js/friendworker.js +++ /dev/null @@ -1,12 +0,0 @@ -WorkerScript.onMessage = function(msg) { - msg.model.clear(); - for (var j=0;j= c.x) - f.contentX = c.x; - else if (f.contentX+f.width <= c.x+c.width) - f.contentX = c.x+c.width-f.width; - if (f.contentY >= c.y) - f.contentY = c.y; - else if (f.contentY+f.height <= c.y+c.height) - f.contentY = c.y+c.height-f.height; -} - -function createObject(objectQml,qmlParameters,parentitem,callback) { - var component = Qt.createComponent(objectQml); - if (component.status === Component.Ready || component.status === Component.Error) - finishCreation(component,qmlParameters,parentitem,callback); - else - component.statusChanged.connect(finishCreation(qmlParameters)); -} - -function finishCreation(component,qmlParameters,parentitem,callback) { - if (component.status === Component.Ready) { - var createdObject = component.createObject(parentitem, qmlParameters); - if (createdObject === null) - print("Error creating image"); } - else if (component.status === Component.Error) - print("Error loading component:"+component.errorString()); - else {print("created")} - //callback(createdObject); -} - diff --git a/v0.002/Release/source-android/js/photoworker.js b/v0.002/Release/source-android/js/photoworker.js deleted file mode 100644 index 36646c7..0000000 --- a/v0.002/Release/source-android/js/photoworker.js +++ /dev/null @@ -1,15 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if (msg.firstalbum==0){msg.model.clear();} - 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 - - qml/friendiqa.qml - qml/newsqml/NewsTab.qml - qml/newsqml/Newsitem.qml - qml/newsqml/MessageSend.qml - qml/newsqml/PermissionDialog.qml - qml/contactqml/FriendsTab.qml - qml/contactqml/GroupComponent.qml - qml/contactqml/ContactComponent.qml - qml/contactqml/ContactDetailsComponent.qml - qml/genericqml/BlueButton.qml - qml/photoqml/PhotoComponent.qml - qml/photoqml/PhotogroupComponent.qml - qml/photoqml/PhotoTab.qml - qml/configqml/InfoBox.qml - qml/configqml/ConfigTab.qml - js/layout.js - js/photoworker.js - js/service.js - js/news.js - js/newsworker.js - js/helper.js - images/defaultcontact.jpg - qml/newsqml/Conversation.qml - - diff --git a/v0.002/Release/source-linux/common/filesystem.cpp b/v0.002/Release/source-linux/common/filesystem.cpp deleted file mode 100644 index 758f7c8..0000000 --- a/v0.002/Release/source-linux/common/filesystem.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "filesystem.h" - -FILESYSTEM *FILESYSTEM::instance() -{ - static FILESYSTEM filesystem; - return &filesystem; -} - -FILESYSTEM::FILESYSTEM(QObject *parent) : QObject(parent){} - -void FILESYSTEM::setDirectory(QString Directory) -{ - if (Directory!=m_Directory) { - m_Directory = Directory; - emit directoryChanged(); - } -} - -QString FILESYSTEM::Directory() const -{ - return m_Directory; -} - -void FILESYSTEM::makeDir(QString name) -{ - QDir dir(m_Directory); - if (dir.mkdir(name)){ - emit success(name); - } - else {emit error(name,1);} -} - -void FILESYSTEM::rmDir() -{ - QDir dir(m_Directory); - if (dir.removeRecursively()){ - emit success(m_Directory); - } - else {emit error(m_Directory,1);} -} - -void FILESYSTEM::rmFile(QString name) -{ - QDir dir(m_Directory); - if(dir.remove(name)){ - emit success(name); - } - else {emit error(name,1);} -} diff --git a/v0.002/Release/source-linux/common/friendiqa.cpp b/v0.002/Release/source-linux/common/friendiqa.cpp deleted file mode 100644 index de055f0..0000000 --- a/v0.002/Release/source-linux/common/friendiqa.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include -#include "xhr.h" -#include "filesystem.h" - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - QQuickView view; - - - XHR* xhr = XHR::instance(); - view.rootContext()->setContextProperty("xhr", xhr); - FILESYSTEM* filesystem = FILESYSTEM::instance(); - view.rootContext()->setContextProperty("filesystem", filesystem); - view.setSource(QUrl("qrc:/qml/friendiqa.qml")); - view.show(); - view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit())); - return app.exec(); - -} - diff --git a/v0.002/Release/source-linux/common/uploadableimage.cpp b/v0.002/Release/source-linux/common/uploadableimage.cpp deleted file mode 100644 index 81bea1a..0000000 --- a/v0.002/Release/source-linux/common/uploadableimage.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "uploadableimage.h" - - -#include -#include -#include -#include - -void UploadableImage::setSource(const QString &a) { - if (a != m_source) { - m_source = a; - //m_base64 = ""; - m_mimetype = ""; - m_filename = ""; - - qDebug() << "UploadableImage::setSource : " << m_source; - - if (m_source=="") { - emit sourceChanged(); - //emit base64Changed(); - emit mimetypeChanged(); - emit filenameChanged(); - return; - } - - QImage fullimage = QImage(QUrl(m_source).toLocalFile()); - if (fullimage.width() > 800 || fullimage.height() > 800) { - if (fullimage.width() > fullimage.height()) { - m_image = fullimage.scaledToWidth(800); - } else { - m_image = fullimage.scaledToHeight(800); - } - } else { - m_image = fullimage; - } - qDebug() << "UploadableImage::setSource : " << m_image.width() << "x" << m_image.height(); - emit sourceChanged(); - - QFileInfo fi(m_source); - - m_filename = fi.fileName(); - emit filenameChanged(); - - QString filetype = fi.suffix().toUpper(); - if (filetype!="PNG" && filetype!="JPG") { - filetype = "JPG"; - } - qDebug() << "UploadableImage::setSource : " << "Saving as " << filetype; - - m_mimetype = "image/"+filetype.toLower(); - emit mimetypeChanged(); - - /* - QByteArray byteArray; - QBuffer buffer(&byteArray); - m_image.save(&buffer, filetype.toLatin1().constData()); - QString b64 = QString::fromLatin1(byteArray.toBase64().data()); - - for(int k=0; k -#include -#include - -class UploadableImage : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) - //Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed) - Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged) - Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged) - Q_PROPERTY(QByteArray bytes READ bytes) - -public: - void setSource(const QString &a); - QString source() const; - - //QString base64() const; - QString filename() const; - QString mimetype() const; - - QByteArray bytes(); -signals: - void sourceChanged(); - //void base64Changed(); - void filenameChanged(); - void mimetypeChanged(); - -private: - QString m_source; - QImage m_image; - //QString m_base64; - QString m_filename; - QString m_mimetype; -}; - -#endif // UPLOADABLEIMAGE_H diff --git a/v0.002/Release/source-linux/friendiqa.pro b/v0.002/Release/source-linux/friendiqa.pro deleted file mode 100644 index 31c1b2d..0000000 --- a/v0.002/Release/source-linux/friendiqa.pro +++ /dev/null @@ -1,44 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = friendiqa -CONFIG += debug -QT += qml quick gui widgets - -SOURCES += common/friendiqa.cpp \ - common/uploadableimage.cpp \ - common/xhr.cpp \ - common/filesystem.cpp - -RESOURCES = application.qrc - -OTHER_FILES += qml/friendiqa.qml \ - translations/*.ts \ - qml/*.qml - qml/newsqml/*.qml - qml/contactqml/*.qml - qml/photoqml/*.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 - -HEADERS += \ - common/uploadableimage.h \ - common/xhr.h \ - common/filesystem.h - - diff --git a/v0.002/Release/source-linux/images/defaultcontact.jpg b/v0.002/Release/source-linux/images/defaultcontact.jpg deleted file mode 100644 index bb7bce2..0000000 Binary files a/v0.002/Release/source-linux/images/defaultcontact.jpg and /dev/null differ diff --git a/v0.002/Release/source-linux/js/friendworker.js b/v0.002/Release/source-linux/js/friendworker.js deleted file mode 100644 index 6b6c5be..0000000 --- a/v0.002/Release/source-linux/js/friendworker.js +++ /dev/null @@ -1,12 +0,0 @@ -WorkerScript.onMessage = function(msg) { - msg.model.clear(); - for (var j=0;j= c.x) - f.contentX = c.x; - else if (f.contentX+f.width <= c.x+c.width) - f.contentX = c.x+c.width-f.width; - if (f.contentY >= c.y) - f.contentY = c.y; - else if (f.contentY+f.height <= c.y+c.height) - f.contentY = c.y+c.height-f.height; -} - -function createObject(objectQml,qmlParameters,parentitem,callback) { - var component = Qt.createComponent(objectQml); - if (component.status === Component.Ready || component.status === Component.Error) - finishCreation(component,qmlParameters,parentitem,callback); - else - component.statusChanged.connect(finishCreation(qmlParameters)); -} - -function finishCreation(component,qmlParameters,parentitem,callback) { - if (component.status === Component.Ready) { - var createdObject = component.createObject(parentitem, qmlParameters); - if (createdObject === null) - print("Error creating image"); } - else if (component.status === Component.Error) - print("Error loading component:"+component.errorString()); - else {print("created")} - //callback(createdObject); -} - diff --git a/v0.002/Release/source-linux/js/photoworker.js b/v0.002/Release/source-linux/js/photoworker.js deleted file mode 100644 index 36646c7..0000000 --- a/v0.002/Release/source-linux/js/photoworker.js +++ /dev/null @@ -1,15 +0,0 @@ -WorkerScript.onMessage = function(msg) { - if (msg.firstalbum==0){msg.model.clear();} - 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