Fix for 'unknown error' while syncing Netvibes account

This commit is contained in:
mkiol 2015-10-11 09:51:59 +02:00
parent 1650adca71
commit b518706f77
6 changed files with 57 additions and 41 deletions

View file

@ -375,7 +375,7 @@ ListItem {
Item {
// Broadcast
anchors.left: parent.left; anchors.right: parent.right
visible: settings.showBroadcast && (!root.hidden || root.expanded) && (root.broadcast || root.annotations!="")
visible: app.isOldReader && settings.showBroadcast && (!root.hidden || root.expanded) && (root.broadcast || root.annotations!="")
height: Math.max(broadcastImage.height, broadcastLabel.height)
/*Image {
@ -501,6 +501,15 @@ ListItem {
visible: box.expandable && root.expanded
text: root.expanded ? qsTr("Collapse") : qsTr("Expand")
onClicked: {
/*console.log("settings.showBroadcast",settings.showBroadcast);
console.log("root.hidden",root.hidden);
console.log("root.expanded",root.expanded);
console.log("root.broadcast",root.broadcast);
console.log("root.annotations \""+root.annotations+"\"");
console.log("value",settings.showBroadcast && (!root.hidden || root.expanded) && (root.broadcast || root.annotations!=""));
*/
root.expanded = !root.expanded;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -14,7 +14,7 @@ Name: harbour-kaktus
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Kaktus
Version: 2.1
Release: 5
Release: 6
Group: Qt/Qt
License: LICENSE
URL: https://github.com/mkiol/kaktus
@ -76,6 +76,9 @@ desktop-file-install --delete-original \
%changelog
* Sat Oct 10 2015 Michal Kosciesza 2.1-6
- BUG FIX: "Unknown error" while syncing Netvibes account
* Wed Sep 30 2015 Michal Kosciesza 2.1-5
- Polishing for Sailfish 2.0

View file

@ -261,7 +261,7 @@ int EntryModel::createItems(int offset, int limit)
}
}
prevDateRow = dateRow;
//qDebug() << "(*i).broadcast" << (*i).broadcast;
//qDebug() << "(*i).broadcast" << (*i).broadcast << ((*i).broadcast==1);
//qDebug() << (*i).id << (*i).link;
appendRow(new EntryItem((*i).id,
title.remove(re),

View file

@ -153,7 +153,7 @@ signals:
void ready();
private:
const int idsOnActionLimit = 100;
static const int idsOnActionLimit = 100;
DatabaseManager* _db;
QString _feedId;

View file

@ -320,45 +320,30 @@ void NvFetcher::setAction()
QUrl url;
//qDebug() << "action type:" << action.type;
//qDebug() << "action id1:" << action.id1;
switch (action.type) {
case DatabaseManager::SetRead:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
break;
case DatabaseManager::SetListRead:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
case DatabaseManager::SetStreamReadAll:
case DatabaseManager::SetTabReadAll:
case DatabaseManager::SetAllRead:
case DatabaseManager::SetSlowRead:
url.setUrl("http://www.netvibes.com/api/streams/read/add?pageId="+s->getDashboardInUse());
break;
case DatabaseManager::SetSaved:
url.setUrl("http://www.netvibes.com/api/streams/saved/add");
break;
case DatabaseManager::UnSetRead:
url.setUrl("http://www.netvibes.com/api/streams/read/remove");
url.setUrl("http://www.netvibes.com/api/streams/saved/add?pageId="+s->getDashboardInUse());
break;
case DatabaseManager::UnSetSaved:
url.setUrl("http://www.netvibes.com/api/streams/saved/remove");
url.setUrl("http://www.netvibes.com/api/streams/saved/remove?pageId="+s->getDashboardInUse());
break;
case DatabaseManager::UnSetRead:
case DatabaseManager::UnSetStreamReadAll:
url.setUrl("http://www.netvibes.com/api/streams/read/remove");
break;
case DatabaseManager::SetStreamReadAll:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
break;
case DatabaseManager::UnSetTabReadAll:
url.setUrl("http://www.netvibes.com/api/streams/read/remove");
break;
case DatabaseManager::SetTabReadAll:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
break;
case DatabaseManager::UnSetAllRead:
url.setUrl("http://www.netvibes.com/api/streams/read/remove");
break;
case DatabaseManager::SetAllRead:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
break;
case DatabaseManager::UnSetSlowRead:
url.setUrl("http://www.netvibes.com/api/streams/read/remove");
break;
case DatabaseManager::SetSlowRead:
url.setUrl("http://www.netvibes.com/api/streams/read/add");
url.setUrl("http://www.netvibes.com/api/streams/read/remove?pageId="+s->getDashboardInUse());
break;
default:
// Unknown action -> skiping
@ -487,11 +472,14 @@ void NvFetcher::setAction()
actions += QString("{\"streams\":[{\"id\":\"%1\",\"items\":[{"
"\"id\":\"%2\",\"publishedAt\":%3}]}]}")
.arg(action.id2).arg(action.id1).arg(action.date1);
qDebug() << actions;
}
if (action.type == DatabaseManager::SetListRead) {
actions += "{\"streams\":[";
//qDebug() << action.id1;
QStringList idList = action.id1.split("&");
QStringList fidList = action.id2.split("&");
QStringList dateList = action.id3.split("&");
@ -501,6 +489,7 @@ void NvFetcher::setAction()
while (i != idList.end() && fi != fidList.end() && di != dateList.end()) {
actions += QString("{\"id\":\"%1\",\"items\":[{\"id\":\"%2\",\"publishedAt\":%3}]},")
.arg(*fi,*i,*di);
//qDebug() << *fi << *i;
++i; ++fi; ++di;
}
actions.remove(actions.length()-1,1);
@ -509,7 +498,11 @@ void NvFetcher::setAction()
actions += "]";
//qDebug() << "actions:" << actions;
QString content = "actions="+QUrl::toPercentEncoding(actions)+"&pageId="+s->getDashboardInUse();
//QString content = "actions="+QUrl::toPercentEncoding(actions)+"&pageId="+s->getDashboardInUse();
currentReply = nam.post(request, content.toUtf8());
@ -963,12 +956,21 @@ void NvFetcher::finishedSetAction()
//qDebug() << data;
if (currentReply->error()) {
emit error(500);
setBusy(false);
return;
}
if(!parse()) {
if (currentReply->error() == QNetworkReply::OperationCanceledError ||
currentReply->error() == QNetworkReply::TimeoutError ) {
setBusy(false);
return;
}
qWarning() << "Unknown error in setAction reply!";
//emit error(500);
//setBusy(false);
//return;
} else if (!parse()) {
qWarning() << "Error parsing Json!";
emit error(600);
setBusy(false);
@ -1315,11 +1317,11 @@ int NvFetcher::storeFeeds()
if (obj["error"].isObject()) {
int code = (int) obj["error"].toObject()["code"].toDouble();
if (code != 204) {
qWarning() << "Nested error in Netvibes response!";
qWarning() << "Code:" << code;
qWarning() << "Message:" << obj["error"].toObject()["message"].toString();
qWarning() << "JSON obj:" << obj;
qWarning() << "id:" << obj["id"].toString();
qWarning() << "Nested error in Netvibes response!" <<
"Code:" << code << "Message:" <<
obj["error"].toObject()["message"].toString();
//qWarning() << "JSON obj:" << obj;
//qWarning() << "id:" << obj["id"].toString();
}
}
#else
@ -1466,6 +1468,8 @@ int NvFetcher::storeFeeds()
e.publishedAt = obj["publishedAt"].toDouble();
e.createdAt = obj["createdAt"].toDouble();
e.fresh = 1;
e.broadcast = 0;
e.annotations = "";
// Downloading image file
if (s->getCachingMode() == 2 || (s->getCachingMode() == 1 && s->dm->isWLANConnected())) {