forked from lubuwest/Friendiqa
v0.6.4 contact search
This commit is contained in:
parent
66e5c33b00
commit
5032c78de1
57 changed files with 2218 additions and 2252 deletions
|
@ -154,10 +154,8 @@ bool FILESYSTEM::isAutostart() {
|
|||
QFileInfo check_file(QDir::homePath() + "/.config/autostart/friendiqa.desktop");
|
||||
|
||||
if (check_file.exists() && check_file.isFile()) {
|
||||
qDebug()<<"autostart "<<true;
|
||||
return true;
|
||||
}
|
||||
qDebug()<<"autostart "<<false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ int main(int argc, char *argv[]) {
|
|||
UPDATENEWS* updatenews= UPDATENEWS::instance();
|
||||
updatenews->setDatabase();
|
||||
updatenews->login();
|
||||
updatenews->setSyncAll(true);
|
||||
updatenews->startsync();
|
||||
|
||||
//app.connect (updatenews,SIGNAL(quitapp()),&app,SLOT(quit()));
|
||||
|
@ -86,6 +87,7 @@ int main(int argc, char *argv[]) {
|
|||
QQmlApplicationEngine view;
|
||||
//QQuickView view;
|
||||
//view.setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
app.setWindowIcon(QIcon(":/images/Friendiqa.ico"));
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load("friendiqa-" + QLocale::system().name(),":/translations");
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
@ -108,6 +110,7 @@ int main(int argc, char *argv[]) {
|
|||
qmlRegisterType<QSystemTrayIcon>("QSystemTrayIcon", 1, 0, "QSystemTrayIcon");
|
||||
qRegisterMetaType<QSystemTrayIcon::ActivationReason>("ActivationReason");
|
||||
view.rootContext()->setContextProperty("iconTray", QIcon(":/images/Friendica_monochrome.png"));
|
||||
view.rootContext()->setContextProperty("iconTrayAvailable", QSystemTrayIcon::isSystemTrayAvailable());
|
||||
|
||||
view.load(QUrl("qrc:/qml/friendiqa.qml"));
|
||||
//view.show();
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "updatenews.h"
|
||||
|
||||
#include <QHttpPart>
|
||||
#include <QTextCodec>
|
||||
//#include <QTextCodec>
|
||||
#include <QUrlQuery>
|
||||
#include <QList>
|
||||
#include <QDataStream>
|
||||
|
@ -68,6 +68,10 @@ void UPDATENEWS::setUrl(QString url)
|
|||
}
|
||||
}
|
||||
|
||||
void UPDATENEWS::setSyncAll(bool syncAll)
|
||||
{
|
||||
m_syncAll=syncAll;
|
||||
}
|
||||
|
||||
void UPDATENEWS::setDatabase()
|
||||
{
|
||||
|
@ -75,7 +79,6 @@ void UPDATENEWS::setDatabase()
|
|||
QString db_url=qe.offlineStorageDatabaseFilePath("Friendiqa");
|
||||
m_db = QSqlDatabase::addDatabase("QSQLITE");
|
||||
m_db.setDatabaseName(QUrl("file://"+db_url+".sqlite").toLocalFile());
|
||||
//qDebug() << db_url;
|
||||
|
||||
if (!m_db.open())
|
||||
{
|
||||
|
@ -86,26 +89,8 @@ void UPDATENEWS::setDatabase()
|
|||
|
||||
void UPDATENEWS::login()
|
||||
{
|
||||
QSqlQuery query("SELECT * FROM config WHERE isActive=0",m_db);
|
||||
while (query.next())
|
||||
{
|
||||
username = query.value(1).toString();
|
||||
QByteArray bpassword=query.value(2).toByteArray();
|
||||
QString password=QByteArray::fromBase64(bpassword);
|
||||
m_login=username+":"+password ;
|
||||
xhr.setLogin(m_login);
|
||||
m_url=query.value(0).toString();
|
||||
xhr.setUrl(m_url);
|
||||
m_imagedir=query.value(3).toString();
|
||||
xhr.setImagedir(m_imagedir);
|
||||
QString isActive=query.value(7).toString();
|
||||
}
|
||||
//m_updateInterval=query.value(5).toInt();
|
||||
|
||||
|
||||
QSqlQuery syncquery("SELECT * FROM globaloptions",m_db);
|
||||
// QSqlQuery delquery("DELETE FROM globaloptions WHERE k='sync_interval'",m_db);
|
||||
// delquery.exec();
|
||||
m_updateInterval=0;
|
||||
syncindex=0;
|
||||
synclist.clear();
|
||||
|
@ -132,39 +117,61 @@ void UPDATENEWS::login()
|
|||
if(!(synctimequery3.exec())) {qDebug() << " synctimequery3 " << synctimequery3.lastError();}
|
||||
}
|
||||
|
||||
QSqlQuery query("SELECT * FROM config ORDER BY isActive ASC, username ASC",m_db);
|
||||
query.last();
|
||||
usernamelength=query.at()+1;
|
||||
|
||||
if (query.isActive()&&(usernameindex<usernamelength))
|
||||
{ query.seek(usernameindex);
|
||||
username = query.value(1).toString();
|
||||
QByteArray bpassword=query.value(2).toByteArray();
|
||||
QString password=QByteArray::fromBase64(bpassword);
|
||||
m_login=username+":"+password ;
|
||||
xhr.setLogin(m_login);
|
||||
m_url=query.value(0).toString();
|
||||
xhr.setUrl(m_url);
|
||||
m_imagedir=query.value(3).toString();
|
||||
xhr.setImagedir(m_imagedir);
|
||||
QString isActive=query.value(7).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UPDATENEWS::startsync()
|
||||
{ qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length(); //<< "Type "<<synclist[syncindex];
|
||||
//QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
||||
//QObject::connect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
||||
if (syncindex<synclist.length()){
|
||||
if (synclist[syncindex]=="sync_Timeline"){
|
||||
timeline();
|
||||
} else if (synclist[syncindex]=="sync_Replies") {
|
||||
replies();
|
||||
} else if (synclist[syncindex]=="sync_DirectMessages") {
|
||||
directmessages();
|
||||
} else if (synclist[syncindex]=="sync_Notifications") {
|
||||
notifications();
|
||||
} else if (synclist[syncindex]=="sync_FriendRequests") {
|
||||
friendrequests();
|
||||
}else if (synclist[syncindex]=="sync_Events") {
|
||||
events();
|
||||
}
|
||||
} else if (syncindex==synclist.length()) {
|
||||
m_api="";
|
||||
if(m_updateInterval!=0){
|
||||
syncindex=0;
|
||||
synclist.clear();
|
||||
m_db.close();
|
||||
m_db.removeDatabase(m_db.connectionName());
|
||||
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
||||
emit quitapp();
|
||||
alarm.setAlarm(m_updateInterval);
|
||||
m_updateInterval=0;
|
||||
}
|
||||
}
|
||||
{ //qDebug()<<"Friendiqa start syncing "<<syncindex <<" of "<<synclist.length() << " m_login "<<m_login;
|
||||
if (syncindex<synclist.length()){
|
||||
if (synclist[syncindex]=="sync_Timeline"){
|
||||
timeline();
|
||||
} else if (synclist[syncindex]=="sync_Replies") {
|
||||
replies();
|
||||
} else if (synclist[syncindex]=="sync_DirectMessages") {
|
||||
directmessages();
|
||||
} else if (synclist[syncindex]=="sync_Notifications") {
|
||||
notifications();
|
||||
} else if (synclist[syncindex]=="sync_FriendRequests") {
|
||||
friendrequests();
|
||||
}else if (synclist[syncindex]=="sync_Events") {
|
||||
events();
|
||||
}
|
||||
} else if ((syncindex==synclist.length())&&(!(usernameindex<usernamelength-1))) {
|
||||
m_api="";
|
||||
if(m_updateInterval!=0){
|
||||
syncindex=0;
|
||||
usernameindex=0;
|
||||
synclist.clear();
|
||||
m_db.close();
|
||||
m_db.removeDatabase(m_db.connectionName());
|
||||
QObject::disconnect(&xhr,SIGNAL(error(QString,QString,QString,int)),this,SLOT(showError(QString,QString,QString,int)));
|
||||
emit quitapp();
|
||||
alarm.setAlarm(m_updateInterval);
|
||||
m_updateInterval=0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
usernameindex+=1;
|
||||
login();
|
||||
startsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,7 +236,7 @@ void UPDATENEWS::directmessages()
|
|||
|
||||
void UPDATENEWS::notifications()
|
||||
{
|
||||
m_api="/api/friendica/notifications";
|
||||
m_api="/api/friendica/notification";
|
||||
xhr.clearParams();
|
||||
xhr.setUrl(m_url);
|
||||
xhr.setApi(m_api);
|
||||
|
@ -282,14 +289,14 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
for (int i=0; i < news.array().count();i++){
|
||||
QJsonValue newsitem=news[i];
|
||||
try{
|
||||
if (apiname=="/api/friendica/notifications"){
|
||||
if (apiname=="/api/friendica/notification"){
|
||||
QSqlQuery testquery("SELECT status_id FROM news WHERE status_id=" + QString::number(newsitem["id"].toInt()) + " AND messagetype=2 AND username='"+ username +"'",m_db);
|
||||
if (testquery.first()) {continue;}
|
||||
}
|
||||
QSqlQuery query(m_db);
|
||||
query.prepare("INSERT INTO news (username,messagetype,text,created_at,in_reply_to_status_id,source,status_id,in_reply_to_user_id,"
|
||||
"geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
"geo,favorited,uid,statusnet_html,statusnet_conversation_id,friendica_activities,friendica_activities_self,attachments,friendica_owner) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
query.bindValue(0,username);
|
||||
query.bindValue(1,"0");
|
||||
query.bindValue(2, newsitem["text"].toString().toUtf8().toBase64());
|
||||
|
@ -303,10 +310,11 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
query.bindValue(8,newsitem["geo"]);
|
||||
query.bindValue( 9, newsitem["favorited"].toInt());
|
||||
query.bindValue(10, newsitem["user"]["id"].toInt());
|
||||
if (newsitem["friendica_title"]!="") {
|
||||
QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
|
||||
query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
|
||||
else{query.bindValue(11, newsitem["friendica_html"].toString().toUtf8().toBase64());}
|
||||
//if (newsitem["friendica_title"]!="") {
|
||||
// QString friendicaHtml="<b>" + newsitem["friendica_title"].toString() +"</b><br><br>"+newsitem["friendica_html"].toString();
|
||||
// query.bindValue(11, friendicaHtml.toUtf8().toBase64());}
|
||||
//else{
|
||||
query.bindValue(11, newsitem["friendica_html"].toString().toUtf8().toBase64());//}
|
||||
if (newsitem["statusnet_conversation_id"].isDouble()){
|
||||
query.bindValue(12, newsitem["statusnet_conversation_id"].toInt());
|
||||
}else{query.bindValue(12, newsitem["statusnet_conversation_id"].toString());}
|
||||
|
@ -351,14 +359,14 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
if (apiname == "/api/direct_messages/all"){
|
||||
query.bindValue(1,"1");
|
||||
query.bindValue(5,"Friendica");
|
||||
query.bindValue(6,newsitem["id"].toString().toInt());
|
||||
query.bindValue(6,newsitem["id"].toInt());
|
||||
if(newsitem["recipient"]["id"]!=QJsonValue::Null){ query.bindValue(7,newsitem["recipient"]["id"].toInt());}
|
||||
query.bindValue(10, newsitem["sender_id"].toInt());
|
||||
query.bindValue(11, newsitem["text"].toString().toUtf8().toBase64());
|
||||
if(newsitem["friendica_parent_uri"]!=QJsonValue::Null){ query.bindValue(12,newsitem["friendica_parent_uri"]);}
|
||||
query.bindValue(16, newsitem["sender"]["url"]);
|
||||
}
|
||||
if (apiname == "/api/friendica/notifications"){
|
||||
if (apiname == "/api/friendica/notification"){
|
||||
query.bindValue(1,"2");
|
||||
query.bindValue(3,QDateTime::fromString(newsitem["date"].toString(),"yyyy-MM-dd hh:mm:ss").toMSecsSinceEpoch());
|
||||
query.bindValue(5,"Friendica");
|
||||
|
@ -387,7 +395,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
alarm.notify("DirectMessage: "+newsitem["sender"]["name"].toString(),newsitem["text"].toString(),2);
|
||||
}
|
||||
}
|
||||
if (apiname=="/api/friendica/notifications"){
|
||||
if (apiname=="/api/friendica/notification"){
|
||||
if(notifylist.contains("notify_Notifications")){
|
||||
alarm.notify("Notification: "+newsitem["name"].toString(),newsitem["text"].toString(),3);
|
||||
}
|
||||
|
@ -403,7 +411,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
startImagedownload("contactlist");
|
||||
|
||||
} else {
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
@ -411,9 +419,12 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
|||
}
|
||||
else {
|
||||
qDebug()<< "Friendiqa updatenews error " << serverreply;
|
||||
emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
//emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
|
||||
emit this->error(m_api,QString(serverreply));
|
||||
if(m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,10 +439,11 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
|
|||
testquery.first();
|
||||
QSqlQuery query("UPDATE contacts SET profile_image='"+ filename +"' WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||
if(!(query.exec())) {qDebug()<< "updateImagelocation " << query.lastError();}
|
||||
//qDebug()<< "index " << index << " " << newcontactnames.length()-1 << " " << m_syncAll;
|
||||
if (index==(newcontactnames.length()-1)){
|
||||
newcontactnames.clear();
|
||||
newcontactimagelinks.clear();
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
@ -445,7 +457,7 @@ void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QStr
|
|||
if (index==(newcontactnames.length()-1)){
|
||||
newcontactnames.clear();
|
||||
newcontactimagelinks.clear();
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
@ -537,10 +549,10 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
|||
QSqlQuery testquery("SELECT url FROM contacts WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'",m_db);
|
||||
if (testquery.first()){
|
||||
query.prepare("UPDATE contacts SET id=?, name=?, screen_name=?, location=?,imageAge=?,"
|
||||
"profile_image_url=?, description=?, protected=?, followers_count=?,"
|
||||
"friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?,"
|
||||
"following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? "
|
||||
" WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'");
|
||||
"profile_image_url=?, description=?, protected=?, followers_count=?,"
|
||||
"friends_count=?, created_at=?, favourites_count=?, utc_offset=?, time_zone=?, statuses_count=?,"
|
||||
"following=?, verified=?, statusnet_blocking=?, notifications=?, statusnet_profile_url=?, cid=?, network=?, timestamp=? "
|
||||
" WHERE username='"+ username +"' AND url='" + contact["url"].toString() +"'");
|
||||
query.bindValue(0, contact["id"].toInt());
|
||||
query.bindValue(1, contact["name"].toString().toUtf8().toBase64());
|
||||
query.bindValue(2, contact["screen_name"]);
|
||||
|
@ -573,10 +585,10 @@ void UPDATENEWS::updateContacts(QList<QJsonValue> contacts){
|
|||
|
||||
else{
|
||||
query.prepare("INSERT INTO contacts (username, id, name, screen_name, location,imageAge,"
|
||||
"profile_image_url, description, profile_image, url, protected, followers_count,"
|
||||
"friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count,"
|
||||
"following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)"
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
"profile_image_url, description, profile_image, url, protected, followers_count,"
|
||||
"friends_count, created_at, favourites_count, utc_offset, time_zone, statuses_count,"
|
||||
"following, verified, statusnet_blocking, notifications, statusnet_profile_url, cid, network, isFriend, timestamp)"
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
|
||||
query.bindValue(0,username);
|
||||
query.bindValue(1, contact["id"].toInt());
|
||||
|
@ -628,6 +640,7 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
|
|||
|
||||
QSqlQuery imagequery("SELECT avatar FROM friendshiprequests",m_db);
|
||||
QList<QString> imageurls;
|
||||
|
||||
while (imagequery.next()){
|
||||
imageurls.append(imagequery.value(0).toString());
|
||||
}
|
||||
|
@ -639,10 +652,10 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
|
|||
QSqlQuery query(m_db);
|
||||
if (testquery.first()){
|
||||
query.prepare("UPDATE friendshiprequests SET id=?, usernamef=?, acct=?, display_name=?,locked=?,"
|
||||
"bot=?, discoverable=?, groupf=?, created_at=?,"
|
||||
"note=?, avatar=?, header=?, header_static=?, followers_count=?,"
|
||||
"following_count=?, statuses_count=?, last_status_at=?, emojis=?, fields=? "
|
||||
" WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'");
|
||||
"bot=?, discoverable=?, groupf=?, created_at=?,"
|
||||
"note=?, avatar=?, header=?, header_static=?, followers_count=?,"
|
||||
"following_count=?, statuses_count=?, last_status_at=?, emojis=?, fields=? "
|
||||
" WHERE username='"+ username +"' AND url='" + friendrequestitem["url"].toString() +"'");
|
||||
|
||||
query.bindValue(0, friendrequestitem["id"].toInt());
|
||||
query.bindValue(1, friendrequestitem["username"]);
|
||||
|
@ -667,9 +680,9 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
|
|||
else{
|
||||
|
||||
query.prepare("INSERT INTO friendshiprequests (username, id, usernamef, acct, display_name, locked,"
|
||||
" created_at, followers_count, following_count, statuses_count, note, url, avatar, avatar_static, "
|
||||
"header, header_static, emojis, moved, fields, bot, groupf, discoverable, last_status_at) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
" created_at, followers_count, following_count, statuses_count, note, url, avatar, avatar_static, "
|
||||
"header, header_static, emojis, moved, fields, bot, groupf, discoverable, last_status_at) "
|
||||
"VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
||||
query.bindValue(0, username);
|
||||
query.bindValue(1, friendrequestitem["id"].toInt());
|
||||
query.bindValue(2, friendrequestitem["username"].toString());
|
||||
|
@ -710,13 +723,12 @@ void UPDATENEWS::storeFriendrequests(QByteArray serverreply,QString apiname)
|
|||
newcontactimagelinks.append(friendrequestitem["avatar"].toString());
|
||||
newcontactnames.append(friendrequestitem["username"].toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (newcontactimagelinks.length()>0){
|
||||
//qDebug() << "start Friendrequests imagedownload";
|
||||
startImagedownload("friendrequests");
|
||||
}else{
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
@ -769,7 +781,7 @@ void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
|
|||
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
|
||||
}
|
||||
}
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
@ -795,7 +807,7 @@ void UPDATENEWS::showError(QString data, QString url,QString api, int code )
|
|||
//qDebug() << "showerror " << api << " data " << data;
|
||||
emit this->error(api,data);
|
||||
if (api!=m_api || xhr.downloadtype()!=""){} else{
|
||||
if(m_updateInterval!=0){
|
||||
if((m_updateInterval!=0) && m_syncAll){
|
||||
syncindex+=1;
|
||||
startsync();
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
void setUrl(QString url);
|
||||
void setSyncAll(bool syncAll);
|
||||
void setDatabase();
|
||||
void login();
|
||||
void timeline();
|
||||
|
@ -84,7 +85,10 @@ private:
|
|||
QString m_imagedir;
|
||||
QString m_login;
|
||||
QString username;
|
||||
bool m_syncAll;
|
||||
int syncindex;
|
||||
int usernameindex;
|
||||
int usernamelength;
|
||||
QSqlDatabase m_db;
|
||||
QList<QString> synclist;
|
||||
QList <QString> notifylist;
|
||||
|
|
|
@ -32,10 +32,11 @@
|
|||
#include "xhr.h"
|
||||
|
||||
#include <QHttpPart>
|
||||
#include <QTextCodec>
|
||||
//#include <QTextCodec>
|
||||
#include <QUrlQuery>
|
||||
#include <QList>
|
||||
#include <QDataStream>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include "uploadableimage.h"
|
||||
|
@ -223,7 +224,7 @@ void XHR::getlist()
|
|||
XHR::setUrl(m_filelist.at(dlindex));}
|
||||
else {
|
||||
XHR::setUrl(m_filelist.at(dlindex));}
|
||||
qDebug() << "start download" << m_url;
|
||||
//qDebug() << "start download" << m_url;
|
||||
XHR::download();
|
||||
} else {dlindex=0;m_downloadtype="";m_contactlist.clear();m_filelist.clear();}
|
||||
}
|
||||
|
@ -291,7 +292,6 @@ void XHR::onReplySuccess()
|
|||
|
||||
void XHR::onRequestFinished()
|
||||
{
|
||||
qDebug()<<"download requestFinished ";
|
||||
// Save the file here
|
||||
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);}
|
||||
else if (m_downloadtype=="picturelist") {
|
||||
|
@ -359,5 +359,6 @@ void XHR::onSSLError(const QList<QSslError> &errors)
|
|||
|
||||
QString XHR::bufferToString()
|
||||
{
|
||||
return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
|
||||
//return QTextCodec::codecForName("utf-8")->toUnicode(buffer);
|
||||
return QString(buffer);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <QNetworkRequest>
|
||||
#include <QObject>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkConfiguration>
|
||||
//#include <QNetworkConfiguration>
|
||||
|
||||
class XHR : public QObject
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue