Actions uploading optimization

This commit is contained in:
mkiol 2015-10-01 07:40:23 +02:00
parent 0c4e18d108
commit 21b691cfa1
19 changed files with 87 additions and 65 deletions

View file

@ -238,37 +238,37 @@ Network connection is unavailable.</source>
<context>
<name>EntryModel</name>
<message>
<location filename="../src/entrymodel.cpp" line="208"/>
<location filename="../src/entrymodel.cpp" line="239"/>
<source>Today</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="211"/>
<location filename="../src/entrymodel.cpp" line="242"/>
<source>Yesterday</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="214"/>
<location filename="../src/entrymodel.cpp" line="245"/>
<source>Current week</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="217"/>
<location filename="../src/entrymodel.cpp" line="248"/>
<source>Current month</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="220"/>
<location filename="../src/entrymodel.cpp" line="251"/>
<source>Previous month</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="223"/>
<location filename="../src/entrymodel.cpp" line="254"/>
<source>Current year</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="226"/>
<location filename="../src/entrymodel.cpp" line="257"/>
<source>Previous year &amp; older</source>
<translation type="unfinished"></translation>
</message>
@ -855,6 +855,11 @@ on the settings page.</source>
<source>Always</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="315"/>
<source>After sync the content of all items will be downloaded and cached for access in the offline mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="578"/>
<source>Read mode</source>
@ -865,11 +870,6 @@ on the settings page.</source>
<source>Web pages will be reformatted into an easy to read version.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="600"/>
<source>Enable social features</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="602"/>
<source>Following Old Reader&apos;s social features will be enabled: Following folder, Sharing article with followers, Like option, Liked articles view mode.</source>
@ -935,11 +935,6 @@ on the settings page.</source>
<source>Network mode</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="315"/>
<source>After sync the content of all items will be downloaded and cached for access in the Offline mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="326"/>
<source>Language</source>
@ -1025,6 +1020,11 @@ on the settings page.</source>
<source>Current cache size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="600"/>
<source>Social features</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="612"/>
<source>Power save mode</source>
@ -1131,6 +1131,8 @@ on the settings page.</source>
</message>
<message>
<location filename="../qml/sailfish/TabPage.qml" line="95"/>
<location filename="../qml/sailfish/TabPage.qml" line="193"/>
<location filename="../qml/sailfish/TabPage.qml" line="197"/>
<source>Uncategorized</source>
<translation type="unfinished"></translation>
</message>

Binary file not shown.

View file

@ -344,37 +344,37 @@ Brak połączenia sieciowego.</translation>
<context>
<name>EntryModel</name>
<message>
<location filename="../src/entrymodel.cpp" line="208"/>
<location filename="../src/entrymodel.cpp" line="239"/>
<source>Today</source>
<translation>Dzisiaj</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="211"/>
<location filename="../src/entrymodel.cpp" line="242"/>
<source>Yesterday</source>
<translation>Wczoraj</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="214"/>
<location filename="../src/entrymodel.cpp" line="245"/>
<source>Current week</source>
<translation>Obecny tydzień</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="217"/>
<location filename="../src/entrymodel.cpp" line="248"/>
<source>Current month</source>
<translation>Obecny miesiąc</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="220"/>
<location filename="../src/entrymodel.cpp" line="251"/>
<source>Previous month</source>
<translation>Poprzedni miesiąc</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="223"/>
<location filename="../src/entrymodel.cpp" line="254"/>
<source>Current year</source>
<translation>Obecny rok</translation>
</message>
<message>
<location filename="../src/entrymodel.cpp" line="226"/>
<location filename="../src/entrymodel.cpp" line="257"/>
<source>Previous year &amp; older</source>
<translation>Poprzedni rok oraz starsze</translation>
</message>
@ -1395,6 +1395,11 @@ Brak połączenia sieciowego</translation>
<source>Always</source>
<translation>Zawsze</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="315"/>
<source>After sync the content of all items will be downloaded and cached for access in the offline mode.</source>
<translation>Każdorazowo podczas aktualizacji, treść artykułów będzie pobierana i zapisywana lokalnie, tak aby była dostępna podczas pracy w trybie offline.</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="578"/>
<source>Read mode</source>
@ -1406,14 +1411,13 @@ Brak połączenia sieciowego</translation>
<translation>Strony zostaną przeformatowane tak aby były łatwiejsze do czytania.</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="600"/>
<source>Enable social features</source>
<translation>Funkcje społecznościowe</translation>
<translation type="vanished">Funkcje społecznościowe</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="602"/>
<source>Following Old Reader&apos;s social features will be enabled: Following folder, Sharing article with followers, Like option, Liked articles view mode.</source>
<translation>Następujące funkcje zostaną włączone: folder Obserwowani, udostępnianie obserwującym, opcja Lubię, tryb przeglądania tylko polubionych artykułów.</translation>
<translation>Następujące funkcje zostaną włączone: Folder obserwowani, Udostępnianie obserwującym, Opcja Lubię, Tryb przeglądania tylko polubionych artykułów.</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="667"/>
@ -1476,9 +1480,8 @@ Brak połączenia sieciowego</translation>
<translation>Tryb sieci</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="315"/>
<source>After sync the content of all items will be downloaded and cached for access in the Offline mode.</source>
<translation>Każdorazowo podczas aktualizacji, treść artykułów będzie pobierana i zapisywana lokalnie, tak aby była dostępna podczas pracy w trybie Offline.</translation>
<translation type="vanished">Każdorazowo podczas aktualizacji, treść artykułów będzie pobierana i zapisywana lokalnie, tak aby była dostępna podczas pracy w trybie Offline.</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="326"/>
@ -1608,6 +1611,11 @@ Brak połączenia sieciowego</translation>
<source>Oldest first</source>
<translation>Najstarsze pierwsze</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="600"/>
<source>Social features</source>
<translation>Funkcje społecznościowe</translation>
</message>
<message>
<location filename="../qml/sailfish/SettingsPage.qml" line="612"/>
<source>Power save mode</source>
@ -1869,6 +1877,8 @@ Brak połączenia sieciowego</translation>
</message>
<message>
<location filename="../qml/sailfish/TabPage.qml" line="95"/>
<location filename="../qml/sailfish/TabPage.qml" line="193"/>
<location filename="../qml/sailfish/TabPage.qml" line="197"/>
<source>Uncategorized</source>
<translation>Bez kategorii</translation>
</message>

View file

@ -92,13 +92,8 @@ Page {
horizontalAlignment: Text.AlignHCenter
anchors.left: parent.left; anchors.right: parent.right
font.pixelSize: Theme.fontSizeExtraSmall
text: PAGE
text: "<u>%1</u>".arg(PAGE)
textFormat: Text.StyledText
/*text: "<a href='%1'>%2</a>".arg(PAGE).arg(PAGE)
onLinkActivated: {
notification.show(qsTr("Launching an external browser..."));
Qt.openUrlExternally(link);
}*/
MouseArea {
anchors.fill: parent

View file

@ -56,22 +56,22 @@ Page {
LogItem {
title: 'Sync read articles'
description: "Previously, unread as well as read articles were synced. With this new option comes possiblity to disable syncing read articles. It will speed up synchronization, but read articles will not be accessible form Kaktus.";
description: "Previously, unread as well as read articles were synced. With this new option comes possibility to disable syncing read articles. It will speed up synchronization, but read articles will not be accessible form Kaktus.";
}
LogItem {
title: 'Sort order for list of articles'
title: 'Sort order'
description: 'New settings option enabling specific sort order for list of articles. Possible values: Recent first, Oldest first.'
}
LogItem {
title: 'Mark above as read'
description: 'Context menu for list of articles has new option for marking all above articles as read.'
description: 'Context menu option for marking all above articles as read.'
}
LogItem {
title: 'Old Reader: Like & Liked articles view mode'
description: "New context option to Like/Unlike article. Additionally, so called Slow view mode is now replaced by Liked articles view mode.";
description: "New context option to Like/Unlike article. So called \"Slow\" view mode is now replaced by Liked articles view mode.";
}
LogItem {

View file

@ -105,7 +105,7 @@ Item {
Image {
anchors.fill: parent
//fillMode: Image.PreserveAspectFit
source: "image://theme/graphic-gradient-home-top"
source: "image://theme/graphic-gradient-edge"
visible: root.transparent
}
@ -159,7 +159,7 @@ Item {
IconButton {
width: back.width; height: back.height
visible: root.canOpenBrowser
icon.source: "image://theme/icon-m-region?"+(root.transparent ? Theme.highlightColor : Theme.highlightDimmerColor)
icon.source: "image://icons/browser?"+(root.transparent ? Theme.highlightColor : Theme.highlightDimmerColor)
onClicked: {root.browserClicked();show();}
}

View file

@ -498,7 +498,7 @@ ListItem {
}
MenuItem {
visible: box.expandable
visible: box.expandable && root.expanded
text: root.expanded ? qsTr("Collapse") : qsTr("Expand")
onClicked: {
root.expanded = !root.expanded;

View file

@ -163,7 +163,7 @@ Page {
}
onClicked: {
//console.log("id",model.uid);
//console.log("id",model.uid, "date", model.date);
if (timer.running) {
// Double click
timer.stop();

View file

@ -67,12 +67,11 @@ Item {
anchors.left: parent.left; anchors.right: parent.right
//anchors.fill: parent
//fillMode: Image.PreserveAspectFit
source: "image://theme/graphic-gradient-home-top?"+Theme.highlightBackgroundColor
source: "image://theme/graphic-gradient-edge?"+Theme.highlightBackgroundColor
//source: "image://theme/graphic-gradient-home-bottom?"+Theme.highlightBackgroundColor
//source: "image://theme/graphic-gradient-edge?"+Theme.highlightBackgroundColor
//source: "image://theme/graphic-keyboard-highlight-top?"+Theme.highlightBackgroundColor
visible: root.transparent
opacity: 0.8
}
Rectangle {

View file

@ -597,7 +597,7 @@ Page {
}
TextSwitch {
text: qsTr("Enable social features")
text: qsTr("Social features")
enabled: app.isOldReader
description: qsTr("Following Old Reader's social features will be enabled: Following folder, Sharing article with followers, Like option, Liked articles view mode.")
onCheckedChanged: {

BIN
qml/sailfish/browser.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -2947,6 +2947,14 @@ QList<DatabaseManager::Entry> DatabaseManager::readEntriesUnreadByTab(const QStr
if (db.isOpen()) {
QSqlQuery query(db);
/*qDebug() << QString("SELECT e.id, e.stream_id, e.title, e.author, e.content, e.link, e.image, s.icon, s.title, e.annotations, s.id, "
"e.fresh, e.fresh_or, e.read, e.saved, e.liked, e.cached, e.broadcast, e.created_at, e.published_at, e.timestamp, e.crawl_time, e.last_update "
"FROM entries as e, streams as s, module_stream as ms, modules as m "
"WHERE e.stream_id=ms.stream_id AND e.stream_id=s.id AND ms.module_id=m.id "
"AND m.tab_id='%1' "
"AND e.read=0 ORDER BY e.published_at %4 LIMIT %2 OFFSET %3;")
.arg(id).arg(limit).arg(offset).arg(ascOrder ? "ASC" : "DESC");*/
bool ret = query.exec(QString("SELECT e.id, e.stream_id, e.title, e.author, e.content, e.link, e.image, s.icon, s.title, e.annotations, s.id, "
"e.fresh, e.fresh_or, e.read, e.saved, e.liked, e.cached, e.broadcast, e.created_at, e.published_at, e.timestamp, e.crawl_time, e.last_update "
"FROM entries as e, streams as s, module_stream as ms, modules as m "
@ -2985,6 +2993,7 @@ QList<DatabaseManager::Entry> DatabaseManager::readEntriesUnreadByTab(const QStr
item.crawlTime = query.value(21).toInt();
list.append(item);
}
} else {
qWarning() << "DB is not open!";
}

View file

@ -102,8 +102,10 @@ int EntryModel::createItems(int offset, int limit)
if (offset > 0) {
int dummyRowsCount = 0;
int l = this->rowCount();
//qDebug() << "this->rowCount():" << l;
for (int i = 0; i < l; ++i) {
EntryItem* item = static_cast<EntryItem*>(readRow(i));
//qDebug() << item->id();
if (item->id()=="last" || item->id()=="daterow") {
++dummyRowsCount;
}
@ -449,14 +451,15 @@ void EntryModel::setAboveAsRead(int index)
{
Settings *s = Settings::instance();
int a = index <= idsOnActionLimit ? 0 : index - idsOnActionLimit;
QString itemIds;
QString feedIds;
QString dates;
bool ok = false;
int l = qMin(this->rowCount(),index);
for (int i=0; i<=l; ++i) {
EntryItem* item = static_cast<EntryItem*>(readRow(i));
for (a; a <= index; ++a) {
EntryItem* item = static_cast<EntryItem*>(readRow(a));
QString id = item->id();
if (id != "daterow" && id != "last" && item->read() == 0) {
item->setRead(1);
@ -465,7 +468,6 @@ void EntryModel::setAboveAsRead(int index)
feedIds.append(QString("%1&").arg(item->feedId()));
dates.append(QString("%1&").arg(item->date()));
ok = true;
//qDebug() << "id:" << id << "feedId:" << item->feedId() << "date:" << item->date();
}
}
@ -473,11 +475,6 @@ void EntryModel::setAboveAsRead(int index)
itemIds.remove(itemIds.length()-1,1);
feedIds.remove(feedIds.length()-1,1);
dates.remove(dates.length()-1,1);
//qDebug() << "itemIds:" << itemIds;
//qDebug() << "feedIds" << feedIds;
//qDebug() << "dates" << dates;
DatabaseManager::Action action;
action.type = DatabaseManager::SetListRead;
action.id1 = itemIds;
@ -485,6 +482,10 @@ void EntryModel::setAboveAsRead(int index)
action.id3 = dates;
s->db->writeAction(action);
}
if (index > idsOnActionLimit)
setAboveAsRead(index - idsOnActionLimit - 1);
}
int EntryModel::countRead()

View file

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

View file

@ -235,11 +235,12 @@ void FeedlyFetcher::setAction()
return;
}
qDebug() << "body:" << body;
//qDebug() << "body:" << body;
QNetworkRequest request(url);
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
request.setRawHeader("Authorization",QString("OAuth %1").arg(s->getCookie()).toLatin1());
request.setRawHeader("Content-Encoding", "gzip");
currentReply = nam.post(request,body.toUtf8());
@ -619,8 +620,7 @@ void FeedlyFetcher::finishedFeeds2()
{
// Proggres initiating, one step is one day
Settings *s = Settings::instance();
//proggressTotal = s->getRetentionDays() > 0 ? log(s->getRetentionDays()) + 1 : 2;
proggressTotal = s->getRetentionDays() > 0 ? s->getRetentionDays() + 1 : 2;
proggressTotal = s->getRetentionDays() > 0 ? log(s->getRetentionDays()) + 1 : 2;
proggress = 1;
lastDate = 0;
emit progress(proggress, proggressTotal);
@ -654,9 +654,9 @@ void FeedlyFetcher::finishedStream2()
}
}
double _proggresDelta = lastDate;
//if (lastDate > 0)
// _proggresDelta = log(lastDate);
double _proggresDelta = 0;
if (lastDate > 0)
_proggresDelta = log(lastDate);
emit progress(proggress + _proggresDelta, proggressTotal);
if (lastContinuation == "" ||

View file

@ -305,6 +305,7 @@ void NvFetcher::fetchFeedsUpdate()
QString content = "actions="+QUrl::toPercentEncoding(actions)+"&pageId="+s->getDashboardInUse();
currentReply = nam.post(request, content.toUtf8());
connect(currentReply, SIGNAL(finished()), this, SLOT(finishedFeedsUpdate()));
connect(currentReply, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(currentReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkError(QNetworkReply::NetworkError)));
@ -375,6 +376,7 @@ void NvFetcher::setAction()
}
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded; charset=UTF-8");
request.setRawHeader("Content-Encoding", "gzip");
setCookie(request, s->getCookie().toLatin1());
QString actions = "[";
@ -507,11 +509,10 @@ void NvFetcher::setAction()
actions += "]";
//qDebug() << "actions:" << actions;
QString content = "actions="+QUrl::toPercentEncoding(actions)+"&pageId="+s->getDashboardInUse();
//qDebug() << "content:" << content;
currentReply = nam.post(request, content.toUtf8());
connect(currentReply, SIGNAL(finished()), this, SLOT(finishedSetAction()));
connect(currentReply, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(currentReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkError(QNetworkReply::NetworkError)));

View file

@ -222,6 +222,7 @@ void OldReaderFetcher::setAction()
// Headers
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded; charset=UTF-8");
request.setRawHeader("Authorization",QString("GoogleLogin auth=%1").arg(s->getCookie()).toLatin1());
request.setRawHeader("Content-Encoding", "gzip");
currentReply = nam.post(request,body.toUtf8());
@ -692,7 +693,7 @@ void OldReaderFetcher::finishedFeeds2()
proggressTotal = s->getRetentionDays() > 0 ? log(s->getRetentionDays()) + 4 : 5;
proggress = 1;
lastDate = 0;
qDebug() << "finishedFeeds2" << "proggress" << proggress << "log(s->getRetentionDays())" << log(s->getRetentionDays()) << "proggressTotal" << proggressTotal;
//qDebug() << "finishedFeeds2" << "proggress" << proggress << "log(s->getRetentionDays())" << log(s->getRetentionDays()) << "proggressTotal" << proggressTotal;
//emit progress(proggress, proggressTotal);
/*if (busyType == Fetcher::Updating)

View file

@ -472,7 +472,7 @@ void Settings::setOffsetLimit(int value)
int Settings::getOffsetLimit()
{
return settings.value("offsetLimit", 20).toInt();
return settings.value("offsetLimit", 100).toInt();
}
QString Settings::getSettingsDir()

View file

@ -572,6 +572,9 @@ QString Utils::getHumanFriendlyTimeString(int date)
//qDebug() << "QDateTime::currentDateTimeUtc()" << QDateTime::currentDateTimeUtc();
//qDebug() << "qdate.secsTo(QDateTime::currentDateTimeUtc())" << secs;
if (secs<=-18000) {
return tr("unknown date");
}
if (secs<=0) {
return tr("just now");
}