diff --git a/CHANGELOG.md b/CHANGELOG.md index 88ec35d..f6e39dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,3 +64,13 @@ * Link to list of public server on Config Tab * Small redesign of SendMessage page * Intents for texts/urls (Send text or url from everywhere to create message) + + +## v0.3 ## +* Fix for [issue 6](https://github.com/LubuWest/Friendiqa/issues/6) +* Refactoring of news part +* Search button for news +* Click on hashtag in newsitem starts search for news with that word +* Public timeline +* Timeline for selected group +* Small redesign of SendMessage page diff --git a/Friendiqa_v0.3.apk b/Friendiqa_v0.3.apk new file mode 100644 index 0000000..485ff67 Binary files /dev/null and b/Friendiqa_v0.3.apk differ diff --git a/README.md b/README.md index d269bbd..a1b051c 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ QML based client for the Friendica Social Network. # News # Currently supported: -* Shows Posts from friends, favorited messages, Direct Messages and Notifications +* Shows Posts from friends, selected group, favorited messages, public timeline, Direct Messages and notifications +* Search button for news +* Click on hashtag in newsitem starts search for news with that word * Open links in external browser * Click on contact photo for contact details * Click on like text for additional contact info diff --git a/source-android/android/AndroidManifest.xml b/source-android/android/AndroidManifest.xml index 5f087d3..d4296b4 100644 --- a/source-android/android/AndroidManifest.xml +++ b/source-android/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java index dd2d3f1..e03622f 100644 --- a/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java +++ b/source-android/androidnative.pri/java/src/androidnative/AndroidNativeActivity.java @@ -21,7 +21,6 @@ public class AndroidNativeActivity extends org.qtproject.qt5.android.bindings.Qt protected void onResume() { super.onResume(); - if((getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_NEW_TASK) || (getIntent().getFlags() == Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED) || (getIntent().getFlags() == (Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED))) { SystemDispatcher.onActivityResume(); } else { diff --git a/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java b/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java index 0f86233..c21d802 100644 --- a/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java +++ b/source-android/androidnative.pri/java/src/androidnative/SystemDispatcher.java @@ -135,7 +135,7 @@ 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 1ac493d..a68f0f1 100644 --- a/source-android/application.qrc +++ b/source-android/application.qrc @@ -217,7 +217,9 @@ js/image.js qml/contactqml/ProfileComponent.qml translations/friendiqa-it.ts - translations/friendiqa-it.qm + qml/genericqml/Search.qml + qml/newsqml/Hashtag.qml qml/genericqml/IntentReceiver.qml + diff --git a/source-android/common/filesystem.cpp b/source-android/common/filesystem.cpp index fa4adcf..c1668e4 100644 --- a/source-android/common/filesystem.cpp +++ b/source-android/common/filesystem.cpp @@ -73,6 +73,10 @@ QString FILESYSTEM::homePath() const // return dir.exists(); //} +bool FILESYSTEM::fileexist(QString name) +{ return QFile::exists(name); +} + void FILESYSTEM::makeDir(QString name) { QDir dir(m_Directory); @@ -113,47 +117,3 @@ QFileInfoList FILESYSTEM::fileList() //qDebug() << "filelist " << m_Filelist; return dir.entryInfoList(); } - -//void FILESYSTEM::searchImage() -//{ -// QAndroidJniObject ACTION_PICK = QAndroidJniObject::getStaticObjectField("android/content/Intent", "ACTION_PICK", "Ljava/lang/String;"); -// QAndroidJniObject EXTERNAL_CONTENT_URI = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$Images$Media", "EXTERNAL_CONTENT_URI", "Landroid/net/Uri;"); - -// QAndroidJniObject intent=QAndroidJniObject("android/content/Intent", "(Ljava/lang/String;Landroid/net/Uri;)V", ACTION_PICK.object(), EXTERNAL_CONTENT_URI.object()); - -// if (ACTION_PICK.isValid() && intent.isValid()) -// { -// intent.callObjectMethod("setType", "(Ljava/lang/String;)Landroid/content/Intent;", QAndroidJniObject::fromString("image/*").object()); -// QtAndroid::startActivity(intent.object(), 101,this); -// qDebug() << "OK"; -// } -// else -// { -// qDebug() << "ERRO"; -// } -//} - -//void FILESYSTEM::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) -//{ -// jint RESULT_OK = QAndroidJniObject::getStaticField("android/app/Activity", "RESULT_OK"); -// if (receiverRequestCode == 101 && resultCode == RESULT_OK) -// { -// QAndroidJniObject uri = data.callObjectMethod("getData", "()Landroid/net/Uri;"); -// QAndroidJniObject dadosAndroid = QAndroidJniObject::getStaticObjectField("android/provider/MediaStore$MediaColumns", "DATA", "Ljava/lang/String;"); -// QAndroidJniEnvironment env; -// jobjectArray projecao = (jobjectArray)env->NewObjectArray(1, env->FindClass("java/lang/String"), NULL); -// jobject projacaoDadosAndroid = env->NewStringUTF(dadosAndroid.toString().toStdString().c_str()); -// env->SetObjectArrayElement(projecao, 0, projacaoDadosAndroid); -// QAndroidJniObject contentResolver = QtAndroid::androidActivity().callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); -// QAndroidJniObject cursor = contentResolver.callObjectMethod("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", uri.object(), projecao, NULL, NULL, NULL); -// jint columnIndex = cursor.callMethod("getColumnIndex", "(Ljava/lang/String;)I", dadosAndroid.object()); -// cursor.callMethod("moveToFirst", "()Z"); -// QAndroidJniObject resultUri = cursor.callObjectMethod("getString", "(I)Ljava/lang/String;", columnIndex); -// QString imageSelect = "file://" + resultUri.toString(); -// emit imageselected(imageSelect); -// } -// else -// { -// qDebug() << "Select error"; -// } -//} diff --git a/source-android/common/filesystem.h b/source-android/common/filesystem.h index 5f56f2a..c8baae8 100644 --- a/source-android/common/filesystem.h +++ b/source-android/common/filesystem.h @@ -65,6 +65,7 @@ signals: void error(QString data, int code); public slots: + bool fileexist(QString name); void makeDir(QString name); void rmDir(); void rmFile(QString name); diff --git a/source-android/common/xhr.cpp b/source-android/common/xhr.cpp index dbb872a..2a9107f 100644 --- a/source-android/common/xhr.cpp +++ b/source-android/common/xhr.cpp @@ -59,6 +59,14 @@ void XHR::setUrl(QString url) } } +void XHR::setApi(QString api) +{ + if (api!=m_api) { + m_api = api; + emit apiChanged(); + } +} + void XHR::setLogin(QString login) { if (login!=m_login) { @@ -111,6 +119,11 @@ QString XHR::url() const return m_url; } +QString XHR::api() const +{ + return m_api; +} + QString XHR::login() const { return m_login; @@ -166,6 +179,7 @@ void XHR::download() request.setRawHeader("Authorization", headerData.toLocal8Bit()); } request.setUrl(requrl); + //qDebug() << requrl; reply = manager.get(request); reply->ignoreSslErrors(); connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead); @@ -185,9 +199,9 @@ void XHR::get() query.addQueryItem(i.key(), i.value()); } - QUrl requrl(m_url); + QUrl requrl(m_url+m_api); + //qDebug() << requrl; requrl.setQuery(query); - QByteArray loginData = m_login.toLocal8Bit().toBase64(); QString headerData = "Basic " + loginData; request.setRawHeader("Authorization", headerData.toLocal8Bit()); @@ -250,7 +264,7 @@ void XHR::post() QString headerData = "Basic " + loginData; request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - request.setUrl(m_url); + request.setUrl(m_url+m_api); reply = manager.post(request, multiPart); qDebug() << "\t request sent"; connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); @@ -263,7 +277,7 @@ void XHR::post() void XHR::onReplyError(QNetworkReply::NetworkError code) { qDebug() << code; - emit this->error( bufferToString(), m_url, (int) code); + emit this->error( bufferToString(), m_url,m_api, (int) code); buffer.clear(); reply->deleteLater(); } @@ -271,7 +285,7 @@ void XHR::onReplyError(QNetworkReply::NetworkError code) void XHR::onReplySuccess() { qDebug() << "!"; - emit this->success( bufferToString() ); + emit this->success( bufferToString(), m_api); buffer.clear(); // reply->deleteLater(); } @@ -279,7 +293,7 @@ void XHR::onReplySuccess() void XHR::onRequestFinished() { // Save the file here - if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,1);} + if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,m_api,1);} else if (m_downloadtype=="picturelist") { QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer); QJsonObject jsonObject = jsonResponse.object(); diff --git a/source-android/common/xhr.h b/source-android/common/xhr.h index f2e0bb6..f111d59 100644 --- a/source-android/common/xhr.h +++ b/source-android/common/xhr.h @@ -56,6 +56,7 @@ public: explicit XHR(QObject *parent = 0); QString url() const; + QString api() const; QString login() const; QString filename() const; QList contactlist() const; @@ -65,6 +66,7 @@ public: signals: void urlChanged(); + void apiChanged(); void loginChanged(); void filenameChanged(); void contactlistChanged(); @@ -73,11 +75,12 @@ signals: void downloadtypeChanged(); void downloaded(QString type, QString url, QString filename, int i); void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); - void success(QString data); - void error(QString data, QString url, int code); + void success(QString data, QString api); + void error(QString data, QString url,QString api, int code); public slots: void setUrl(QString url); + void setApi(QString api); void setLogin(QString login); void setDownloadtype(QString downloadtype); void setFilename(QString filename); @@ -103,6 +106,7 @@ private slots: private: QByteArray buffer; QString m_url; + QString m_api; QString m_login; QString m_filename; QString m_downloadtype; diff --git a/source-android/js/helper.js b/source-android/js/helper.js index d949a81..3730c72 100644 --- a/source-android/js/helper.js +++ b/source-android/js/helper.js @@ -37,7 +37,7 @@ function friendicaRequest(login,api,rootwindow,callback) { xhrequest.onreadystatechange = function() { if(xhrequest.readyState === XMLHttpRequest.DONE) { try{ - if (xhrequest.status=200){ + if (xhrequest.status==200){ callback(xhrequest.responseText) }else{ showMessage("Error","API:\n" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow); @@ -65,7 +65,7 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) { callback(xhrequest.responseText) } } - catch (e){showMessage("Error", "API:\n" + +api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)} + catch (e){showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)} } } xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password)); @@ -151,7 +151,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'"; }); } -function showMessage(header,message,rootwindow){//print("message: "+message); +function showMessage(header,message,rootwindow){print("message: "+message); var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage); if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'} var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}'; diff --git a/source-android/js/news.js b/source-android/js/news.js index 9e53bfe..e01dcb8 100644 --- a/source-android/js/news.js +++ b/source-android/js/news.js @@ -38,7 +38,7 @@ function requestFriends(login,database,rootwindow,callback){ var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); db.transaction( function(tx) { var result = tx.executeSql('UPDATE contacts SET isFriend=0 where username="'+login.username+'"')}); // clean old friends - Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){ + Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){ var friends=JSON.parse(obj); for (var i=0;i0){ + if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.like.length>0){ for (var j=0;j0){ + if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.dislike.length>0){ for (var k=0;j0){var helpernews=newsrs.rows.item(0); + var newscount=newsrs.rows.length; + helpernews=fetchUsersForNews(database,user,helpernews,allcontacts); + helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html); + helpernews.text=Qt.atob(helpernews.text); + helpernews.id=helpernews.status_id; + if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))}; + callback(helpernews,newscount);} +// var conversationobject={news:helpernews,newscount:newscount}; +// return conversationobject; +})} + + + + +function getAllContacts(database,user){ + var allcontacts=[]; + Helperjs.readData(database,"contacts",user,function(obj){ + allcontacts=obj; + for (var n in allcontacts){ + allcontacts[n].name=Qt.atob(allcontacts[n].name); + allcontacts[n].description=Qt.atob(allcontacts[n].description) + } + }); + return allcontacts; +} + function inArray(list, prop, val) { if (list.length > 0 ) { for (var i in list) {if (list[i][prop] == val) { diff --git a/source-android/js/newsworker.js b/source-android/js/newsworker.js index a738ff8..6f10e77 100644 --- a/source-android/js/newsworker.js +++ b/source-android/js/newsworker.js @@ -41,49 +41,50 @@ else{ if (msg.news[j]) { var newsitemobject=msg.news[j]; //print("Newsitem"+JSON.stringify(newsitemobject.friendica_owner+" userid: "+newsitemobject.user.id)); - if (newsitemobject.messagetype==2){ - newsitemobject.user={}; - newsitemobject.user.profile_image=""; - newsitemobject.user.profile_image_url=""; - newsitemobject.user.name=""; - } - var forumname="";try{if (newsitemobject.messagetype==0&&((newsitemobject.friendica_owner)!=(newsitemobject.user.url))){ +// if (newsitemobject.messagetype==2){ +// newsitemobject.user={}; +// newsitemobject.user.profile_image=""; +// newsitemobject.user.profile_image_url=""; +// newsitemobject.user.name=""; +// } + var forumname="";try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_owner')&&((newsitemobject.friendica_owner.url)!=(newsitemobject.user.url))){ //print(newsitemobject.friendica_owner+" Friendica Owner "+JSON.stringify(newsitemobject)); - forumname=" via "+Qt.atob(newsitemobject.friendica_owner_object.name) + forumname=" via "+newsitemobject.friendica_owner.name }}catch(e){print("forum name "+e)} var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={}; - try{if (newsitemobject.messagetype==0){ - if (newsitemobject.like.length>0){ - if (newsitemobject.like.length==1){likeText= Qt.atob(newsitemobject.like[0].name)+" "+ qsTr("likes this.")} - else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")} + try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){ + if (newsitemobject.friendica_activities.like.length>0){ + if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")} + else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")} } - if (newsitemobject.dislike.length>0){ - if (newsitemobject.dislike.length==1){dislikeText= Qt.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")} - else {dislikeText= newsitemobject.dislike.length+" "+ qsTr("don't like this.")} + if (newsitemobject.friendica_activities.dislike.length>0){ + if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")} + else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")} } - if (newsitemobject.attendyes.length>0){ - if (newsitemobject.attendyes.length==1){attendyesText= Qt.atob(newsitemobject.attendyes[0].name)+" "+ qsTr("will attend.")} - else {attendyesText= newsitemobject.attendyes.length+" "+ qsTr("persons will attend.")} + if (newsitemobject.friendica_activities.attendyes.length>0){ + if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")} + else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")} } - if (newsitemobject.attendno.length>0){ - if (newsitemobject.attendno.length==1){attendnoText= Qt.atob(newsitemobject.attendno[0].name)+" "+ qsTr("will not attend.")} - else {attendnoText= newsitemobject.attendno.length+" "+ qsTr("persons will not attend.")} + if (newsitemobject.friendica_activities.attendno.length>0){ + if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")} + else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")} } - if (newsitemobject.attendmaybe.length>0){ - if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")} - else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} + if (newsitemobject.friendica_activities.attendmaybe.length>0){ + if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")} + else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")} } //var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); + if (newsitemobject.hasOwnProperty("friendica_activities_self")){ if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1} if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - }} catch(e){print("Activities "+e)} + }}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))} var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} var attachmentList=[];try{if(newsitemobject.attachments){ - var attachArray=JSON.parse(Qt.atob(newsitemobject.attachments)); + var attachArray=newsitemobject.attachments; for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){ attachmentList.push(attachArray[image]) } diff --git a/source-android/js/service.js b/source-android/js/service.js index f77ee3d..607e1ad 100644 --- a/source-android/js/service.js +++ b/source-android/js/service.js @@ -1,5 +1,4 @@ -// This file is part of Friendiqa -// https://github.com/lubuwest/Friendiqa +// 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 @@ -314,7 +313,7 @@ function cleanNews(database,callback){ var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config"); var maxnews=maxnewsrs.rows.item(0).maxnews; var newscountrs = tx.executeSql('SELECT COUNT(*) from news'); - var newscount = newscountrs.rows.item(0)["COUNT(*)"]; + var newscount = newscountrs.rows.item(0)["COUNT(*)"];//print("newscount "+newscount) if (newscount>maxnews){ var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news ORDER BY created_at ASC LIMIT ' +(newscount-maxnews)); var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnews-1).created_at; @@ -330,6 +329,7 @@ function cleanContacts(login,database,callback){ if (oldestnewsrs.rows.length>0){ var oldestnewsTime=oldestnewsrs.rows.item(0).created_at- 604800000;} else{var oldestnewsTime=0} //contacts can be 7 days old //print(login.username+" älteste news: "+ oldestnewsTime); var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend=0 AND imageAge<'+oldestnewsTime); // check for friends + //print ("Contact result length: "+ result.rows.length) for (var i=0;i-1){contacttimer.start()} + } +} + + +function cleanUser(user){ + user.created_at=Date.parse(Newsjs.cleanDate(user.created_at)); + var imagehelper1=user.profile_image_url.split("?"); + var imagehelper2=imagehelper1[0].substring(imagehelper1[0].lastIndexOf("/")+1,imagehelper1[0].length); + var imagehelper3=login.imagestore+"contacts/"+user.screen_name+"-"+imagehelper2 + if(filesystem.fileexist(imagehelper3)){user.profile_image=imagehelper3}else {user.profile_image=""} + return user +} + +function updateView(viewtype){ + newsBusy.running=true; + //downloadNotice.text="xhr start "+Date.now() + switch(viewtype){ + case "Conversations": + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + break; + case "Timeline": + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + break; + case "Search": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/search"); + break; + case "Notifications": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/friendica/notifications"); + xhr.clearParams(); + break; + case "Direct Messages": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/all"); + xhr.clearParams(); + break; + case "Public Timeline": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/public_timeline"); + xhr.clearParams(); + break; + case "Favorites": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/favorites"); + xhr.clearParams(); + break; + default: + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + newstab.newstabstatus="Conversations"; + } + xhr.get(); + + if (viewtype==="Conversations"){Newsjs.allchatsfromdb(db,login.username,function(temp){ + newsStack.allchats=temp + })} +} + +function showGroups(){ + Helperjs.readData(db,"groups",login.username,function(groups){ + var groupitems=""; + for (var i=0;iFriendiqa v0.2
Licensed under GPL 3 with the exception of OpenSSL
"+ + text: "Friendiqa v0.3
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ "Sourcecode: https://github.com/LubuWest/Friendiqa
"+ "C++ code by Fabio
"+ diff --git a/source-android/qml/contactqml/ContactDetailsComponent.qml b/source-android/qml/contactqml/ContactDetailsComponent.qml index 9c97def..45d3767 100644 --- a/source-android/qml/contactqml/ContactDetailsComponent.qml +++ b/source-android/qml/contactqml/ContactDetailsComponent.qml @@ -37,7 +37,7 @@ Item { id: contactLargeComponent x:mm y:mm -property var contact:{} +property var contact:({}) property var createdAtDate: new Date(contact.created_at) property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( ""+qsTr("Connect")+"
") @@ -63,7 +63,7 @@ Rectangle { x: mm width: root.width-6*mm //friendsTabView.width-4*mm height: 3*mm - text:Qt.atob(contact.name)+" (@"+contact.screen_name+")" + text:contact.name+" (@"+contact.screen_name+")" elide:Text.ElideRight anchors.topMargin: 0 anchors.left: photoImage.left @@ -91,7 +91,7 @@ Rectangle{ font.pixelSize: 3*mm textFormat:Text.RichText wrapMode: Text.Wrap - text:""+qsTr("Description")+": "+Qt.atob(contact.description)+"
"+qsTr("Location")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ + text:""+qsTr("Description")+": "+contact.description+"
"+qsTr("Location")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ "
"+qsTr("URL")+": "+contact.url+"
"+ connectUrl+ ""+qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) onLinkActivated: { @@ -123,7 +123,7 @@ Rectangle{ text: "\uf0e6" //"Messages" onClicked:{ root.currentIndex=0; - newstab.active=true; + //newstab.active=true; root.messageSignal(contact) ; contactLargeComponent.destroy(); } @@ -135,7 +135,7 @@ Rectangle{ text: "\uf040" //"DM" onClicked:{ root.currentIndex=0; - newstab.active=true; + //newstab.active=true; root.directmessageSignal(contact.screen_name); contactLargeComponent.destroy(); } diff --git a/source-android/qml/contactqml/FriendsTab.qml b/source-android/qml/contactqml/FriendsTab.qml index 03a3144..db32907 100644 --- a/source-android/qml/contactqml/FriendsTab.qml +++ b/source-android/qml/contactqml/FriendsTab.qml @@ -126,6 +126,8 @@ Rectangle { try {friendsModel.clear()} catch(e){print(e)}; Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){ for (var i=0;i1){ friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid } @@ -205,6 +207,8 @@ Rectangle { try {contactsModel.clear()} catch(e){print(e)}; Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){ for (var j=0;j +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +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 + + +Item { + id:searchComponent + onVisibleChanged: if (visible) searchText.forceActiveFocus() +// border.color: "#EEEEEE" +// border.width: 1 +// color:"lightgrey" +// width:conversationView.width +// height:Math.max(replyText.contentHeight+2*mm,6*mm) + Rectangle{ + color: "white" + radius:0.5*mm + anchors.left: parent.left + anchors.leftMargin:mm + anchors.top:parent.top + anchors.topMargin: 0.5*mm + width:parent.width-2*mm + height:Math.max( searchText.contentHeight,5*mm) + + TextInput { + id: searchText + font.pixelSize: 3*mm + wrapMode: Text.Wrap + anchors.fill: parent + selectByMouse: true + cursorVisible: false + onEditingFinished: search(displayText) + //onHeightChanged: newsView.contentY+=4.5*mm + } + +// BlueButton { +// id: sendButton +// text: "\uf002" +// anchors.left: parent.right +// anchors.leftMargin:mm +// anchors.top:parent.top +// //anchors.topMargin: 0.5*mm +// color:"white" +// onClicked: { +// var body=searchText.getText(0,searchText.length); +// search(body) +// } +// } + } +} diff --git a/source-android/qml/newsqml/Conversation.qml b/source-android/qml/newsqml/Conversation.qml index 7231358..0324290 100644 --- a/source-android/qml/newsqml/Conversation.qml +++ b/source-android/qml/newsqml/Conversation.qml @@ -126,14 +126,19 @@ Rectangle { xhr.clearParams(); xhr.setLogin(login.username+":"+Qt.atob(login.password)); if (conversationModel.get(0).newsitemobject.messagetype==0){ + + //xhr.url= login.server + "/api/statuses/update.json"; + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/update"); xhr.setParam("source", "Friendiqa"); - xhr.url= login.server + "/api/statuses/update.json"; xhr.setParam("status", body); - xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)} - else {xhr.url= login.server + "/api/direct_messages/new.json"; + xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)} + else {//xhr.url= login.server + "/api/direct_messages/new.json"; + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/new"); xhr.setParam("text", body); xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name); - xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.status_id) + xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id) } xhr.post(); } catch(e){Helperjs.showMessage("Error",e.toString(),root)} diff --git a/source-android/qml/newsqml/FriendicaActivities.qml b/source-android/qml/newsqml/FriendicaActivities.qml index 02a189f..e235518 100644 --- a/source-android/qml/newsqml/FriendicaActivities.qml +++ b/source-android/qml/newsqml/FriendicaActivities.qml @@ -77,7 +77,7 @@ Rectangle { font.pixelSize: 3*mm anchors.left: contactImage.right anchors.margins: 1*mm - text:Qt.atob(contact.name) + text:contact.name } MouseArea{ diff --git a/source-android/qml/newsqml/Hashtag.qml b/source-android/qml/newsqml/Hashtag.qml new file mode 100644 index 0000000..27584c0 --- /dev/null +++ b/source-android/qml/newsqml/Hashtag.qml @@ -0,0 +1,51 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.0 + +Rectangle { + id:hasgtagRectangle + color: "light grey" + property alias text: hashtagText.text + radius:0.3*mm + width:hashtagText.contentWidth+mm + height:2.5* mm + Text{ + id:hashtagText + font.pixelSize: 1.5*mm + anchors.centerIn: parent + anchors.margins: 0.5*mm + } + MouseArea{ + anchors.fill: parent + onClicked:{search(hashtagText.text.replace("#",""))} + } +} diff --git a/source-android/qml/newsqml/MessageSend.qml b/source-android/qml/newsqml/MessageSend.qml index 935960f..d730b82 100644 --- a/source-android/qml/newsqml/MessageSend.qml +++ b/source-android/qml/newsqml/MessageSend.qml @@ -39,12 +39,11 @@ import "qrc:/js/smiley.js" as Smileyjs import "qrc:/qml/genericqml" -Flickable{ +Rectangle{ + color:"white" width:root.width-5*mm height:root.height-12*mm - contentHeight: messageColumn.height - boundsBehavior: Flickable.StopAtBounds - id:messageSend + //anchors.fill: parent property string parentId: "" property string reply_to_user:"" property alias bodyMessage: bodyField.text @@ -57,15 +56,17 @@ Flickable{ property var group_allow:login.permissions[2] property var group_deny:login.permissions[3] - function attachImage(url){ + function attachImage(url){ print("attachImage "+url) var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+ url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+ url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage"); } function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) { - xhr.url= login.server + "/api/statuses/update.json"; + //xhr.url= login.server + "/api/statuses/update.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/update"); xhr.clearParams(); xhr.setParam("source", "Friendiqa"); xhr.setParam("status", status); @@ -80,17 +81,27 @@ Flickable{ } function dmUpdate(title,text,replyto,screen_name,attachImageURL) { - xhr.url= login.server + "/api/direct_messages/new.json"; + //xhr.url= login.server + "/api/direct_messages/new.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/new"); xhr.clearParams(); xhr.setParam("text", text); xhr.setParam("screen_name", screen_name); if (parentId!="") {xhr.setParam("replyto", replyto)}; - if (title!=="") {xhr.setParam("title", title)}; + //if (title!=="") {xhr.setParam("title", title)}; xhr.post(); } - Column { + Flickable{ + anchors.fill: parent + contentHeight: messageColumn.height + boundsBehavior: Flickable.StopAtBounds + id:messageSend + + + + Column { id:messageColumn spacing: 0.5*mm width: parent.width @@ -98,7 +109,7 @@ Flickable{ id: titleField width: parent.width placeholderText: qsTr("Title (optional)") - visible: messageSend.parentId === "" + visible: parentId === "" } Rectangle{ @@ -236,3 +247,4 @@ Flickable{ } Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])} } +} diff --git a/source-android/qml/newsqml/NewsTab.qml b/source-android/qml/newsqml/NewsTab.qml index c8bcb15..abf7ac9 100644 --- a/source-android/qml/newsqml/NewsTab.qml +++ b/source-android/qml/newsqml/NewsTab.qml @@ -31,64 +31,98 @@ import QtQuick 2.0 import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.3 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 AndroidNative 1.0 Item { Connections{ target:newstab onNewstabstatusChanged:{ newstabstatusButton.text= qsTr(newstab.newstabstatus) +// switch(newstab.newstabstatus){ +// case "Timeline": newstabstatusCombo.currentIndex=1; break; +// case "Conversations":newstabstatusCombo.currentIndex=2; break; +// case "Favorites":newstabstatusCombo.currentIndex=3; break; +// case "Network":newstabstatusCombo.currentIndex=4; break; +// case "Direct Messages":newstabstatusCombo.currentIndex=5; break; +// case "Notifications":newstabstatusCombo.currentIndex=6; break; +// case "Search":newstabstatusCombo.currentIndex=7; break; +// case "Groupnews":newstabstatusCombo.currentIndex=8; break; +// } } } Connections{ target:xhr -// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}} - onSuccess:{replytimer.start() //wait 1 second to load new timeline + onError:{ + Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); + } + onSuccess:{ + // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now(); + Service.processNews(api,data); } } - - Timer {id:replytimer; interval: 1000; running: false; repeat: false onTriggered: { if(newstab.newstabstatus=="Conversation"){ showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)} else{ - var onlynew=true; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ + Service.updateView(newstab.newstabstatus) root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) } } } + Timer {id:contacttimer; interval: 50; running: false; repeat: false + onTriggered: { + // downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now() + root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist); + Newsjs.storeNews(login,db,root.news,root) + } + } + + function showNews(newsToShow){ try{if (newsStack.depth>1){newsStack.pop()}}catch(e){} newsBusy.running=false; var currentTime= new Date(); - downloadNotice.text=""; - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow}; + // 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}; newsWorker.sendMessage(msg); + newsStack.appendNews=false } + + function showConversation(conversationIndex,newsitemobject){ //newsBusy.running=true; root.contactLoadType="conversation"; newsStack.conversationIndex= conversationIndex; + //print(newsitemobject.id); if(newsitemobject.messagetype==0){ - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){ - root.news=ns;root.newContacts=nc; - })} - else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){ - root.news=newsarray;root.newContacts=[]; - })} + xhr.clearParams(); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/conversation/show"); + xhr.setParam("id",newsitemobject.id) + xhr.get(); + } + else{ + xhr.clearParams(); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/conversation"); + xhr.setParam("uri",newsitemobject.statusnet_conversation_id) + xhr.get(); + } } function showContact(contact){ @@ -98,6 +132,21 @@ Item { } } + function search(term){print("Search "+term) + if (term!=""){ + newstab.newstabstatus="Search"; + newsBusy.running=true; + 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; + newsView.anchors.topMargin=7*mm + } + + function onFriendsMessages(friend){ newstab.newstabstatus="Contact" Newsjs.newsfromdb(db,root.login.username, function(dbnews){ @@ -132,18 +181,163 @@ Item { id: newsStack anchors.fill:parent property int conversationIndex: 0 - + property bool appendNews: false + property var allchats: ({}) initialItem:Rectangle { id:newslistRectangle y:1 color: "white" +// ComboBox{ +// id:newstabstatusCombo +// anchors.top: parent.top +// anchors.topMargin: 0.5*mm +// width: 1/3*root.width +// height: 5*mm; +// style: +// ComboBoxStyle{ +// background: Rectangle { +// color:"light blue" +// radius: 0.5*mm +// } +// label: Text { +// verticalAlignment: Text.AlignVCenter +// horizontalAlignment: Text.AlignHCenter +// text: control.currentText +// } +// } + +// model: ListModel { +// id: newscomboItems +// ListElement { type: "Timeline"; text: qsTr("Timeline")} +// ListElement { type: "Conversations";text: qsTr("Conversations")} +// ListElement { type: "Favorites";text: qsTr("Favorites") } +// ListElement { type: "PublicTimeline";text: qsTr("Public timeline") } +// ListElement { type: "DirectMessages";text: qsTr("Direct Messages") } +// ListElement { type: "Notifications";text: qsTr("Notifications") } +// ListElement { type: "Search";text: qsTr("Search") } +// ListElement { type: "Groupnews"; text: qsTr("Group News") } +// ListElement { type: "Quit";text: qsTr("Quit") } +// } +// currentIndex:(login.newsViewType=="Timeline")?0:1 +// onCurrentIndexChanged:{ +// //onActivated:{ +// print(newscomboItems.get(currentIndex).type); +// switch(newscomboItems.get(currentIndex).type){ +// case "Timeline": +// newstab.newstabstatus="Timeline"; +// newsModel.clear(); +// try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ +// showNews(dbnews) +// })}catch(e){Helperjs.showMessage("Error",e,root)} +// break; +// case "Conversations": +// newsModel.clear(); +// newstab.newstabstatus="Conversations"; +// Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) +// break; +// case "Favorites": +// newstab.newstabstatus="Favorites"; +// root.contactLoadType="favorites"; +// Service.updateView("Favorites"); +// break; +// case "PublicTimeline": +// newstab.newstabstatus="Network"; +// Service.updateView("Network"); +// break; +// case "DirectMessages": +// newstab.newstabstatus="DirectMessages"; +// Service.updateView("DirectMessages"); +// break; +// case "Notifications": +// newstab.newstabstatus="Notifications"; +// Service.updateView("Notifications"); +// break; +// case "Search": +// newsView.anchors.topMargin=18*mm; +// newsSearch.visible=true +// break; +// case "Groupnews": +// Service.showGroups(); +// break; +// case "Quit": +// Service.cleanNews(root.db,function(){ +// Service.cleanContacts(root.login,root.db,function(){ +// Qt.quit()}) +// }) +// } +// } +// } + BlueButton{ id:newstabstatusButton anchors.top: parent.top anchors.topMargin: 0.5*mm text: qsTr(newstab.newstabstatus) onClicked: {newstabmenu.popup()} + + Menu{id:newstabmenu + MenuItem { + text: qsTr("Timeline") + onTriggered: { + newstab.newstabstatus="Timeline"; + newsModel.clear(); + try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ + showNews(dbnews) + })}catch(e){Helperjs.showMessage("Error",e,root)}} + } + MenuItem { + text: qsTr("Conversations") + onTriggered:{ + newsModel.clear(); + newstab.newstabstatus="Conversations"; + Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) + } + } + MenuItem { + text: qsTr("Favorites") + onTriggered:{ + newstab.newstabstatus="Favorites"; + // root.contactLoadType="favorites"; + Service.updateView("Favorites") + } + } + MenuItem { + text: qsTr("Public timeline") + onTriggered:{ + newstab.newstabstatus="Public Timeline"; + Service.updateView("Public Timeline") + } + } + + MenuItem { + text: qsTr("Direct Messages") + onTriggered:{ + newstab.newstabstatus="Direct Messages"; + Service.updateView("Direct Messages") + } + } + MenuItem { + text: qsTr("Notifications") + onTriggered:{ + newstab.newstabstatus="Notifications"; + Service.updateView("Notifications") + } + } + MenuItem { + text: qsTr("Group news") + onTriggered:Service.showGroups(); + } + MenuItem { + text: qsTr("Quit") + onTriggered:{ + Service.cleanNews(root.db,function(){ + Service.cleanContacts(root.login,root.db,function(){ + Qt.quit()}) + }) + } + } + } } Row{ @@ -152,6 +346,20 @@ Item { anchors.topMargin: 0.5*mm anchors.right: parent.right + BlueButton { + id: searchButton + text: "\uf002" + onClicked: { + if (newsSearch.visible==false){ + newsView.anchors.topMargin=18*mm; + newsSearch.visible=true} + else{ + newsSearch.visible=false; + newsView.anchors.topMargin=7*mm; + } + } + } + BlueButton { id: newMessageButton text: "\uf040" @@ -166,32 +374,20 @@ Item { },"isFriend",1); } } - BlueButton { - id: quitButton - text: "\uf08b" - onClicked: {Service.cleanNews(root.db,function(){ - Service.cleanContacts(root.login,root.db,function(){ - Qt.quit() }) - })} - } +// BlueButton { +// id: quitButton +// text: "\uf08b" +// onClicked: {Service.cleanNews(root.db,function(){ +// Service.cleanContacts(root.login,root.db,function(){ +// Qt.quit() }) +// })} +// } BlueButton { id: update text: "\uf021" onClicked: { - newsBusy.running=true; - newstab.newstabstatus=login.newsViewType; - root.contactLoadType="news"; - var onlynew=true; - //print("newstab "+ JSON.stringify(contactlist)); - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc; - if (ns.length==0){// update last 20 existing news for changes and likes - onlynew=false; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ - root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) - } - }) + //root.contactLoadType="news"; + Service.updateView(newstab.newstabstatus) } } @@ -211,7 +407,6 @@ Item { onClicked:{ var currentTime= new Date(); var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - print("Lastnews ID "+lastnews_id+Qt.atob(newsModel.get(newsModel.count-1).newsitemobject.statusnet_html)) if(newstab.newstabstatus=="Timeline"){ Newsjs.newsfromdb(root.db,root.login.username, function(news){ var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; @@ -227,11 +422,27 @@ Item { var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; newsWorker.sendMessage(msg); },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)} - } + else if (newstab.newstabstatus=="Notifications"){} + else{ + newsStack.appendNews=true; + xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1); + xhr.get() + }} } } } - + 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 @@ -245,19 +456,9 @@ Item { delegate: Newsitem{} //onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing"); onDragEnded:{if(contentY<-5*mm){//print("refreshing"); - newsBusy.running=true; - newstab.newstabstatus=login.newsViewType; root.contactLoadType="news"; var onlynew=true; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc; - if (ns.length==0){// update last 20 existing news for changes and likes - onlynew=false; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ - root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) - } - }) + Service.updateView(newstab.newstabstatus) }} } @@ -299,67 +500,23 @@ Item { text:"" } } - Menu { - id:newstabmenu - MenuItem { - text: qsTr("Timeline") - onTriggered: { - newstab.newstabstatus="Timeline"; - newsModel.clear(); - try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })}catch(e){Helperjs.showMessage("Error",e,root)}} - } - MenuItem { - text: qsTr("Favorites") - onTriggered:{ - newstab.newstabstatus="Favorites"; - root.contactLoadType="favorites"; - newsBusy.running=true; - Newsjs.requestFavorites(root.login,db,root.contactlist,root,function(ns,nc){ - root.news=ns; root.newContacts=nc; - }) - } - } - MenuItem { - text: qsTr("Conversations") - onTriggered:{ - newsModel.clear(); - newstab.newstabstatus="Conversations"; - Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) - } - } - MenuItem { - text: qsTr("Notifications") - onTriggered:{ - newstab.newstabstatus="Notifications"; - newsBusy.running=true; - Newsjs.getNotifications(root.login,db,root,function(news){ - showNews(news)} - )} - } - } Component.onCompleted: { - root.messageSignal.connect(onFriendsMessages); - root.directmessageSignal.connect(onDirectMessage); - root.newsSignal.connect(showNews); - root.uploadSignal.connect(sendUrls); - root.sendtextSignal.connect(sendtext); - try{newsModel.clear()} catch(e){} - - //print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth); - //newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:[imageUrl]}}) -// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ -// osSettings.imagePickQml+'{multiple : true; onReady: {'+ -// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+ -// ' root.currentIndex=2;fotostab.active=true;'+ -// 'root.uploadSignal(imageUrls)};}}',newstab,"imagePicker"); - //SystemDispatcher.setInitialized(); + root.messageSignal.connect(onFriendsMessages); + root.directmessageSignal.connect(onDirectMessage); + root.newsSignal.connect(showNews); + root.uploadSignal.connect(sendUrls); + root.sendtextSignal.connect(sendtext); + try{newsModel.clear()} catch(e){} + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); 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)})} + if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} + else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} + } + if(osSettings.imagePickQml=="ImagePicker"){var component = Qt.createComponent("qrc:/qml/genericqml/IntentReceiver.qml"); + var IntentReceiverQml = component.createObject(root) } } } diff --git a/source-android/qml/newsqml/Newsitem.qml b/source-android/qml/newsqml/Newsitem.qml index 77f59fa..aa396d3 100644 --- a/source-android/qml/newsqml/Newsitem.qml +++ b/source-android/qml/newsqml/Newsitem.qml @@ -52,6 +52,11 @@ Item { var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml"); var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts}); } + + function findTags(fulltext){ + return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g) + } + Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} Rectangle{ @@ -72,7 +77,8 @@ Item { height: 7*mm MouseArea{ anchors.fill: parent - onClicked:{showContact(newsitemobject.user)} + onClicked:{ + showContact(newsitemobject.user)} } onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} } @@ -82,7 +88,7 @@ Item { width:parent.width font.pixelSize: 1.5*mm wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name)+forumname + text: newsitemobject.user.name+forumname } } Column { @@ -143,7 +149,7 @@ Item { linkColor: "light green" id: itemMessage textFormat: Text.RichText - text:Qt.atob(newsitemobject.statusnet_html) + text:newsitemobject.statusnet_html width: newsitem.width-8*mm-2 height: Math.min(implicitHeight,3/4*root.height) wrapMode: Text.Wrap @@ -151,6 +157,14 @@ Item { onLinkActivated:{ Qt.openUrlExternally(link)} Component.onCompleted:{ + if (newsitemobject.messagetype==0){ + var hashtags=[]; + hashtags=findTags(newsitemobject.text); + var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml"); + for (var tags in hashtags){ + var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()}); + }} + if (newsitemobject.attachmentList.length>0){ for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+ @@ -198,7 +212,7 @@ Item { text: friendica_activities.likeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.like)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)} } } Label{color: "grey" @@ -207,7 +221,7 @@ Item { text: friendica_activities.dislikeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.dislike)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)} } } Label{color: "grey" @@ -216,7 +230,7 @@ Item { text: friendica_activities.attendyesText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendyes)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)} }} Label{color: "grey" height:3.5*mm @@ -224,7 +238,7 @@ Item { text: friendica_activities.attendnoText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendno)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)} } } Label{color: "grey" @@ -233,7 +247,7 @@ Item { text: friendica_activities.attendmaybeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendmaybe)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)} } } Label{ @@ -267,8 +281,8 @@ Item { } } onClicked: { - if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 } - else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root); model.friendica_activities.self.liked=1}} + if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 } + else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.friendica_activities.self.liked=1}} } CheckBox{ id: dislikeCheckbox @@ -289,8 +303,8 @@ Item { } } onClicked: { - if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0} - else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}} + if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0} + else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.friendica_activities.self.disliked=1}} } CheckBox { @@ -312,22 +326,23 @@ Item { checked:(newsitemobject.favorited>0) onClicked:{ if(favoritedCheckbox.checkedState==Qt.Checked){ - Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1} + Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1} else if(favoritedCheckbox.checkedState==Qt.Unchecked){ - Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0} + Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0} } } Rectangle{ width: 10*mm height: 4*mm + visible:(newsitemobject.messagetype!==2) color:"transparent" Text{ id:newsmenusymbol color: "grey" anchors.centerIn: parent - font.pixelSize: 2*mm - font.bold: true - text: "\u22EE" + font.pixelSize: 2.5*mm + font.family:fontAwesome.name + text: "\uf142" } MouseArea{ anchors.fill:parent @@ -336,7 +351,7 @@ Item { Rectangle{ width: 10*mm height: 4*mm - visible:newstab.newstabstatus!="Conversation" + visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation") color:"transparent" Text{ id:conversationsymbol @@ -365,7 +380,7 @@ Item { onTriggered: { var directmessage=0; if (newsitemobject.messagetype==1){ directmessage=1} - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id,"login":root.login,"directmessage":directmessage}}); + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage}}); } } MenuItem { @@ -377,7 +392,7 @@ Item { MenuItem { text: qsTr("Repost") onTriggered: { - Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){ + Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){ Helperjs.showMessage("Repost",qsTr("Success!"),root) }) } @@ -396,17 +411,17 @@ Item { title: qsTr("Attending") MenuItem{ text:qsTr("yes") - onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="yes";attending="yes"}) } } MenuItem{text:qsTr("maybe") - onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="maybe";attending="maybe"}) } } MenuItem{text:qsTr("no") - onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="no";attending="no"})} } } @@ -414,7 +429,7 @@ Item { MenuItem { text: qsTr("Delete") onTriggered: { - Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){ + Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){ var msg = {'deleteId': index, 'model': newsModel}; newsWorker.sendMessage(msg); }) diff --git a/source-android/qml/photoqml/PhotogroupComponent.qml b/source-android/qml/photoqml/PhotogroupComponent.qml index 686e298..0705a34 100644 --- a/source-android/qml/photoqml/PhotogroupComponent.qml +++ b/source-android/qml/photoqml/PhotogroupComponent.qml @@ -104,7 +104,7 @@ Package { Component.onCompleted:{ try {photoModel.clear()}catch (e){print(e)} if(foreignPicture){ - Imagejs.newRequestFriendsPictures(login,albumlink,friend,remoteContact,remoteauth,root,function(obj){ + Imagejs.newRequestFriendsPictures(login,albumlink,friend,photoStack.remoteContact,remoteauth,root,function(obj){ if (obj) { for (var k=0;k ConfigTab - - - + + + User Name - + Server Server - + Nickname Kurzname - + Password Passwort - + Image dir. Bildverz. - + Max. News Max. Nachr. - + News as Anzeige - + Interval (0=None) Intervall (0=keins) - - - + + + Error Fehler - + Nickname not registered at given server! Name auf der Seite nicht registriert! - + Confirm Bestätigen - + No server given! Kein Server angegeben! - + No nickname given! Kein Kurzname angegeben! - + Nickname not registered at given server! Name auf der Seite nicht registriert! @@ -95,42 +95,42 @@ Kein Nutzername angegeben! - + No password given! Kein Passwort angegeben! - + No image directory given! Kein Verzeichnis für Bilder angegeben! - + No maximum news number given! Maximale News-Anzahl nicht angegeben! - + Wrong password! Falsches Passwort! - + Success Bestätigt - + Name Name - + Timeline Chronologisch - + Conversations Unterhaltungen @@ -189,12 +189,12 @@ Freunde - + Contacts Kontakte - + Groups Gruppen @@ -213,32 +213,37 @@ ImageUploadDialog - + + Upload to album + In Album hochladen + + + Album Album - + Image Bild - + Description Beschreibung - + Upload Hochladen - + Error Fehler - + No album name given Kein Albumname angegeben @@ -246,17 +251,17 @@ MessageSend - + Title (optional) Überschrift (optional) - + Error Fehler - + Only one attachment supported at the moment. Remove other attachment first! Nur ein Anhang derzeit unterstützt. @@ -270,30 +275,55 @@ Lade Profilbild für - + More Mehr - + Timeline Chronologisch - + + Error + Fehler + + + Favorites Markierte News - + Conversations Unterhaltungen - + + Public timeline + Gemeinschaft + + + + Direct Messages + Direktnachrichten + + + Notifications Meldungen + + + Group news + News Gruppe + + + + Quit + Schliessen + Newsitem @@ -303,77 +333,77 @@ Teilnahme - + Source: Quelle: - + Direct Message Direktnachricht - + In reply to Antwort an - + comments Kommentare - + Attending: Teilnahme: - + Reply Antworten - + DM Direktnachricht - + Repost Teilen - + Success! Erledigt! - + Conversation Unterhaltung - + Attending Teilnahme - + yes ja - + maybe vielleicht - + no nein - + Delete Löschen @@ -394,28 +424,28 @@ PhotoTab - + 's images s Bilder - + All Images Alle Bilder - + Only new Nur neue - - + + Own Images Eigene Bilder - + More Mehr @@ -613,32 +643,32 @@ Aktualisieren - + profile id Profil-Nummer - + Description Beschreibung - + Location Ort - + Posts Beiträge - + URL Profilseite - + Created at Erstellt @@ -714,27 +744,26 @@ Personen nehmen vielleicht teil. - + yes ja - + no nein - + maybe vielleicht - + seconds Sekunden - @@ -744,53 +773,64 @@ + ago her - + minute Minute - + minutes Minuten - + hour Stunde - + hours Stunden - + day Tag - + days Tage - + month Monat - + months Monate - + years + + service + + + + + Error + Fehler + + diff --git a/source-android/translations/friendiqa-es.qm b/source-android/translations/friendiqa-es.qm index f2e5dc3..4bd80da 100644 Binary files a/source-android/translations/friendiqa-es.qm and b/source-android/translations/friendiqa-es.qm differ diff --git a/source-android/translations/friendiqa-es.ts b/source-android/translations/friendiqa-es.ts index 34d2d15..1b22144 100644 --- a/source-android/translations/friendiqa-es.ts +++ b/source-android/translations/friendiqa-es.ts @@ -17,76 +17,76 @@ ConfigTab - - - + + + User Usuario - + Server Servidor - + Nickname - + Password Contraseña - + Image dir. Dir. de imágenes - + Max. News Nº Max. de noticias. - + News as Noticias como - + Interval (0=None) Intervalo (0=ningún) - - - + + + Error Error - + Nickname not registered at given server! - + Confirm Confirmar - + No server given! ¡Servidor no encontrado! - + No nickname given! - + Nickname not registered at given server! @@ -95,42 +95,42 @@ ¡Usuario incorrecto! - + No password given! ¡Contraseña incorrecta! - + No image directory given! ¡No se ha encontrado el directorio de imágenes! - + No maximum news number given! ¡Nº máximo de noticias incorrecto! - + Wrong password! - + Success - + Name - + Timeline Cronología - + Conversations Conversaciones @@ -189,12 +189,12 @@ Amigos - + Contacts Contactos - + Groups Grupos @@ -202,32 +202,37 @@ ImageUploadDialog - + + Upload to album + + + + Album álbum - + Image imagen - + Description Descripción - + Upload Subir - + Error Error - + No album name given ¡Nombre del álbum no encontrado! @@ -235,17 +240,17 @@ MessageSend - + Title (optional) Título (opcional) - + Error Error - + Only one attachment supported at the moment. Remove other attachment first! Solo se admite adjuntar un solo archivo en este momento. @@ -259,30 +264,55 @@ Descargar la imagen del perfil para - + More Mas - + Timeline Cronología - + + Error + Error + + + Favorites Favoritos - + Conversations Conversaciones - + + Public timeline + + + + + Direct Messages + + + + Notifications Notificaciones + + + Group news + + + + + Quit + + Newsitem @@ -292,77 +322,77 @@ Asistiendo: - + Source: Fuente: - + Direct Message Mensaje directo - + In reply to En respuesta a - + comments comentarios - + Attending: Asistiendo: - + Reply Respuesta - + DM Mensaje directo - + Repost Volver a publicar - + Success! éxito! - + Conversation Conversación - + Attending Asistiendo - + yes si - + maybe quizás - + no no - + Delete Borrar @@ -383,28 +413,28 @@ PhotoTab - + 's images s Imágenes - + All Images - + Only new - - + + Own Images Mis imágenes - + More Mas @@ -602,32 +632,32 @@ - + profile id - + Description Descripción - + Location Localización - + Posts Mensajes - + URL URL - + Created at Creado en @@ -703,27 +733,26 @@ Personas que pueden asistir. - + yes si - + no no - + maybe quizás - + seconds Segundos - @@ -733,53 +762,64 @@ + ago hace - + minute Minuto - + minutes Minutos - + hour Hora - + hours Horas - + day Dia - + days Dias - + month Mes - + months Meses - + years Años + + service + + + + + Error + Error + + diff --git a/source-android/translations/friendiqa-it.qm b/source-android/translations/friendiqa-it.qm index ab27823..4dfcf94 100644 Binary files a/source-android/translations/friendiqa-it.qm and b/source-android/translations/friendiqa-it.qm differ diff --git a/source-android/translations/friendiqa-it.ts b/source-android/translations/friendiqa-it.ts index 0be61b7..658670b 100644 --- a/source-android/translations/friendiqa-it.ts +++ b/source-android/translations/friendiqa-it.ts @@ -17,76 +17,76 @@ ConfigTab - - - + + + User Utente - + Server Server - + Nickname - + Password Password - + Image dir. Directory immagini - + Max. News Nº Max. di notizie - + News as News come - + Interval (0=None) Intervallo (0=nessuno) - - - + + + Error Errore - + Nickname not registered at given server! - + Confirm Conferma - + No server given! Nessun server inserito! - + No nickname given! - + Nickname not registered at given server! @@ -95,42 +95,42 @@ Nessun utente inserito! - + No password given! Nessuna password inserita! - + No image directory given! Nessuna directory immagini inserita! - + No maximum news number given! Nessun numero massimo di news inserito! - + Wrong password! - + Success - + Name - + Timeline Cronologia - + Conversations Conversazioni @@ -189,12 +189,12 @@ Amici - + Contacts Contatti - + Groups Gruppi @@ -202,32 +202,37 @@ ImageUploadDialog - + + Upload to album + + + + Album Album - + Image Immagine - + Description Descrizione - + Upload Carica - + Error Errore - + No album name given Nessun nome album inserito! @@ -235,17 +240,17 @@ MessageSend - + Title (optional) Titolo (opzionale) - + Error Errore - + Only one attachment supported at the moment. Remove other attachment first! Solo un allegato è attualmente supportato. @@ -259,30 +264,55 @@ Download immagine profilo per - + More Ancora - + Timeline Cronologia - + + Error + Errore + + + Favorites Favoriti - + Conversations Conversazioni - + + Public timeline + + + + + Direct Messages + + + + Notifications Notifiche + + + Group news + + + + + Quit + + Newsitem @@ -292,77 +322,77 @@ attendere: - + Source: Codice: - + Direct Message Messaggio diretto - + In reply to In risposta a - + comments commenti - + Attending: Attendi: - + Reply Risposta - + DM Messaggio diretto - + Repost Condividi - + Success! Ha funzionato! - + Conversation Conversazione - + Attending Attendi - + yes si - + maybe potrebbe - + no no - + Delete Cancella @@ -383,28 +413,28 @@ PhotoTab - + 's images Immagini - + All Images - + Only new - - + + Own Images Mie immagini - + More Ancora @@ -602,32 +632,32 @@ - + profile id - + Description Descrizione - + Location Località - + Posts Messaggi - + URL URL - + Created at Creato il @@ -703,27 +733,26 @@ Persone che possono attendere. - + yes si - + no no - + maybe potrebbe - + seconds secondi - @@ -733,53 +762,64 @@ + ago fa - + minute minuti - + minutes minuti - + hour ora - + hours ore - + day giorno - + days giorni - + month mese - + months mesi - + years anni + + service + + + + + Error + Errore + + diff --git a/source-linux/application.qrc b/source-linux/application.qrc index 6cfb777..a68f0f1 100644 --- a/source-linux/application.qrc +++ b/source-linux/application.qrc @@ -217,5 +217,9 @@ js/image.js qml/contactqml/ProfileComponent.qml translations/friendiqa-it.ts + qml/genericqml/Search.qml + qml/newsqml/Hashtag.qml + qml/genericqml/IntentReceiver.qml + diff --git a/source-linux/common/filesystem.cpp b/source-linux/common/filesystem.cpp index ef27ee7..c1668e4 100644 --- a/source-linux/common/filesystem.cpp +++ b/source-linux/common/filesystem.cpp @@ -73,6 +73,10 @@ QString FILESYSTEM::homePath() const // return dir.exists(); //} +bool FILESYSTEM::fileexist(QString name) +{ return QFile::exists(name); +} + void FILESYSTEM::makeDir(QString name) { QDir dir(m_Directory); diff --git a/source-linux/common/filesystem.h b/source-linux/common/filesystem.h index 5f56f2a..c8baae8 100644 --- a/source-linux/common/filesystem.h +++ b/source-linux/common/filesystem.h @@ -65,6 +65,7 @@ signals: void error(QString data, int code); public slots: + bool fileexist(QString name); void makeDir(QString name); void rmDir(); void rmFile(QString name); diff --git a/source-linux/common/xhr.cpp b/source-linux/common/xhr.cpp index dbb872a..2a9107f 100644 --- a/source-linux/common/xhr.cpp +++ b/source-linux/common/xhr.cpp @@ -59,6 +59,14 @@ void XHR::setUrl(QString url) } } +void XHR::setApi(QString api) +{ + if (api!=m_api) { + m_api = api; + emit apiChanged(); + } +} + void XHR::setLogin(QString login) { if (login!=m_login) { @@ -111,6 +119,11 @@ QString XHR::url() const return m_url; } +QString XHR::api() const +{ + return m_api; +} + QString XHR::login() const { return m_login; @@ -166,6 +179,7 @@ void XHR::download() request.setRawHeader("Authorization", headerData.toLocal8Bit()); } request.setUrl(requrl); + //qDebug() << requrl; reply = manager.get(request); reply->ignoreSslErrors(); connect(reply, &QNetworkReply::readyRead,this, &XHR::onReadyRead); @@ -185,9 +199,9 @@ void XHR::get() query.addQueryItem(i.key(), i.value()); } - QUrl requrl(m_url); + QUrl requrl(m_url+m_api); + //qDebug() << requrl; requrl.setQuery(query); - QByteArray loginData = m_login.toLocal8Bit().toBase64(); QString headerData = "Basic " + loginData; request.setRawHeader("Authorization", headerData.toLocal8Bit()); @@ -250,7 +264,7 @@ void XHR::post() QString headerData = "Basic " + loginData; request.setRawHeader(QByteArray("Authorization"), headerData.toLocal8Bit()); - request.setUrl(m_url); + request.setUrl(m_url+m_api); reply = manager.post(request, multiPart); qDebug() << "\t request sent"; connect(reply, &QNetworkReply::finished, this, &XHR::onReplySuccess); @@ -263,7 +277,7 @@ void XHR::post() void XHR::onReplyError(QNetworkReply::NetworkError code) { qDebug() << code; - emit this->error( bufferToString(), m_url, (int) code); + emit this->error( bufferToString(), m_url,m_api, (int) code); buffer.clear(); reply->deleteLater(); } @@ -271,7 +285,7 @@ void XHR::onReplyError(QNetworkReply::NetworkError code) void XHR::onReplySuccess() { qDebug() << "!"; - emit this->success( bufferToString() ); + emit this->success( bufferToString(), m_api); buffer.clear(); // reply->deleteLater(); } @@ -279,7 +293,7 @@ void XHR::onReplySuccess() void XHR::onRequestFinished() { // Save the file here - if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,1);} + if (buffer.isNull()){qDebug() << "File empty"<error(m_downloadtype,m_url,m_api,1);} else if (m_downloadtype=="picturelist") { QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer); QJsonObject jsonObject = jsonResponse.object(); diff --git a/source-linux/common/xhr.h b/source-linux/common/xhr.h index f2e0bb6..f111d59 100644 --- a/source-linux/common/xhr.h +++ b/source-linux/common/xhr.h @@ -56,6 +56,7 @@ public: explicit XHR(QObject *parent = 0); QString url() const; + QString api() const; QString login() const; QString filename() const; QList contactlist() const; @@ -65,6 +66,7 @@ public: signals: void urlChanged(); + void apiChanged(); void loginChanged(); void filenameChanged(); void contactlistChanged(); @@ -73,11 +75,12 @@ signals: void downloadtypeChanged(); void downloaded(QString type, QString url, QString filename, int i); void downloadedjson(QString type, QString url, QString filename, int i,QJsonObject jsonObject); - void success(QString data); - void error(QString data, QString url, int code); + void success(QString data, QString api); + void error(QString data, QString url,QString api, int code); public slots: void setUrl(QString url); + void setApi(QString api); void setLogin(QString login); void setDownloadtype(QString downloadtype); void setFilename(QString filename); @@ -103,6 +106,7 @@ private slots: private: QByteArray buffer; QString m_url; + QString m_api; QString m_login; QString m_filename; QString m_downloadtype; diff --git a/source-linux/friendiqa.pro b/source-linux/friendiqa.pro index 3449516..dc04c6b 100644 --- a/source-linux/friendiqa.pro +++ b/source-linux/friendiqa.pro @@ -51,3 +51,4 @@ DISTFILES += \ qml/photoqml/*.qml \ qml/configqml/*.qml \ js/*.js \ + qml/newsqml/Hashtag.qml diff --git a/source-linux/js/helper.js b/source-linux/js/helper.js index d949a81..3730c72 100644 --- a/source-linux/js/helper.js +++ b/source-linux/js/helper.js @@ -37,7 +37,7 @@ function friendicaRequest(login,api,rootwindow,callback) { xhrequest.onreadystatechange = function() { if(xhrequest.readyState === XMLHttpRequest.DONE) { try{ - if (xhrequest.status=200){ + if (xhrequest.status==200){ callback(xhrequest.responseText) }else{ showMessage("Error","API:\n" +login.server+api+"\n NO RESPONSE"+xhrequest.statusText,rootwindow); @@ -65,7 +65,7 @@ function friendicaPostRequest(login,api,data,method,rootwindow,callback) { callback(xhrequest.responseText) } } - catch (e){showMessage("Error", "API:\n" + +api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)} + catch (e){showMessage("Error", "API:\n" + api+" "+e+"\n Return:"+xhrequest.responseText,rootwindow)} } } xhrequest.open(method, login.server+api,true,login.username,Qt.atob(login.password)); @@ -151,7 +151,7 @@ var where = " AND "+ filter +" = '" + filtervalue+"'"; }); } -function showMessage(header,message,rootwindow){//print("message: "+message); +function showMessage(header,message,rootwindow){print("message: "+message); var cleanmessage=message.replace(/"/g,"-"); //print(cleanmessage); if(cleanmessage.length>200){cleanmessage=cleanmessage.slice(0,200)+'...'} var messageString='import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:"'+header+'";standardButtons: StandardButton.Ok; text:" '+cleanmessage+'"}'; diff --git a/source-linux/js/news.js b/source-linux/js/news.js index 9e53bfe..e01dcb8 100644 --- a/source-linux/js/news.js +++ b/source-linux/js/news.js @@ -38,7 +38,7 @@ function requestFriends(login,database,rootwindow,callback){ var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]); db.transaction( function(tx) { var result = tx.executeSql('UPDATE contacts SET isFriend=0 where username="'+login.username+'"')}); // clean old friends - Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){ + Helperjs.friendicaRequest(login,"/api/statuses/friends?count=9999", rootwindow,function (obj){ var friends=JSON.parse(obj); for (var i=0;i0){ + if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.like.length>0){ for (var j=0;j0){ + if (news[i].hasOwnProperty('friendica_activities') && news[i].friendica_activities.dislike.length>0){ for (var k=0;j0){var helpernews=newsrs.rows.item(0); + var newscount=newsrs.rows.length; + helpernews=fetchUsersForNews(database,user,helpernews,allcontacts); + helpernews.statusnet_html=Qt.atob(helpernews.statusnet_html); + helpernews.text=Qt.atob(helpernews.text); + helpernews.id=helpernews.status_id; + if (helpernews.attachments!==null){helpernews.attachments=JSON.parse(Qt.atob(helpernews.attachments))}; + callback(helpernews,newscount);} +// var conversationobject={news:helpernews,newscount:newscount}; +// return conversationobject; +})} + + + + +function getAllContacts(database,user){ + var allcontacts=[]; + Helperjs.readData(database,"contacts",user,function(obj){ + allcontacts=obj; + for (var n in allcontacts){ + allcontacts[n].name=Qt.atob(allcontacts[n].name); + allcontacts[n].description=Qt.atob(allcontacts[n].description) + } + }); + return allcontacts; +} + function inArray(list, prop, val) { if (list.length > 0 ) { for (var i in list) {if (list[i][prop] == val) { diff --git a/source-linux/js/newsworker.js b/source-linux/js/newsworker.js index a738ff8..6f10e77 100644 --- a/source-linux/js/newsworker.js +++ b/source-linux/js/newsworker.js @@ -41,49 +41,50 @@ else{ if (msg.news[j]) { var newsitemobject=msg.news[j]; //print("Newsitem"+JSON.stringify(newsitemobject.friendica_owner+" userid: "+newsitemobject.user.id)); - if (newsitemobject.messagetype==2){ - newsitemobject.user={}; - newsitemobject.user.profile_image=""; - newsitemobject.user.profile_image_url=""; - newsitemobject.user.name=""; - } - var forumname="";try{if (newsitemobject.messagetype==0&&((newsitemobject.friendica_owner)!=(newsitemobject.user.url))){ +// if (newsitemobject.messagetype==2){ +// newsitemobject.user={}; +// newsitemobject.user.profile_image=""; +// newsitemobject.user.profile_image_url=""; +// newsitemobject.user.name=""; +// } + var forumname="";try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_owner')&&((newsitemobject.friendica_owner.url)!=(newsitemobject.user.url))){ //print(newsitemobject.friendica_owner+" Friendica Owner "+JSON.stringify(newsitemobject)); - forumname=" via "+Qt.atob(newsitemobject.friendica_owner_object.name) + forumname=" via "+newsitemobject.friendica_owner.name }}catch(e){print("forum name "+e)} var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={}; - try{if (newsitemobject.messagetype==0){ - if (newsitemobject.like.length>0){ - if (newsitemobject.like.length==1){likeText= Qt.atob(newsitemobject.like[0].name)+" "+ qsTr("likes this.")} - else {likeText= newsitemobject.like.length+" "+ qsTr("like this.")} + try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){ + if (newsitemobject.friendica_activities.like.length>0){ + if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")} + else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")} } - if (newsitemobject.dislike.length>0){ - if (newsitemobject.dislike.length==1){dislikeText= Qt.atob(newsitemobject.dislike[0].name)+" "+ qsTr("doesn't like this.")} - else {dislikeText= newsitemobject.dislike.length+" "+ qsTr("don't like this.")} + if (newsitemobject.friendica_activities.dislike.length>0){ + if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")} + else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")} } - if (newsitemobject.attendyes.length>0){ - if (newsitemobject.attendyes.length==1){attendyesText= Qt.atob(newsitemobject.attendyes[0].name)+" "+ qsTr("will attend.")} - else {attendyesText= newsitemobject.attendyes.length+" "+ qsTr("persons will attend.")} + if (newsitemobject.friendica_activities.attendyes.length>0){ + if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")} + else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")} } - if (newsitemobject.attendno.length>0){ - if (newsitemobject.attendno.length==1){attendnoText= Qt.atob(newsitemobject.attendno[0].name)+" "+ qsTr("will not attend.")} - else {attendnoText= newsitemobject.attendno.length+" "+ qsTr("persons will not attend.")} + if (newsitemobject.friendica_activities.attendno.length>0){ + if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")} + else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")} } - if (newsitemobject.attendmaybe.length>0){ - if (newsitemobject.attendmaybe.length==1){attendmaybeText= Qt.atob(newsitemobject.attendmaybe[0].name)+" "+ qsTr("may attend.")} - else {attendmaybeText= newsitemobject.attendmaybe.length+" "+ qsTr("persons may attend.")} + if (newsitemobject.friendica_activities.attendmaybe.length>0){ + if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")} + else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")} } //var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self); + if (newsitemobject.hasOwnProperty("friendica_activities_self")){ if (newsitemobject.friendica_activities_self.indexOf(3)!=-1){self.attending=qsTr("yes")} if (newsitemobject.friendica_activities_self.indexOf(4)!=-1){self.attending=qsTr("no")} if (newsitemobject.friendica_activities_self.indexOf(5)!=-1){self.attending=qsTr("maybe")} if (newsitemobject.friendica_activities_self.indexOf(1)!=-1){self.liked=1} if (newsitemobject.friendica_activities_self.indexOf(2)!=-1){self.disliked=1} - }} catch(e){print("Activities "+e)} + }}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))} var friendica_activities={likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText,self:self} var attachmentList=[];try{if(newsitemobject.attachments){ - var attachArray=JSON.parse(Qt.atob(newsitemobject.attachments)); + var attachArray=newsitemobject.attachments; for (var image in attachArray){if(attachArray[image].mimetype=="image/gif"){ attachmentList.push(attachArray[image]) } diff --git a/source-linux/js/service.js b/source-linux/js/service.js index f77ee3d..c31b2f6 100644 --- a/source-linux/js/service.js +++ b/source-linux/js/service.js @@ -1,5 +1,4 @@ -// This file is part of Friendiqa -// https://github.com/lubuwest/Friendiqa +// 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 @@ -338,50 +337,6 @@ function cleanContacts(login,database,callback){ }) } -function processNews(callback){ - if (contactLoadType=="news"){ - if(root.news.length==0){} - else{// show news - Newsjs.storeNews(login,db,news,root,function(dbnews){ - if(login.newsViewType=="Timeline"){ - Newsjs.newsfromdb(db,login.username,function(dbnews){ - root.newsSignal(dbnews); - newstab.newstabstatus=login.newsViewType}) - } - else{ - Newsjs.chatsfromdb(db,login.username,function(dbnews){ - root.newsSignal(dbnews); - newstab.newstabstatus=login.newsViewType}) - } - }) - } - } - else if (contactLoadType=="friends"){// show friends - root.friendsSignal(login.username); - Newsjs.getCurrentContacts(login,db,function(contacts){ - contactlist=contacts; - })} - - else if (contactLoadType=="conversation"){ - var conversationid=news[0].statusnet_conversation_id - if (!isNaN(parseInt(conversationid))){//no directmessage conversation - Newsjs.storeNews(root.login,root.db,news,root,function(){ - Newsjs.conversationfromdb(db,root.login.username,conversationid, function(newsarray){ - newstab.conversation=newsarray; - }) - })} - else {newstab.conversation=news}//only DM conversations from database - } - else if (contactLoadType=="favorites"){//show favorited news - Newsjs.storeNews(root.login,root.db,news,root,function(){ - Newsjs.favoritesfromdb(db,login.username,function(newsarray){ - root.newsSignal(newsarray); - newstab.newstabstatus="Favorites"; - }) - })} - callback() -} - function updateContactInDB(login,database,isFriend,contact){// for newstab and friendstab var currentTime=Date.now(); var image_timestamp=0; @@ -393,8 +348,217 @@ function updateContactInDB(login,database,isFriend,contact){// for newstab and f var result; result = tx.executeSql('SELECT * from contacts where username="'+login.username+'" AND url = "'+contact.url+'"'); // check for news url if(result.rows.length === 1) {// use update - result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ Date.parse(Newsjs.cleanDate(contact.created_at))+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ currentTime+' where username="'+login.username+'" AND url="'+contact.url+'"'); + result = tx.executeSql('UPDATE contacts SET id='+contact.id+', name="'+Qt.btoa(contact.name)+'", screen_name="'+contact.screen_name+'", location="'+contact.location+'",imageAge='+currentTime+', profile_image_url="'+contact.profile_image_url+'", description="'+Qt.btoa(contact.description)+'", protected="'+contact.protected+'", followers_count='+contact.followers_count+', friends_count='+contact.friends_count+', created_at="'+ contact.created_at+'", favourites_count="'+contact.favorites_count+'", utc_offset="'+contact.utc_offset+'", time_zone="'+contact.time_zone+'", statuses_count='+contact.statuses_count+', following="'+contact.following+'", verified ="'+contact.verified+'", statusnet_blocking="'+contact.statusnet_blocking+'", notifications="'+contact.notifictions+'", statusnet_profile_url="'+contact.statusnet_profile_url+'", cid='+contact.cid+', network="'+contact.network+'", isFriend='+isFriend+', timestamp='+ currentTime+' where username="'+login.username+'" AND url="'+contact.url+'"'); } else {// use insert - result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),"",contact.url,contact.protected,contact.followers_count, contact.friends_count,Date.parse(Newsjs.cleanDate(contact.created_at)),contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} + result = tx.executeSql('INSERT INTO contacts VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [login.username,contact.id,Qt.btoa(contact.name),contact.screen_name,contact.location,currentTime,contact.profile_image_url, Qt.btoa(contact.description),"",contact.url,contact.protected,contact.followers_count, contact.friends_count,contact.created_at,contact.favorites_count,contact.utc_offset,contact.time_zone,contact.statuses_count,contact.following,contact.verfied,contact.statusnet_blocking,contact.notifications,contact.statusnet_profile_url,contact.cid,contact.network,isFriend,image_timestamp]);} }); } + +function processNews(api,data){ + try{var newslist=JSON.parse(data); + } catch(e){ + Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)}; + if (typeof(newslist)=='undefined'){ + Helperjs.showMessage(qsTr("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))){ + replytimer.restart() + } else { + var allcontacts=[]; + allcontacts=Newsjs.getAllContacts(db,login.username); + if (api=="/api/direct_messages/all"){ + for (var n in newslist){ + newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at)); + newslist[n].messagetype=1; + newslist[n].source=" Friendica"; + newslist[n].status_id=newslist[n].id; + newslist[n].uid=newslist[n].sender.id; + newslist[n].statusnet_conversation_id=newslist[n].friendica_parent_uri; + newslist[n].user=cleanUser(newslist[n].sender); + newslist[n].statusnet_html=newslist[n].text; + }} + else if (api=="/api/friendica/notifications"){ + for (var n in newslist){ + newslist[n].created_at=Date.parse(newslist[n].date); + newslist[n].messagetype=2; + newslist[n].user=Newsjs.objFromArray(allcontacts,"url",newslist[n].url) + if (newslist[n].user==false){ + newslist[n].user={"profile_image_url": newslist[n].photo,"name": newslist[n].name," url":newslist[n].url, "created_at":newslist[n].date}; + newslist[n].user=cleanUser(newslist[n].user); + } + newslist[n].statusnet_html=newslist[n].msg_html; + } + } else { + var chatlist=[]; + var conversationIds=[]; + var commentCount=[]; + for (var n in newslist){ + newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at)); + newslist[n].messagetype=0; + newslist[n].user=cleanUser(newslist[n].user) + if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)} + //print (JSON.stringify(newslist[n].user)) + if(newslist[n].hasOwnProperty('friendica_activities')){ + for (var m in newslist[n].friendica_activities.like){ + newslist[n].friendica_activities.like[m]=cleanUser(newslist[n].friendica_activities.like[m]); + } + for (var o in newslist[n].friendica_activities.dislike){ + newslist[n].friendica_activities.dislike[o]=cleanUser(newslist[n].friendica_activities.dislike[o]); + } + for (var p in newslist[n].friendica_activities.attendyes){ + newslist[n].friendica_activities.attendyes[p]=cleanUser(newslist[n].friendica_activities.attendyes[p]); + } + for (var q in newslist[n].friendica_activities.attendno){ + newslist[n].friendica_activities.attendno[q]=cleanUser(newslist[n].friendica_activities.attendno[q]); + } + for (var r in newslist[n].friendica_activities.attendmaybe){ + newslist[n].friendica_activities.attendmaybe[r]=cleanUser(newslist[n].friendica_activities.attendmaybe[r]); + } + } + if(!(newslist[n].hasOwnProperty('friendica_owner'))){ + newslist[n].friendica_owner=newslist[n].user + } + var conversationindex=conversationIds.indexOf(newslist[n].statusnet_conversation_id); + + //fill chatlist + if (conversationindex==-1){ + chatlist.push(newslist[n]); + conversationIds.push(newslist[n].statusnet_conversation_id); + commentCount.push(1); + } else{ + commentCount[conversationindex]=commentCount[conversationindex]+1; + chatlist[conversationindex]=newslist[n]; + } + } + //enrich chatlist with old entries + + for (var count in chatlist){ //print("chat "+JSON.stringify(chatlist[count])+" count: "+commentCount[count]) + //chatlist[count].newscount=commentCount[count] + if (chatlist[count].id_str!==chatlist[count].statusnet_conversation_id){ + try{ + Newsjs.oldchatfromdb(db,login.username,chatlist[count].statusnet_conversation_id,chatlist[count].id,allcontacts,function(oldpost,oldcount){ + chatlist[count]=oldpost; + chatlist[count].newscount=oldcount+commentCount[count]; + //print("JSON "+chatlist[count].statusnet_conversation_id+" "+chatlist[count].id+JSON.stringify(oldpost)) + }) + }catch(e){print(e)} + } + else{chatlist[count].newscount=commentCount[count]} + } + } + + + if (api=="/api/conversation/show"){ + newslist.reverse(); + newstab.conversation=newslist + } + else if (newstab.newstabstatus==="Conversations"){ + showNews(chatlist);root.news=newslist} + else {showNews(newslist);root.news=newslist}; + + var newstabarray=["Conversations","Favorites","Timeline","DirectMessage"]; + if (newstabarray.indexOf(newstab.newstabstatus)>-1){contacttimer.start()} + } +} + + +function cleanUser(user){ + user.created_at=Date.parse(Newsjs.cleanDate(user.created_at)); + var imagehelper1=user.profile_image_url.split("?"); + var imagehelper2=imagehelper1[0].substring(imagehelper1[0].lastIndexOf("/")+1,imagehelper1[0].length); + var imagehelper3=login.imagestore+"contacts/"+user.screen_name+"-"+imagehelper2 + if(filesystem.fileexist(imagehelper3)){user.profile_image=imagehelper3}else {user.profile_image=""} + return user +} + +function updateView(viewtype){ + newsBusy.running=true; + //downloadNotice.text="xhr start "+Date.now() + switch(viewtype){ + case "Conversations": + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + break; + case "Timeline": + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + break; + case "Search": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/search"); + break; + case "Notifications": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/friendica/notifications"); + xhr.clearParams(); + break; + case "Direct Messages": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/all"); + xhr.clearParams(); + break; + case "Public Timeline": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/public_timeline"); + xhr.clearParams(); + break; + case "Favorites": + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/favorites"); + xhr.clearParams(); + break; + default: + var lastnews=Newsjs.getLastNews(login,db); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/friends_timeline"); + xhr.clearParams(); + xhr.setParam("since_id",lastnews); + xhr.setParam("count",50) + newstab.newstabstatus="Conversations"; + } + xhr.get(); + if (viewtype==="Conversations"){Newsjs.allchatsfromdb(db,login.username,function(temp){ + newsStack.allchats=temp + })} +} + +function showGroups(){ + Helperjs.readData(db,"groups",login.username,function(groups){ + var groupitems=""; + for (var i=0;iFriendiqa v0.2
Licensed under GPL 3 with the exception of OpenSSL
"+ + text: "Friendiqa v0.3
Licensed under GPL 3 with the exception of OpenSSL
"+ "Profile https://freunde.ma-nic.de/profile/friendiqa
"+ "Sourcecode: https://github.com/LubuWest/Friendiqa
"+ "C++ code by Fabio
"+ diff --git a/source-linux/qml/contactqml/ContactDetailsComponent.qml b/source-linux/qml/contactqml/ContactDetailsComponent.qml index 9c97def..45d3767 100644 --- a/source-linux/qml/contactqml/ContactDetailsComponent.qml +++ b/source-linux/qml/contactqml/ContactDetailsComponent.qml @@ -37,7 +37,7 @@ Item { id: contactLargeComponent x:mm y:mm -property var contact:{} +property var contact:({}) property var createdAtDate: new Date(contact.created_at) property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend!=0)?"":( ""+qsTr("Connect")+"
") @@ -63,7 +63,7 @@ Rectangle { x: mm width: root.width-6*mm //friendsTabView.width-4*mm height: 3*mm - text:Qt.atob(contact.name)+" (@"+contact.screen_name+")" + text:contact.name+" (@"+contact.screen_name+")" elide:Text.ElideRight anchors.topMargin: 0 anchors.left: photoImage.left @@ -91,7 +91,7 @@ Rectangle{ font.pixelSize: 3*mm textFormat:Text.RichText wrapMode: Text.Wrap - text:""+qsTr("Description")+": "+Qt.atob(contact.description)+"
"+qsTr("Location")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ + text:""+qsTr("Description")+": "+contact.description+"
"+qsTr("Location")+": "+contact.location+"
"+qsTr("Posts")+": "+contact.statuses_count+ "
"+qsTr("URL")+": "+contact.url+"
"+ connectUrl+ ""+qsTr("Created at")+": "+createdAtDate.toLocaleString(Qt.locale()) onLinkActivated: { @@ -123,7 +123,7 @@ Rectangle{ text: "\uf0e6" //"Messages" onClicked:{ root.currentIndex=0; - newstab.active=true; + //newstab.active=true; root.messageSignal(contact) ; contactLargeComponent.destroy(); } @@ -135,7 +135,7 @@ Rectangle{ text: "\uf040" //"DM" onClicked:{ root.currentIndex=0; - newstab.active=true; + //newstab.active=true; root.directmessageSignal(contact.screen_name); contactLargeComponent.destroy(); } diff --git a/source-linux/qml/contactqml/FriendsTab.qml b/source-linux/qml/contactqml/FriendsTab.qml index 03a3144..db32907 100644 --- a/source-linux/qml/contactqml/FriendsTab.qml +++ b/source-linux/qml/contactqml/FriendsTab.qml @@ -126,6 +126,8 @@ Rectangle { try {friendsModel.clear()} catch(e){print(e)}; Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){ for (var i=0;i1){ friendsobject[i].screen_name=friendsobject[i].screen_name+"+"+friendsobject[i].cid } @@ -205,6 +207,8 @@ Rectangle { try {contactsModel.clear()} catch(e){print(e)}; Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){ for (var j=0;j +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +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 + + +Item { + id:searchComponent + onVisibleChanged: if (visible) searchText.forceActiveFocus() +// border.color: "#EEEEEE" +// border.width: 1 +// color:"lightgrey" +// width:conversationView.width +// height:Math.max(replyText.contentHeight+2*mm,6*mm) + Rectangle{ + color: "white" + radius:0.5*mm + anchors.left: parent.left + anchors.leftMargin:mm + anchors.top:parent.top + anchors.topMargin: 0.5*mm + width:parent.width-2*mm + height:Math.max( searchText.contentHeight,5*mm) + + TextInput { + id: searchText + font.pixelSize: 3*mm + wrapMode: Text.Wrap + anchors.fill: parent + selectByMouse: true + cursorVisible: false + onEditingFinished: search(displayText) + //onHeightChanged: newsView.contentY+=4.5*mm + } + +// BlueButton { +// id: sendButton +// text: "\uf002" +// anchors.left: parent.right +// anchors.leftMargin:mm +// anchors.top:parent.top +// //anchors.topMargin: 0.5*mm +// color:"white" +// onClicked: { +// var body=searchText.getText(0,searchText.length); +// search(body) +// } +// } + } +} diff --git a/source-linux/qml/newsqml/Conversation.qml b/source-linux/qml/newsqml/Conversation.qml index 7231358..0324290 100644 --- a/source-linux/qml/newsqml/Conversation.qml +++ b/source-linux/qml/newsqml/Conversation.qml @@ -126,14 +126,19 @@ Rectangle { xhr.clearParams(); xhr.setLogin(login.username+":"+Qt.atob(login.password)); if (conversationModel.get(0).newsitemobject.messagetype==0){ + + //xhr.url= login.server + "/api/statuses/update.json"; + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/update"); xhr.setParam("source", "Friendiqa"); - xhr.url= login.server + "/api/statuses/update.json"; xhr.setParam("status", body); - xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.status_id)} - else {xhr.url= login.server + "/api/direct_messages/new.json"; + xhr.setParam("in_reply_to_status_id", conversationModel.get(conversationModel.count-1).newsitemobject.id)} + else {//xhr.url= login.server + "/api/direct_messages/new.json"; + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/new"); xhr.setParam("text", body); xhr.setParam("screen_name",conversationModel.get(conversationModel.count-1).newsitemobject.screen_name); - xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.status_id) + xhr.setParam("replyto", conversationModel.get(conversationModel.count-1).newsitemobject.id) } xhr.post(); } catch(e){Helperjs.showMessage("Error",e.toString(),root)} diff --git a/source-linux/qml/newsqml/FriendicaActivities.qml b/source-linux/qml/newsqml/FriendicaActivities.qml index 02a189f..e235518 100644 --- a/source-linux/qml/newsqml/FriendicaActivities.qml +++ b/source-linux/qml/newsqml/FriendicaActivities.qml @@ -77,7 +77,7 @@ Rectangle { font.pixelSize: 3*mm anchors.left: contactImage.right anchors.margins: 1*mm - text:Qt.atob(contact.name) + text:contact.name } MouseArea{ diff --git a/source-linux/qml/newsqml/Hashtag.qml b/source-linux/qml/newsqml/Hashtag.qml new file mode 100644 index 0000000..27584c0 --- /dev/null +++ b/source-linux/qml/newsqml/Hashtag.qml @@ -0,0 +1,51 @@ +// This file is part of Friendiqa +// https://github.com/lubuwest/Friendiqa +// Copyright (C) 2017 Marco R. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// In addition, as a special exception, the copyright holders give +// permission to link the code of portions of this program with the +// OpenSSL library under certain conditions as described in each +// individual source file, and distribute linked combinations including +// the two. +// +// You must obey the GNU General Public License in all respects for all +// of the code used other than OpenSSL. If you modify file(s) with this +// exception, you may extend this exception to your version of the +// file(s), but you are not obligated to do so. If you do not wish to do +// so, delete this exception statement from your version. If you delete +// this exception statement from all source files in the program, then +// also delete it here. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import QtQuick 2.0 + +Rectangle { + id:hasgtagRectangle + color: "light grey" + property alias text: hashtagText.text + radius:0.3*mm + width:hashtagText.contentWidth+mm + height:2.5* mm + Text{ + id:hashtagText + font.pixelSize: 1.5*mm + anchors.centerIn: parent + anchors.margins: 0.5*mm + } + MouseArea{ + anchors.fill: parent + onClicked:{search(hashtagText.text.replace("#",""))} + } +} diff --git a/source-linux/qml/newsqml/MessageSend.qml b/source-linux/qml/newsqml/MessageSend.qml index 935960f..d730b82 100644 --- a/source-linux/qml/newsqml/MessageSend.qml +++ b/source-linux/qml/newsqml/MessageSend.qml @@ -39,12 +39,11 @@ import "qrc:/js/smiley.js" as Smileyjs import "qrc:/qml/genericqml" -Flickable{ +Rectangle{ + color:"white" width:root.width-5*mm height:root.height-12*mm - contentHeight: messageColumn.height - boundsBehavior: Flickable.StopAtBounds - id:messageSend + //anchors.fill: parent property string parentId: "" property string reply_to_user:"" property alias bodyMessage: bodyField.text @@ -57,15 +56,17 @@ Flickable{ property var group_allow:login.permissions[2] property var group_deny:login.permissions[3] - function attachImage(url){ + function attachImage(url){ print("attachImage "+url) var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+ url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+ url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage"); } function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) { - xhr.url= login.server + "/api/statuses/update.json"; + //xhr.url= login.server + "/api/statuses/update.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/statuses/update"); xhr.clearParams(); xhr.setParam("source", "Friendiqa"); xhr.setParam("status", status); @@ -80,17 +81,27 @@ Flickable{ } function dmUpdate(title,text,replyto,screen_name,attachImageURL) { - xhr.url= login.server + "/api/direct_messages/new.json"; + //xhr.url= login.server + "/api/direct_messages/new.json"; xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/new"); xhr.clearParams(); xhr.setParam("text", text); xhr.setParam("screen_name", screen_name); if (parentId!="") {xhr.setParam("replyto", replyto)}; - if (title!=="") {xhr.setParam("title", title)}; + //if (title!=="") {xhr.setParam("title", title)}; xhr.post(); } - Column { + Flickable{ + anchors.fill: parent + contentHeight: messageColumn.height + boundsBehavior: Flickable.StopAtBounds + id:messageSend + + + + Column { id:messageColumn spacing: 0.5*mm width: parent.width @@ -98,7 +109,7 @@ Flickable{ id: titleField width: parent.width placeholderText: qsTr("Title (optional)") - visible: messageSend.parentId === "" + visible: parentId === "" } Rectangle{ @@ -236,3 +247,4 @@ Flickable{ } Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])} } +} diff --git a/source-linux/qml/newsqml/NewsTab.qml b/source-linux/qml/newsqml/NewsTab.qml index c8bcb15..df02d90 100644 --- a/source-linux/qml/newsqml/NewsTab.qml +++ b/source-linux/qml/newsqml/NewsTab.qml @@ -31,64 +31,98 @@ import QtQuick 2.0 import QtQuick.Controls 1.2 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.3 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 AndroidNative 1.0 Item { Connections{ target:newstab onNewstabstatusChanged:{ newstabstatusButton.text= qsTr(newstab.newstabstatus) +// switch(newstab.newstabstatus){ +// case "Timeline": newstabstatusCombo.currentIndex=1; break; +// case "Conversations":newstabstatusCombo.currentIndex=2; break; +// case "Favorites":newstabstatusCombo.currentIndex=3; break; +// case "Network":newstabstatusCombo.currentIndex=4; break; +// case "Direct Messages":newstabstatusCombo.currentIndex=5; break; +// case "Notifications":newstabstatusCombo.currentIndex=6; break; +// case "Search":newstabstatusCombo.currentIndex=7; break; +// case "Groupnews":newstabstatusCombo.currentIndex=8; break; +// } } } Connections{ target:xhr -// onError:{if (data=="contact"){downloadNotice.text=root.newContacts[root.currentContact].name+"... Error!"}} - onSuccess:{replytimer.start() //wait 1 second to load new timeline + onError:{ + Helperjs.showMessage(qsTr("Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root); + } + onSuccess:{ + // downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now(); + Service.processNews(api,data); } } - - Timer {id:replytimer; interval: 1000; running: false; repeat: false onTriggered: { if(newstab.newstabstatus=="Conversation"){ showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)} else{ - var onlynew=true; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ + Service.updateView(newstab.newstabstatus) root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) } } } + Timer {id:contacttimer; interval: 50; running: false; repeat: false + onTriggered: { + // downloadNotice.text=downloadNotice.text + "\n contactTimer start "+ Date.now() + root.newContacts=Newsjs.findNewContacts(root.news,root.contactlist); + Newsjs.storeNews(login,db,root.news,root) + } + } + + function showNews(newsToShow){ try{if (newsStack.depth>1){newsStack.pop()}}catch(e){} newsBusy.running=false; var currentTime= new Date(); - downloadNotice.text=""; - var msg = {'currentTime': currentTime, 'model': newsModel,'news':newsToShow}; + // 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}; newsWorker.sendMessage(msg); + newsStack.appendNews=false } + + function showConversation(conversationIndex,newsitemobject){ //newsBusy.running=true; root.contactLoadType="conversation"; newsStack.conversationIndex= conversationIndex; + //print(newsitemobject.id); if(newsitemobject.messagetype==0){ - Newsjs.requestConversation(root.login,db,newsitemobject.status_id,root.contactlist,root,function(ns,nc){ - root.news=ns;root.newContacts=nc; - })} - else{Newsjs.conversationfromdb(root.db,root.login.username,newsitemobject.statusnet_conversation_id, function(newsarray){ - root.news=newsarray;root.newContacts=[]; - })} + xhr.clearParams(); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/conversation/show"); + xhr.setParam("id",newsitemobject.id) + xhr.get(); + } + else{ + xhr.clearParams(); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); + xhr.setApi("/api/direct_messages/conversation"); + xhr.setParam("uri",newsitemobject.statusnet_conversation_id) + xhr.get(); + } } function showContact(contact){ @@ -98,6 +132,21 @@ Item { } } + function search(term){//print("Search "+term) + if (term!=""){ + newstab.newstabstatus="Search"; + newsBusy.running=true; + 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; + newsView.anchors.topMargin=7*mm + } + + function onFriendsMessages(friend){ newstab.newstabstatus="Contact" Newsjs.newsfromdb(db,root.login.username, function(dbnews){ @@ -132,18 +181,163 @@ Item { id: newsStack anchors.fill:parent property int conversationIndex: 0 - + property bool appendNews: false + property var allchats: ({}) initialItem:Rectangle { id:newslistRectangle y:1 color: "white" +// ComboBox{ +// id:newstabstatusCombo +// anchors.top: parent.top +// anchors.topMargin: 0.5*mm +// width: 1/3*root.width +// height: 5*mm; +// style: +// ComboBoxStyle{ +// background: Rectangle { +// color:"light blue" +// radius: 0.5*mm +// } +// label: Text { +// verticalAlignment: Text.AlignVCenter +// horizontalAlignment: Text.AlignHCenter +// text: control.currentText +// } +// } + +// model: ListModel { +// id: newscomboItems +// ListElement { type: "Timeline"; text: qsTr("Timeline")} +// ListElement { type: "Conversations";text: qsTr("Conversations")} +// ListElement { type: "Favorites";text: qsTr("Favorites") } +// ListElement { type: "PublicTimeline";text: qsTr("Public timeline") } +// ListElement { type: "DirectMessages";text: qsTr("Direct Messages") } +// ListElement { type: "Notifications";text: qsTr("Notifications") } +// ListElement { type: "Search";text: qsTr("Search") } +// ListElement { type: "Groupnews"; text: qsTr("Group News") } +// ListElement { type: "Quit";text: qsTr("Quit") } +// } +// currentIndex:(login.newsViewType=="Timeline")?0:1 +// onCurrentIndexChanged:{ +// //onActivated:{ +// print(newscomboItems.get(currentIndex).type); +// switch(newscomboItems.get(currentIndex).type){ +// case "Timeline": +// newstab.newstabstatus="Timeline"; +// newsModel.clear(); +// try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ +// showNews(dbnews) +// })}catch(e){Helperjs.showMessage("Error",e,root)} +// break; +// case "Conversations": +// newsModel.clear(); +// newstab.newstabstatus="Conversations"; +// Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) +// break; +// case "Favorites": +// newstab.newstabstatus="Favorites"; +// root.contactLoadType="favorites"; +// Service.updateView("Favorites"); +// break; +// case "PublicTimeline": +// newstab.newstabstatus="Network"; +// Service.updateView("Network"); +// break; +// case "DirectMessages": +// newstab.newstabstatus="DirectMessages"; +// Service.updateView("DirectMessages"); +// break; +// case "Notifications": +// newstab.newstabstatus="Notifications"; +// Service.updateView("Notifications"); +// break; +// case "Search": +// newsView.anchors.topMargin=18*mm; +// newsSearch.visible=true +// break; +// case "Groupnews": +// Service.showGroups(); +// break; +// case "Quit": +// Service.cleanNews(root.db,function(){ +// Service.cleanContacts(root.login,root.db,function(){ +// Qt.quit()}) +// }) +// } +// } +// } + BlueButton{ id:newstabstatusButton anchors.top: parent.top anchors.topMargin: 0.5*mm text: qsTr(newstab.newstabstatus) onClicked: {newstabmenu.popup()} + + Menu{id:newstabmenu + MenuItem { + text: qsTr("Timeline") + onTriggered: { + newstab.newstabstatus="Timeline"; + newsModel.clear(); + try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ + showNews(dbnews) + })}catch(e){Helperjs.showMessage("Error",e,root)}} + } + MenuItem { + text: qsTr("Conversations") + onTriggered:{ + newsModel.clear(); + newstab.newstabstatus="Conversations"; + Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) + } + } + MenuItem { + text: qsTr("Favorites") + onTriggered:{ + newstab.newstabstatus="Favorites"; + // root.contactLoadType="favorites"; + Service.updateView("Favorites") + } + } + MenuItem { + text: qsTr("Public timeline") + onTriggered:{ + newstab.newstabstatus="Public Timeline"; + Service.updateView("Public Timeline") + } + } + + MenuItem { + text: qsTr("Direct Messages") + onTriggered:{ + newstab.newstabstatus="Direct Messages"; + Service.updateView("Direct Messages") + } + } + MenuItem { + text: qsTr("Notifications") + onTriggered:{ + newstab.newstabstatus="Notifications"; + Service.updateView("Notifications") + } + } + MenuItem { + text: qsTr("Group news") + onTriggered:Service.showGroups(); + } + MenuItem { + text: qsTr("Quit") + onTriggered:{ + Service.cleanNews(root.db,function(){ + Service.cleanContacts(root.login,root.db,function(){ + Qt.quit()}) + }) + } + } + } } Row{ @@ -152,6 +346,20 @@ Item { anchors.topMargin: 0.5*mm anchors.right: parent.right + BlueButton { + id: searchButton + text: "\uf002" + onClicked: { + if (newsSearch.visible==false){ + newsView.anchors.topMargin=18*mm; + newsSearch.visible=true} + else{ + newsSearch.visible=false; + newsView.anchors.topMargin=7*mm; + } + } + } + BlueButton { id: newMessageButton text: "\uf040" @@ -166,32 +374,20 @@ Item { },"isFriend",1); } } - BlueButton { - id: quitButton - text: "\uf08b" - onClicked: {Service.cleanNews(root.db,function(){ - Service.cleanContacts(root.login,root.db,function(){ - Qt.quit() }) - })} - } +// BlueButton { +// id: quitButton +// text: "\uf08b" +// onClicked: {Service.cleanNews(root.db,function(){ +// Service.cleanContacts(root.login,root.db,function(){ +// Qt.quit() }) +// })} +// } BlueButton { id: update text: "\uf021" onClicked: { - newsBusy.running=true; - newstab.newstabstatus=login.newsViewType; root.contactLoadType="news"; - var onlynew=true; - //print("newstab "+ JSON.stringify(contactlist)); - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc; - if (ns.length==0){// update last 20 existing news for changes and likes - onlynew=false; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ - root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) - } - }) + Service.updateView(newstab.newstabstatus) } } @@ -211,7 +407,6 @@ Item { onClicked:{ var currentTime= new Date(); var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at; - print("Lastnews ID "+lastnews_id+Qt.atob(newsModel.get(newsModel.count-1).newsitemobject.statusnet_html)) if(newstab.newstabstatus=="Timeline"){ Newsjs.newsfromdb(root.db,root.login.username, function(news){ var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; @@ -227,11 +422,27 @@ Item { var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true}; newsWorker.sendMessage(msg); },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)} - } + else if (newstab.newstabstatus=="Notifications"){} + else{ + newsStack.appendNews=true; + xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1); + xhr.get() + }} } } } - + 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 @@ -245,19 +456,9 @@ Item { delegate: Newsitem{} //onContentYChanged:{if(contentY<-8*mm&&contentY>(-8*mm-1)){print("refreshing"); onDragEnded:{if(contentY<-5*mm){//print("refreshing"); - newsBusy.running=true; - newstab.newstabstatus=login.newsViewType; root.contactLoadType="news"; var onlynew=true; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(ns,nc){ - root.news=ns;root.newContacts=nc; - if (ns.length==0){// update last 20 existing news for changes and likes - onlynew=false; - Newsjs.getFriendsTimeline(login,db,contactlist,onlynew,newstab,function(rns,rnc){ - root.contactLoadType="news"; - root.news=rns;root.newContacts=rnc;}) - } - }) + Service.updateView(newstab.newstabstatus) }} } @@ -299,47 +500,7 @@ Item { text:"" } } - Menu { - id:newstabmenu - MenuItem { - text: qsTr("Timeline") - onTriggered: { - newstab.newstabstatus="Timeline"; - newsModel.clear(); - try{ Newsjs.newsfromdb(root.db,root.login.username, function(dbnews){ - showNews(dbnews) - })}catch(e){Helperjs.showMessage("Error",e,root)}} - } - MenuItem { - text: qsTr("Favorites") - onTriggered:{ - newstab.newstabstatus="Favorites"; - root.contactLoadType="favorites"; - newsBusy.running=true; - Newsjs.requestFavorites(root.login,db,root.contactlist,root,function(ns,nc){ - root.news=ns; root.newContacts=nc; - }) - } - } - MenuItem { - text: qsTr("Conversations") - onTriggered:{ - newsModel.clear(); - newstab.newstabstatus="Conversations"; - Newsjs.chatsfromdb(db,root.login.username,function(news){showNews(news)}) - } - } - MenuItem { - text: qsTr("Notifications") - onTriggered:{ - newstab.newstabstatus="Notifications"; - newsBusy.running=true; - Newsjs.getNotifications(root.login,db,root,function(news){ - showNews(news)} - )} - } - } Component.onCompleted: { root.messageSignal.connect(onFriendsMessages); root.directmessageSignal.connect(onDirectMessage); @@ -347,17 +508,10 @@ Item { root.uploadSignal.connect(sendUrls); root.sendtextSignal.connect(sendtext); try{newsModel.clear()} catch(e){} - - //print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth); - //newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:[imageUrl]}}) -// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+ -// osSettings.imagePickQml+'{multiple : true; onReady: {'+ -// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+ -// ' root.currentIndex=2;fotostab.active=true;'+ -// 'root.uploadSignal(imageUrls)};}}',newstab,"imagePicker"); - //SystemDispatcher.setInitialized(); + xhr.setLogin(login.username+":"+Qt.atob(login.password)); + xhr.setUrl(login.server); if(root.news.length>0){showNews(root.news)} - else{ newstab.newstabstatus=login.newsViewType; + else{ newstab.newstabstatus=login.newsViewType; if(login.newsViewType=="Timeline"){Newsjs.newsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} else{Newsjs.chatsfromdb(db,login.username,function(dbnews){showNews(dbnews)})} } diff --git a/source-linux/qml/newsqml/Newsitem.qml b/source-linux/qml/newsqml/Newsitem.qml index 77f59fa..aa396d3 100644 --- a/source-linux/qml/newsqml/Newsitem.qml +++ b/source-linux/qml/newsqml/Newsitem.qml @@ -52,6 +52,11 @@ Item { var component = Qt.createComponent("qrc:/qml/newsqml/FriendicaActivities.qml"); var imagedialog = component.createObject(friendicaActivities,{"activitymembers": contacts}); } + + function findTags(fulltext){ + return fulltext.match(/\s+[#]+[A-Za-z0-9-_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]+/g) + } + Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom; color:"light grey"} Rectangle{ @@ -72,7 +77,8 @@ Item { height: 7*mm MouseArea{ anchors.fill: parent - onClicked:{showContact(newsitemobject.user)} + onClicked:{ + showContact(newsitemobject.user)} } onStatusChanged: if (profileImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"} } @@ -82,7 +88,7 @@ Item { width:parent.width font.pixelSize: 1.5*mm wrapMode: Text.WrapAtWordBoundaryOrAnywhere - text: Qt.atob(newsitemobject.user.name)+forumname + text: newsitemobject.user.name+forumname } } Column { @@ -143,7 +149,7 @@ Item { linkColor: "light green" id: itemMessage textFormat: Text.RichText - text:Qt.atob(newsitemobject.statusnet_html) + text:newsitemobject.statusnet_html width: newsitem.width-8*mm-2 height: Math.min(implicitHeight,3/4*root.height) wrapMode: Text.Wrap @@ -151,6 +157,14 @@ Item { onLinkActivated:{ Qt.openUrlExternally(link)} Component.onCompleted:{ + if (newsitemobject.messagetype==0){ + var hashtags=[]; + hashtags=findTags(newsitemobject.text); + var component = Qt.createComponent("qrc:/qml/newsqml/Hashtag.qml"); + for (var tags in hashtags){ + var hashtagQml = component.createObject(friendicaActivities,{"text":hashtags[tags].trim()}); + }} + if (newsitemobject.attachmentList.length>0){ for(var attachments in newsitemobject.attachmentList){// (newsitemobject.attachmentList[attachments].url); var attachcomponent = Qt.createQmlObject('import QtQuick 2.0; '+ @@ -198,7 +212,7 @@ Item { text: friendica_activities.likeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.like)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)} } } Label{color: "grey" @@ -207,7 +221,7 @@ Item { text: friendica_activities.dislikeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.dislike)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)} } } Label{color: "grey" @@ -216,7 +230,7 @@ Item { text: friendica_activities.attendyesText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendyes)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)} }} Label{color: "grey" height:3.5*mm @@ -224,7 +238,7 @@ Item { text: friendica_activities.attendnoText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendno)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)} } } Label{color: "grey" @@ -233,7 +247,7 @@ Item { text: friendica_activities.attendmaybeText MouseArea{ anchors.fill: parent - onClicked: { showActivityContacts(newsitemobject.attendmaybe)} + onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendmaybe)} } } Label{ @@ -267,8 +281,8 @@ Item { } } onClicked: { - if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.status_id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 } - else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.status_id,root); model.friendica_activities.self.liked=1}} + if(likeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"like",newsitemobject.id,root);dislikeCheckbox.checked=false; model.friendica_activities.self.liked=0 } + else{Newsjs.like(root.login,root.db,0,"like",newsitemobject.id,root); model.friendica_activities.self.liked=1}} } CheckBox{ id: dislikeCheckbox @@ -289,8 +303,8 @@ Item { } } onClicked: { - if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.status_id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0} - else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.status_id,root); model.friendica_activities.self.disliked=1}} + if (dislikeCheckbox.checked==true){Newsjs.like(root.login,root.db,1,"dislike",newsitemobject.id,root);likeCheckbox.checked=false; model.friendica_activities.self.disliked=0} + else {Newsjs.like(root.login,root.db,0,"dislike",newsitemobject.id,root); model.friendica_activities.self.disliked=1}} } CheckBox { @@ -312,22 +326,23 @@ Item { checked:(newsitemobject.favorited>0) onClicked:{ if(favoritedCheckbox.checkedState==Qt.Checked){ - Newsjs.favorite(login,true,newsitemobject.status_id,root); model.newsitemobject.favorited=1} + Newsjs.favorite(login,true,newsitemobject.id,root); model.newsitemobject.favorited=1} else if(favoritedCheckbox.checkedState==Qt.Unchecked){ - Newsjs.favorite(login,false,newsitemobject.status_id,root);model.newsitemobject.favorited=0} + Newsjs.favorite(login,false,newsitemobject.id,root);model.newsitemobject.favorited=0} } } Rectangle{ width: 10*mm height: 4*mm + visible:(newsitemobject.messagetype!==2) color:"transparent" Text{ id:newsmenusymbol color: "grey" anchors.centerIn: parent - font.pixelSize: 2*mm - font.bold: true - text: "\u22EE" + font.pixelSize: 2.5*mm + font.family:fontAwesome.name + text: "\uf142" } MouseArea{ anchors.fill:parent @@ -336,7 +351,7 @@ Item { Rectangle{ width: 10*mm height: 4*mm - visible:newstab.newstabstatus!="Conversation" + visible:(newsitemobject.messagetype!==2)&&(newstab.newstabstatus!="Conversation") color:"transparent" Text{ id:conversationsymbol @@ -365,7 +380,7 @@ Item { onTriggered: { var directmessage=0; if (newsitemobject.messagetype==1){ directmessage=1} - newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.status_id,"login":root.login,"directmessage":directmessage}}); + newsStack.push({item:"qrc:/qml/newsqml/MessageSend.qml",properties:{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage}}); } } MenuItem { @@ -377,7 +392,7 @@ Item { MenuItem { text: qsTr("Repost") onTriggered: { - Newsjs.retweetNews(root.login,db,newsitemobject.status_id,root,function(reply){ + Newsjs.retweetNews(root.login,db,newsitemobject.id,root,function(reply){ Helperjs.showMessage("Repost",qsTr("Success!"),root) }) } @@ -396,17 +411,17 @@ Item { title: qsTr("Attending") MenuItem{ text:qsTr("yes") - onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"yes",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="yes";attending="yes"}) } } MenuItem{text:qsTr("maybe") - onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"maybe",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="maybe";attending="maybe"}) } } MenuItem{text:qsTr("no") - onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.status_id,root,function(){ + onTriggered: {Newsjs.attend(root.login,db,"no",newsitemobject.id,root,function(){ model.friendica_activities.self.attending="no";attending="no"})} } } @@ -414,7 +429,7 @@ Item { MenuItem { text: qsTr("Delete") onTriggered: { - Newsjs.deleteNews(root.login,root.db,newsitemobject.status_id,newsitemobject.messagetype,root,function(reply){ + Newsjs.deleteNews(root.login,root.db,newsitemobject.id,newsitemobject.messagetype,root,function(reply){ var msg = {'deleteId': index, 'model': newsModel}; newsWorker.sendMessage(msg); }) diff --git a/source-linux/qml/photoqml/PhotogroupComponent.qml b/source-linux/qml/photoqml/PhotogroupComponent.qml index 686e298..0705a34 100644 --- a/source-linux/qml/photoqml/PhotogroupComponent.qml +++ b/source-linux/qml/photoqml/PhotogroupComponent.qml @@ -104,7 +104,7 @@ Package { Component.onCompleted:{ try {photoModel.clear()}catch (e){print(e)} if(foreignPicture){ - Imagejs.newRequestFriendsPictures(login,albumlink,friend,remoteContact,remoteauth,root,function(obj){ + Imagejs.newRequestFriendsPictures(login,albumlink,friend,photoStack.remoteContact,remoteauth,root,function(obj){ if (obj) { for (var k=0;k ConfigTab - - - + + + User Name - + Server Server - + Nickname Kurzname - + Password Passwort - + Image dir. Bildverz. - + Max. News Max. Nachr. - + News as Anzeige - + Interval (0=None) Intervall (0=keins) - - - + + + Error Fehler - + Nickname not registered at given server! Name auf der Seite nicht registriert! - + Confirm Bestätigen - + No server given! Kein Server angegeben! - + No nickname given! Kein Kurzname angegeben! - + Nickname not registered at given server! Name auf der Seite nicht registriert! @@ -95,42 +95,42 @@ Kein Nutzername angegeben! - + No password given! Kein Passwort angegeben! - + No image directory given! Kein Verzeichnis für Bilder angegeben! - + No maximum news number given! Maximale News-Anzahl nicht angegeben! - + Wrong password! Falsches Passwort! - + Success Bestätigt - + Name Name - + Timeline Chronologisch - + Conversations Unterhaltungen @@ -189,12 +189,12 @@ Freunde - + Contacts Kontakte - + Groups Gruppen @@ -213,32 +213,37 @@ ImageUploadDialog - + + Upload to album + In Album hochladen + + + Album Album - + Image Bild - + Description Beschreibung - + Upload Hochladen - + Error Fehler - + No album name given Kein Albumname angegeben @@ -246,17 +251,17 @@ MessageSend - + Title (optional) Überschrift (optional) - + Error Fehler - + Only one attachment supported at the moment. Remove other attachment first! Nur ein Anhang derzeit unterstützt. @@ -270,30 +275,55 @@ Lade Profilbild für - + More Mehr - + Timeline Chronologisch - + + Error + Fehler + + + Favorites Markierte News - + Conversations Unterhaltungen - + + Public timeline + Gemeinschaft + + + + Direct Messages + Direktnachrichten + + + Notifications Meldungen + + + Group news + News Gruppe + + + + Quit + Schliessen + Newsitem @@ -303,77 +333,77 @@ Teilnahme - + Source: Quelle: - + Direct Message Direktnachricht - + In reply to Antwort an - + comments Kommentare - + Attending: Teilnahme: - + Reply Antworten - + DM Direktnachricht - + Repost Teilen - + Success! Erledigt! - + Conversation Unterhaltung - + Attending Teilnahme - + yes ja - + maybe vielleicht - + no nein - + Delete Löschen @@ -394,28 +424,28 @@ PhotoTab - + 's images s Bilder - + All Images Alle Bilder - + Only new Nur neue - - + + Own Images Eigene Bilder - + More Mehr @@ -613,32 +643,32 @@ Aktualisieren - + profile id Profil-Nummer - + Description Beschreibung - + Location Ort - + Posts Beiträge - + URL Profilseite - + Created at Erstellt @@ -714,27 +744,26 @@ Personen nehmen vielleicht teil. - + yes ja - + no nein - + maybe vielleicht - + seconds Sekunden - @@ -744,53 +773,64 @@ + ago her - + minute Minute - + minutes Minuten - + hour Stunde - + hours Stunden - + day Tag - + days Tage - + month Monat - + months Monate - + years + + service + + + + + Error + Fehler + + diff --git a/source-linux/translations/friendiqa-es.qm b/source-linux/translations/friendiqa-es.qm index f2e5dc3..4bd80da 100644 Binary files a/source-linux/translations/friendiqa-es.qm and b/source-linux/translations/friendiqa-es.qm differ diff --git a/source-linux/translations/friendiqa-es.ts b/source-linux/translations/friendiqa-es.ts index 34d2d15..1b22144 100644 --- a/source-linux/translations/friendiqa-es.ts +++ b/source-linux/translations/friendiqa-es.ts @@ -17,76 +17,76 @@ ConfigTab - - - + + + User Usuario - + Server Servidor - + Nickname - + Password Contraseña - + Image dir. Dir. de imágenes - + Max. News Nº Max. de noticias. - + News as Noticias como - + Interval (0=None) Intervalo (0=ningún) - - - + + + Error Error - + Nickname not registered at given server! - + Confirm Confirmar - + No server given! ¡Servidor no encontrado! - + No nickname given! - + Nickname not registered at given server! @@ -95,42 +95,42 @@ ¡Usuario incorrecto! - + No password given! ¡Contraseña incorrecta! - + No image directory given! ¡No se ha encontrado el directorio de imágenes! - + No maximum news number given! ¡Nº máximo de noticias incorrecto! - + Wrong password! - + Success - + Name - + Timeline Cronología - + Conversations Conversaciones @@ -189,12 +189,12 @@ Amigos - + Contacts Contactos - + Groups Grupos @@ -202,32 +202,37 @@ ImageUploadDialog - + + Upload to album + + + + Album álbum - + Image imagen - + Description Descripción - + Upload Subir - + Error Error - + No album name given ¡Nombre del álbum no encontrado! @@ -235,17 +240,17 @@ MessageSend - + Title (optional) Título (opcional) - + Error Error - + Only one attachment supported at the moment. Remove other attachment first! Solo se admite adjuntar un solo archivo en este momento. @@ -259,30 +264,55 @@ Descargar la imagen del perfil para - + More Mas - + Timeline Cronología - + + Error + Error + + + Favorites Favoritos - + Conversations Conversaciones - + + Public timeline + + + + + Direct Messages + + + + Notifications Notificaciones + + + Group news + + + + + Quit + + Newsitem @@ -292,77 +322,77 @@ Asistiendo: - + Source: Fuente: - + Direct Message Mensaje directo - + In reply to En respuesta a - + comments comentarios - + Attending: Asistiendo: - + Reply Respuesta - + DM Mensaje directo - + Repost Volver a publicar - + Success! éxito! - + Conversation Conversación - + Attending Asistiendo - + yes si - + maybe quizás - + no no - + Delete Borrar @@ -383,28 +413,28 @@ PhotoTab - + 's images s Imágenes - + All Images - + Only new - - + + Own Images Mis imágenes - + More Mas @@ -602,32 +632,32 @@ - + profile id - + Description Descripción - + Location Localización - + Posts Mensajes - + URL URL - + Created at Creado en @@ -703,27 +733,26 @@ Personas que pueden asistir. - + yes si - + no no - + maybe quizás - + seconds Segundos - @@ -733,53 +762,64 @@ + ago hace - + minute Minuto - + minutes Minutos - + hour Hora - + hours Horas - + day Dia - + days Dias - + month Mes - + months Meses - + years Años + + service + + + + + Error + Error + + diff --git a/source-linux/translations/friendiqa-it.qm b/source-linux/translations/friendiqa-it.qm index ab27823..4dfcf94 100644 Binary files a/source-linux/translations/friendiqa-it.qm and b/source-linux/translations/friendiqa-it.qm differ diff --git a/source-linux/translations/friendiqa-it.ts b/source-linux/translations/friendiqa-it.ts index 0be61b7..658670b 100644 --- a/source-linux/translations/friendiqa-it.ts +++ b/source-linux/translations/friendiqa-it.ts @@ -17,76 +17,76 @@ ConfigTab - - - + + + User Utente - + Server Server - + Nickname - + Password Password - + Image dir. Directory immagini - + Max. News Nº Max. di notizie - + News as News come - + Interval (0=None) Intervallo (0=nessuno) - - - + + + Error Errore - + Nickname not registered at given server! - + Confirm Conferma - + No server given! Nessun server inserito! - + No nickname given! - + Nickname not registered at given server! @@ -95,42 +95,42 @@ Nessun utente inserito! - + No password given! Nessuna password inserita! - + No image directory given! Nessuna directory immagini inserita! - + No maximum news number given! Nessun numero massimo di news inserito! - + Wrong password! - + Success - + Name - + Timeline Cronologia - + Conversations Conversazioni @@ -189,12 +189,12 @@ Amici - + Contacts Contatti - + Groups Gruppi @@ -202,32 +202,37 @@ ImageUploadDialog - + + Upload to album + + + + Album Album - + Image Immagine - + Description Descrizione - + Upload Carica - + Error Errore - + No album name given Nessun nome album inserito! @@ -235,17 +240,17 @@ MessageSend - + Title (optional) Titolo (opzionale) - + Error Errore - + Only one attachment supported at the moment. Remove other attachment first! Solo un allegato è attualmente supportato. @@ -259,30 +264,55 @@ Download immagine profilo per - + More Ancora - + Timeline Cronologia - + + Error + Errore + + + Favorites Favoriti - + Conversations Conversazioni - + + Public timeline + + + + + Direct Messages + + + + Notifications Notifiche + + + Group news + + + + + Quit + + Newsitem @@ -292,77 +322,77 @@ attendere: - + Source: Codice: - + Direct Message Messaggio diretto - + In reply to In risposta a - + comments commenti - + Attending: Attendi: - + Reply Risposta - + DM Messaggio diretto - + Repost Condividi - + Success! Ha funzionato! - + Conversation Conversazione - + Attending Attendi - + yes si - + maybe potrebbe - + no no - + Delete Cancella @@ -383,28 +413,28 @@ PhotoTab - + 's images Immagini - + All Images - + Only new - - + + Own Images Mie immagini - + More Ancora @@ -602,32 +632,32 @@ - + profile id - + Description Descrizione - + Location Località - + Posts Messaggi - + URL URL - + Created at Creato il @@ -703,27 +733,26 @@ Persone che possono attendere. - + yes si - + no no - + maybe potrebbe - + seconds secondi - @@ -733,53 +762,64 @@ + ago fa - + minute minuti - + minutes minuti - + hour ora - + hours ore - + day giorno - + days giorni - + month mese - + months mesi - + years anni + + service + + + + + Error + Errore + +