diff --git a/resources/sql.qrc b/resources/sql.qrc
index d3c892fb5..ce17db495 100755
--- a/resources/sql.qrc
+++ b/resources/sql.qrc
@@ -12,6 +12,7 @@
sql/db_update_mysql_9_10.sql
sql/db_update_mysql_10_11.sql
sql/db_update_mysql_11_12.sql
+ sql/db_update_mysql_12_13.sql
sql/db_init_sqlite.sql
sql/db_update_sqlite_1_2.sql
@@ -25,5 +26,6 @@
sql/db_update_sqlite_9_10.sql
sql/db_update_sqlite_10_11.sql
sql/db_update_sqlite_11_12.sql
+ sql/db_update_sqlite_12_13.sql
\ No newline at end of file
diff --git a/resources/sql/db_init_mysql.sql b/resources/sql/db_init_mysql.sql
index 202a60970..589dba164 100644
--- a/resources/sql/db_init_mysql.sql
+++ b/resources/sql/db_init_mysql.sql
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL
);
-- !
-INSERT INTO Information VALUES (1, 'schema_version', '12');
+INSERT INTO Information VALUES (1, 'schema_version', '13');
-- !
CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY,
@@ -20,14 +20,15 @@ CREATE TABLE IF NOT EXISTS Accounts (
);
-- !
CREATE TABLE IF NOT EXISTS TtRssAccounts (
- id INTEGER,
- username TEXT NOT NULL,
- password TEXT,
- auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
- auth_username TEXT,
- auth_password TEXT,
- url TEXT NOT NULL,
- force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
+ id INTEGER,
+ username TEXT NOT NULL,
+ password TEXT,
+ auth_protected INTEGER(1) NOT NULL DEFAULT 0 CHECK (auth_protected >= 0 AND auth_protected <= 1),
+ auth_username TEXT,
+ auth_password TEXT,
+ url TEXT NOT NULL,
+ force_update INTEGER(1) NOT NULL DEFAULT 0 CHECK (force_update >= 0 AND force_update <= 1),
+ update_only_unread INTEGER(1) NOT NULL DEFAULT 0 CHECK (update_only_unread >= 0 AND update_only_unread <= 1),
FOREIGN KEY (id) REFERENCES Accounts (id)
);
diff --git a/resources/sql/db_init_sqlite.sql b/resources/sql/db_init_sqlite.sql
index cfaf5cf01..55b389663 100644
--- a/resources/sql/db_init_sqlite.sql
+++ b/resources/sql/db_init_sqlite.sql
@@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS Information (
inf_value TEXT NOT NULL
);
-- !
-INSERT INTO Information VALUES (1, 'schema_version', '12');
+INSERT INTO Information VALUES (1, 'schema_version', '13');
-- !
CREATE TABLE IF NOT EXISTS Accounts (
id INTEGER PRIMARY KEY,
@@ -14,14 +14,15 @@ CREATE TABLE IF NOT EXISTS Accounts (
);
-- !
CREATE TABLE IF NOT EXISTS TtRssAccounts (
- id INTEGER,
- username TEXT NOT NULL,
- password TEXT,
- auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
- auth_username TEXT,
- auth_password TEXT,
- url TEXT NOT NULL,
- force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
+ id INTEGER,
+ username TEXT NOT NULL,
+ password TEXT,
+ auth_protected INTEGER(1) NOT NULL CHECK (auth_protected >= 0 AND auth_protected <= 1) DEFAULT 0,
+ auth_username TEXT,
+ auth_password TEXT,
+ url TEXT NOT NULL,
+ force_update INTEGER(1) NOT NULL CHECK (force_update >= 0 AND force_update <= 1) DEFAULT 0,
+ update_only_unread INTEGER(1) NOT NULL CHECK (update_only_unread >= 0 AND update_only_unread <= 1) DEFAULT 0,
FOREIGN KEY (id) REFERENCES Accounts (id)
);
diff --git a/src/librssguard/definitions/definitions.h b/src/librssguard/definitions/definitions.h
index a7a02383e..dd3d8bcb8 100755
--- a/src/librssguard/definitions/definitions.h
+++ b/src/librssguard/definitions/definitions.h
@@ -113,7 +113,7 @@
#define APP_DB_SQLITE_FILE "database.db"
// Keep this in sync with schema versions declared in SQL initialization code.
-#define APP_DB_SCHEMA_VERSION "12"
+#define APP_DB_SCHEMA_VERSION "13"
#define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
#define APP_DB_COMMENT_SPLIT "-- !\n"
#define APP_DB_NAME_PLACEHOLDER "##"
diff --git a/src/librssguard/miscellaneous/databasequeries.cpp b/src/librssguard/miscellaneous/databasequeries.cpp
index e7e8096de..d12dff8ea 100755
--- a/src/librssguard/miscellaneous/databasequeries.cpp
+++ b/src/librssguard/miscellaneous/databasequeries.cpp
@@ -583,8 +583,8 @@ int DatabaseQueries::updateMessages(QSqlDatabase db,
message.m_isImportant != is_important_existing_message ||
message.m_feedId != feed_id_existing_message)) ||
- /* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message
- && message.m_contents != contents_existing_message)) {
+ /* 2 */ (message.m_createdFromFeed && message.m_created.toMSecsSinceEpoch() != date_existing_message
+ && message.m_contents != contents_existing_message)) {
// Message exists, it is changed, update it.
query_update.bindValue(QSL(":title"), unnulifyString(message.m_title));
query_update.bindValue(QSL(":is_read"), (int) message.m_isRead);
@@ -898,7 +898,6 @@ QStringList DatabaseQueries::customIdsOfMessagesFromFeed(const QSqlDatabase& db,
QList DatabaseQueries::getOwnCloudAccounts(const QSqlDatabase& db, bool* ok) {
QSqlQuery query(db);
-
QList roots;
if (query.exec("SELECT * FROM OwnCloudAccounts;")) {
@@ -933,7 +932,6 @@ QList DatabaseQueries::getOwnCloudAccounts(const QSqlDatabase& db,
QList DatabaseQueries::getTtRssAccounts(const QSqlDatabase& db, bool* ok) {
QSqlQuery query(db);
-
QList roots;
if (query.exec("SELECT * FROM TtRssAccounts;")) {
@@ -949,6 +947,7 @@ QList DatabaseQueries::getTtRssAccounts(const QSqlDatabase& db, bo
root->network()->setAuthPassword(TextFactory::decrypt(query.value(5).toString()));
root->network()->setUrl(query.value(6).toString());
root->network()->setForceServerSideUpdate(query.value(7).toBool());
+ root->network()->setDownloadOnlyUnreadMessages(query.value(8).toBool());
root->updateTitle();
roots.append(root);
}
@@ -1298,8 +1297,8 @@ bool DatabaseQueries::editBaseFeed(const QSqlDatabase& db, int feed_id, Feed::Au
QList DatabaseQueries::getAccounts(const QSqlDatabase& db, bool* ok) {
QSqlQuery q(db);
-
QList roots;
+
q.setForwardOnly(true);
q.prepare(QSL("SELECT id FROM Accounts WHERE type = :type;"));
q.bindValue(QSL(":type"), SERVICE_CODE_STD_RSS);
@@ -1419,14 +1418,17 @@ bool DatabaseQueries::deleteTtRssAccount(const QSqlDatabase& db, int account_id)
return q.exec();
}
-bool DatabaseQueries::overwriteTtRssAccount(const QSqlDatabase& db, const QString& username, const QString& password,
- bool auth_protected, const QString& auth_username, const QString& auth_password,
- const QString& url, bool force_server_side_feed_update, int account_id) {
+bool DatabaseQueries::overwriteTtRssAccount(const QSqlDatabase& db, const QString& username,
+ const QString& password, bool auth_protected,
+ const QString& auth_username, const QString& auth_password,
+ const QString& url, bool force_server_side_feed_update,
+ bool download_only_unread_messages, int account_id) {
QSqlQuery q(db);
q.prepare("UPDATE TtRssAccounts "
"SET username = :username, password = :password, url = :url, auth_protected = :auth_protected, "
- "auth_username = :auth_username, auth_password = :auth_password, force_update = :force_update "
+ "auth_username = :auth_username, auth_password = :auth_password, force_update = :force_update, "
+ "update_only_unread = :update_only_unread "
"WHERE id = :id;");
q.bindValue(QSL(":username"), username);
q.bindValue(QSL(":password"), TextFactory::encrypt(password));
@@ -1435,6 +1437,7 @@ bool DatabaseQueries::overwriteTtRssAccount(const QSqlDatabase& db, const QStrin
q.bindValue(QSL(":auth_username"), auth_username);
q.bindValue(QSL(":auth_password"), TextFactory::encrypt(auth_password));
q.bindValue(QSL(":force_update"), force_server_side_feed_update ? 1 : 0);
+ q.bindValue(QSL(":update_only_unread"), download_only_unread_messages ? 1 : 0);
q.bindValue(QSL(":id"), account_id);
if (q.exec()) {
@@ -1449,11 +1452,11 @@ bool DatabaseQueries::overwriteTtRssAccount(const QSqlDatabase& db, const QStrin
bool DatabaseQueries::createTtRssAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
const QString& password, bool auth_protected, const QString& auth_username,
const QString& auth_password, const QString& url,
- bool force_server_side_feed_update) {
+ bool force_server_side_feed_update, bool download_only_unread_messages) {
QSqlQuery q(db);
- q.prepare("INSERT INTO TtRssAccounts (id, username, password, auth_protected, auth_username, auth_password, url, force_update) "
- "VALUES (:id, :username, :password, :auth_protected, :auth_username, :auth_password, :url, :force_update);");
+ q.prepare("INSERT INTO TtRssAccounts (id, username, password, auth_protected, auth_username, auth_password, url, force_update, update_only_unread) "
+ "VALUES (:id, :username, :password, :auth_protected, :auth_username, :auth_password, :url, :force_update, :update_only_unread);");
q.bindValue(QSL(":id"), id_to_assign);
q.bindValue(QSL(":username"), username);
q.bindValue(QSL(":password"), TextFactory::encrypt(password));
@@ -1462,6 +1465,7 @@ bool DatabaseQueries::createTtRssAccount(const QSqlDatabase& db, int id_to_assig
q.bindValue(QSL(":auth_password"), TextFactory::encrypt(auth_password));
q.bindValue(QSL(":url"), url);
q.bindValue(QSL(":force_update"), force_server_side_feed_update ? 1 : 0);
+ q.bindValue(QSL(":update_only_unread"), download_only_unread_messages ? 1 : 0);
if (q.exec()) {
return true;
@@ -1539,7 +1543,6 @@ Assignment DatabaseQueries::getGmailFeeds(const QSqlDatabase& db, int account_id
QList DatabaseQueries::getGmailAccounts(const QSqlDatabase& db, bool* ok) {
QSqlQuery query(db);
-
QList roots;
if (query.exec("SELECT * FROM GmailAccounts;")) {
@@ -1642,7 +1645,6 @@ bool DatabaseQueries::storeNewInoreaderTokens(const QSqlDatabase& db, const QStr
QList DatabaseQueries::getInoreaderAccounts(const QSqlDatabase& db, bool* ok) {
QSqlQuery query(db);
-
QList roots;
if (query.exec("SELECT * FROM InoreaderAccounts;")) {
diff --git a/src/librssguard/miscellaneous/databasequeries.h b/src/librssguard/miscellaneous/databasequeries.h
index 8fd13f43e..1077d8fca 100644
--- a/src/librssguard/miscellaneous/databasequeries.h
+++ b/src/librssguard/miscellaneous/databasequeries.h
@@ -42,14 +42,18 @@ class DatabaseQueries {
static int getMessageCountsForBin(const QSqlDatabase& db, int account_id, bool including_total_counts, bool* ok = nullptr);
// Get messages (for newspaper view for example).
- static QList getUndeletedMessagesForFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
+ static QList getUndeletedMessagesForFeed(const QSqlDatabase& db,
+ const QString& feed_custom_id,
+ int account_id,
+ bool* ok = nullptr);
static QList getUndeletedMessagesForBin(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
static QList getUndeletedMessagesForAccount(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
// Custom ID accumulators.
static QStringList customIdsOfMessagesFromAccount(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
static QStringList customIdsOfMessagesFromBin(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
- static QStringList customIdsOfMessagesFromFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
+ static QStringList customIdsOfMessagesFromFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id,
+ bool* ok = nullptr);
// Common accounts methods.
static int updateMessages(QSqlDatabase db, const QList& messages, const QString& feed_custom_id,
@@ -122,11 +126,12 @@ class DatabaseQueries {
static bool deleteTtRssAccount(const QSqlDatabase& db, int account_id);
static bool overwriteTtRssAccount(const QSqlDatabase& db, const QString& username, const QString& password,
bool auth_protected, const QString& auth_username, const QString& auth_password,
- const QString& url, bool force_server_side_feed_update, int account_id);
+ const QString& url, bool force_server_side_feed_update,
+ bool download_only_unread_messages, int account_id);
static bool createTtRssAccount(const QSqlDatabase& db, int id_to_assign, const QString& username,
const QString& password, bool auth_protected, const QString& auth_username,
const QString& auth_password, const QString& url,
- bool force_server_side_feed_update);
+ bool force_server_side_feed_update, bool download_only_unread_messages);
static Assignment getTtRssFeeds(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
private:
diff --git a/src/librssguard/network-web/googlesuggest.h b/src/librssguard/network-web/googlesuggest.h
index 779f6270c..4c7b0900e 100644
--- a/src/librssguard/network-web/googlesuggest.h
+++ b/src/librssguard/network-web/googlesuggest.h
@@ -35,14 +35,14 @@
#include
+#include "network-web/downloader.h"
+
class LocationLineEdit;
class QTimer;
class QListWidget;
-class Downloader;
-
class GoogleSuggest : public QObject {
Q_OBJECT
diff --git a/src/librssguard/services/tt-rss/gui/formeditttrssaccount.cpp b/src/librssguard/services/tt-rss/gui/formeditttrssaccount.cpp
index 5a52adf7d..467414289 100644
--- a/src/librssguard/services/tt-rss/gui/formeditttrssaccount.cpp
+++ b/src/librssguard/services/tt-rss/gui/formeditttrssaccount.cpp
@@ -87,6 +87,7 @@ void FormEditTtRssAccount::execForEdit(TtRssServiceRoot* existing_root) {
m_ui->m_txtPassword->lineEdit()->setText(existing_root->network()->password());
m_ui->m_txtUrl->lineEdit()->setText(existing_root->network()->url());
m_ui->m_checkServerSideUpdate->setChecked(existing_root->network()->forceServerSideUpdate());
+ m_ui->m_checkDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages());
exec();
}
@@ -108,6 +109,7 @@ void FormEditTtRssAccount::performTest() {
factory.setAuthUsername(m_ui->m_txtHttpUsername->lineEdit()->text());
factory.setAuthPassword(m_ui->m_txtHttpPassword->lineEdit()->text());
factory.setForceServerSideUpdate(m_ui->m_checkServerSideUpdate->isChecked());
+
TtRssLoginResponse result = factory.login();
if (result.isLoaded()) {
@@ -186,6 +188,8 @@ void FormEditTtRssAccount::onClickedOk() {
m_editableRoot->network()->setAuthUsername(m_ui->m_txtHttpUsername->lineEdit()->text());
m_editableRoot->network()->setAuthPassword(m_ui->m_txtHttpPassword->lineEdit()->text());
m_editableRoot->network()->setForceServerSideUpdate(m_ui->m_checkServerSideUpdate->isChecked());
+ m_editableRoot->network()->setDownloadOnlyUnreadMessages(m_ui->m_checkDownloadOnlyUnreadMessages->isChecked());
+
m_editableRoot->saveAccountDataToDatabase();
accept();
diff --git a/src/librssguard/services/tt-rss/gui/formeditttrssaccount.ui b/src/librssguard/services/tt-rss/gui/formeditttrssaccount.ui
index 544eca504..133426807 100644
--- a/src/librssguard/services/tt-rss/gui/formeditttrssaccount.ui
+++ b/src/librssguard/services/tt-rss/gui/formeditttrssaccount.ui
@@ -7,7 +7,7 @@
0
0
604
- 502
+ 442
@@ -16,24 +16,14 @@
-
-
-
-
-
-
-
-
- URL
-
-
- m_txtUrl
-
-
-
- -
-
-
-
+ -
+
+
+ &Test setup
+
+
- -
+
-
Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.
@@ -84,7 +74,7 @@
- -
+
-
Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.
@@ -108,7 +98,7 @@
Username
- m_txtUsername
+ m_txtHttpUsername
@@ -121,7 +111,7 @@
Password
- m_txtPassword
+ m_txtHttpPassword
@@ -138,14 +128,58 @@
- -
-
+
-
+
+
-
+
+
+ URL
+
+
+ m_txtUrl
+
+
+
+ -
+
+
+
+
+ -
+
- &Test setup
+
+
+
+ true
- -
+
-
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Force execution of server-side update when updating feeds from RSS Guard
+
+
+
+ -
+
+
+ Download only unread messages.
+
+
+
+ -
@@ -158,35 +192,21 @@
- -
-
-
- Force execution of server-side update when updating feeds from RSS Guard
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- -
-
-
-
-
-
- true
-
-
-
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 68
+
+
+
+
-
@@ -213,6 +233,14 @@
1
+
+ m_checkDownloadOnlyUnreadMessages
+ m_checkServerSideUpdate
+ m_checkShowPassword
+ m_gbHttpAuthentication
+ m_checkShowHttpPassword
+ m_btnTestSetup
+
diff --git a/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.cpp b/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.cpp
index 3276ffc33..d7a6f9259 100644
--- a/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.cpp
+++ b/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.cpp
@@ -78,8 +78,8 @@ TtRssLoginResponse TtRssNetworkFactory::login() {
json["password"] = m_password;
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -112,8 +112,8 @@ TtRssResponse TtRssNetworkFactory::logout() {
json["op"] = QSL("logout");
json["sid"] = m_sessionId;
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -152,8 +152,8 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories() {
json["include_empty"] = true;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -185,7 +185,7 @@ TtRssGetFeedsCategoriesResponse TtRssNetworkFactory::getFeedsCategories() {
TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, int limit, int skip,
bool show_content, bool include_attachments,
- bool sanitize) {
+ bool sanitize, bool unread_only) {
QJsonObject json;
json["op"] = QSL("getHeadlines");
@@ -194,13 +194,14 @@ TtRssGetHeadlinesResponse TtRssNetworkFactory::getHeadlines(int feed_id, int lim
json["force_update"] = m_forceServerSideUpdate;
json["limit"] = limit;
json["skip"] = skip;
+ json["view_mode"] = unread_only ? QSL("unread") : QSL("all_articles");
json["show_content"] = show_content;
json["include_attachments"] = include_attachments;
json["sanitize"] = sanitize;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -246,8 +247,8 @@ TtRssUpdateArticleResponse TtRssNetworkFactory::updateArticles(const QStringList
json["field"] = (int) field;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -294,8 +295,8 @@ TtRssSubscribeToFeedResponse TtRssNetworkFactory::subscribeToFeed(const QString&
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -333,8 +334,8 @@ TtRssUnsubscribeFeedResponse TtRssNetworkFactory::unsubscribeFeed(int feed_id) {
json["feed_id"] = feed_id;
const int timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt();
QByteArray result_raw;
-
QList> headers;
+
headers << QPair(HTTP_HEADERS_CONTENT_TYPE, TTRSS_CONTENT_TYPE_JSON);
headers << NetworkFactory::generateBasicAuthHeader(m_authUsername, m_authPassword);
@@ -365,6 +366,14 @@ TtRssUnsubscribeFeedResponse TtRssNetworkFactory::unsubscribeFeed(int feed_id) {
return result;
}
+bool TtRssNetworkFactory::downloadOnlyUnreadMessages() const {
+ return m_downloadOnlyUnreadMessages;
+}
+
+void TtRssNetworkFactory::setDownloadOnlyUnreadMessages(bool download_only_unread_messages) {
+ m_downloadOnlyUnreadMessages = download_only_unread_messages;
+}
+
bool TtRssNetworkFactory::forceServerSideUpdate() const {
return m_forceServerSideUpdate;
}
@@ -484,7 +493,6 @@ RootItem* TtRssGetFeedsCategoriesResponse::feedsCategories(bool obtain_icons, QS
if (status() == TTRSS_API_STATUS_OK) {
// We have data, construct object tree according to data.
QJsonArray items_to_process = m_rawContent["content"].toObject()["categories"].toObject()["items"].toArray();
-
QVector> pairs;
for (const QJsonValue& item : items_to_process) {
diff --git a/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.h b/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.h
index eaabbbdb0..154074da1 100644
--- a/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.h
+++ b/src/librssguard/services/tt-rss/network/ttrssnetworkfactory.h
@@ -11,6 +11,7 @@
#include
class RootItem;
+
class TtRssFeed;
class TtRssResponse {
@@ -123,6 +124,9 @@ class TtRssNetworkFactory {
bool forceServerSideUpdate() const;
void setForceServerSideUpdate(bool force_server_side_update);
+ bool downloadOnlyUnreadMessages() const;
+ void setDownloadOnlyUnreadMessages(bool download_only_unread_messages);
+
// Metadata.
QDateTime lastLoginTime() const;
QNetworkReply::NetworkError lastError() const;
@@ -141,7 +145,7 @@ class TtRssNetworkFactory {
// Gets headlines (messages) from the server.
TtRssGetHeadlinesResponse getHeadlines(int feed_id, int limit, int skip,
bool show_content, bool include_attachments,
- bool sanitize);
+ bool sanitize, bool unread_only);
TtRssUpdateArticleResponse updateArticles(const QStringList& ids, UpdateArticle::OperatingField field,
UpdateArticle::Mode mode, bool async = true);
@@ -151,14 +155,13 @@ class TtRssNetworkFactory {
TtRssUnsubscribeFeedResponse unsubscribeFeed(int feed_id);
- //TtRssGetConfigResponse getConfig();
-
private:
QString m_bareUrl;
QString m_fullUrl;
QString m_username;
QString m_password;
bool m_forceServerSideUpdate;
+ bool m_downloadOnlyUnreadMessages;
bool m_authIsUsed;
QString m_authUsername;
QString m_authPassword;
diff --git a/src/librssguard/services/tt-rss/ttrssfeed.cpp b/src/librssguard/services/tt-rss/ttrssfeed.cpp
index a61a95ff7..a609a58c7 100644
--- a/src/librssguard/services/tt-rss/ttrssfeed.cpp
+++ b/src/librssguard/services/tt-rss/ttrssfeed.cpp
@@ -14,8 +14,7 @@
#include
-TtRssFeed::TtRssFeed(RootItem* parent)
- : Feed(parent) {}
+TtRssFeed::TtRssFeed(RootItem* parent) : Feed(parent) {}
TtRssFeed::TtRssFeed(const QSqlRecord& record) : Feed(record) {}
@@ -31,6 +30,7 @@ bool TtRssFeed::canBeEdited() const {
bool TtRssFeed::editViaGui() {
QPointer form_pointer = new FormTtRssFeedDetails(serviceRoot(), qApp->mainFormWidget());
+
form_pointer.data()->addEditFeed(this, nullptr);
delete form_pointer.data();
return false;
@@ -75,7 +75,7 @@ QList TtRssFeed::obtainNewMessages(bool* error_during_obtaining) {
do {
TtRssGetHeadlinesResponse headlines = serviceRoot()->network()->getHeadlines(customId().toInt(), limit, skip,
- true, true, false);
+ true, true, false, true);
if (serviceRoot()->network()->lastError() != QNetworkReply::NoError) {
setStatus(Feed::NetworkError);
@@ -85,6 +85,7 @@ QList TtRssFeed::obtainNewMessages(bool* error_during_obtaining) {
}
else {
QList new_messages = headlines.messages();
+
messages.append(new_messages);
newly_added_messages = new_messages.size();
skip += newly_added_messages;
diff --git a/src/librssguard/services/tt-rss/ttrssserviceroot.cpp b/src/librssguard/services/tt-rss/ttrssserviceroot.cpp
index e3f9fe654..8fdf4fd64 100644
--- a/src/librssguard/services/tt-rss/ttrssserviceroot.cpp
+++ b/src/librssguard/services/tt-rss/ttrssserviceroot.cpp
@@ -53,6 +53,7 @@ QString TtRssServiceRoot::code() const {
bool TtRssServiceRoot::editViaGui() {
QScopedPointer form_pointer(new FormEditTtRssAccount(qApp->mainFormWidget()));
+
form_pointer.data()->execForEdit(this);
return true;
}
@@ -92,6 +93,7 @@ void TtRssServiceRoot::addNewFeed(const QString& url) {
}
QScopedPointer form_pointer(new FormTtRssFeedDetails(this, qApp->mainFormWidget()));
+
form_pointer.data()->addEditFeed(nullptr, this, url);
qApp->feedUpdateLock()->unlock();
}
@@ -132,7 +134,6 @@ void TtRssServiceRoot::saveAllCachedData(bool async) {
while (j.hasNext()) {
j.next();
auto key = j.key();
-
QList messages = j.value();
if (!messages.isEmpty()) {
@@ -178,7 +179,8 @@ void TtRssServiceRoot::saveAccountDataToDatabase() {
if (DatabaseQueries::overwriteTtRssAccount(database, m_network->username(), m_network->password(),
m_network->authIsUsed(), m_network->authUsername(),
m_network->authPassword(), m_network->url(),
- m_network->forceServerSideUpdate(), accountId())) {
+ m_network->forceServerSideUpdate(), m_network->downloadOnlyUnreadMessages(),
+ accountId())) {
updateTitle();
itemChanged(QList() << this);
}
@@ -191,7 +193,8 @@ void TtRssServiceRoot::saveAccountDataToDatabase() {
if (DatabaseQueries::createTtRssAccount(database, id_to_assign, m_network->username(),
m_network->password(), m_network->authIsUsed(),
m_network->authUsername(), m_network->authPassword(),
- m_network->url(), m_network->forceServerSideUpdate())) {
+ m_network->url(), m_network->forceServerSideUpdate(),
+ m_network->downloadOnlyUnreadMessages())) {
setId(id_to_assign);
setAccountId(id_to_assign);
updateTitle();