parent
d7d3be2914
commit
139e014d2a
@ -12,6 +12,7 @@
|
||||
<file>sql/db_update_mysql_9_10.sql</file>
|
||||
<file>sql/db_update_mysql_10_11.sql</file>
|
||||
<file>sql/db_update_mysql_11_12.sql</file>
|
||||
<file>sql/db_update_mysql_12_13.sql</file>
|
||||
|
||||
<file>sql/db_init_sqlite.sql</file>
|
||||
<file>sql/db_update_sqlite_1_2.sql</file>
|
||||
@ -25,5 +26,6 @@
|
||||
<file>sql/db_update_sqlite_9_10.sql</file>
|
||||
<file>sql/db_update_sqlite_10_11.sql</file>
|
||||
<file>sql/db_update_sqlite_11_12.sql</file>
|
||||
<file>sql/db_update_sqlite_12_13.sql</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -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)
|
||||
);
|
||||
|
@ -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)
|
||||
);
|
||||
|
@ -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 "##"
|
||||
|
@ -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<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(const QSqlDatabase& db, bool* ok) {
|
||||
QSqlQuery query(db);
|
||||
|
||||
QList<ServiceRoot*> roots;
|
||||
|
||||
if (query.exec("SELECT * FROM OwnCloudAccounts;")) {
|
||||
@ -933,7 +932,6 @@ QList<ServiceRoot*> DatabaseQueries::getOwnCloudAccounts(const QSqlDatabase& db,
|
||||
|
||||
QList<ServiceRoot*> DatabaseQueries::getTtRssAccounts(const QSqlDatabase& db, bool* ok) {
|
||||
QSqlQuery query(db);
|
||||
|
||||
QList<ServiceRoot*> roots;
|
||||
|
||||
if (query.exec("SELECT * FROM TtRssAccounts;")) {
|
||||
@ -949,6 +947,7 @@ QList<ServiceRoot*> 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<ServiceRoot*> DatabaseQueries::getAccounts(const QSqlDatabase& db, bool* ok) {
|
||||
QSqlQuery q(db);
|
||||
|
||||
QList<ServiceRoot*> 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<ServiceRoot*> DatabaseQueries::getGmailAccounts(const QSqlDatabase& db, bool* ok) {
|
||||
QSqlQuery query(db);
|
||||
|
||||
QList<ServiceRoot*> roots;
|
||||
|
||||
if (query.exec("SELECT * FROM GmailAccounts;")) {
|
||||
@ -1642,7 +1645,6 @@ bool DatabaseQueries::storeNewInoreaderTokens(const QSqlDatabase& db, const QStr
|
||||
|
||||
QList<ServiceRoot*> DatabaseQueries::getInoreaderAccounts(const QSqlDatabase& db, bool* ok) {
|
||||
QSqlQuery query(db);
|
||||
|
||||
QList<ServiceRoot*> roots;
|
||||
|
||||
if (query.exec("SELECT * FROM InoreaderAccounts;")) {
|
||||
|
@ -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<Message> getUndeletedMessagesForFeed(const QSqlDatabase& db, const QString& feed_custom_id, int account_id, bool* ok = nullptr);
|
||||
static QList<Message> getUndeletedMessagesForFeed(const QSqlDatabase& db,
|
||||
const QString& feed_custom_id,
|
||||
int account_id,
|
||||
bool* ok = nullptr);
|
||||
static QList<Message> getUndeletedMessagesForBin(const QSqlDatabase& db, int account_id, bool* ok = nullptr);
|
||||
static QList<Message> 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<Message>& 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:
|
||||
|
@ -35,14 +35,14 @@
|
||||
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "network-web/downloader.h"
|
||||
|
||||
class LocationLineEdit;
|
||||
|
||||
class QTimer;
|
||||
|
||||
class QListWidget;
|
||||
|
||||
class Downloader;
|
||||
|
||||
class GoogleSuggest : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>604</width>
|
||||
<height>502</height>
|
||||
<height>442</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -16,24 +16,14 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lblTitle">
|
||||
<property name="text">
|
||||
<string>URL</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_txtUrl</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LineEditWithStatus" name="m_txtUrl" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="7" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<property name="text">
|
||||
<string>&Test setup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_gbAuthentication">
|
||||
<property name="toolTip">
|
||||
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
|
||||
@ -84,7 +74,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="m_gbHttpAuthentication">
|
||||
<property name="toolTip">
|
||||
<string>Some feeds require authentication, including GMail feeds. BASIC, NTLM-2 and DIGEST-MD5 authentication schemes are supported.</string>
|
||||
@ -108,7 +98,7 @@
|
||||
<string>Username</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_txtUsername</cstring>
|
||||
<cstring>m_txtHttpUsername</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -121,7 +111,7 @@
|
||||
<string>Password</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_txtPassword</cstring>
|
||||
<cstring>m_txtHttpPassword</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -138,14 +128,58 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lblTitle">
|
||||
<property name="text">
|
||||
<string>URL</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>m_txtUrl</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LineEditWithStatus" name="m_txtUrl" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblDescription">
|
||||
<property name="text">
|
||||
<string>&Test setup</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblServerSideUpdateInformation">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkServerSideUpdate">
|
||||
<property name="text">
|
||||
<string>Force execution of server-side update when updating feeds from RSS Guard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages">
|
||||
<property name="text">
|
||||
<string>Download only unread messages.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblTestResult" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
@ -158,35 +192,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_checkServerSideUpdate">
|
||||
<property name="text">
|
||||
<string>Force execution of server-side update when updating feeds from RSS Guard</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblDescription">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblServerSideUpdateInformation">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>68</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
@ -213,6 +233,14 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_checkDownloadOnlyUnreadMessages</tabstop>
|
||||
<tabstop>m_checkServerSideUpdate</tabstop>
|
||||
<tabstop>m_checkShowPassword</tabstop>
|
||||
<tabstop>m_gbHttpAuthentication</tabstop>
|
||||
<tabstop>m_checkShowHttpPassword</tabstop>
|
||||
<tabstop>m_btnTestSetup</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -78,8 +78,8 @@ TtRssLoginResponse TtRssNetworkFactory::login() {
|
||||
json["password"] = m_password;
|
||||
|
||||
QByteArray result_raw;
|
||||
|
||||
QList<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<QByteArray, QByteArray>> headers;
|
||||
|
||||
headers << QPair<QByteArray, QByteArray>(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<QPair<RootItem*, QJsonValue>> pairs;
|
||||
|
||||
for (const QJsonValue& item : items_to_process) {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <QString>
|
||||
|
||||
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;
|
||||
|
@ -14,8 +14,7 @@
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
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<FormTtRssFeedDetails> form_pointer = new FormTtRssFeedDetails(serviceRoot(), qApp->mainFormWidget());
|
||||
|
||||
form_pointer.data()->addEditFeed(this, nullptr);
|
||||
delete form_pointer.data();
|
||||
return false;
|
||||
@ -75,7 +75,7 @@ QList<Message> 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<Message> TtRssFeed::obtainNewMessages(bool* error_during_obtaining) {
|
||||
}
|
||||
else {
|
||||
QList<Message> new_messages = headlines.messages();
|
||||
|
||||
messages.append(new_messages);
|
||||
newly_added_messages = new_messages.size();
|
||||
skip += newly_added_messages;
|
||||
|
@ -53,6 +53,7 @@ QString TtRssServiceRoot::code() const {
|
||||
|
||||
bool TtRssServiceRoot::editViaGui() {
|
||||
QScopedPointer<FormEditTtRssAccount> form_pointer(new FormEditTtRssAccount(qApp->mainFormWidget()));
|
||||
|
||||
form_pointer.data()->execForEdit(this);
|
||||
return true;
|
||||
}
|
||||
@ -92,6 +93,7 @@ void TtRssServiceRoot::addNewFeed(const QString& url) {
|
||||
}
|
||||
|
||||
QScopedPointer<FormTtRssFeedDetails> 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<Message> 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<RootItem*>() << 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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user