forked from lubuwest/Friendiqa
v0.5.1
This commit is contained in:
parent
01e9ae06f4
commit
7119d5bdf4
292 changed files with 790 additions and 16347 deletions
|
@ -2,35 +2,67 @@
|
|||
<qresource prefix="/">
|
||||
<file>qtquickcontrols2.conf</file>
|
||||
<file>qml/friendiqa.qml</file>
|
||||
<file>qml/newsqml/NewsStack.qml</file>
|
||||
<file>qml/newsqml/NewsTab.qml</file>
|
||||
<file>qml/newsqml/Newsitem.qml</file>
|
||||
<file>qml/newsqml/MessageSend.qml</file>
|
||||
<file>qml/newsqml/Conversation.qml</file>
|
||||
<file>qml/newsqml/FriendicaActivities.qml</file>
|
||||
<file>qml/newsqml/Hashtag.qml</file>
|
||||
<file>qml/newsqml/NewsImage.qml</file>
|
||||
<file>qml/newsqml/NewsVideo.qml</file>
|
||||
<file>qml/newsqml/ContactPage.qml</file>
|
||||
<file>qml/newsqml/NewsLink.qml</file>
|
||||
<file>qml/newsqml/NewsVideoLarge.qml</file>
|
||||
<file>qml/newsqml/NewsYplayer.qml</file>
|
||||
<file>qml/newsqml/SmileyDialog.qml</file>
|
||||
<file>qml/contactqml/FriendsTab.qml</file>
|
||||
<file>qml/contactqml/GroupComponent.qml</file>
|
||||
<file>qml/contactqml/ContactComponent.qml</file>
|
||||
<file>qml/contactqml/ProfileComponent.qml</file>
|
||||
<file>qml/contactqml/ContactDetailsComponent.qml</file>
|
||||
<file>qml/contactqml/Contactlist.qml</file>
|
||||
<file>qml/genericqml/BlueButton.qml</file>
|
||||
<file>qml/photoqml/PhotoComponent.qml</file>
|
||||
<file>qml/photoqml/PhotogroupComponent.qml</file>
|
||||
<file>qml/photoqml/PhotoTab.qml</file>
|
||||
<file>qml/photoqml/ImageUploadDialog.qml</file>
|
||||
<file>qml/genericqml/ImagePicker.qml</file>
|
||||
<file>qml/genericqml/ImagePickerLinux.qml</file>
|
||||
<file>qml/genericqml/Search.qml</file>
|
||||
<file>qml/genericqml/IntentReceiver.qml</file>
|
||||
<file>qml/genericqml/MButton.qml</file>
|
||||
<file>qml/genericqml/LinuxSync.qml</file>
|
||||
<file>qml/genericqml/BlueButton.qml</file>
|
||||
<file>qml/genericqml/ContactComponent.qml</file>
|
||||
<file>qml/genericqml/PermissionDialog.qml</file>
|
||||
<file>qml/calendarqml/CalendarTab.qml</file>
|
||||
<file>qml/calendarqml/CalendarDay.qml</file>
|
||||
<file>qml/calendarqml/EventList.qml</file>
|
||||
<file>qml/configqml/RegisterPage.qml</file>
|
||||
<file>qml/configqml/AccountPage.qml</file>
|
||||
<file>qml/configqml/SyncConfig.qml</file>
|
||||
<file>qml/configqml/SyncComponent.qml</file>
|
||||
<file>qml/configqml/InfoBox.qml</file>
|
||||
<file>qml/configqml/ConfigPage.qml</file>
|
||||
<file>qml/configqml/OSSettingsAndroid.qml</file>
|
||||
<file>qml/configqml/OSSettingsLinux.qml</file>
|
||||
<file>js/image.js</file>
|
||||
<file>js/yplayer.html</file>
|
||||
<file>js/layout.js</file>
|
||||
<file>js/photoworker.js</file>
|
||||
<file>js/service.js</file>
|
||||
<file>js/news.js</file>
|
||||
<file>js/newsworker.js</file>
|
||||
<file>js/helper.js</file>
|
||||
<file>js/smiley.js</file>
|
||||
<file>translations/friendiqa-it.ts</file>
|
||||
<file>translations/friendiqa-it.qm</file>
|
||||
<file>translations/friendiqa-de.qm</file>
|
||||
<file>translations/friendiqa-de.ts</file>
|
||||
<file>translations/friendiqa-es.qm</file>
|
||||
<file>translations/friendiqa-es.ts</file>
|
||||
<file>images/defaultcontact.jpg</file>
|
||||
<file>images/fontawesome-webfont.ttf</file>
|
||||
<file>images/folder-blue.png</file>
|
||||
<file>qml/configqml/OSSettingsAndroid.qml</file>
|
||||
<file>qml/configqml/OSSettingsLinux.qml</file>
|
||||
<file>qml/newsqml/SmileyDialog.qml</file>
|
||||
<file>js/smiley.js</file>
|
||||
<file>images/smileys/animals/bee.gif</file>
|
||||
<file>images/smileys/animals/bigspider.gif</file>
|
||||
<file>images/smileys/animals/bunny.gif</file>
|
||||
|
@ -196,6 +228,7 @@
|
|||
<file>images/smileys/adult/finger.gif</file>
|
||||
<file>images/smileys/adult/sperm.gif</file>
|
||||
<file>images/smileys/adult/tits.gif</file>
|
||||
<file>images/addImage.png</file>
|
||||
<file>common/filesystem.cpp</file>
|
||||
<file>common/filesystem.h</file>
|
||||
<file>common/friendiqa.cpp</file>
|
||||
|
@ -203,34 +236,5 @@
|
|||
<file>common/uploadableimage.h</file>
|
||||
<file>common/xhr.cpp</file>
|
||||
<file>common/xhr.h</file>
|
||||
<file>qml/calendarqml/CalendarTab.qml</file>
|
||||
<file>qml/calendarqml/CalendarDay.qml</file>
|
||||
<file>qml/calendarqml/EventList.qml</file>
|
||||
<file>translations/friendiqa-de.qm</file>
|
||||
<file>translations/friendiqa-de.ts</file>
|
||||
<file>translations/friendiqa-es.qm</file>
|
||||
<file>translations/friendiqa-es.ts</file>
|
||||
<file>qml/photoqml/ImageUploadDialog.qml</file>
|
||||
<file>qml/genericqml/PermissionDialog.qml</file>
|
||||
<file>images/addImage.png</file>
|
||||
<file>qml/genericqml/ImagePicker.qml</file>
|
||||
<file>qml/genericqml/ImagePickerLinux.qml</file>
|
||||
<file>js/image.js</file>
|
||||
<file>qml/contactqml/ProfileComponent.qml</file>
|
||||
<file>translations/friendiqa-it.ts</file>
|
||||
<file>qml/genericqml/Search.qml</file>
|
||||
<file>qml/newsqml/Hashtag.qml</file>
|
||||
<file>qml/genericqml/IntentReceiver.qml</file>
|
||||
<file>qml/newsqml/NewsImage.qml</file>
|
||||
<file>qml/newsqml/NewsVideo.qml</file>
|
||||
<file>qml/newsqml/ContactPage.qml</file>
|
||||
<file>qml/newsqml/NewsLink.qml</file>
|
||||
<file>qml/configqml/RegisterPage.qml</file>
|
||||
<file>qml/configqml/AccountPage.qml</file>
|
||||
<file>qml/newsqml/NewsStack.qml</file>
|
||||
<file>qml/configqml/SyncConfig.qml</file>
|
||||
<file>qml/configqml/SyncComponent.qml</file>
|
||||
<file>qml/genericqml/MButton.qml</file>
|
||||
<file>qml/genericqml/LinuxSync.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -43,6 +43,7 @@ ALARM::ALARM(QObject *parent) : QObject(parent){}
|
|||
|
||||
void ALARM::setAlarm(int interval)
|
||||
{
|
||||
//qDebug() << "alarm "<< interval;
|
||||
QVariantMap message;
|
||||
message["value"] = interval;
|
||||
AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
|
||||
|
|
|
@ -29,12 +29,11 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//#include <QtAndroidExtras/QAndroidJniObject>
|
||||
//#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||
#include "alarm.h"
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtDBus/QtDBus>
|
||||
//#include "AndroidNative/systemdispatcher.h"
|
||||
#include <QJsonArray>
|
||||
|
||||
|
||||
ALARM *ALARM::instance()
|
||||
{
|
||||
|
@ -49,25 +48,23 @@ void ALARM::setAlarm(int interval)
|
|||
qDebug() << interval;
|
||||
QVariantMap message;
|
||||
message["value"] = interval;
|
||||
// AndroidNative::SystemDispatcher::instance()->loadClass("androidnative.Util");
|
||||
// AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.setSchedule", message);
|
||||
//AndroidNative::SystemDispatcher::instance()->dispatch("androidnative.Util.stopService", message);
|
||||
}
|
||||
|
||||
void ALARM::notify(QString title, QString text, int id)
|
||||
{
|
||||
qDebug() << title << text;
|
||||
QVariantMap message;
|
||||
message["title"] = title;
|
||||
message["message"] = text;
|
||||
// QVariantMap message;
|
||||
// message["title"] = title;
|
||||
// message["message"] = text;
|
||||
QStringList actionlist;
|
||||
QMap<QString,QVariant> hint;
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
QDBusInterface dbus_iface("org.freedesktop.Notifications", "/org/freedesktop/Notifications",
|
||||
"org.freedesktop.Notifications", bus);
|
||||
QString appname="Friendiqa";
|
||||
uint v=12321;
|
||||
if (dbus_iface.isValid()){
|
||||
|
||||
dbus_iface.call("Notify",appname,v,"",title,text,"","",5000);
|
||||
dbus_iface.call("Notify",appname,v,"",title,text,actionlist,hint,10000);
|
||||
//qDebug() << "Qdebug error " << dbus_iface.lastError();
|
||||
}
|
||||
// AndroidNative::SystemDispatcher::instance()->dispatch("Notifier.notify", message);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
#include <QtQml/QQmlEngine>
|
||||
#include <QtWebEngine>
|
||||
//#include <QAndroidService>
|
||||
//#include <QtAndroid>
|
||||
#include <QtQuick>
|
||||
|
@ -88,6 +89,7 @@ int main(int argc, char *argv[]) {
|
|||
view.rootContext()->setContextProperty("alarm", alarm);
|
||||
UPDATENEWS* updatenews = UPDATENEWS::instance();
|
||||
view.rootContext()->setContextProperty("updatenews", updatenews);
|
||||
QtWebEngine::initialize();
|
||||
view.setSource(QUrl("qrc:/qml/friendiqa.qml"));
|
||||
view.show();
|
||||
view.connect(view.rootContext()->engine(), SIGNAL(quit()), &app, SLOT(quit()));
|
||||
|
|
|
@ -36,6 +36,19 @@
|
|||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QUrl>
|
||||
#include <QTransform>
|
||||
|
||||
void UploadableImage::setAngle(const int &b) {
|
||||
if (b != m_angle) {
|
||||
m_angle = b;
|
||||
|
||||
qDebug() << "UploadableImage::setAngle : " << m_angle;
|
||||
if (m_angle==0) {
|
||||
emit angleChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UploadableImage::setSource(const QString &a) {
|
||||
if (a != m_source) {
|
||||
|
@ -55,6 +68,12 @@ void UploadableImage::setSource(const QString &a) {
|
|||
}
|
||||
|
||||
QImage fullimage = QImage(QUrl(m_source).toLocalFile());
|
||||
|
||||
if (m_angle!=0){
|
||||
QTransform transform;
|
||||
transform.rotate(qreal(m_angle));
|
||||
fullimage=fullimage.transformed(transform);
|
||||
}
|
||||
if (fullimage.width() > 800 || fullimage.height() > 800) {
|
||||
if (fullimage.width() > fullimage.height()) {
|
||||
m_image = fullimage.scaledToWidth(800);
|
||||
|
@ -101,6 +120,9 @@ QString UploadableImage::source() const {
|
|||
return m_source;
|
||||
}
|
||||
|
||||
int UploadableImage::angle() const{
|
||||
return m_angle;
|
||||
}
|
||||
//QString UploadableImage::base64() const {
|
||||
// return m_base64;
|
||||
//}
|
||||
|
|
|
@ -40,6 +40,7 @@ class UploadableImage : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
|
||||
Q_PROPERTY(int angle READ angle WRITE setAngle NOTIFY angleChanged)
|
||||
//Q_PROPERTY(QString base64 READ base64 NOTIFY base64Changed)
|
||||
Q_PROPERTY(QString filename READ filename NOTIFY filenameChanged)
|
||||
Q_PROPERTY(QString mimetype READ mimetype NOTIFY mimetypeChanged)
|
||||
|
@ -47,8 +48,9 @@ class UploadableImage : public QObject
|
|||
|
||||
public:
|
||||
void setSource(const QString &a);
|
||||
void setAngle(const int &b);
|
||||
QString source() const;
|
||||
|
||||
int angle() const;
|
||||
//QString base64() const;
|
||||
QString filename() const;
|
||||
QString mimetype() const;
|
||||
|
@ -56,6 +58,7 @@ public:
|
|||
QByteArray bytes();
|
||||
signals:
|
||||
void sourceChanged();
|
||||
void angleChanged();
|
||||
//void base64Changed();
|
||||
void filenameChanged();
|
||||
void mimetypeChanged();
|
||||
|
@ -63,6 +66,7 @@ signals:
|
|||
private:
|
||||
QString m_source;
|
||||
QImage m_image;
|
||||
int m_angle;
|
||||
//QString m_base64;
|
||||
QString m_filename;
|
||||
QString m_mimetype;
|
||||
|
|
|
@ -251,19 +251,29 @@ void XHR::post()
|
|||
}
|
||||
|
||||
UploadableImage uimg;
|
||||
QHashIterator<QString, QString> ifiles(files);
|
||||
while(ifiles.hasNext()) {
|
||||
ifiles.next();
|
||||
|
||||
uimg.setSource(ifiles.value());
|
||||
//qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key();
|
||||
if (files.contains("media")){
|
||||
uimg.setAngle(files.value("angle").toInt());
|
||||
uimg.setSource(files.value("media"));
|
||||
|
||||
QHttpPart imagePart;
|
||||
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype()));
|
||||
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\""));
|
||||
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"media\"; filename=\""+uimg.filename()+"\""));
|
||||
imagePart.setBody(uimg.bytes());
|
||||
multiPart->append(imagePart);
|
||||
}
|
||||
// QHashIterator<QString, QString> ifiles(files);
|
||||
// while(ifiles.hasNext()) {
|
||||
// ifiles.next();
|
||||
|
||||
// uimg.setSource(ifiles.value());
|
||||
// //qDebug() << "\t image: " << uimg.mimetype() << ", " << ifiles.key();
|
||||
|
||||
// QHttpPart imagePart;
|
||||
// imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(uimg.mimetype()));
|
||||
// imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"" + ifiles.key() + "\"; filename=\""+uimg.filename()+"\""));
|
||||
// imagePart.setBody(uimg.bytes());
|
||||
// multiPart->append(imagePart);
|
||||
// }
|
||||
|
||||
QByteArray loginData = m_login.toLocal8Bit().toBase64();
|
||||
QString headerData = "Basic " + loginData;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
TEMPLATE = app
|
||||
TARGET = friendiqa
|
||||
CONFIG += release
|
||||
QT += qml quick gui widgets sql webview dbus
|
||||
QT += qml quick gui widgets sql webview dbus webengine
|
||||
|
||||
SOURCES += common/friendiqa.cpp \
|
||||
common/uploadableimage.cpp \
|
||||
|
@ -47,6 +47,7 @@ HEADERS += \
|
|||
|
||||
DISTFILES += \
|
||||
qml/calendarqml/*.qml \
|
||||
qml/newsqml/NewsVideoLarge.qml \
|
||||
translations/*.ts \
|
||||
translations/*.qm \
|
||||
qml/*.qml \
|
||||
|
|
|
@ -172,21 +172,25 @@ function deleteContacts(database,user,callback) { // does nothing useful at the
|
|||
// })
|
||||
//}
|
||||
|
||||
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){
|
||||
function newRequestFriendsAlbumPictures(login,friend,rootwindow,callback){print("newRequestFriendsAlbumPictures");
|
||||
// screenscraping of albums page of contact with remoteAuth
|
||||
Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
||||
try {var obj=JSON.parse(photohtml);
|
||||
//commented out for broken remoteauth
|
||||
//Helperjs.friendicaRemoteAuthRequest(login,friend.url.replace("profile","photos"),friend.url,rootwindow,function(photohtml){
|
||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||
try {var obj=JSON.parse(photohtml);print ("Photohtml: "+photohtml)
|
||||
if (obj.hasOwnProperty('status')){
|
||||
Helperjs.friendicaWebRequest(friend.url.replace("profile","photos"),rootwindow,function(photohtml){
|
||||
getAlbumFromHtml(photohtml,false,rootwindow,callback)})
|
||||
}}
|
||||
catch (e){
|
||||
getAlbumFromHtml(photohtml,true,rootwindow,callback)
|
||||
//getAlbumFromHtml(photohtml,true,rootwindow,callback)
|
||||
getAlbumFromHtml(photohtml,false,rootwindow,callback)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getAlbumFromHtml(photohtml,remoteAuthBool,rootwindow,callback){
|
||||
print(photohtml);
|
||||
var photoarray=[];
|
||||
var arr = photohtml.split("sidebar-photos-albums-li");
|
||||
for (var i=2;i<arr.length;i++){
|
||||
|
|
|
@ -68,15 +68,19 @@ function requestGroups(login,database,rootwindow,callback){
|
|||
function listFriends(login,database,callback,filter){
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
var filtertext='';
|
||||
try {filtertext=' AND screen_name like "' + filter+'%"'}catch(e){}
|
||||
//try {filtertext=' AND screen_name like "' + filter+'%"'}catch(e){}
|
||||
var filtertext=new RegExp(".*"+filter.toLowerCase()+".*")
|
||||
// if (filter){filtertext=' AND (screen_name like "' + filter+'%" OR name like "' + Qt.btoa(filter)+'%")'}
|
||||
db.transaction( function(tx) {
|
||||
//var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>0'+filtertext);
|
||||
//print('SELECT * from contacts WHERE username="'+login.username+'"'+filtertext);
|
||||
var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>0'+filtertext);
|
||||
var result = tx.executeSql('SELECT * from contacts WHERE username="'+login.username+'" AND isFriend>0');
|
||||
// check for friends
|
||||
var contactlist=[];
|
||||
for (var i=0;i<result.rows.length;i++){
|
||||
contactlist.push(result.rows.item(i))
|
||||
var contact=result.rows.item(i)
|
||||
contact.name=Qt.atob(contact.name);
|
||||
if(filtertext.test(contact.name.toLowerCase())|| filtertext.test(contact.screen_name.toLowerCase())){
|
||||
contactlist.push(contact)}
|
||||
}
|
||||
callback(contactlist)
|
||||
});
|
||||
|
@ -183,7 +187,7 @@ function storeNews(login,database,news,rootwindow){
|
|||
// save news after contacts download, call next function
|
||||
var db=Sql.LocalStorage.openDatabaseSync(database[0],database[1],database[2],database[3]);
|
||||
for (var i=0;i<news.length;i++){
|
||||
//print('store news data for ' + news[i].id+JSON.stringify(news[i].friendica_author));
|
||||
print('store news data for ' + login.username+news[i].messagetype+Qt.btoa(news[i].text)+news[i].created_at+ news[i].in_reply_to_status_id+ news[i].source+ news[i].id+news[i].in_reply_to_user_id+news[i].geo+news[i].favorited+ news[i].user.id+Qt.btoa(news[i].statusnet_html)+news[i].statusnet_conversation_id+ Qt.btoa(JSON.stringify(friendica_activities))+"[]"+attachments+news[i].friendica_author.url);
|
||||
//var ausdruck=news[i];
|
||||
var likearray=[];var dislikearray=[];var attendyesarray=[];var attendnoarray=[];var attendmaybearray=[];
|
||||
if(news[i].hasOwnProperty('friendica_activities')){
|
||||
|
@ -277,8 +281,9 @@ function newsfromdb(database,login,messagetype,callback,contact,stop_time){
|
|||
stop="<="+rs.rows.item(0).created_at}catch(e){stop="<99999999999999"}}
|
||||
else{var stop="<"+stop_time}
|
||||
var contactfilter="";if(contact){contactfilter=" AND (uid='"+contact+"' OR friendica_owner='"+contact+"')"}
|
||||
//print('select * from news WHERE username="'+username+'" AND created_at'+stop+contactfilter+' ORDER BY created_at DESC LIMIT 20');
|
||||
var newsrs=tx.executeSql('select * from news WHERE username="'+login.username+'" AND messagetype="'+messagetype+'" AND created_at'+stop+contactfilter+' ORDER BY created_at DESC LIMIT 20');
|
||||
if (messagetype=="0"){messagetype="0,5"}
|
||||
//print('select * from news WHERE username="'+login.username+'" AND messagetype IN ( '+messagetype+' ) AND created_at'+stop+contactfilter+' ORDER BY created_at DESC LIMIT 20');
|
||||
var newsrs=tx.executeSql('select * from news WHERE username="'+login.username+'" AND messagetype IN ( '+messagetype+' ) AND created_at'+stop+contactfilter+' ORDER BY created_at DESC LIMIT 20');
|
||||
var newsArray=[];
|
||||
var allcontacts=getAllContacts(database,login.username);
|
||||
|
||||
|
@ -462,7 +467,8 @@ function chatsfromdb(database,login,messagetype,callback,stop_time){
|
|||
try{var rs = tx.executeSql('select created_at from news WHERE username="'+login.username+'" AND messagetype="'+messagetype+'" ORDER BY created_at DESC LIMIT 1');
|
||||
stop="<="+rs.rows.item(0).created_at}catch(e){stop="<99999999999999"}}
|
||||
else{var stop="<"+stop_time}
|
||||
var conversationsrs=tx.executeSql('select DISTINCT statusnet_conversation_id from news WHERE username="'+login.username+'" AND created_at'+stop+' AND messagetype="'+messagetype+'" ORDER BY created_at DESC LIMIT 20'); //+' ORDER BY created_at DESC LIMIT 20');
|
||||
if (messagetype=="1"){messagetype="1,5"}
|
||||
var conversationsrs=tx.executeSql('select DISTINCT statusnet_conversation_id from news WHERE username="'+login.username+'" AND created_at'+stop+' AND messagetype IN ( "'+messagetype+'" ) ORDER BY created_at DESC LIMIT 20'); //+' ORDER BY created_at DESC LIMIT 20');
|
||||
var result = tx.executeSql('SELECT status_id from news WHERE username="'+login.username+'" AND messagetype=0 ORDER BY status_id DESC LIMIT 1');
|
||||
try{var lastid=result.rows.item(0).status_id;}catch(e){var lastid=0};
|
||||
var conversations=[];
|
||||
|
|
|
@ -56,7 +56,7 @@ else{
|
|||
var forumname="";
|
||||
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_author')&&
|
||||
((newsitemobject.friendica_author.url)!=(newsitemobject.user.url))&&((newsitemobject.friendica_author.url)!=null)){
|
||||
print(" Friendica Author "+JSON.stringify(newsitemobject.friendica_author));
|
||||
//print(" Friendica Author "+JSON.stringify(newsitemobject));
|
||||
forumname=" via "+newsitemobject.user.name;
|
||||
newsitemobject.user=newsitemobject.friendica_author;
|
||||
}}catch(e){print("forum name "+e)}
|
||||
|
@ -138,20 +138,21 @@ else{
|
|||
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ptvideohelper.url)){attachmentList.push(ptvideohelper)}
|
||||
}
|
||||
}
|
||||
// if (newsitemobject.text.indexOf("https://www.youtube.com/watch")>-1){
|
||||
// //print("message "+msg.options.showWebsiteForLinks);
|
||||
// if (msg.options.showYoutube!="false"){
|
||||
// var ythelper={mimetype:"video/youtube"}
|
||||
// var yttext=newsitemobject.text;
|
||||
// while (yttext.indexOf("https://www.youtube.com/watch")>-1){
|
||||
// var ythelperstringposition=linktext.indexOf("watch?v=");
|
||||
// var ytposend=findend(yttext,ythelperstringposition);
|
||||
// ythelper.url=yttext.substring(yttext.lastIndexOf("http",linkhelperstringposition),linkposend);
|
||||
// linktext=linktext.substring(linkhelperstringposition+5,linktext.length)
|
||||
// if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=linkhelper.url)){attachmentList.push(linkhelper)}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (newsitemobject.text.indexOf("youtube.com/watch?v")>-1){
|
||||
//print("message "+msg.options.showWebsiteForLinks);
|
||||
//if (msg.options.showYoutube!="false"){
|
||||
|
||||
var yttext=newsitemobject.text;
|
||||
while (yttext.indexOf("youtube.com/watch?v")>-1){
|
||||
var ythelperstringposition=yttext.indexOf("watch?v=");
|
||||
var ytposend=findend(yttext,ythelperstringposition);
|
||||
var ythelper={mimetype:"video/youtube"}
|
||||
ythelper.url=yttext.substring(ythelperstringposition+8,ytposend);
|
||||
yttext=yttext.substring(ytposend,yttext.length);
|
||||
if ((attachmentList.length==0) || (attachmentList[attachmentList.length-1].url!=ythelper.url)){attachmentList.push(ythelper)}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// if (newsitemobject.text.indexOf(".html")>-1){
|
||||
// //print("message "+msg.options.showWebsiteForLinks);
|
||||
|
@ -169,6 +170,11 @@ else{
|
|||
// }
|
||||
|
||||
newsitemobject.attachmentList=attachmentList;
|
||||
|
||||
if ((msg.options.hasOwnProperty("hide_nsfw"))&&(msg.options.hide_nsfw==1)&&(newsitemobject.text.indexOf("#nsfw")>-1)){
|
||||
newsitemobject.nsfw=true
|
||||
} else{newsitemobject.nsfw=false}
|
||||
|
||||
var seconds=(msg.currentTime-newsitemobject.created_at)/1000;
|
||||
var timestring="";
|
||||
if (seconds<60) {timestring=seconds+" "+qsTr("seconds") +" "+qsTr("ago");}
|
||||
|
|
|
@ -340,12 +340,15 @@ function cleanNews(database,callback){
|
|||
//var maxnewsrs = tx.executeSql("SELECT DISTINCT maxnews FROM config");
|
||||
var maxnewsrs = tx.executeSql("SELECT v FROM globaloptions WHERE k='max_news'");
|
||||
var maxnews=1000; if(maxnewsrs.rows.length>0){ maxnews=maxnewsrs.rows.item(0).v};
|
||||
var newscountrs = tx.executeSql('SELECT COUNT(*) from news');
|
||||
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;
|
||||
var deleters = tx.executeSql('DELETE from news WHERE created_at<='+lastvalidtime)}
|
||||
for (var i=0; i<6;i++){
|
||||
if (i!=0){maxnews=maxnews/5}
|
||||
var newscountrs = tx.executeSql('SELECT COUNT(*) from news WHERE messagetype='+i);
|
||||
var newscount = newscountrs.rows.item(0)["COUNT(*)"];//print("newscount "+newscount)
|
||||
if (newscount>maxnews){
|
||||
var lastvalidtimers= tx.executeSql('SELECT DISTINCT created_at FROM news WHERE messagetype='+i+' ORDER BY created_at ASC LIMIT ' +(newscount-maxnews));
|
||||
var lastvalidtime=lastvalidtimers.rows.item(newscount-maxnews-1).created_at;
|
||||
var deleters = tx.executeSql('DELETE from news WHERE messagetype='+i+' AND created_at<='+lastvalidtime)}
|
||||
}
|
||||
callback()
|
||||
})
|
||||
}
|
||||
|
@ -394,13 +397,40 @@ function processNews(api,data){
|
|||
Helperjs.showMessage(qsTr("JSON status Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root)
|
||||
}
|
||||
else if (!(Array.isArray(newslist))){
|
||||
//print("processNews not array"+newslist+JSON.stringify(newslist));
|
||||
// print("processNews not array"+newslist+JSON.stringify(newslist));
|
||||
// if(newslist.hasOwnProperty('id')){
|
||||
// newslist.created_at=Date.parse(Newsjs.cleanDate(newslist.created_at));
|
||||
// newslist.messagetype=5;
|
||||
// newslist.friendica_author=cleanUser(newslist.friendica_author);
|
||||
// newslist.user=cleanUser(newslist.user);
|
||||
// if(newslist.in_reply_to_user_id){newslist.reply_user=Newsjs.objFromArray(allcontacts,"id",newslist.in_reply_to_user_id)}
|
||||
// var dummynewslist=[newslist];
|
||||
// Newsjs.storeNews(login,db,dummynewslist,root);
|
||||
// switch(newsSwipeview.stacktype){
|
||||
// case "Home":messagetype=0;break;
|
||||
// case "DirectMessages": messagetype=1;break;
|
||||
// case "Notifications":messagetype=2;break;
|
||||
// case "Replies":messagetype=3;break;
|
||||
// default:messagetype=0;
|
||||
// }
|
||||
// if((login.newsViewType=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
// Newsjs.chatsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
// lastnewsid=lastid;
|
||||
// showNews(dbnews);
|
||||
// })
|
||||
// }
|
||||
// else{Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
// lastnewsid=lastid;
|
||||
// showNews(dbnews)
|
||||
// })}
|
||||
|
||||
// }
|
||||
replytimer.restart()
|
||||
}
|
||||
else {
|
||||
var allcontacts=[];
|
||||
allcontacts=Newsjs.getAllContacts(db,login.username);
|
||||
if (api=="/api/direct_messages/all"){
|
||||
if (api=="/api/direct_messages/all" || api=="/api/direct_messages/conversation"){
|
||||
for (var n in newslist){
|
||||
newslist[n].created_at=Date.parse(Newsjs.cleanDate(newslist[n].created_at));
|
||||
newslist[n].messagetype=1;
|
||||
|
@ -412,6 +442,8 @@ function processNews(api,data){
|
|||
newslist[n].friendica_owner=newslist[n].user;
|
||||
newslist[n].friendica_author=newslist[n].user;
|
||||
newslist[n].statusnet_html=newslist[n].text;
|
||||
newslist[n].in_reply_to_user_id=newslist[n].recipient_id
|
||||
if(newslist[n].in_reply_to_user_id){newslist[n].reply_user=Newsjs.objFromArray(allcontacts,"id",newslist[n].in_reply_to_user_id)}
|
||||
}}
|
||||
else if (api=="/api/friendica/notifications"){
|
||||
for (var n in newslist){
|
||||
|
@ -488,7 +520,7 @@ function processNews(api,data){
|
|||
}
|
||||
|
||||
|
||||
if (api=="/api/conversation/show"){
|
||||
if (api=="/api/conversation/show"|| api=="/api/direct_messages/conversation"){
|
||||
newslist.reverse();
|
||||
newstab.conversation=newslist
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
var player;
|
||||
function onYouTubeIframeAPIReady() {
|
||||
console.log("Videoid: "+getVideoId());
|
||||
player = new YT.Player('player', {
|
||||
playerVars: { 'html5': 1, 'iv_load_policy': 3 },
|
||||
playerVars: { 'html5': 1, 'iv_load_policy': 3, 'autoplay': 1 },
|
||||
frameborder: '0',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
|
@ -31,6 +32,7 @@
|
|||
|
||||
function onPlayerReady(event) {
|
||||
document.title = 0;
|
||||
event.target.playVideo();
|
||||
}
|
||||
|
||||
function onPlayerStateChange(event) {
|
||||
|
@ -42,4 +44,4 @@
|
|||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -65,7 +65,7 @@ Page{
|
|||
var useritems="";
|
||||
for (var i=0;i<accountPage.users.length;i++){
|
||||
|
||||
useritems=useritems+"MenuItem{font.pixelSize: 3*mm; text:'"+accountPage.users[i].username+
|
||||
useritems=useritems+"MenuItem{font.pixelSize: 3*mm;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
|
||||
"'; onTriggered: {Service.readConfig(db,function(obj){
|
||||
userButton.text=obj.username;
|
||||
servername.text=obj.server;
|
||||
|
@ -191,7 +191,7 @@ Page{
|
|||
text: "\uf234"
|
||||
font.pixelSize: 3*mm
|
||||
onClicked: {
|
||||
configStack.push({item:"qrc:/qml/configqml/RegisterPage.qml",properties:{url:servername.text+"/register?nickname="+username.getText(0,username.length)}})
|
||||
root.push("qrc:/qml/configqml/RegisterPage.qml",{url:servername.text+"/register?nickname="+username.getText(0,username.length)})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,6 +217,7 @@ Page{
|
|||
width: imagestoreFlickable.width
|
||||
height: imagestoreFlickable.height
|
||||
font.pixelSize:3*mm
|
||||
text: (osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
|
||||
wrapMode: TextEdit.NoWrap
|
||||
onCursorRectangleChanged: Layoutjs.ensureVisibility(cursorRectangle,imagestoreFlickable)
|
||||
}
|
||||
|
@ -405,6 +406,7 @@ Page{
|
|||
Button{
|
||||
id:closeButton
|
||||
height: 8*mm
|
||||
width: 5*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
|
@ -428,7 +430,7 @@ Page{
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try{Helperjs.readData(db,"config","",function(storedUsers){
|
||||
try{Helperjs.readData(db,"config","",function(storedUsers){
|
||||
storedUsers.sort(function(obj1, obj2) {
|
||||
return obj1.isActive - obj2.isActive;
|
||||
})
|
||||
|
@ -445,13 +447,8 @@ Page{
|
|||
//messageIntervalSlider.value=obj.timerInterval;
|
||||
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
|
||||
},"isActive",0)
|
||||
})
|
||||
// Service.readGlobaloptions(db,function(go){
|
||||
// if (root.globaloptions.showWebsiteForLinks!="false"){showwebsiteCheckbox.checked=true}
|
||||
// })
|
||||
|
||||
}
|
||||
catch (e){print(e)
|
||||
})}
|
||||
catch (e){print(e)
|
||||
// Helperjs.friendicaWebRequest("https://dir.friendica.social/servers/surprise",accountPage,function(html){
|
||||
// print(html);
|
||||
// var bpos=html.indexOf("base ");
|
||||
|
|
|
@ -118,6 +118,25 @@ Page{
|
|||
}
|
||||
|
||||
|
||||
CheckBox{
|
||||
id: nsfwCheckbox
|
||||
x: 4*mm
|
||||
y: 33.5*mm
|
||||
font.pixelSize: 3*mm
|
||||
//width:5*mm
|
||||
text: qsTr("Hide #nsfw?")
|
||||
checked:(globaloptions["hide_nsfw"]==1)?true:false
|
||||
onClicked: {
|
||||
toggle();
|
||||
if(nsfwCheckbox.checked==true){
|
||||
Service.updateglobaloptions(root.db,"hide_nsfw",0);nsfwCheckbox.checked=false;
|
||||
}
|
||||
else{
|
||||
Service.updateglobaloptions(root.db,"hide_nsfw",1);nsfwCheckbox.checked=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{color: "light grey"; x: 4*mm; y: 13.5*mm; width: 9*mm; height: 5*mm;
|
||||
radius: 0.5*mm
|
||||
TextEdit{id:maxNewsText;
|
||||
|
@ -132,7 +151,6 @@ Page{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
x: 4*mm; y:23.5*mm; width: parent.width - 14*mm; height: 5*mm;
|
||||
color:"light grey"
|
||||
|
|
|
@ -38,29 +38,30 @@ Rectangle{
|
|||
color:"white"
|
||||
//border.color: "light grey"
|
||||
property alias url:htmlview.url
|
||||
width:root.width-5*mm
|
||||
height:root.height-12*mm
|
||||
// width:root.width-5*mm
|
||||
// height:root.height-12*mm
|
||||
|
||||
WebView {id:htmlview;
|
||||
height:parent.height-7*mm
|
||||
width:parent.width
|
||||
y:7*mm
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
//print(url)
|
||||
}
|
||||
}
|
||||
// MouseArea {
|
||||
// anchors.fill:parent;
|
||||
// onClicked:{
|
||||
// //print(url)
|
||||
// }
|
||||
// }
|
||||
//onLoadingChanged: print(loadProgress)
|
||||
}
|
||||
Button{
|
||||
id:closeButton
|
||||
height:8*mm
|
||||
height:6*mm
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 1*mm
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
font.pixelSize: 3*mm
|
||||
onClicked:{configStack.pop()}
|
||||
onClicked:{root.pop()}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,15 +44,21 @@ Rectangle {
|
|||
y:1
|
||||
color: "white"
|
||||
|
||||
// function showContactdetails(contact){
|
||||
// var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
// if(contact.isFriend){
|
||||
// friendsTabView.currentIndex=1;
|
||||
// var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
// }
|
||||
// else{friendsTabView.currentIndex=2;
|
||||
// var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
// }
|
||||
// }
|
||||
|
||||
function showContactdetails(contact){
|
||||
var component = Qt.createComponent("qrc:/qml/contactqml/ContactDetailsComponent.qml");
|
||||
if(contact.isFriend){
|
||||
friendsTabView.currentIndex=1;
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
else{friendsTabView.currentIndex=2;
|
||||
var contactDetails = component.createObject(friendstab,{"contact": contact})
|
||||
}
|
||||
rootstack.currentIndex=0;
|
||||
bar.currentIndex=0;
|
||||
root.contactdetailsSignal(contact)
|
||||
}
|
||||
|
||||
function showProfile(callback){
|
||||
|
@ -103,6 +109,7 @@ Rectangle {
|
|||
currentIndex: friendsbar.currentIndex
|
||||
signal contactsSignal(var contact)
|
||||
signal groupsSignal(var username)
|
||||
|
||||
onCurrentIndexChanged:{
|
||||
if (currentIndex==1){
|
||||
contactsSignal("")
|
||||
|
@ -147,6 +154,7 @@ Rectangle {
|
|||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
property int currentContact: 0
|
||||
|
||||
function showFriends(contact){
|
||||
try {friendsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(root.db,"contacts",login.username,function(friendsobject){
|
||||
|
@ -209,6 +217,7 @@ Rectangle {
|
|||
height:friendsGridTab.height-updateFriendsButton.height-2*mm
|
||||
clip: true
|
||||
spacing: 2
|
||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
|
@ -269,6 +278,7 @@ Rectangle {
|
|||
width:contactsGridTab.width-2*mm
|
||||
height:contactsGridTab.height-cleanButton.height-2*mm
|
||||
clip: true
|
||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||
//add: Transition {
|
||||
// NumberAnimation { properties: "x,y"; from: 300; duration: 1000 }
|
||||
// }
|
||||
|
@ -315,7 +325,7 @@ Rectangle {
|
|||
Connections{
|
||||
target:xhr
|
||||
onError:{print(data)}//if (data=="image"){Helperjs.showMessage()}}
|
||||
onSuccess:{print("gruppe "+data);
|
||||
onSuccess:{
|
||||
Newsjs.requestGroups(root.login,root.db,root,function(){
|
||||
showGroups(root.login.username)});
|
||||
}
|
||||
|
|
|
@ -116,7 +116,8 @@ Item {
|
|||
if (userdata[0]){
|
||||
userdata[0].name=Qt.atob(userdata[0].name);
|
||||
userdata[0].description=Qt.atob(userdata[0].description)
|
||||
groupModel.append({"groupmember":userdata[0]
|
||||
//groupModel.append({"groupmember":userdata[0]
|
||||
groupModel.append({"contact":userdata[0]
|
||||
})}
|
||||
},"id",groupmembers[user])
|
||||
} //catch(e){}
|
||||
|
@ -132,53 +133,53 @@ Item {
|
|||
anchors.topMargin: mm
|
||||
opacity: 0
|
||||
|
||||
Component {
|
||||
id:groupMember
|
||||
Rectangle{
|
||||
width:parent.width
|
||||
height:6*mm
|
||||
Rectangle{id:memberrectangle
|
||||
border.color: "#EEEEEE"
|
||||
border.width: 1
|
||||
width:parent.width-12*mm
|
||||
height:6*mm
|
||||
Image {
|
||||
id: memberImage
|
||||
x:1
|
||||
y:1
|
||||
width: 5*mm
|
||||
height:5*mm
|
||||
source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
|
||||
onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
}
|
||||
Text{
|
||||
font.pixelSize: 3*mm
|
||||
anchors.left: memberImage.right
|
||||
anchors.margins: 1*mm
|
||||
width:parent.width-1
|
||||
text:groupmember.name
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
// root.currentIndex=1;
|
||||
// friendstab.active=true;
|
||||
// Component {
|
||||
// id:groupMember
|
||||
// Rectangle{
|
||||
// width:parent.width
|
||||
// height:6*mm
|
||||
// Rectangle{id:memberrectangle
|
||||
// border.color: "#EEEEEE"
|
||||
// border.width: 1
|
||||
// width:parent.width-12*mm
|
||||
// height:6*mm
|
||||
// Image {
|
||||
// id: memberImage
|
||||
// x:1
|
||||
// y:1
|
||||
// width: 5*mm
|
||||
// height:5*mm
|
||||
// source:(groupmember.isFriend==1)? "file://"+groupmember.profile_image :groupmember.profile_image_url
|
||||
// onStatusChanged: if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
|
||||
// }
|
||||
// Text{
|
||||
// font.pixelSize: 3*mm
|
||||
// anchors.left: memberImage.right
|
||||
// anchors.margins: 1*mm
|
||||
// width:parent.width-1
|
||||
// text:groupmember.name
|
||||
// }
|
||||
// MouseArea{
|
||||
// anchors.fill: parent
|
||||
// onClicked:{
|
||||
//// root.currentIndex=1;
|
||||
//// friendstab.active=true;
|
||||
//// root.contactdetailsSignal(groupmember)
|
||||
// root.currentIndex=0;
|
||||
// root.contactdetailsSignal(groupmember)
|
||||
root.currentIndex=0;
|
||||
root.contactdetailsSignal(groupmember)
|
||||
}
|
||||
}
|
||||
// BlueButton{
|
||||
// anchors.left: memberrectangle.right
|
||||
// anchors.margins: 1*mm
|
||||
// text: "\uf056"
|
||||
// onClicked:{
|
||||
// groupModel.remove(index)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// // BlueButton{
|
||||
// // anchors.left: memberrectangle.right
|
||||
// // anchors.margins: 1*mm
|
||||
// // text: "\uf056"
|
||||
// // onClicked:{
|
||||
// // groupModel.remove(index)
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
ListView{
|
||||
id: groupListView
|
||||
|
@ -189,7 +190,8 @@ Item {
|
|||
clip: true
|
||||
spacing: 2
|
||||
model: groupModel
|
||||
delegate: groupMember
|
||||
delegate: ContactComponent { }// groupMember
|
||||
function processContactSelection(contactobject){showContactdetails(contactobject)}
|
||||
}
|
||||
|
||||
ListModel{id: groupModel}
|
||||
|
|
|
@ -120,6 +120,7 @@ StackView{
|
|||
})}
|
||||
}
|
||||
else if (newstab.conversation.length>0){newstab.conversation=[]}
|
||||
else if (root.depth>1){root.pop()}
|
||||
else{Service.cleanNews(root.db,function(){
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
Qt.quit()})
|
||||
|
|
93
source-linux/qml/genericqml/ContactComponent.qml
Normal file
93
source-linux/qml/genericqml/ContactComponent.qml
Normal file
|
@ -0,0 +1,93 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.4
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
Item {
|
||||
id: contactComponent
|
||||
height: 8*mm
|
||||
width: parent.width
|
||||
property var createdAtDate: new Date(contact.created_at)
|
||||
property string connectUrl: (contact.network!=="dfrn")||(contact.isFriend==1)?"":( "<a href='"+contact.url.replace("profile","dfrn_request") +"'>"+qsTr("Connect")+"</a><br>")
|
||||
|
||||
Rectangle {
|
||||
id: wrapper
|
||||
width:parent.width
|
||||
height: 8*mm
|
||||
border.color: "grey"
|
||||
color:"white"
|
||||
Image {
|
||||
id: photoImage
|
||||
x:0.5*mm
|
||||
y:0.5*mm
|
||||
width: 7*mm
|
||||
height:7*mm
|
||||
source:((contact.profile_image!="") && (typeof(contact.profile_image)=="string"))? "file://"+contact.profile_image : contact.profile_image_url
|
||||
onStatusChanged: {if (photoImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}}
|
||||
}
|
||||
|
||||
Column{
|
||||
width: wrapper.width-8*mm
|
||||
anchors.left: photoImage.right
|
||||
anchors.margins: 1*mm
|
||||
spacing: mm
|
||||
Label {
|
||||
id: namelabel
|
||||
width: wrapper.width-4
|
||||
height: 3*mm
|
||||
text: contact.name
|
||||
elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pixelSize: 3*mm
|
||||
}
|
||||
Label {
|
||||
id: screennamelabel
|
||||
width: wrapper.width-8*mm
|
||||
height: 2.5*mm
|
||||
text: "@"+contact.screen_name
|
||||
elide:Text.ElideRight
|
||||
color: "#303030"
|
||||
font.pixelSize: 2.5*mm
|
||||
}
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
contactComponent.ListView.view.processContactSelection(contact)
|
||||
// rootstack.currentIndex=0;
|
||||
// bar.currentIndex=0;
|
||||
// root.contactdetailsSignal(contact)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ Rectangle {
|
|||
|
||||
ListView {
|
||||
id: conversationView
|
||||
property string viewtype: "conversation"
|
||||
x:3*mm
|
||||
y:8*mm
|
||||
width: conversationList.width-4*mm
|
||||
|
|
|
@ -47,6 +47,7 @@ Rectangle{
|
|||
id:messageSend
|
||||
visible:(newsSwipeview.stacktype!="Notifications")?true:false
|
||||
property string parentId: ""
|
||||
property bool textfocus: false
|
||||
//property var parentObject:({})
|
||||
property bool conversation: false
|
||||
property string reply_to_user:""
|
||||
|
@ -55,21 +56,23 @@ Rectangle{
|
|||
//property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property var contact_allow:login.permissions[0]
|
||||
property var contact_deny:login.permissions[1]
|
||||
property var group_allow:login.permissions[2]
|
||||
property var group_deny:login.permissions[3]
|
||||
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
|
||||
property var contact_deny:login.hasOwnProperty("permissions")?login.permissions[1]:[]
|
||||
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
|
||||
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
|
||||
|
||||
onReply_to_userChanged: {
|
||||
if (reply_to_user!=""){
|
||||
receiverLabel.visible=true
|
||||
}
|
||||
}
|
||||
// onReply_to_userChanged: {
|
||||
// if (reply_to_user!=""){
|
||||
// print("reply "+reply_to_user)
|
||||
// //receiverLabel.visible=true
|
||||
// receiverLabel.text=reply_to_user
|
||||
// }
|
||||
// }
|
||||
|
||||
function directmessagePrepare(friend){
|
||||
messageSend.state="active";
|
||||
reply_to_user=friend.screen_name;
|
||||
receiverLabel.text=qsTr("to:")+ " "+ friend.screen_name;
|
||||
receiverLabel.text=friend.screen_name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,9 +97,10 @@ Rectangle{
|
|||
|
||||
|
||||
function 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");
|
||||
imageAttachment.source=url.toString();
|
||||
// var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
// url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
|
||||
// url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
|
@ -114,7 +118,12 @@ Rectangle{
|
|||
if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
|
||||
if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
|
||||
if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
|
||||
if (attachImageURL.length>0) {for (var image in attachImageURL){xhr.setImageFileParam("media", attachImageURL[image] )}};
|
||||
if (attachImageURL.length>0) {
|
||||
for (var image in attachImageURL){
|
||||
xhr.setImageFileParam("media", attachImageURL[image]);
|
||||
xhr.setImageFileParam("angle", rotator.angle.toString());
|
||||
}
|
||||
};
|
||||
xhr.post();
|
||||
}
|
||||
|
||||
|
@ -137,35 +146,24 @@ Rectangle{
|
|||
if (newsitemobject!=""){
|
||||
messageSend.state="conversation"
|
||||
reply_to_user=newsitemobject.user.screen_name;
|
||||
receiverLabel.text=qsTr("to:")+ " "+ newsitemobject.user.screen_name;
|
||||
parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state=""
|
||||
reply_to_user="";
|
||||
receiverLabel.text=qsTr("to:");
|
||||
parentId="";
|
||||
bodyField.text="";
|
||||
attachImageURLs.pop();
|
||||
try{imageAttachment.destroy()}catch(e){}
|
||||
imageAttachment.source=""
|
||||
}
|
||||
}
|
||||
|
||||
function contactmenu(letter){
|
||||
Newsjs.listFriends(login,db,function(contacts){
|
||||
var contactitems="";
|
||||
contactModel.clear();
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
|
||||
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
|
||||
}
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+
|
||||
"'; onTriggered:{if (newsSwipeview.stacktype=='DirectMessages'){reply_to_user='"+
|
||||
contacts[i].screen_name+"'} else {bodyField.insert("+
|
||||
bodyField.cursorPosition+",' "+contacts[i].screen_name.substring(1)+" ');bodyField.cursorPosition=bodyField.cursorPosition+"+contacts[i].screen_name.length+"}}}"
|
||||
//}
|
||||
contactModel.append({"contact":contacts[i]})
|
||||
}
|
||||
var menuString="import QtQuick.Controls 2.4; Menu {width:40*mm; font.pixelSize: 3*mm; "+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput");
|
||||
if (contacts.length>0){contactlistObject.popup()}
|
||||
contactSelector.visible=true
|
||||
},letter);
|
||||
}
|
||||
// Flickable{
|
||||
|
@ -179,18 +177,47 @@ Rectangle{
|
|||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 10*mm//implicitHeight
|
||||
Label{
|
||||
id:receiverLabel
|
||||
x: 0.5*mm
|
||||
width: parent.width-mm
|
||||
font.pixelSize: 3*mm
|
||||
text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
|
||||
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{}
|
||||
|
||||
// Row{
|
||||
// x: 0.5*mm
|
||||
// Label{
|
||||
// id:toLabel
|
||||
// width: 7*mm
|
||||
// height: 6*mm
|
||||
// topPadding: 1.5* mm
|
||||
// font.pixelSize: 3*mm
|
||||
// text: newsSwipeview.stacktype=="DirectMessages"?qsTr("to:"):""
|
||||
// visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
// }
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
//x: 8*mm
|
||||
width: messageColumn.width//-8*mm
|
||||
font.pixelSize: 3*mm
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""//newsSwipeview.stacktype=="DirectMessages"?qsTr("to:")+ " "+ reply_to_user:""
|
||||
visible:false// ((parentId !== "") || (newsStack.parent.stacktype=="DirectMessages"))
|
||||
//onLengthChanged: contactmenu(text)
|
||||
//onPreeditTextChanged: contactmenu(text)
|
||||
// onActiveFocusChanged:{
|
||||
// if (activeFocus==true){contactmenu("")}
|
||||
// }
|
||||
onTextChanged: {
|
||||
//print (text)
|
||||
contactmenu(text)}
|
||||
// MouseArea{
|
||||
// anchors.fill: parent
|
||||
// onClicked:{print("receiverlabel")
|
||||
// if(newsSwipeview.stacktype=="DirectMessages"){
|
||||
// contactmenu();
|
||||
|
||||
// }}
|
||||
// }
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
|
||||
TextField {
|
||||
id: titleField
|
||||
x: 0.5*mm
|
||||
|
@ -203,16 +230,16 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius: 0.5*mm
|
||||
x:mm
|
||||
width: parent.width-2*mm
|
||||
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
|
||||
|
||||
TextArea {
|
||||
id: bodyField
|
||||
property string contactprefix:""
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
font.family: "Noto Sans"
|
||||
|
@ -226,26 +253,103 @@ Rectangle{
|
|||
if (activeFocus==true){
|
||||
if (conversation==true){
|
||||
setParent(conversationModel.get(0).newsitemobject);
|
||||
messageSend.state="conversation"
|
||||
} else{
|
||||
messageSend.state="active"
|
||||
messageSend.state="conversation";
|
||||
conversationView.contentY=conversationView.contentY+20*mm
|
||||
} else if (textfocus==false){
|
||||
messageSend.state="active";
|
||||
newsView.positionViewAtBeginning();
|
||||
}
|
||||
}
|
||||
}
|
||||
onTextChanged:{
|
||||
if (text!=""){
|
||||
//print(getText(bodyField.cursorPosition-2,bodyField.cursorPosition) +" preedit: "+ preeditText+cursorPosition);
|
||||
var regex1 = /@[a-z]/;var regex2 = /![a-z]/;
|
||||
//print(text.substring(cursorPosition-2,cursorPosition));
|
||||
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
|
||||
if (regex1.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText) || regex2.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)+preeditText)){
|
||||
var letter=(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)).match(/[a-z]/);
|
||||
contactmenu(letter)
|
||||
}
|
||||
}}
|
||||
var plaintext=getText(0,cursorPosition)
|
||||
//print(plaintext+plaintext.lastIndexOf("@",cursorPosition)+getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition) +" preedit: "+ preeditText+cursorPosition);
|
||||
var regex1 = /@[a-z]+/;var regex2 = /![a-z]+/;var regex3 = /\s/;
|
||||
//print(text.substring(cursorPosition-2,cursorPosition));
|
||||
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
|
||||
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
|
||||
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
|
||||
contactprefix="@";
|
||||
contactmenu(letter.toString())
|
||||
} else if( regex2.test(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) ){
|
||||
var letter=(getText(plaintext.lastIndexOf('!',cursorPosition),cursorPosition)).match(/[a-z]+/);
|
||||
contactprefix="!";
|
||||
contactmenu(letter.toString())
|
||||
}else {contactSelector.visible=false}
|
||||
}else{contactSelector.visible=false}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListView{
|
||||
id:contactSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:8*mm
|
||||
width: parent.width-9*mm
|
||||
height: messageSend.height/2
|
||||
model:contactModel
|
||||
function processContactSelection(contact){
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
|
||||
contact.screen_name=contact.screen_name+"+"+contacts.cid
|
||||
}
|
||||
if (newsSwipeview.stacktype=='DirectMessages'){
|
||||
receiverLabel.text=contact.screen_name;
|
||||
reply_to_user=contact.screen_name
|
||||
} else {
|
||||
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
|
||||
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
|
||||
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
|
||||
}
|
||||
//receiverLabel.text=contact.screen_name;
|
||||
contactSelector.visible=false
|
||||
}
|
||||
delegate: ContactComponent { }
|
||||
}
|
||||
ListModel{id:contactModel}
|
||||
|
||||
|
||||
Item{
|
||||
id:imageAttachment;
|
||||
property alias source:realimage.source
|
||||
//property alias angle:rotator.angle
|
||||
visible: source!=""
|
||||
width: 45*mm
|
||||
height: 45*mm;
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
attachImageURLs.splice(attachImageURLs.indexOf(source),1);
|
||||
imageAttachment.source=""
|
||||
}
|
||||
}
|
||||
Image{id:realimage
|
||||
source:"";
|
||||
x:2*mm;
|
||||
width: 45*mm;
|
||||
height: source==""?0:45*mm;
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
transform: Rotation {id:rotator; origin.x: 22.5*mm; origin.y: 22.5*mm; angle: 0}
|
||||
|
||||
}
|
||||
Rectangle{
|
||||
width: 5*mm
|
||||
height: 5*mm
|
||||
visible: imageAttachment.source!=""
|
||||
anchors.bottom: imageAttachment.bottom
|
||||
anchors.right: imageAttachment.right
|
||||
color: "black"
|
||||
opacity: 0.5
|
||||
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
|
||||
MouseArea{
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
rotator.angle+=90;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Row{
|
||||
// spacing: 2
|
||||
|
@ -341,13 +445,16 @@ Rectangle{
|
|||
width: 7*mm
|
||||
text: "\uf057"
|
||||
onClicked: {
|
||||
bodyField.text="";
|
||||
messageSend.state="";
|
||||
permissionDialog.visible=false;
|
||||
receiverLabel.visible=false;
|
||||
reply_to_user="";
|
||||
attachImage("");
|
||||
attachImageURLs.pop();
|
||||
if (textfocus==true){messageSend.destroy()}
|
||||
else{
|
||||
bodyField.text="";
|
||||
messageSend.state="";
|
||||
permissionDialog.visible=false;
|
||||
receiverLabel.visible=false;
|
||||
reply_to_user="";
|
||||
attachImage("");
|
||||
attachImageURLs.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
MButton {
|
||||
|
@ -382,6 +489,7 @@ Rectangle{
|
|||
root.directmessageSignal.connect(directmessagePrepare);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
if (textfocus==true){bodyField.forceActiveFocus()}
|
||||
}
|
||||
|
||||
states: [ State {
|
||||
|
@ -398,6 +506,9 @@ Rectangle{
|
|||
PropertyChanges {
|
||||
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
}
|
||||
// PropertyChanges {
|
||||
// target: toLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
|
||||
// }
|
||||
},
|
||||
State {
|
||||
name: "conversation"
|
||||
|
@ -422,6 +533,23 @@ Rectangle{
|
|||
// PropertyChanges {
|
||||
// target: messageSend; parentId: conversationModel.get(0).newsitemobject.status_id
|
||||
// }
|
||||
} ]
|
||||
},
|
||||
|
||||
State {
|
||||
name: "reply"
|
||||
PropertyChanges {
|
||||
target: messageColumn; height: implicitHeight
|
||||
}
|
||||
PropertyChanges {
|
||||
target: buttonRow; visible:true
|
||||
}
|
||||
PropertyChanges {
|
||||
target: titleField; visible:false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: bodyField; placeholderText:"";focus:true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -152,7 +152,40 @@ StackView{
|
|||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
Connections{
|
||||
function getOldNews(){
|
||||
var currentTime= new Date();
|
||||
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
// else if(newstab.newstabstatus=="Contact"){
|
||||
// Newsjs.newsfromdb(root.db,root.login, function(news){
|
||||
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
// newsWorker.sendMessage(msg);
|
||||
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
else{
|
||||
//newsStack.appendNews=true;
|
||||
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
|
||||
xhr.get()
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target:xhr
|
||||
onError:{
|
||||
Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);
|
||||
|
@ -375,39 +408,11 @@ StackView{
|
|||
anchors.centerIn: parent
|
||||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
onClicked:{
|
||||
var currentTime= new Date();
|
||||
var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true, 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
// else if(newstab.newstabstatus=="Contact"){
|
||||
// Newsjs.newsfromdb(root.db,root.login, function(news){
|
||||
// var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'appendnews':true};
|
||||
// newsWorker.sendMessage(msg);
|
||||
// },newsModel.get(newsModel.count-1).newsitemobject.uid,lastnews_id)}
|
||||
else if (newstab.newstabstatus=="Notifications"){}
|
||||
else{
|
||||
//newsStack.appendNews=true;
|
||||
xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);
|
||||
xhr.get()
|
||||
}}
|
||||
getOldNews();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -425,6 +430,8 @@ StackView{
|
|||
id: newsView
|
||||
property real oldContentY:0
|
||||
property bool viewdragged: false
|
||||
property bool viewdraggedpositive: false
|
||||
property string viewtype: "news"
|
||||
anchors.fill: parent
|
||||
anchors.margins: mm
|
||||
//anchors.topMargin: 6*mm
|
||||
|
@ -440,7 +447,10 @@ StackView{
|
|||
onDragEnded: {
|
||||
if(verticalOvershoot<-5*mm){
|
||||
viewdragged=true
|
||||
}
|
||||
}
|
||||
else if (verticalOvershoot>5*mm){
|
||||
viewdraggedpositive=true
|
||||
}
|
||||
else{
|
||||
if((contentY-oldContentY)>15*mm){
|
||||
swipeIndicator.visible=false;
|
||||
|
@ -460,24 +470,25 @@ StackView{
|
|||
if (viewdragged){
|
||||
var onlynew=true;
|
||||
newsBusy.running=true;
|
||||
viewdragged=false
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
}
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
if(newstab.newstabstatus=="Timeline"){
|
||||
try{ Newsjs.newsfromdb(root.db,root.login,0, function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
}
|
||||
if(newstab.newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(news)});
|
||||
}
|
||||
} else {
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
|
@ -492,9 +503,16 @@ StackView{
|
|||
else if (newsSwipeview.stacktype=="Replies"){
|
||||
Service.updateView("Replies")
|
||||
}
|
||||
viewdragged=false
|
||||
}}
|
||||
|
||||
}
|
||||
}
|
||||
onViewdraggedpositiveChanged: {
|
||||
if (viewdraggedpositive){
|
||||
getOldNews();
|
||||
viewdraggedpositive=false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel{id: newsModel}
|
||||
|
||||
|
@ -554,7 +572,7 @@ StackView{
|
|||
// showNews(root.news)
|
||||
// }
|
||||
//else{
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
login.hasOwnProperty("newsViewType")?newstab.newstabstatus=login.newsViewType:"Conversations"
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
|
|
|
@ -59,10 +59,8 @@ Item {
|
|||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Timer {id:contacttimer; interval: 50; running: false; repeat: false
|
||||
onTriggered: {//print("Contacttimer "+JSON.stringify(root.news));
|
||||
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)
|
||||
|
|
|
@ -29,63 +29,39 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtMultimedia 5.8
|
||||
//import QtMultimedia 5.8
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
//import QtQuick.Controls 2.4
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle{
|
||||
color:"black"
|
||||
//border.color: "light grey"
|
||||
width:newscolumn.width;
|
||||
height:newscolumn.width/4*3//video.hasVideo?newscolumn.width/4*3:10*mm
|
||||
property alias source:video.source
|
||||
width:newscolumn.width/2;
|
||||
height:newscolumn.width/3//video.hasVideo?newscolumn.width/4*3:10*mm
|
||||
property var attachment:({})
|
||||
Text{
|
||||
id:noticeText
|
||||
text:"\uf144";
|
||||
color:"light grey"
|
||||
width:parent.width
|
||||
font.pixelSize: parent.height/2
|
||||
x:parent.width/2-parent.height/4
|
||||
x: (parent.width-contentWidth)/2
|
||||
y:parent.height/5
|
||||
visible: video.playbackState!=MediaPlayer.PlayingState
|
||||
//visible: video.playbackState!=MediaPlayer.PlayingState
|
||||
}
|
||||
|
||||
Video {id:video;
|
||||
anchors.fill:parent
|
||||
property string mimetype:""
|
||||
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString}
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
autoLoad: false
|
||||
audioRole: MediaPlayer.VideoRole
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{if(video.playbackState!=MediaPlayer.PlayingState){
|
||||
video.play()} else{video.pause()}
|
||||
MouseArea {anchors.fill:parent;
|
||||
onClicked:{
|
||||
if(attachment.mimetype=="video/youtube"){
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsYplayer.qml");
|
||||
var videoQml = component.createObject(root,{"ytcode":attachment.url,"mimetype":attachment.mimetype});
|
||||
} else {
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideoLarge.qml");
|
||||
var videoQml = component.createObject(root,{"source": attachment.url,"mimetype": attachment.mimetype});
|
||||
}
|
||||
}
|
||||
}
|
||||
ProgressBar{
|
||||
id: videoProgress
|
||||
width: parent.width
|
||||
height: 2*mm
|
||||
anchors.top: video.bottom
|
||||
z:2
|
||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||
value: video.position/video.duration
|
||||
}
|
||||
ProgressBar{
|
||||
id: videoBuffer
|
||||
width: parent.width
|
||||
height: 2*mm
|
||||
anchors.top: video.bottom
|
||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||
value: video.bufferProgress
|
||||
style:ProgressBarStyle{
|
||||
progress: Rectangle{
|
||||
color:"light grey"
|
||||
}
|
||||
}
|
||||
}
|
||||
// Slider{ id: videoSlider
|
||||
// width: parent.width
|
||||
// height: 3*mm
|
||||
|
|
111
source-linux/qml/newsqml/NewsVideoLarge.qml
Normal file
111
source-linux/qml/newsqml/NewsVideoLarge.qml
Normal file
|
@ -0,0 +1,111 @@
|
|||
// This file is part of Friendiqa
|
||||
// https://git.friendi.ca/lubuwest/Friendiqa
|
||||
// Copyright (C) 2017 Marco R. <thomasschmidt45@gmx.net>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations including
|
||||
// the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for all
|
||||
// of the code used other than OpenSSL. If you modify file(s) with this
|
||||
// exception, you may extend this exception to your version of the
|
||||
// file(s), but you are not obligated to do so. If you do not wish to do
|
||||
// so, delete this exception statement from your version. If you delete
|
||||
// this exception statement from all source files in the program, then
|
||||
// also delete it here.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import QtMultimedia 5.8
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.4
|
||||
//import QtQuick.Controls.Styles 1.4
|
||||
|
||||
Rectangle{
|
||||
id:newsvideofullscreen
|
||||
color:"black"
|
||||
//border.color: "light grey"
|
||||
width:root.width;
|
||||
height:root.height
|
||||
property alias source:video.source
|
||||
Text{
|
||||
id:noticeText
|
||||
text:""
|
||||
color:"light grey"
|
||||
width:parent.width/2
|
||||
wrapMode: Text.Wrap
|
||||
font.pixelSize: 3*mm
|
||||
x:parent.width/2-parent.height/4
|
||||
y:parent.height/5
|
||||
visible: video.playbackState!=MediaPlayer.PlayingState
|
||||
}
|
||||
|
||||
Video {id:video;
|
||||
anchors.fill:parent
|
||||
property string mimetype:""
|
||||
onErrorChanged:{noticeText.font.pixelSize=3*mm;noticeText.text=errorString;}
|
||||
fillMode: Image.PreserveAspectFit;
|
||||
autoLoad: true
|
||||
autoPlay: true
|
||||
audioRole: MediaPlayer.VideoRole
|
||||
MouseArea {
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
newsvideofullscreen.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: videoProgress
|
||||
width: parent.width
|
||||
height: 2*mm
|
||||
anchors.bottom: video.bottom
|
||||
z:2
|
||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||
value: video.position/video.duration
|
||||
MouseArea {
|
||||
anchors.fill:parent;
|
||||
onClicked:{
|
||||
if(video.playbackState!=MediaPlayer.PlayingState){
|
||||
video.play()} else{video.pause()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProgressBar{
|
||||
id: videoBuffer
|
||||
width: parent.width
|
||||
height: 2*mm
|
||||
anchors.bottom: video.bottom
|
||||
visible:video.playbackState!=MediaPlayer.StoppedState
|
||||
value: video.bufferProgress
|
||||
// style:ProgressBarStyle{
|
||||
// progress: Rectangle{
|
||||
// color:"light grey"
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// Slider{ id: videoSlider
|
||||
// width: parent.width
|
||||
// height: 3*mm
|
||||
// anchors.top: video.bottom
|
||||
// visible:video.playbackState!=MediaPlayer.StoppedState && video.seekable
|
||||
// value: video.position/video.duration
|
||||
// onPressed:video.seek(value*video.duration)
|
||||
// }
|
||||
}
|
|
@ -33,19 +33,23 @@
|
|||
|
||||
import QtQuick 2.8
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
//import QtWebView 1.1
|
||||
import QtWebView 1.1
|
||||
|
||||
Rectangle{
|
||||
color:"transparent"
|
||||
width:newscolumn.width;
|
||||
height:newscolumn.width/4*3
|
||||
property string url:""//htmlview.text
|
||||
id:newsYplayer
|
||||
color:"black"
|
||||
width:root.width;
|
||||
height:root.height
|
||||
property string url:""
|
||||
property string ytcode:""
|
||||
|
||||
WebView {
|
||||
id: webView
|
||||
anchors.fill: parent
|
||||
z:1
|
||||
opacity: 0
|
||||
|
||||
url: "qrc:///content/player.html?" + currentVideo.vId
|
||||
url: root.osSettings.osType=="Android"?"https://youtube.com/watch?v="+ytcode:"qrc:/js/yplayer.html?" + ytcode
|
||||
|
||||
Behavior on opacity { NumberAnimation { duration: 200 } }
|
||||
|
||||
|
@ -59,42 +63,13 @@ Rectangle{
|
|||
case WebView.LoadStoppedStatus:
|
||||
break
|
||||
case WebView.LoadFailedStatus:
|
||||
topInfo.text = "Failed to load the requested video"
|
||||
print("Failed to load the requested video" + url)
|
||||
break
|
||||
}
|
||||
opacity = 0
|
||||
}
|
||||
onTitleChanged: {
|
||||
currentVideo.status = 1 * title
|
||||
if (title == videoStatus.paused || title == videoStatus.ready)
|
||||
panel.state = "list"
|
||||
else if (title == videoStatus.playing)
|
||||
panel.state = "hidden"
|
||||
if (title==2){newsYplayer.destroy()}
|
||||
}
|
||||
}
|
||||
Text{id:htmlview
|
||||
textFormat:Text.RichText
|
||||
}
|
||||
// WebView {id:htmlview;
|
||||
// anchors.fill: parent
|
||||
// }
|
||||
Component.onCompleted:{
|
||||
|
||||
// Helperjs.friendicaWebRequest(url,parent,function(document){
|
||||
// print(document);
|
||||
|
||||
//// var metas = document.getElementsByTagName('meta'); //get all the meta tag elements
|
||||
//// //iterate through them
|
||||
//// for (i=0; i<metas.length; i++) {
|
||||
//// if (metas[i].getAttribute("name") == "keywords") {
|
||||
//// print(metas[i].getAttribute("content"));
|
||||
//// }
|
||||
//// else if (metas[i].getAttribute("name") == "description") {
|
||||
//// console.log(metas[i].getAttribute("content"));
|
||||
//// }
|
||||
//// }
|
||||
// //print(html);
|
||||
// htmlview.text=""
|
||||
// })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ Item {
|
|||
width:parent.width
|
||||
spacing:mm
|
||||
clip:true
|
||||
height: Math.min(implicitHeight,3/4*root.height)
|
||||
height: newsitemobject.nsfw?5*mm:Math.min(implicitHeight,3/4*root.height)
|
||||
MouseArea{
|
||||
width: newsitem.width-8*mm-2
|
||||
height: itemMessage.height
|
||||
|
@ -188,9 +188,10 @@ Item {
|
|||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsLink.qml");
|
||||
var linkQml = component.createObject(messageColumn,{"url":newsitemobject.attachmentList[attachments].url});
|
||||
}
|
||||
else {//print(newsitemobject.attachmentList[attachments].url+" Type: "+newsitemobject.attachmentList[attachments].mimetype)
|
||||
else {
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/NewsVideo.qml");
|
||||
var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
//var videoQml = component.createObject(messageColumn,{"source":newsitemobject.attachmentList[attachments].url,"mimetype":newsitemobject.attachmentList[attachments].mimetype});
|
||||
var videoQml = component.createObject(messageColumn,{"attachment":newsitemobject.attachmentList[attachments]});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +202,7 @@ Item {
|
|||
width: newsitem.width-8*mm-2
|
||||
height:5*mm
|
||||
//anchors.bottom: messageColumn.bottom//itemMessage.bottom
|
||||
visible: messageColumn.implicitHeight>3/4*root.height//itemMessage.implicitHeight>3/4*root.height
|
||||
visible: messageColumn.implicitHeight>3/4*root.height || newsitemobject.nsfw//itemMessage.implicitHeight>3/4*root.height
|
||||
text:"\uf078"
|
||||
fontColor:"grey"
|
||||
border.color: "transparent"
|
||||
|
@ -412,7 +413,10 @@ Item {
|
|||
onTriggered: {
|
||||
var directmessage=0;
|
||||
if (newsitemobject.messagetype==1){ directmessage=1}
|
||||
replySignal(newsitemobject)
|
||||
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
|
||||
var conversation;newsitem.ListView.view.viewtype=="conversation"?true:false;
|
||||
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
|
||||
//replySignal(newsitemobject)
|
||||
//newsStack.push("qrc:/qml/newsqml/MessageSend.qml",{"reply_to_user": newsitemobject.user.screen_name,"parentId":newsitemobject.id,"login":root.login,"directmessage":directmessage});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,8 +254,22 @@ function updateImage(){
|
|||
y: 10*mm
|
||||
width: root.width/2;
|
||||
height: 5*mm;
|
||||
font.pixelSize: 3*mm
|
||||
editable:true
|
||||
model: albumModel
|
||||
|
||||
// delegate: ItemDelegate {
|
||||
// width: album.width
|
||||
// contentItem: Text {
|
||||
// //text: modelData
|
||||
// color: "white"
|
||||
// font: album.font
|
||||
// font.pixelSize: album.font.pixelSize
|
||||
// elide: Text.ElideRight
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// }
|
||||
// //highlighted: album.highlightedIndex === index
|
||||
// }
|
||||
onAccepted: {
|
||||
if (find(currentText) === -1) {
|
||||
albumModel.append({text: editText})
|
||||
|
|
|
@ -116,7 +116,7 @@ StackView{
|
|||
else{
|
||||
try {photogroupModel.clear()}catch (e){print(e)}
|
||||
if (friend){
|
||||
Imagejs.newRequestFriendsAlbumPictures(root.login,friend,fotorectangle,function(albums,remoteAuthBool){
|
||||
Imagejs.newRequestFriendsAlbumPictures(login,friend,fotorectangle,function(albums,remoteAuthBool){
|
||||
remoteContact=remoteAuthBool;
|
||||
var msg = {'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture':true,'friend':friend}
|
||||
photoWorker.sendMessage(msg);
|
||||
|
@ -125,7 +125,7 @@ StackView{
|
|||
|
||||
}
|
||||
else {
|
||||
Helperjs.readField("album", root.db, "imageData",login.username,function(albums){
|
||||
Helperjs.readField("album", db, "imageData",login.username,function(albums){
|
||||
if (albums[0]) {
|
||||
var msg = { 'model': photogroupModel,'albums':albums,'firstalbum':0,'foreignPicture': false};
|
||||
photoWorker.sendMessage(msg);
|
||||
|
@ -261,7 +261,7 @@ StackView{
|
|||
text:qsTr("More")
|
||||
}
|
||||
MouseArea{anchors.fill:parent
|
||||
onClicked:{print(photogroupModel.get(0).foreignPicture);
|
||||
onClicked:{//print(photogroupModel.get(0).foreignPicture);
|
||||
var lastalbum_id=photogroupModel.count-1;
|
||||
if(photogroupModel.get(photogroupModel.count-1).foreignPicture==true){
|
||||
Imagejs.newRequestFriendsAlbumPictures(login,photogroupModel.get(0).friend,fotorectangle,function(albums,remoteAuthBool){
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
[Controls]
|
||||
Style=Material
|
||||
|
||||
[Default]
|
||||
Font\Family=Noto Sans
|
||||
Font\PointSize=20
|
||||
|
||||
[Universal]
|
||||
Theme=System
|
||||
Accent=Red
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue