diff --git a/source-android/android/AndroidManifest.xml b/source-android/android/AndroidManifest.xml index 975885b..f688812 100644 --- a/source-android/android/AndroidManifest.xml +++ b/source-android/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + @@ -61,4 +61,5 @@ Remove the comment if you do not require these default features. --> + diff --git a/source-android/androidnative.pri/.gitignore b/source-android/androidnative.pri/.gitignore deleted file mode 100644 index 23657c7..0000000 --- a/source-android/androidnative.pri/.gitignore +++ /dev/null @@ -1,45 +0,0 @@ -# C++ objects and libs - -*.slo -*.lo -*.o -*.a -*.la -*.lai -*.so -*.dll -*.dylib - -# Qt-es - -/.qmake.cache -/.qmake.stash -*.pro.user -*.pro.user.* -*.moc -moc_*.cpp -qrc_*.cpp -ui_*.h -Makefile* -*-build-* -build-* -html - -# QtCreator - -*.autosave -.idea - -tests/quickandroidactivitytests/tests/bin/* -tests/quickandroidactivitytests/tests/gen/* - -#Android -local.properties -gradle.properties -.build -.gradle -*.iml -vendor -tests/instrument/build -build -*.swp diff --git a/source-android/androidnative.pri/.gitmodules b/source-android/androidnative.pri/.gitmodules deleted file mode 100644 index 8b13789..0000000 --- a/source-android/androidnative.pri/.gitmodules +++ /dev/null @@ -1 +0,0 @@ - diff --git a/source-android/androidnative.pri/.travis.yml b/source-android/androidnative.pri/.travis.yml deleted file mode 100644 index deffa3c..0000000 --- a/source-android/androidnative.pri/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -language : android -addons: - apt: - packages: - - p7zip - - coreutils - - realpath -android: - components: - - build-tools-23.0.2 - - android-19 - - extra-google-google_play_services -env: - - DISPLAY=:99.0 -compiler: - - gcc -before_install: - - wget -c https://services.gradle.org/distributions/gradle-2.9-bin.zip - - unzip -qq gradle-2.9-bin.zip - - export GRADLE_HOME=$PWD/gradle-2.9 - - export PATH=$GRADLE_HOME/bin:$PATH - - gradle --version - - git clone https://github.com/benlau/qtci/ - - source qtci/path.env - - ./ci/qt-android - -script: - - export ROOT_DIR=`pwd` - - KEYSTORE=dev.keystore - - KEYPASS=123456 - - BUILD_DIR=$ROOT_DIR/tests/instrument/build - - ANDROID_TARGET_SDK_VERSION=23 - - mkdir -p $BUILD_DIR - - ls - - keytool -genkey -v -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=localhost, ou=oss, o=Continuent, c=HK" -storepass $KEYPASS -keypass $KEYPASS -keystore $KEYSTORE - - source qt.env - - ls $ANDROID_SDK_ROOT/build-tools - - cd $BUILD_DIR - - build-android-gradle-project ${ROOT_DIR}/tests/instrument/activity/activity.pro - - sed -i "s/com.android.application/com.android.library/g" android-build/build.gradle - - cat android-build/gradle.properties - - cp ./android-build/build/outputs/apk/android-build-debug.apk output.apk - - echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a - - emulator -avd test -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & - - export ANDROID_HOME=$ANDROID_SDK_ROOT - - adb install -r output.apk - - cd $ROOT_DIR/tests/instrument/runner - - ls - - ./gradlew -q assembleDebug - - find . -name "*.apk" - - adb install -r ./build/outputs/apk/runner-debug.apk - - adb shell am instrument -w quickandroid.example.tests/android.test.InstrumentationTestRunner 2>&1 | tee instrument.log - - adb logcat -d > log.txt - - sed -i "/dalvikvm/d" log.txt - - tail -n 500 log.txt - - OK=`cat instrument.log | grep -G "^OK" | wc -l` - - echo $OK - - if [ $OK -eq 0 ]; then echo "Test failure found"; exit 1; fi - diff --git a/source-android/androidnative.pri/examples/androidnativeexample/android-sources/gradle.properties~ b/source-android/androidnative.pri/examples/androidnativeexample/android-sources/gradle.properties~ deleted file mode 100644 index 798b77d..0000000 --- a/source-android/androidnative.pri/examples/androidnativeexample/android-sources/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=25.0.3 -androidCompileSdkVersion=25 -buildDir=.build -qt5AndroidDir=/home/pankraz/Qt/5.9.1/android_armv7/src/android/java diff --git a/source-android/androidnative.pri/examples/androidnativeexample/android-sources/local.properties~ b/source-android/androidnative.pri/examples/androidnativeexample/android-sources/local.properties~ deleted file mode 100644 index 4277a61..0000000 --- a/source-android/androidnative.pri/examples/androidnativeexample/android-sources/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=/home/pankraz/android-sdk_alt diff --git a/source-android/androidnative.pri/java/src/androidnative/ImagePicker.java b/source-android/androidnative.pri/java/src/androidnative/ImagePicker.java index 5d515f8..0b4737d 100644 --- a/source-android/androidnative.pri/java/src/androidnative/ImagePicker.java +++ b/source-android/androidnative.pri/java/src/androidnative/ImagePicker.java @@ -95,7 +95,7 @@ public class ImagePicker { return; int requestCode = (Integer) message.get("requestCode"); Intent data = (Intent) message.get("data"); - + if (requestCode == PICK_IMAGE_ACTION) { importImage(data); } else if (requestCode == TAKE_PHOTO_ACTION) { diff --git a/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java b/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java index c21d802..a8f0015 100644 --- a/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java +++ b/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java @@ -135,7 +135,6 @@ public class SystemDispatcher { message.put("requestCode",requestCode); message.put("resultCode",resultCode); message.put("data",data); - Log.d(TAG,"onActivityResult" + isInitialized); if(isInitialized) { dispatch(ACTIVITY_RESULT_MESSAGE,message); waitingIntent=null; diff --git a/source-android/application.qrc b/source-android/application.qrc index 256445b..305c556 100644 --- a/source-android/application.qrc +++ b/source-android/application.qrc @@ -221,5 +221,6 @@ qml/newsqml/Hashtag.qml qml/genericqml/IntentReceiver.qml qml/newsqml/NewsImage.qml + qml/newsqml/NewsVideo.qml diff --git a/source-android/common/xhr.cpp b/source-android/common/xhr.cpp index 2a9107f..d9e04b4 100644 --- a/source-android/common/xhr.cpp +++ b/source-android/common/xhr.cpp @@ -154,6 +154,11 @@ QString XHR::downloadtype() const return m_downloadtype; } +QString XHR::networktype() const +{ + return nc.bearerTypeFamily() + nc.bearerTypeName(); +} + void XHR::setParam(QString name, QString value) { params.insert(name, value); diff --git a/source-android/common/xhr.h b/source-android/common/xhr.h index f111d59..d56f23f 100644 --- a/source-android/common/xhr.h +++ b/source-android/common/xhr.h @@ -37,6 +37,7 @@ #include #include #include +#include class XHR : public QObject { @@ -48,6 +49,7 @@ class XHR : public QObject Q_PROPERTY(QList contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged) Q_PROPERTY(QList filelist READ filelist WRITE setFilelist NOTIFY filelistChanged) Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged) + Q_PROPERTY(QString networktype READ networktype NOTIFY networktypeChanged) public: @@ -63,6 +65,7 @@ public: QList filelist() const; QString imagedir() const; QString downloadtype() const; + QString networktype() const; signals: void urlChanged(); @@ -73,6 +76,7 @@ signals: void filelistChanged(); void imagedirChanged(); void downloadtypeChanged(); + void networktypeChanged(); void downloaded(QString type, QString url, QString filename, int i); void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); void success(QString data, QString api); @@ -94,6 +98,7 @@ public slots: void get(); void getlist(); void download(); +// void networktype(); private slots: void onReplyError(QNetworkReply::NetworkError code); @@ -110,6 +115,7 @@ private: QString m_login; QString m_filename; QString m_downloadtype; + QString m_networktype; QHash params; QHash files; QList m_filelist; @@ -120,7 +126,7 @@ private: QNetworkAccessManager manager; QNetworkRequest request; QNetworkReply *reply; - + QNetworkConfiguration nc; QString bufferToString(); }; diff --git a/source-android/friendiqa.pro.user b/source-android/friendiqa.pro.user new file mode 100644 index 0000000..d4eb51a --- /dev/null +++ b/source-android/friendiqa.pro.user @@ -0,0 +1,709 @@ + + + + + + EnvironmentId + {8825bc46-5cad-4a59-be78-bf9eeaa7217a} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Android für armeabi-v7a (GCC 4.9, Qt 5.10.0 for Android armv72) + Android für armeabi-v7a (GCC 4.9, Qt 5.10.0 for Android armv72) + {a031fbdc-282e-4ae3-be5e-a8255f35e34c} + 1 + 0 + 0 + + /home/pankraz/build/release + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/pankraz/build/release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + /home/pankraz/ownCloud/clientsync/android_release.keystore + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Android_for_armeabi_v7a_GCC_4_9_Qt_5_10_0_for_Android_armv72-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Deployment auf Android-Gerät + + Qt4ProjectManager.AndroidDeployQtStep + false + + 1 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment auf Android-Gerät + Deployment auf Android-Gerät + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + CB5A22HSB9 + 25 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + + + friendiqa + friendiqa + Qt4ProjectManager.AndroidRunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.3.2/source-android/friendiqa.pro + friendiqa.pro + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + Android für armeabi-v7a (GCC 4.9, Qt 5.11.1 for Android armv7) + {bb79c26b-27db-4deb-bf28-37e1d57a32b7} + 1 + 0 + 0 + + /home/pankraz/build/release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + /home/pankraz/ownCloud/clientsync/android_release.keystore + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/build/release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + /home/pankraz/ownCloud/clientsync/android_release.keystore + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.3.1/build-friendiqa-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_11_1_for_Android_armv7-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + + true + Anwendungsdaten kopieren + + Qt4ProjectManager.AndroidPackageInstallationStep + + + android-25 + + true + Android-APK erstellen + + QmakeProjectManager.AndroidBuildApkStep + false + false + + 4 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + Deployment auf Android-Gerät + + Qt4ProjectManager.AndroidDeployQtStep + false + + 1 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment auf Android-Gerät + + Qt4ProjectManager.AndroidDeployConfiguration2 + + 1 + + CB5A22HSB9 + 22 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + + + friendiqa + friendiqa + Qt4ProjectManager.AndroidRunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.3.1/source-android/friendiqa.pro + ../../v0.3.1/source-android/friendiqa.pro + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/source-android/js/image.js b/source-android/js/image.js index 5c48ac3..1cfc09e 100644 --- a/source-android/js/image.js +++ b/source-android/js/image.js @@ -132,6 +132,21 @@ function deleteImage(database,login,type,location,filesystem,rootwindow,callback }) } +function updateImage(database,login,type,filesystem,imageId,rootwindow,callback) { // delete image locally and on server + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + Helperjs.readData(database,"imageData",login.username,function(obj){ + db.transaction( function(tx) { + if (type=='image'){ + var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+obj[0].location+'" AND filename="'+obj[0].filename+'"'); + filesystem.Directory=obj[0].location + filesystem.rmFile(obj[0].filename) + } + }) + },"id",imageId); + callback() +} + + function deleteContacts(database,user,callback) { // does nothing useful at the moment var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); //print(' delete Image Data() for ' + field +"="+selection) diff --git a/source-android/js/newsworker.js b/source-android/js/newsworker.js index fe60147..ef21e62 100644 --- a/source-android/js/newsworker.js +++ b/source-android/js/newsworker.js @@ -35,9 +35,9 @@ if(msg.deleteId!==undefined) msg.model.sync() } else{ - if(msg.appendnews!==true){msg.model.clear()}; - msg.model.sync() - for (var j=0;j-1){attachhelper.url=newsitemobject.text.substring(newsitemobject.text.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); + var helperstringposition=newsitemobject.statusnet_html.indexOf(attachhelperstring); + if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"} else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"} else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"} } else {attachhelper.url=attachArray[image].url} attachmentList.push(attachhelper) - newsitemobject.text=newsitemobject.text.replace(attachhelper.url,"") - newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","") - newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"") + + newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"") } - }}catch(e){print("attachment "+e)} + } + }catch(e){print("attachment "+e)} + for (var format in videoformats){ + if (newsitemobject.text.indexOf("."+videoformats[format])>-1){ + var videohelper={mimetype:"video/"+videoformats[format]} + var videotext=newsitemobject.text; + while (videotext.indexOf("."+videoformats[format])>-1){ + var videohelperstringposition=videotext.indexOf("."+videoformats[format]); + videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4); + videotext=videotext.substring(videohelperstringposition+4,videotext.length) + if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=videohelper.url)){attachmentList.push(videohelper)} + } + } + } newsitemobject.attachmentList=attachmentList; var seconds=(msg.currentTime-newsitemobject.created_at)/1000; @@ -118,12 +131,15 @@ else{ var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities,"forumname":forumname})} //print("News:"+j+msg.news.length+JSON.stringify(data)); - msg.model.append(data) + if(msg.method=="append") { + msg.model.insert(j, data)} + else{ + msg.model.append(data)} } if (j==msg.news.length){ //print("j: "+j+" msg.model.count: "+msg.model.count); msg.model.sync() -} + } } } diff --git a/source-android/js/service.js b/source-android/js/service.js index a846235..e8a44e0 100644 --- a/source-android/js/service.js +++ b/source-android/js/service.js @@ -358,14 +358,17 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f function processNews(api,data){ try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;}; - if (typeof(newslist)=='undefined'){ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) + if (data==""){} + else if (typeof(newslist)=='undefined'){ + Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) } else if (newslist.hasOwnProperty('status')){ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) - } else if (!(Array.isArray(newslist))){ + Helperjs.showMessage(qsTr("JSON status Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) + } + else if (!(Array.isArray(newslist))){ replytimer.restart() - } else { + } + else { var allcontacts=[]; allcontacts=Newsjs.getAllContacts(db,login.username); if (api=="/api/direct_messages/all"){ @@ -389,6 +392,7 @@ function processNews(api,data){ newslist[n].user=cleanUser(newslist[n].user); } newslist[n].statusnet_html=newslist[n].msg_html; + newslist[n].text=newslist[n].msg; } } else { var chatlist=[]; diff --git a/source-android/qml/configqml/ConfigTab.qml b/source-android/qml/configqml/ConfigTab.qml index 9aef03d..23abd1c 100644 --- a/source-android/qml/configqml/ConfigTab.qml +++ b/source-android/qml/configqml/ConfigTab.qml @@ -181,15 +181,15 @@ StackView{ id: username anchors.fill: parent selectByMouse: true - onEditingFinished:{ - Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ - var screennametest=JSON.parse(obj); - if (screennametest.hasOwnProperty('status')){ - Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); - configBackground.registeredUser=false; - }else{configBackground.registeredUser=true} - }); - } + //onEditingFinished:{ + // Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ + // var screennametest=JSON.parse(obj); + // if (screennametest.hasOwnProperty('status')){ + // Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); + // configBackground.registeredUser=false; + // }else{configBackground.registeredUser=true} + // }); + // } } } diff --git a/source-android/qml/configqml/InfoBox.qml b/source-android/qml/configqml/InfoBox.qml index d4c48b9..9c82b77 100644 --- a/source-android/qml/configqml/InfoBox.qml +++ b/source-android/qml/configqml/InfoBox.qml @@ -43,7 +43,7 @@ Rectangle{ textFormat: Text.RichText width: parent.width wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: "Friendiqa v0.3.1
Licensed under GPL 3 with the exception of OpenSSL
"+ + text: "Friendiqa v0.3.2
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ "Sourcecode: https://git.friendi.ca/LubuWest/Friendiqa
"+ "Most of C++ code by Fabio
"+ diff --git a/source-android/qml/friendiqa.qml b/source-android/qml/friendiqa.qml index 20cbf79..719eb9b 100644 --- a/source-android/qml/friendiqa.qml +++ b/source-android/qml/friendiqa.qml @@ -29,14 +29,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.LocalStorage 2.0 import QtQuick.Window 2.0 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 +//import QtQuick.Controls 2.3 import "qrc:/js/news.js" as Newsjs import "qrc:/js/service.js" as Service import "qrc:/qml/genericqml" +import "qrc:/qml/newsqml" +import "qrc:/qml/contactqml" +import "qrc:/qml/photoqml" +import "qrc:/qml/calendarqml" +import "qrc:/qml/configqml" TabView{ @@ -61,10 +67,11 @@ TabView{ signal eventSignal(var contact) signal uploadSignal(var urls) signal sendtextSignal(var intenttext) - + signal changeimage(var method, var type, var id) property var news:[] property var newContacts:[] property string contactLoadType: "" + property bool imagePicking: false onLoginChanged:{ if(login==""){root.currentIndex=4} @@ -186,13 +193,13 @@ TabView{ source: (root.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":"" } - Tab{ title:"\uf085" id: configtab source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":"" } Component.onCompleted: { + //print(xhr.networktype); if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); var IntentReceiverQml = component.createObject(root) } diff --git a/source-android/qml/genericqml/ImagePicker.qml b/source-android/qml/genericqml/ImagePicker.qml index 6f1a925..e62305a 100644 --- a/source-android/qml/genericqml/ImagePicker.qml +++ b/source-android/qml/genericqml/ImagePicker.qml @@ -46,13 +46,13 @@ Item { imageUrls=h; imageUrl=h[0]; ready(); + root.imagePicking=false } } } Component.onCompleted: { SystemDispatcher.loadClass("androidnative.ImagePicker"); - if (root.currentIndex==0){SystemDispatcher.setInitialized();} } } diff --git a/source-android/qml/genericqml/IntentReceiver.qml b/source-android/qml/genericqml/IntentReceiver.qml index c39c742..3a640fe 100644 --- a/source-android/qml/genericqml/IntentReceiver.qml +++ b/source-android/qml/genericqml/IntentReceiver.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import AndroidNative 1.0 Item { - + id:intent /// The URL of the image chosen. If multiple images are picked, it will be equal to the first image. property string imageUrl: "" @@ -16,7 +16,7 @@ Item { Connections { target: SystemDispatcher onDispatched: { - if (type === m_IMAGE_MESSAGE) { + if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) { var h=[]; for (var n in message.imageUrls){ h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5)) diff --git a/source-android/qml/genericqml/Search.qml b/source-android/qml/genericqml/Search.qml index d76b2e2..3ed2b6e 100644 --- a/source-android/qml/genericqml/Search.qml +++ b/source-android/qml/genericqml/Search.qml @@ -32,17 +32,18 @@ import QtQuick 2.7 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/service.js" as Service +//import "qrc:/js/news.js" as Newsjs +//import "qrc:/js/helper.js" as Helperjs +//import "qrc:/js/service.js" as Service -Item { +Rectangle { id:searchComponent - onVisibleChanged: if (visible) searchText.forceActiveFocus() + //onActiveFocusChanged: searchText.forceActiveFocus() + //onVisibleChanged: if (visible) searchText.forceActiveFocus() // border.color: "#EEEEEE" // border.width: 1 -// color:"lightgrey" + color:"lightgrey" // width:conversationView.width // height:Math.max(replyText.contentHeight+2*mm,6*mm) Rectangle{ @@ -53,19 +54,21 @@ Item { anchors.top:parent.top anchors.topMargin: 0.5*mm width:parent.width-2*mm - height:Math.max( searchText.contentHeight,5*mm) + height: 7*mm //Math.max( searchText.contentHeight,5*mm) TextInput { id: searchText + focus: true font.pixelSize: 3*mm wrapMode: Text.Wrap anchors.fill: parent selectByMouse: true cursorVisible: false - onEditingFinished: search(displayText) + onEditingFinished:{ if (displayText!=""){search(displayText)};searchComponent.destroy()} //onHeightChanged: newsView.contentY+=4.5*mm - } + } + Component.onCompleted: searchText.forceActiveFocus() // BlueButton { // id: sendButton // text: "\uf002" @@ -80,4 +83,5 @@ Item { // } // } } + } diff --git a/source-android/qml/newsqml/MessageSend.qml b/source-android/qml/newsqml/MessageSend.qml index 12812ae..25081f0 100644 --- a/source-android/qml/newsqml/MessageSend.qml +++ b/source-android/qml/newsqml/MessageSend.qml @@ -148,7 +148,7 @@ Rectangle{ else{urlTextEdit.text=""; urlRectangle.visible=true}} } - } + } Rectangle{ id:urlRectangle height: 7*mm //parent.height @@ -189,9 +189,10 @@ Rectangle{ Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn) } else{ + // root.imagePicking=true; var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+ - 'attachImage(imageUrl)}}',messageSend,"imagePicker"); + 'attachImage(imageUrl)}}',root,"imagePicker"); imagePicker.pickImage() } } diff --git a/source-android/qml/newsqml/NewsImage.qml b/source-android/qml/newsqml/NewsImage.qml index 74401a0..a4116a1 100644 --- a/source-android/qml/newsqml/NewsImage.qml +++ b/source-android/qml/newsqml/NewsImage.qml @@ -29,7 +29,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.9 AnimatedImage {id:gif; width:newscolumn.width; property string mimetype:"" diff --git a/source-android/qml/newsqml/NewsTab.qml b/source-android/qml/newsqml/NewsTab.qml index 095bb0e..e68d00c 100644 --- a/source-android/qml/newsqml/NewsTab.qml +++ b/source-android/qml/newsqml/NewsTab.qml @@ -29,8 +29,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 -import QtQuick.Controls 2.3 +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.3 as QC2 //import QtQuick.Controls.Styles 2.3 import QtQuick.Dialogs 1.3 import "qrc:/qml/genericqml" @@ -50,7 +51,7 @@ Item { Connections{ target:xhr onError:{ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); + Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); } onSuccess:{ // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now(); @@ -85,9 +86,9 @@ Item { var currentTime= new Date(); // downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now(); //print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow)) - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'appendnews':newsStack.appendNews}; + var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews}; newsWorker.sendMessage(msg); - newsStack.appendNews=false + //newsStack.appendNews=false } @@ -126,13 +127,14 @@ Item { if (term!=""){ newstab.newstabstatus="Search"; newsBusy.running=true; + newsStack.updateMethodNews="refresh"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setUrl(login.server); xhr.setApi("/api/search"); xhr.clearParams(); xhr.setParam("q",term) xhr.get();} - newsSearch.visible=false; + //newsSearch.visible=false; newsView.anchors.topMargin=7*mm } @@ -151,21 +153,21 @@ Item { function onDirectMessage(friend){ newstab.newstabstatus="SendMessage" - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login}); + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}}); } - function sendUrls(urls){ + function sendUrls(urls){print(root.currentIndex==0); if((urls.length==1)&&(newsStack.depth<2)){ - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls}) + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"attachImageURLs":urls}}) } } function sendtext(text){ if(text&&(newsStack.depth<2)){ if (text.subject=="undefined"){text.subject=""} - if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){ + if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".gif")>-1){ text.plaintext=""} - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext}) + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"bodyMessage":text.subject+"\n"+text.plaintext}}) } } @@ -173,7 +175,7 @@ Item { id: newsStack anchors.fill:parent property int conversationIndex: 0 - property bool appendNews: false + property string updateMethodNews: "refresh" property var allchats: ({}) initialItem:Rectangle { id:newslistRectangle @@ -187,10 +189,10 @@ Item { text: qsTr(newstab.newstabstatus) onClicked: {newstabmenu.popup(2*mm,6*mm)} - Menu{id:newstabmenu + QC2.Menu{id:newstabmenu width: 40*mm - delegate:MenuItem{ + delegate:QC2.MenuItem{ contentItem: Text{ font.pixelSize: 3.5*mm text:parent.text @@ -201,57 +203,66 @@ Item { border.color: "grey" } } - Action { + QC2.Action { text: qsTr("Timeline") onTriggered: { newstab.newstabstatus="Timeline"; - newsModel.clear(); + //newsModel.clear(); try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ showNews(dbnews) })}catch(e){Helperjs.showMessage("Error",e,root)}} } - Action { + QC2.Action { text: qsTr("Conversations") onTriggered:{ - newsModel.clear(); + //newsModel.clear(); newstab.newstabstatus="Conversations"; Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) } } - Action { + QC2.Action { text: qsTr("Favorites") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Favorites"; Service.updateView("Favorites") } } - Action { + QC2.Action { text: qsTr("Public timeline") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Public Timeline"; Service.updateView("Public Timeline") } } - Action { + QC2.Action { text: qsTr("Direct Messages") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Direct Messages"; Service.updateView("Direct Messages") } } - Action { + QC2.Action { text: qsTr("Notifications") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Notifications"; Service.updateView("Notifications") } } - Action { + QC2.Action { + text: qsTr("Group news") - onTriggered:Service.showGroups(); + onTriggered: + { + newsStack.updateMethodNews="refresh"; + Service.showGroups(); + } } - Action { + QC2.Action { text: qsTr("Quit") onTriggered:{ Service.cleanNews(root.db,function(){ @@ -273,13 +284,17 @@ Item { id: searchButton text: "\uf002" onClicked: { - if (newsSearch.visible==false){ + //if (newsSearch.visible==false){ newsView.anchors.topMargin=18*mm; - newsSearch.visible=true} - else{ - newsSearch.visible=false; - newsView.anchors.topMargin=7*mm; - } + var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml"); + var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm}); + //searchItem.forceActiveFocus() + + // newsSearch.visible=true} + //else{ + // newsSearch.visible=false; + // newsView.anchors.topMargin=7*mm; + //} } } @@ -309,6 +324,9 @@ Item { id: update text: "\uf021" onClicked: { + if (newstab.newstabstatus=="Timeline"){ + newsStack.updateMethodNews="append" + } else {newsStack.updateMethodNews="refresh"} root.contactLoadType="news"; Service.updateView(newstab.newstabstatus) } @@ -354,18 +372,19 @@ Item { } } } - Rectangle{ - id: newsSearch - color: "#FFFAFA" - y:8*mm - width:root.width - height: 8*mm - visible:false - Search{ - anchors.fill: parent - anchors.margins: mm - } - } +// Rectangle{ +// id: newsSearch +// color: "#FFFAFA" +// y:8*mm +// width:root.width +// height: 8*mm +// //visible:false +// Search{ +// anchors.fill: parent +// anchors.margins: mm +// } +// } + ListView { id: newsView anchors.fill: parent @@ -378,11 +397,12 @@ Item { model: newsModel delegate: Newsitem{} //onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing"); - onDragEnded:{if(contentY<-5*mm){//print("refreshing"); + onDragEnded:{if(contentY<-5*mm){ root.contactLoadType="news"; var onlynew=true; Service.updateView(newstab.newstabstatus) }} + //Component.onCompleted: currentIndex=count } ListModel{id: newsModel} @@ -436,7 +456,9 @@ Item { if(root.news.length>0){showNews(root.news)} else{ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} - else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} + else{Newsjs.chatsfromdb(db,login.username,function(dbnews){ + showNews(dbnews); + })} } } } diff --git a/source-android/qml/newsqml/NewsVideo.qml b/source-android/qml/newsqml/NewsVideo.qml new file mode 100644 index 0000000..97fefcb --- /dev/null +++ b/source-android/qml/newsqml/NewsVideo.qml @@ -0,0 +1,97 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtMultimedia 5.8 +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +Rectangle{ + color:"black" + //border.color: "light grey" + width:newscolumn.width; + height:video.hasVideo?newscolumn.width/4*3:10*mm + property alias source:video.source + Text{ + id:noticeText + text:"\uf144"; + color:"light grey" + width:parent.width + font.pixelSize: parent.height/2 + x:parent.width/2-parent.height/4 + y:parent.height/5 + visible: video.playbackState!=MediaPlayer.PlayingState + } + + Video {id:video; + anchors.fill:parent + property string mimetype:"" + onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString} + fillMode: Image.PreserveAspectFit; + autoLoad: false + audioRole: MediaPlayer.VideoRole + MouseArea {anchors.fill:parent; + onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){ + video.play()} else{video.pause()} + } + } + } + ProgressBar{ + id: videoProgress + width: parent.width + height: 2*mm + anchors.top: video.bottom + z:2 + visible:video.playbackState!=MediaPlayer.StoppedState + value: video.position/video.duration + } + ProgressBar{ + id: videoBuffer + width: parent.width + height: 2*mm + anchors.top: video.bottom + visible:video.playbackState!=MediaPlayer.StoppedState + value: video.bufferProgress + style:ProgressBarStyle{ + progress: Rectangle{ + color:"light grey" + } + } + } +// Slider{ id: videoSlider +// width: parent.width +// height: 3*mm +// anchors.top: video.bottom +// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable +// value: video.position/video.duration +// onPressed:video.seek(value*video.duration) +// } +} diff --git a/source-android/qml/newsqml/Newsitem.qml b/source-android/qml/newsqml/Newsitem.qml index b626057..0b75445 100644 --- a/source-android/qml/newsqml/Newsitem.qml +++ b/source-android/qml/newsqml/Newsitem.qml @@ -163,7 +163,7 @@ Item { linkColor: "light green" id: itemMessage textFormat: Text.RichText - text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html + text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html width: newsitem.width-8*mm-2 height: implicitHeight wrapMode: Text.Wrap @@ -181,10 +181,17 @@ Item { }} if (newsitemobject.attachmentList.length>0){ - var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); + for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); - var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); - } + if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){ + var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); + var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); + } else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype) + var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml"); + var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); +} + + } } } }} diff --git a/source-android/qml/photoqml/ImageUploadDialog.qml b/source-android/qml/photoqml/ImageUploadDialog.qml index ca379f0..33c099b 100644 --- a/source-android/qml/photoqml/ImageUploadDialog.qml +++ b/source-android/qml/photoqml/ImageUploadDialog.qml @@ -29,15 +29,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.7 +import QtQuick 2.5 import QtQuick.Controls 1.4 -import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs +import "qrc:/js/image.js" as Imagejs import "qrc:/qml/genericqml" Rectangle{ id:imageDialog property var attachImageURLs: [] + property string imageId: "" + property string currentAlbum:"" property var contacts: [] property var groups: [] property var contact_allow:login.permissions[0] @@ -60,6 +62,19 @@ Rectangle{ xhr.post(); } + +function updateImage(){ + xhr.url= login.server + "/api/friendica/photo/update.json"; + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.clearParams(); + xhr.setParam("desc",imageUploadModel.get(0).description); + xhr.setParam("album", currentAlbum); + xhr.setParam("album_new", album.currentText); + xhr.setParam("photo_id", imageId); + xhr.post(); + } + + function attachImage(url){ imageUploadModel.append({"imageUrl":url,"description":""}) } @@ -74,15 +89,24 @@ Rectangle{ target:xhr onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}} onSuccess:{ - imageNo=imageNo+1; - if(imageNo0){ - uploadSelectedImage(0) + if (imageUploadModel.count>0){ + uploadSelectedImage(0) }} } } @@ -258,13 +299,4 @@ Rectangle{ for (var n in attachImageURLs){attachImage(attachImageURLs[n])} } } -// BusyIndicator{ -// id: imageBusy -// anchors.horizontalCenter: imageUploadView.horizontalCenter -// anchors.top:imageUploadView.top -// anchors.topMargin: 2*mm -// width:10*mm -// height: 10*mm -// running:false -// } } diff --git a/source-android/qml/photoqml/PhotoComponent.qml b/source-android/qml/photoqml/PhotoComponent.qml index 2e4f29b..b3ca5f6 100644 --- a/source-android/qml/photoqml/PhotoComponent.qml +++ b/source-android/qml/photoqml/PhotoComponent.qml @@ -29,8 +29,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.7 +import QtQuick 2.5 import QtQuick.Controls 1.2 +import "qrc:/qml/photoqml" Package { Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm} @@ -42,6 +43,7 @@ Package { width: 16.5*mm; height: 16.5*mm z: stackItem.PathView.z property string hqphotolink: photoLink + property string imageId:"" Rectangle { id: placeHolder @@ -82,7 +84,12 @@ Package { MouseArea { width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage onPressAndHold:{ - var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}"; + var menuString="import QtQuick 2.5;import QtQuick.Controls 1.4; "+ + "Menu {MenuItem {text:qsTr('Delete on client and server'); onTriggered: {"+ + "changeimage('delete','image','"+imageLocation+"');photoModel.remove(index)}}"+ + "MenuItem {text:qsTr('Move to album'); onTriggered: {"+ + "changeimage('update','image','"+imageId+"');}}"+ + "}"; var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput") imagemenuObject.popup() } diff --git a/source-android/qml/photoqml/PhotoTab.qml b/source-android/qml/photoqml/PhotoTab.qml index de6e1da..5ca1482 100644 --- a/source-android/qml/photoqml/PhotoTab.qml +++ b/source-android/qml/photoqml/PhotoTab.qml @@ -29,8 +29,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 -import QtQuick.Controls 1.2 +import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtQml.Models 2.1 import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs @@ -51,6 +51,7 @@ StackView{ property int currentimageno: 0 property bool remoteContact: false + onNewimagesChanged:{ if(fotorectangle.newimages.length>0){ //print("newimages "+JSON.stringify(newimages)); @@ -104,6 +105,7 @@ StackView{ function showFotos(login,friend){ if(friend=="backButton"){ + if (photoStack.depth>1){photoStack.pop()} if(!albumgridview.currentItem){root.currentIndex=0} if(albumgridview.currentItem.state=='fullscreen'){ albumgridview.currentItem.state = 'inGrid'} @@ -132,9 +134,17 @@ StackView{ } } - function deletepics(type,url ,imageId){ - Imagejs.deleteImage(db,login,type, url,filesystem,root,function(){//showFotos("") - }) + function deletepics(method, type,id){ + if(method=="delete"){Imagejs.deleteImage(db,login,type, id,filesystem,root,function(){//showFotos("") + })} + } + function updatepic(method,type,id){ + if(method=="update"){ + Helperjs.readData(db,"imageData",login.username,function(url){ + photoStack.push({ + item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{attachImageURLs:[url[0].location+url[0].filename],imageId:id,currentAlbum:url[0].album} + }) + },"id",id)} } function uploadUrls(urls){ @@ -159,7 +169,7 @@ StackView{ anchors.right:updatePhotolist.left anchors.rightMargin:mm text:"\uf0ee" - onClicked: { + onClicked: {print(root.imagePicking) photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{}}); // var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml"); // var imageUpload = component.createObject(fotorectangle); @@ -272,6 +282,8 @@ StackView{ Component.onCompleted: { root.fotoSignal.connect(showFotos); root.uploadSignal.connect(uploadUrls); + root.changeimage.connect(deletepics); + root.changeimage.connect(updatepic); if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")} } } diff --git a/source-android/qml/photoqml/PhotogroupComponent.qml b/source-android/qml/photoqml/PhotogroupComponent.qml index 0705a34..c23f307 100644 --- a/source-android/qml/photoqml/PhotogroupComponent.qml +++ b/source-android/qml/photoqml/PhotogroupComponent.qml @@ -29,7 +29,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.Controls 1.3 import QtQml.Models 2.1 //import "qrc:/js/service.js" as Service @@ -116,7 +116,7 @@ Package { if (obj) { for (var k=0;kqml/newsqml/Hashtag.qml qml/genericqml/IntentReceiver.qml qml/newsqml/NewsImage.qml + qml/newsqml/NewsVideo.qml diff --git a/source-linux/common/xhr.cpp b/source-linux/common/xhr.cpp index 2a9107f..d9e04b4 100644 --- a/source-linux/common/xhr.cpp +++ b/source-linux/common/xhr.cpp @@ -154,6 +154,11 @@ QString XHR::downloadtype() const return m_downloadtype; } +QString XHR::networktype() const +{ + return nc.bearerTypeFamily() + nc.bearerTypeName(); +} + void XHR::setParam(QString name, QString value) { params.insert(name, value); diff --git a/source-linux/common/xhr.h b/source-linux/common/xhr.h index f111d59..d56f23f 100644 --- a/source-linux/common/xhr.h +++ b/source-linux/common/xhr.h @@ -37,6 +37,7 @@ #include #include #include +#include class XHR : public QObject { @@ -48,6 +49,7 @@ class XHR : public QObject Q_PROPERTY(QList contactlist READ contactlist WRITE setContactlist NOTIFY contactlistChanged) Q_PROPERTY(QList filelist READ filelist WRITE setFilelist NOTIFY filelistChanged) Q_PROPERTY(QString downloadtype READ downloadtype WRITE setDownloadtype NOTIFY downloadtypeChanged) + Q_PROPERTY(QString networktype READ networktype NOTIFY networktypeChanged) public: @@ -63,6 +65,7 @@ public: QList filelist() const; QString imagedir() const; QString downloadtype() const; + QString networktype() const; signals: void urlChanged(); @@ -73,6 +76,7 @@ signals: void filelistChanged(); void imagedirChanged(); void downloadtypeChanged(); + void networktypeChanged(); void downloaded(QString type, QString url, QString filename, int i); void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); void success(QString data, QString api); @@ -94,6 +98,7 @@ public slots: void get(); void getlist(); void download(); +// void networktype(); private slots: void onReplyError(QNetworkReply::NetworkError code); @@ -110,6 +115,7 @@ private: QString m_login; QString m_filename; QString m_downloadtype; + QString m_networktype; QHash params; QHash files; QList m_filelist; @@ -120,7 +126,7 @@ private: QNetworkAccessManager manager; QNetworkRequest request; QNetworkReply *reply; - + QNetworkConfiguration nc; QString bufferToString(); }; diff --git a/source-linux/friendiqa.pro.user b/source-linux/friendiqa.pro.user new file mode 100644 index 0000000..cc28722 --- /dev/null +++ b/source-linux/friendiqa.pro.user @@ -0,0 +1,338 @@ + + + + + + EnvironmentId + {5561cd20-7085-451e-af24-a60df31a0208} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {18bb940b-5202-4d9a-96aa-2972411b7a41} + 0 + 0 + 0 + + /home/pankraz/bin + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + friendiqa + friendiqa2 + Qt4ProjectManager.Qt4RunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.3.2/source-linux/friendiqa.pro + true + + friendiqa.pro + + /home/pankraz/bin + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/source-linux/friendiqa.pro.user.4e26e1d b/source-linux/friendiqa.pro.user.4e26e1d new file mode 100644 index 0000000..90e71bc --- /dev/null +++ b/source-linux/friendiqa.pro.user.4e26e1d @@ -0,0 +1,601 @@ + + + + + + EnvironmentId + {4e26e1df-26fd-4b76-8028-2f213523c328} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {e9e69f48-1ef9-4389-91ea-9cc2982eefff} + 0 + 0 + 0 + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Lokales Deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + friendiqa + + Qt4ProjectManager.Qt4RunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/source-linux/friendiqa.pro + true + + friendiqa.pro + false + + /home/pankraz/bin/test + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Linux + Linux + {52f4b2cf-b3aa-447e-af87-fc8e27ab3925} + 0 + 0 + 0 + + /home/pankraz/bin/test + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Linux-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Linux-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Lokales Deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + friendiqa + + Qt4ProjectManager.Qt4RunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/source-linux/friendiqa.pro + true + + friendiqa.pro + false + + /home/pankraz/bin/test + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/source-linux/friendiqa.pro.user.5561cd2 b/source-linux/friendiqa.pro.user.5561cd2 new file mode 100644 index 0000000..ce3a4d5 --- /dev/null +++ b/source-linux/friendiqa.pro.user.5561cd2 @@ -0,0 +1,336 @@ + + + + + + EnvironmentId + {5561cd20-7085-451e-af24-a60df31a0208} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + {18bb940b-5202-4d9a-96aa-2972411b7a41} + 0 + 0 + 0 + + /home/pankraz/bin + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/build-friendiqa-Desktop-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy locally + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + friendiqa + + Qt4ProjectManager.Qt4RunConfiguration:/home/pankraz/ownCloud/clientsync/Friendiqa/v0.2/source-linux/friendiqa.pro + true + + friendiqa.pro + false + + /home/pankraz/bin + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/source-linux/js/image.js b/source-linux/js/image.js index 5c48ac3..1cfc09e 100644 --- a/source-linux/js/image.js +++ b/source-linux/js/image.js @@ -132,6 +132,21 @@ function deleteImage(database,login,type,location,filesystem,rootwindow,callback }) } +function updateImage(database,login,type,filesystem,imageId,rootwindow,callback) { // delete image locally and on server + var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); + Helperjs.readData(database,"imageData",login.username,function(obj){ + db.transaction( function(tx) { + if (type=='image'){ + var deleters=tx.executeSql('DELETE FROM imageData WHERE location="'+obj[0].location+'" AND filename="'+obj[0].filename+'"'); + filesystem.Directory=obj[0].location + filesystem.rmFile(obj[0].filename) + } + }) + },"id",imageId); + callback() +} + + function deleteContacts(database,user,callback) { // does nothing useful at the moment var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); //print(' delete Image Data() for ' + field +"="+selection) diff --git a/source-linux/js/newsworker.js b/source-linux/js/newsworker.js index fe60147..ef21e62 100644 --- a/source-linux/js/newsworker.js +++ b/source-linux/js/newsworker.js @@ -35,9 +35,9 @@ if(msg.deleteId!==undefined) msg.model.sync() } else{ - if(msg.appendnews!==true){msg.model.clear()}; - msg.model.sync() - for (var j=0;j-1){attachhelper.url=newsitemobject.text.substring(newsitemobject.text.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); + var helperstringposition=newsitemobject.statusnet_html.indexOf(attachhelperstring); + if (helperstringposition>-1){attachhelper.url=newsitemobject.statusnet_html.substring(newsitemobject.statusnet_html.lastIndexOf("http",helperstringposition),helperstringposition+attachhelperstring.length); if (attachArray[image].mimetype=="image/jpeg"){attachhelper.url=attachhelper.url+".jpg"} else if (attachArray[image].mimetype=="image/gif"){attachhelper.url=attachhelper.url+".gif"} else if (attachArray[image].mimetype=="image/png"){attachhelper.url=attachhelper.url+".png"} } else {attachhelper.url=attachArray[image].url} attachmentList.push(attachhelper) - newsitemobject.text=newsitemobject.text.replace(attachhelper.url,"") - newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4)+".jpeg","") - newsitemobject.text=newsitemobject.text.replace(attachhelper.url.substring(0,attachhelper.url.length-4),"") + + newsitemobject.statusnet_html=newsitemobject.statusnet_html.replace(attachhelper.url,"") } - }}catch(e){print("attachment "+e)} + } + }catch(e){print("attachment "+e)} + for (var format in videoformats){ + if (newsitemobject.text.indexOf("."+videoformats[format])>-1){ + var videohelper={mimetype:"video/"+videoformats[format]} + var videotext=newsitemobject.text; + while (videotext.indexOf("."+videoformats[format])>-1){ + var videohelperstringposition=videotext.indexOf("."+videoformats[format]); + videohelper.url=videotext.substring(videotext.lastIndexOf("http",videohelperstringposition),videohelperstringposition+4); + videotext=videotext.substring(videohelperstringposition+4,videotext.length) + if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=videohelper.url)){attachmentList.push(videohelper)} + } + } + } newsitemobject.attachmentList=attachmentList; var seconds=(msg.currentTime-newsitemobject.created_at)/1000; @@ -118,12 +131,15 @@ else{ var data=({"newsitemobject": newsitemobject,"dateDiff":timestring,"friendica_activities":friendica_activities,"forumname":forumname})} //print("News:"+j+msg.news.length+JSON.stringify(data)); - msg.model.append(data) + if(msg.method=="append") { + msg.model.insert(j, data)} + else{ + msg.model.append(data)} } if (j==msg.news.length){ //print("j: "+j+" msg.model.count: "+msg.model.count); msg.model.sync() -} + } } } diff --git a/source-linux/js/service.js b/source-linux/js/service.js index a846235..e8a44e0 100644 --- a/source-linux/js/service.js +++ b/source-linux/js/service.js @@ -358,14 +358,17 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f function processNews(api,data){ try{var newslist=JSON.parse(data)} catch(e){newsBusy.running=false;}; - if (typeof(newslist)=='undefined'){ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) + if (data==""){} + else if (typeof(newslist)=='undefined'){ + Helperjs.showMessage(qsTr("Undefined Array Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) } else if (newslist.hasOwnProperty('status')){ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) - } else if (!(Array.isArray(newslist))){ + Helperjs.showMessage(qsTr("JSON status Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root) + } + else if (!(Array.isArray(newslist))){ replytimer.restart() - } else { + } + else { var allcontacts=[]; allcontacts=Newsjs.getAllContacts(db,login.username); if (api=="/api/direct_messages/all"){ @@ -389,6 +392,7 @@ function processNews(api,data){ newslist[n].user=cleanUser(newslist[n].user); } newslist[n].statusnet_html=newslist[n].msg_html; + newslist[n].text=newslist[n].msg; } } else { var chatlist=[]; diff --git a/source-linux/qml/configqml/ConfigTab.qml b/source-linux/qml/configqml/ConfigTab.qml index 9aef03d..23abd1c 100644 --- a/source-linux/qml/configqml/ConfigTab.qml +++ b/source-linux/qml/configqml/ConfigTab.qml @@ -181,15 +181,15 @@ StackView{ id: username anchors.fill: parent selectByMouse: true - onEditingFinished:{ - Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ - var screennametest=JSON.parse(obj); - if (screennametest.hasOwnProperty('status')){ - Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); - configBackground.registeredUser=false; - }else{configBackground.registeredUser=true} - }); - } + //onEditingFinished:{ + // Helperjs.friendicaWebRequest(servername.text+'/api/users/show?screen_name='+username.text,configBackground,function(obj){ + // var screennametest=JSON.parse(obj); + // if (screennametest.hasOwnProperty('status')){ + // Helperjs.showMessage(qsTr("Error"),qsTr("Nickname not registered at given server!"),configBackground); + // configBackground.registeredUser=false; + // }else{configBackground.registeredUser=true} + // }); + // } } } diff --git a/source-linux/qml/configqml/InfoBox.qml b/source-linux/qml/configqml/InfoBox.qml index d4c48b9..9c82b77 100644 --- a/source-linux/qml/configqml/InfoBox.qml +++ b/source-linux/qml/configqml/InfoBox.qml @@ -43,7 +43,7 @@ Rectangle{ textFormat: Text.RichText width: parent.width wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: "Friendiqa v0.3.1
Licensed under GPL 3 with the exception of OpenSSL
"+ + text: "Friendiqa v0.3.2
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ "Sourcecode: https://git.friendi.ca/LubuWest/Friendiqa
"+ "Most of C++ code by Fabio
"+ diff --git a/source-linux/qml/friendiqa.qml b/source-linux/qml/friendiqa.qml index 8c933cb..1499b73 100644 --- a/source-linux/qml/friendiqa.qml +++ b/source-linux/qml/friendiqa.qml @@ -29,14 +29,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.LocalStorage 2.0 import QtQuick.Window 2.0 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.4 +//import QtQuick.Controls 2.3 import "qrc:/js/news.js" as Newsjs import "qrc:/js/service.js" as Service import "qrc:/qml/genericqml" +import "qrc:/qml/newsqml" +import "qrc:/qml/contactqml" +import "qrc:/qml/photoqml" +import "qrc:/qml/calendarqml" +import "qrc:/qml/configqml" TabView{ @@ -61,10 +67,11 @@ TabView{ signal eventSignal(var contact) signal uploadSignal(var urls) signal sendtextSignal(var intenttext) - + signal changeimage(var method, var type, var id) property var news:[] property var newContacts:[] property string contactLoadType: "" + property bool imagePicking: false onLoginChanged:{ if(login==""){root.currentIndex=4} @@ -186,13 +193,13 @@ TabView{ source: (root.currentIndex==3)?"qrc:/qml/calendarqml/CalendarTab.qml":"" } - Tab{ title:"\uf085" id: configtab source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":"" } Component.onCompleted: { + //print(xhr.networktype); if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); var IntentReceiverQml = component.createObject(root) } diff --git a/source-linux/qml/genericqml/ImagePicker.qml b/source-linux/qml/genericqml/ImagePicker.qml index 6f1a925..e62305a 100644 --- a/source-linux/qml/genericqml/ImagePicker.qml +++ b/source-linux/qml/genericqml/ImagePicker.qml @@ -46,13 +46,13 @@ Item { imageUrls=h; imageUrl=h[0]; ready(); + root.imagePicking=false } } } Component.onCompleted: { SystemDispatcher.loadClass("androidnative.ImagePicker"); - if (root.currentIndex==0){SystemDispatcher.setInitialized();} } } diff --git a/source-linux/qml/genericqml/IntentReceiver.qml b/source-linux/qml/genericqml/IntentReceiver.qml index c39c742..3a640fe 100644 --- a/source-linux/qml/genericqml/IntentReceiver.qml +++ b/source-linux/qml/genericqml/IntentReceiver.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import AndroidNative 1.0 Item { - + id:intent /// The URL of the image chosen. If multiple images are picked, it will be equal to the first image. property string imageUrl: "" @@ -16,7 +16,7 @@ Item { Connections { target: SystemDispatcher onDispatched: { - if (type === m_IMAGE_MESSAGE) { + if ((type === m_IMAGE_MESSAGE)&& (root.imagePicking==false)) { var h=[]; for (var n in message.imageUrls){ h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5)) diff --git a/source-linux/qml/genericqml/Search.qml b/source-linux/qml/genericqml/Search.qml index d76b2e2..3ed2b6e 100644 --- a/source-linux/qml/genericqml/Search.qml +++ b/source-linux/qml/genericqml/Search.qml @@ -32,17 +32,18 @@ import QtQuick 2.7 import QtQuick.Controls 1.2 import "qrc:/qml/genericqml" -import "qrc:/js/news.js" as Newsjs -import "qrc:/js/helper.js" as Helperjs -import "qrc:/js/service.js" as Service +//import "qrc:/js/news.js" as Newsjs +//import "qrc:/js/helper.js" as Helperjs +//import "qrc:/js/service.js" as Service -Item { +Rectangle { id:searchComponent - onVisibleChanged: if (visible) searchText.forceActiveFocus() + //onActiveFocusChanged: searchText.forceActiveFocus() + //onVisibleChanged: if (visible) searchText.forceActiveFocus() // border.color: "#EEEEEE" // border.width: 1 -// color:"lightgrey" + color:"lightgrey" // width:conversationView.width // height:Math.max(replyText.contentHeight+2*mm,6*mm) Rectangle{ @@ -53,19 +54,21 @@ Item { anchors.top:parent.top anchors.topMargin: 0.5*mm width:parent.width-2*mm - height:Math.max( searchText.contentHeight,5*mm) + height: 7*mm //Math.max( searchText.contentHeight,5*mm) TextInput { id: searchText + focus: true font.pixelSize: 3*mm wrapMode: Text.Wrap anchors.fill: parent selectByMouse: true cursorVisible: false - onEditingFinished: search(displayText) + onEditingFinished:{ if (displayText!=""){search(displayText)};searchComponent.destroy()} //onHeightChanged: newsView.contentY+=4.5*mm - } + } + Component.onCompleted: searchText.forceActiveFocus() // BlueButton { // id: sendButton // text: "\uf002" @@ -80,4 +83,5 @@ Item { // } // } } + } diff --git a/source-linux/qml/newsqml/MessageSend.qml b/source-linux/qml/newsqml/MessageSend.qml index 12812ae..25081f0 100644 --- a/source-linux/qml/newsqml/MessageSend.qml +++ b/source-linux/qml/newsqml/MessageSend.qml @@ -148,7 +148,7 @@ Rectangle{ else{urlTextEdit.text=""; urlRectangle.visible=true}} } - } + } Rectangle{ id:urlRectangle height: 7*mm //parent.height @@ -189,9 +189,10 @@ Rectangle{ Helperjs.showMessage( qsTr("Error"),qsTr("Only one attachment supported at the moment.\n Remove other attachment first!"), messageColumn) } else{ + // root.imagePicking=true; var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ osSettings.imagePickQml+'{multiple : false;onReady: {attachImageURLs.push(imageUrl);'+ - 'attachImage(imageUrl)}}',messageSend,"imagePicker"); + 'attachImage(imageUrl)}}',root,"imagePicker"); imagePicker.pickImage() } } diff --git a/source-linux/qml/newsqml/NewsImage.qml b/source-linux/qml/newsqml/NewsImage.qml index 74401a0..a4116a1 100644 --- a/source-linux/qml/newsqml/NewsImage.qml +++ b/source-linux/qml/newsqml/NewsImage.qml @@ -29,7 +29,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.9 AnimatedImage {id:gif; width:newscolumn.width; property string mimetype:"" diff --git a/source-linux/qml/newsqml/NewsTab.qml b/source-linux/qml/newsqml/NewsTab.qml index 095bb0e..e68d00c 100644 --- a/source-linux/qml/newsqml/NewsTab.qml +++ b/source-linux/qml/newsqml/NewsTab.qml @@ -29,8 +29,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 -import QtQuick.Controls 2.3 +import QtQuick 2.7 +import QtQuick.Controls 1.4 +import QtQuick.Controls 2.3 as QC2 //import QtQuick.Controls.Styles 2.3 import QtQuick.Dialogs 1.3 import "qrc:/qml/genericqml" @@ -50,7 +51,7 @@ Item { Connections{ target:xhr onError:{ - Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); + Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); } onSuccess:{ // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now(); @@ -85,9 +86,9 @@ Item { var currentTime= new Date(); // downloadNotice.text=downloadNotice.text + "\n shownews start "+ Date.now(); //print("appendnews "+newsStack.appendNews +JSON.stringify(newsToShow)) - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'appendnews':newsStack.appendNews}; + var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow,'method':newsStack.updateMethodNews}; newsWorker.sendMessage(msg); - newsStack.appendNews=false + //newsStack.appendNews=false } @@ -126,13 +127,14 @@ Item { if (term!=""){ newstab.newstabstatus="Search"; newsBusy.running=true; + newsStack.updateMethodNews="refresh"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); xhr.setUrl(login.server); xhr.setApi("/api/search"); xhr.clearParams(); xhr.setParam("q",term) xhr.get();} - newsSearch.visible=false; + //newsSearch.visible=false; newsView.anchors.topMargin=7*mm } @@ -151,21 +153,21 @@ Item { function onDirectMessage(friend){ newstab.newstabstatus="SendMessage" - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": friend,"directmessage":1,"login":root.login}); + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": friend,"directmessage":1,"login":root.login}}); } - function sendUrls(urls){ + function sendUrls(urls){print(root.currentIndex==0); if((urls.length==1)&&(newsStack.depth<2)){ - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"attachImageURLs":urls}) + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"attachImageURLs":urls}}) } } function sendtext(text){ if(text&&(newsStack.depth<2)){ if (text.subject=="undefined"){text.subject=""} - if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1){ + if(text.plaintext.lastIndexOf(".jpg")>-1 || text.plaintext.lastIndexOf(".jpeg")>-1 || text.plaintext.lastIndexOf(".png")>-1 || text.plaintext.lastIndexOf(".gif")>-1){ text.plaintext=""} - newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"bodyMessage":text.subject+"\n"+text.plaintext}) + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"bodyMessage":text.subject+"\n"+text.plaintext}}) } } @@ -173,7 +175,7 @@ Item { id: newsStack anchors.fill:parent property int conversationIndex: 0 - property bool appendNews: false + property string updateMethodNews: "refresh" property var allchats: ({}) initialItem:Rectangle { id:newslistRectangle @@ -187,10 +189,10 @@ Item { text: qsTr(newstab.newstabstatus) onClicked: {newstabmenu.popup(2*mm,6*mm)} - Menu{id:newstabmenu + QC2.Menu{id:newstabmenu width: 40*mm - delegate:MenuItem{ + delegate:QC2.MenuItem{ contentItem: Text{ font.pixelSize: 3.5*mm text:parent.text @@ -201,57 +203,66 @@ Item { border.color: "grey" } } - Action { + QC2.Action { text: qsTr("Timeline") onTriggered: { newstab.newstabstatus="Timeline"; - newsModel.clear(); + //newsModel.clear(); try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ showNews(dbnews) })}catch(e){Helperjs.showMessage("Error",e,root)}} } - Action { + QC2.Action { text: qsTr("Conversations") onTriggered:{ - newsModel.clear(); + //newsModel.clear(); newstab.newstabstatus="Conversations"; Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) } } - Action { + QC2.Action { text: qsTr("Favorites") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Favorites"; Service.updateView("Favorites") } } - Action { + QC2.Action { text: qsTr("Public timeline") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Public Timeline"; Service.updateView("Public Timeline") } } - Action { + QC2.Action { text: qsTr("Direct Messages") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Direct Messages"; Service.updateView("Direct Messages") } } - Action { + QC2.Action { text: qsTr("Notifications") onTriggered:{ + newsStack.updateMethodNews="refresh"; newstab.newstabstatus="Notifications"; Service.updateView("Notifications") } } - Action { + QC2.Action { + text: qsTr("Group news") - onTriggered:Service.showGroups(); + onTriggered: + { + newsStack.updateMethodNews="refresh"; + Service.showGroups(); + } } - Action { + QC2.Action { text: qsTr("Quit") onTriggered:{ Service.cleanNews(root.db,function(){ @@ -273,13 +284,17 @@ Item { id: searchButton text: "\uf002" onClicked: { - if (newsSearch.visible==false){ + //if (newsSearch.visible==false){ newsView.anchors.topMargin=18*mm; - newsSearch.visible=true} - else{ - newsSearch.visible=false; - newsView.anchors.topMargin=7*mm; - } + var component = Qt.createComponent("qrc:/qml/genericqml/Search.qml"); + var searchItem = component.createObject(newsStack,{y:8*mm,width:root.width,height: 8*mm}); + //searchItem.forceActiveFocus() + + // newsSearch.visible=true} + //else{ + // newsSearch.visible=false; + // newsView.anchors.topMargin=7*mm; + //} } } @@ -309,6 +324,9 @@ Item { id: update text: "\uf021" onClicked: { + if (newstab.newstabstatus=="Timeline"){ + newsStack.updateMethodNews="append" + } else {newsStack.updateMethodNews="refresh"} root.contactLoadType="news"; Service.updateView(newstab.newstabstatus) } @@ -354,18 +372,19 @@ Item { } } } - Rectangle{ - id: newsSearch - color: "#FFFAFA" - y:8*mm - width:root.width - height: 8*mm - visible:false - Search{ - anchors.fill: parent - anchors.margins: mm - } - } +// Rectangle{ +// id: newsSearch +// color: "#FFFAFA" +// y:8*mm +// width:root.width +// height: 8*mm +// //visible:false +// Search{ +// anchors.fill: parent +// anchors.margins: mm +// } +// } + ListView { id: newsView anchors.fill: parent @@ -378,11 +397,12 @@ Item { model: newsModel delegate: Newsitem{} //onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing"); - onDragEnded:{if(contentY<-5*mm){//print("refreshing"); + onDragEnded:{if(contentY<-5*mm){ root.contactLoadType="news"; var onlynew=true; Service.updateView(newstab.newstabstatus) }} + //Component.onCompleted: currentIndex=count } ListModel{id: newsModel} @@ -436,7 +456,9 @@ Item { if(root.news.length>0){showNews(root.news)} else{ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} - else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} + else{Newsjs.chatsfromdb(db,login.username,function(dbnews){ + showNews(dbnews); + })} } } } diff --git a/source-linux/qml/newsqml/NewsVideo.qml b/source-linux/qml/newsqml/NewsVideo.qml new file mode 100644 index 0000000..97fefcb --- /dev/null +++ b/source-linux/qml/newsqml/NewsVideo.qml @@ -0,0 +1,97 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtMultimedia 5.8 +import QtQuick 2.9 +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 + +Rectangle{ + color:"black" + //border.color: "light grey" + width:newscolumn.width; + height:video.hasVideo?newscolumn.width/4*3:10*mm + property alias source:video.source + Text{ + id:noticeText + text:"\uf144"; + color:"light grey" + width:parent.width + font.pixelSize: parent.height/2 + x:parent.width/2-parent.height/4 + y:parent.height/5 + visible: video.playbackState!=MediaPlayer.PlayingState + } + + Video {id:video; + anchors.fill:parent + property string mimetype:"" + onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString} + fillMode: Image.PreserveAspectFit; + autoLoad: false + audioRole: MediaPlayer.VideoRole + MouseArea {anchors.fill:parent; + onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){ + video.play()} else{video.pause()} + } + } + } + ProgressBar{ + id: videoProgress + width: parent.width + height: 2*mm + anchors.top: video.bottom + z:2 + visible:video.playbackState!=MediaPlayer.StoppedState + value: video.position/video.duration + } + ProgressBar{ + id: videoBuffer + width: parent.width + height: 2*mm + anchors.top: video.bottom + visible:video.playbackState!=MediaPlayer.StoppedState + value: video.bufferProgress + style:ProgressBarStyle{ + progress: Rectangle{ + color:"light grey" + } + } + } +// Slider{ id: videoSlider +// width: parent.width +// height: 3*mm +// anchors.top: video.bottom +// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable +// value: video.position/video.duration +// onPressed:video.seek(value*video.duration) +// } +} diff --git a/source-linux/qml/newsqml/Newsitem.qml b/source-linux/qml/newsqml/Newsitem.qml index b626057..0b75445 100644 --- a/source-linux/qml/newsqml/Newsitem.qml +++ b/source-linux/qml/newsqml/Newsitem.qml @@ -163,7 +163,7 @@ Item { linkColor: "light green" id: itemMessage textFormat: Text.RichText - text: newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html + text: newsitemobject.statusnet_html//newsitemobject.attachmentList.length>0?newsitemobject.text : newsitemobject.statusnet_html width: newsitem.width-8*mm-2 height: implicitHeight wrapMode: Text.Wrap @@ -181,10 +181,17 @@ Item { }} if (newsitemobject.attachmentList.length>0){ - var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); + for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); - var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); - } + if(newsitemobject.attachmentList[attachments].mimetype.substring(0,5)=="image"){ + var component = Qt.createComponent("qrc:/qml/newsqml/NewsImage.qml"); + var imageQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); + } else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype) + var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml"); + var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype}); +} + + } } } }} diff --git a/source-linux/qml/photoqml/ImageUploadDialog.qml b/source-linux/qml/photoqml/ImageUploadDialog.qml index ca379f0..33c099b 100644 --- a/source-linux/qml/photoqml/ImageUploadDialog.qml +++ b/source-linux/qml/photoqml/ImageUploadDialog.qml @@ -29,15 +29,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.7 +import QtQuick 2.5 import QtQuick.Controls 1.4 -import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs +import "qrc:/js/image.js" as Imagejs import "qrc:/qml/genericqml" Rectangle{ id:imageDialog property var attachImageURLs: [] + property string imageId: "" + property string currentAlbum:"" property var contacts: [] property var groups: [] property var contact_allow:login.permissions[0] @@ -60,6 +62,19 @@ Rectangle{ xhr.post(); } + +function updateImage(){ + xhr.url= login.server + "/api/friendica/photo/update.json"; + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.clearParams(); + xhr.setParam("desc",imageUploadModel.get(0).description); + xhr.setParam("album", currentAlbum); + xhr.setParam("album_new", album.currentText); + xhr.setParam("photo_id", imageId); + xhr.post(); + } + + function attachImage(url){ imageUploadModel.append({"imageUrl":url,"description":""}) } @@ -74,15 +89,24 @@ Rectangle{ target:xhr onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}} onSuccess:{ - imageNo=imageNo+1; - if(imageNo0){ - uploadSelectedImage(0) + if (imageUploadModel.count>0){ + uploadSelectedImage(0) }} } } @@ -258,13 +299,4 @@ Rectangle{ for (var n in attachImageURLs){attachImage(attachImageURLs[n])} } } -// BusyIndicator{ -// id: imageBusy -// anchors.horizontalCenter: imageUploadView.horizontalCenter -// anchors.top:imageUploadView.top -// anchors.topMargin: 2*mm -// width:10*mm -// height: 10*mm -// running:false -// } } diff --git a/source-linux/qml/photoqml/PhotoComponent.qml b/source-linux/qml/photoqml/PhotoComponent.qml index 2e4f29b..b3ca5f6 100644 --- a/source-linux/qml/photoqml/PhotoComponent.qml +++ b/source-linux/qml/photoqml/PhotoComponent.qml @@ -29,8 +29,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.7 +import QtQuick 2.5 import QtQuick.Controls 1.2 +import "qrc:/qml/photoqml" Package { Item { id: stackItem; Package.name: 'stack'; z: stackItem.PathView.z;width:16.5*mm;height:16.5*mm} @@ -42,6 +43,7 @@ Package { width: 16.5*mm; height: 16.5*mm z: stackItem.PathView.z property string hqphotolink: photoLink + property string imageId:"" Rectangle { id: placeHolder @@ -82,7 +84,12 @@ Package { MouseArea { width: realImage.paintedWidth; height: realImage.paintedHeight; anchors.centerIn: realImage onPressAndHold:{ - var menuString="import QtQuick.Controls 1.4; Menu {MenuItem{text:qsTr('Delete on client and server'); onTriggered: {deletepics('image','"+imageLocation+"');photoModel.remove(index)}}}"; + var menuString="import QtQuick 2.5;import QtQuick.Controls 1.4; "+ + "Menu {MenuItem {text:qsTr('Delete on client and server'); onTriggered: {"+ + "changeimage('delete','image','"+imageLocation+"');photoModel.remove(index)}}"+ + "MenuItem {text:qsTr('Move to album'); onTriggered: {"+ + "changeimage('update','image','"+imageId+"');}}"+ + "}"; var imagemenuObject=Qt.createQmlObject(menuString,photoWrapper,"imagemenuOutput") imagemenuObject.popup() } diff --git a/source-linux/qml/photoqml/PhotoTab.qml b/source-linux/qml/photoqml/PhotoTab.qml index de6e1da..5ca1482 100644 --- a/source-linux/qml/photoqml/PhotoTab.qml +++ b/source-linux/qml/photoqml/PhotoTab.qml @@ -29,8 +29,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 -import QtQuick.Controls 1.2 +import QtQuick 2.5 +import QtQuick.Controls 1.4 import QtQml.Models 2.1 import "qrc:/js/image.js" as Imagejs import "qrc:/js/helper.js" as Helperjs @@ -51,6 +51,7 @@ StackView{ property int currentimageno: 0 property bool remoteContact: false + onNewimagesChanged:{ if(fotorectangle.newimages.length>0){ //print("newimages "+JSON.stringify(newimages)); @@ -104,6 +105,7 @@ StackView{ function showFotos(login,friend){ if(friend=="backButton"){ + if (photoStack.depth>1){photoStack.pop()} if(!albumgridview.currentItem){root.currentIndex=0} if(albumgridview.currentItem.state=='fullscreen'){ albumgridview.currentItem.state = 'inGrid'} @@ -132,9 +134,17 @@ StackView{ } } - function deletepics(type,url ,imageId){ - Imagejs.deleteImage(db,login,type, url,filesystem,root,function(){//showFotos("") - }) + function deletepics(method, type,id){ + if(method=="delete"){Imagejs.deleteImage(db,login,type, id,filesystem,root,function(){//showFotos("") + })} + } + function updatepic(method,type,id){ + if(method=="update"){ + Helperjs.readData(db,"imageData",login.username,function(url){ + photoStack.push({ + item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{attachImageURLs:[url[0].location+url[0].filename],imageId:id,currentAlbum:url[0].album} + }) + },"id",id)} } function uploadUrls(urls){ @@ -159,7 +169,7 @@ StackView{ anchors.right:updatePhotolist.left anchors.rightMargin:mm text:"\uf0ee" - onClicked: { + onClicked: {print(root.imagePicking) photoStack.push({item:"qrc:/qml/photoqml/ImageUploadDialog.qml",properties:{}}); // var component = Qt.createComponent("qrc:/qml/photoqml/ImageUploadDialog.qml"); // var imageUpload = component.createObject(fotorectangle); @@ -272,6 +282,8 @@ StackView{ Component.onCompleted: { root.fotoSignal.connect(showFotos); root.uploadSignal.connect(uploadUrls); + root.changeimage.connect(deletepics); + root.changeimage.connect(updatepic); if (fotostab.phototabstatus=="Images"){showFotos(root.login,"")} } } diff --git a/source-linux/qml/photoqml/PhotogroupComponent.qml b/source-linux/qml/photoqml/PhotogroupComponent.qml index 0705a34..c23f307 100644 --- a/source-linux/qml/photoqml/PhotogroupComponent.qml +++ b/source-linux/qml/photoqml/PhotogroupComponent.qml @@ -29,7 +29,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.Controls 1.3 import QtQml.Models 2.1 //import "qrc:/js/service.js" as Service @@ -116,7 +116,7 @@ Package { if (obj) { for (var k=0;k