download unread only for inoreader too
This commit is contained in:
parent
899c7ccf06
commit
b1d394b6e5
@ -40,7 +40,8 @@ GreaderAccountDetails::GreaderAccountDetails(QWidget* parent) : QWidget(parent)
|
|||||||
connect(m_ui.m_cmbService, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GreaderAccountDetails::fillPredefinedUrl);
|
connect(m_ui.m_cmbService, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &GreaderAccountDetails::fillPredefinedUrl);
|
||||||
|
|
||||||
setTabOrder(m_ui.m_cmbService, m_ui.m_txtUrl->lineEdit());
|
setTabOrder(m_ui.m_cmbService, m_ui.m_txtUrl->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_spinLimitMessages);
|
setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_cbDownloadOnlyUnreadMessages);
|
||||||
|
setTabOrder(m_ui.m_cbDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
|
||||||
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_txtUsername->lineEdit());
|
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_txtUsername->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit());
|
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit());
|
||||||
setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_checkShowPassword);
|
setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_checkShowPassword);
|
||||||
|
@ -32,6 +32,7 @@ void FormEditInoreaderAccount::apply() {
|
|||||||
|
|
||||||
account<InoreaderServiceRoot>()->network()->setUsername(m_details->m_ui.m_txtUsername->lineEdit()->text());
|
account<InoreaderServiceRoot>()->network()->setUsername(m_details->m_ui.m_txtUsername->lineEdit()->text());
|
||||||
account<InoreaderServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
|
account<InoreaderServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
|
||||||
|
account<InoreaderServiceRoot>()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_cbDownloadOnlyUnreadMessages->isChecked());
|
||||||
|
|
||||||
account<InoreaderServiceRoot>()->saveAccountDataToDatabase();
|
account<InoreaderServiceRoot>()->saveAccountDataToDatabase();
|
||||||
accept();
|
accept();
|
||||||
@ -55,4 +56,5 @@ void FormEditInoreaderAccount::loadAccountData() {
|
|||||||
|
|
||||||
m_details->m_ui.m_txtUsername->lineEdit()->setText(account<InoreaderServiceRoot>()->network()->username());
|
m_details->m_ui.m_txtUsername->lineEdit()->setText(account<InoreaderServiceRoot>()->network()->username());
|
||||||
m_details->m_ui.m_spinLimitMessages->setValue(account<InoreaderServiceRoot>()->network()->batchSize());
|
m_details->m_ui.m_spinLimitMessages->setValue(account<InoreaderServiceRoot>()->network()->batchSize());
|
||||||
|
m_details->m_ui.m_cbDownloadOnlyUnreadMessages->setChecked(account<InoreaderServiceRoot>()->network()->downloadOnlyUnreadMessages());
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,9 @@ InoreaderAccountDetails::InoreaderAccountDetails(QWidget* parent)
|
|||||||
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtAppId);
|
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtAppId);
|
||||||
setTabOrder(m_ui.m_txtAppId, m_ui.m_txtAppKey);
|
setTabOrder(m_ui.m_txtAppId, m_ui.m_txtAppKey);
|
||||||
setTabOrder(m_ui.m_txtAppKey, m_ui.m_txtRedirectUrl);
|
setTabOrder(m_ui.m_txtAppKey, m_ui.m_txtRedirectUrl);
|
||||||
setTabOrder(m_ui.m_txtRedirectUrl, m_ui.m_spinLimitMessages);
|
setTabOrder(m_ui.m_txtRedirectUrl, m_ui.m_btnRegisterApi);
|
||||||
|
setTabOrder(m_ui.m_btnRegisterApi, m_ui.m_cbDownloadOnlyUnreadMessages);
|
||||||
|
setTabOrder(m_ui.m_cbDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
|
||||||
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_btnTestSetup);
|
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_btnTestSetup);
|
||||||
|
|
||||||
connect(m_ui.m_txtAppId->lineEdit(), &BaseLineEdit::textChanged, this, &InoreaderAccountDetails::checkOAuthValue);
|
connect(m_ui.m_txtAppId->lineEdit(), &BaseLineEdit::textChanged, this, &InoreaderAccountDetails::checkOAuthValue);
|
||||||
|
@ -115,7 +115,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<layout class="QFormLayout" name="formLayout_3">
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="m_spinLimitMessages">
|
<widget class="QSpinBox" name="m_spinLimitMessages">
|
||||||
@ -142,7 +142,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="4" column="0" colspan="2">
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="m_btnTestSetup">
|
<widget class="QPushButton" name="m_btnTestSetup">
|
||||||
@ -160,7 +160,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="2">
|
<item row="5" column="0" colspan="2">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -173,6 +173,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="m_cbDownloadOnlyUnreadMessages">
|
||||||
|
<property name="text">
|
||||||
|
<string>Download only unread messages</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
InoreaderNetworkFactory::InoreaderNetworkFactory(QObject* parent) : QObject(parent),
|
InoreaderNetworkFactory::InoreaderNetworkFactory(QObject* parent) : QObject(parent),
|
||||||
m_service(nullptr), m_username(QString()), m_batchSize(INOREADER_DEFAULT_BATCH_SIZE),
|
m_service(nullptr), m_username(QString()), m_downloadOnlyUnreadMessages(false), m_batchSize(INOREADER_DEFAULT_BATCH_SIZE),
|
||||||
m_oauth2(new OAuth2Service(INOREADER_OAUTH_AUTH_URL, INOREADER_OAUTH_TOKEN_URL,
|
m_oauth2(new OAuth2Service(INOREADER_OAUTH_AUTH_URL, INOREADER_OAUTH_TOKEN_URL,
|
||||||
{}, {}, INOREADER_OAUTH_SCOPE, this)) {
|
{}, {}, INOREADER_OAUTH_SCOPE, this)) {
|
||||||
initializeOauth();
|
initializeOauth();
|
||||||
@ -75,6 +75,14 @@ void InoreaderNetworkFactory::initializeOauth() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InoreaderNetworkFactory::downloadOnlyUnreadMessages() const {
|
||||||
|
return m_downloadOnlyUnreadMessages;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InoreaderNetworkFactory::setDownloadOnlyUnreadMessages(bool download_only_unread) {
|
||||||
|
m_downloadOnlyUnreadMessages = download_only_unread;
|
||||||
|
}
|
||||||
|
|
||||||
void InoreaderNetworkFactory::setUsername(const QString& username) {
|
void InoreaderNetworkFactory::setUsername(const QString& username) {
|
||||||
m_username = username;
|
m_username = username;
|
||||||
}
|
}
|
||||||
@ -177,6 +185,10 @@ QList<Message> InoreaderNetworkFactory::messages(ServiceRoot* root, const QStrin
|
|||||||
|
|
||||||
target_url += QSL("/") + QUrl::toPercentEncoding(stream_id) + QString("?n=%1").arg(batchSize());
|
target_url += QSL("/") + QUrl::toPercentEncoding(stream_id) + QString("?n=%1").arg(batchSize());
|
||||||
|
|
||||||
|
if (downloadOnlyUnreadMessages()) {
|
||||||
|
target_url += QSL("&xt=%1").arg(INOREADER_FULL_STATE_READ);
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray output_msgs;
|
QByteArray output_msgs;
|
||||||
auto result = NetworkFactory::performNetworkOperation(target_url,
|
auto result = NetworkFactory::performNetworkOperation(target_url,
|
||||||
qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(),
|
qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(),
|
||||||
|
@ -45,6 +45,9 @@ class InoreaderNetworkFactory : public QObject {
|
|||||||
QNetworkReply::NetworkError markMessagesRead(RootItem::ReadStatus status, const QStringList& msg_custom_ids);
|
QNetworkReply::NetworkError markMessagesRead(RootItem::ReadStatus status, const QStringList& msg_custom_ids);
|
||||||
QNetworkReply::NetworkError markMessagesStarred(RootItem::Importance importance, const QStringList& msg_custom_ids);
|
QNetworkReply::NetworkError markMessagesStarred(RootItem::Importance importance, const QStringList& msg_custom_ids);
|
||||||
|
|
||||||
|
bool downloadOnlyUnreadMessages() const;
|
||||||
|
void setDownloadOnlyUnreadMessages(bool download_only_unread);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTokensError(const QString& error, const QString& error_description);
|
void onTokensError(const QString& error, const QString& error_description);
|
||||||
void onAuthFailed();
|
void onAuthFailed();
|
||||||
@ -58,6 +61,7 @@ class InoreaderNetworkFactory : public QObject {
|
|||||||
private:
|
private:
|
||||||
InoreaderServiceRoot* m_service;
|
InoreaderServiceRoot* m_service;
|
||||||
QString m_username;
|
QString m_username;
|
||||||
|
bool m_downloadOnlyUnreadMessages;
|
||||||
int m_batchSize;
|
int m_batchSize;
|
||||||
OAuth2Service* m_oauth2;
|
OAuth2Service* m_oauth2;
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include "services/inoreader/inoreaderserviceroot.h"
|
#include "services/inoreader/inoreaderserviceroot.h"
|
||||||
|
|
||||||
#include "miscellaneous/application.h"
|
|
||||||
#include "database/databasequeries.h"
|
#include "database/databasequeries.h"
|
||||||
|
#include "miscellaneous/application.h"
|
||||||
#include "miscellaneous/iconfactory.h"
|
#include "miscellaneous/iconfactory.h"
|
||||||
#include "network-web/oauth2service.h"
|
#include "network-web/oauth2service.h"
|
||||||
#include "services/abstract/importantnode.h"
|
#include "services/abstract/importantnode.h"
|
||||||
@ -35,6 +35,7 @@ QVariantHash InoreaderServiceRoot::customDatabaseData() const {
|
|||||||
QVariantHash data;
|
QVariantHash data;
|
||||||
|
|
||||||
data["username"] = m_network->username();
|
data["username"] = m_network->username();
|
||||||
|
data["download_only_unread"] = m_network->downloadOnlyUnreadMessages();
|
||||||
data["batch_size"] = m_network->batchSize();
|
data["batch_size"] = m_network->batchSize();
|
||||||
data["client_id"] = m_network->oauth()->clientId();
|
data["client_id"] = m_network->oauth()->clientId();
|
||||||
data["client_secret"] = m_network->oauth()->clientSecret();
|
data["client_secret"] = m_network->oauth()->clientSecret();
|
||||||
@ -47,6 +48,7 @@ QVariantHash InoreaderServiceRoot::customDatabaseData() const {
|
|||||||
void InoreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
void InoreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||||
m_network->setUsername(data["username"].toString());
|
m_network->setUsername(data["username"].toString());
|
||||||
m_network->setBatchSize(data["batch_size"].toInt());
|
m_network->setBatchSize(data["batch_size"].toInt());
|
||||||
|
m_network->setDownloadOnlyUnreadMessages(data["download_only_unread"].toBool());
|
||||||
m_network->oauth()->setClientId(data["client_id"].toString());
|
m_network->oauth()->setClientId(data["client_id"].toString());
|
||||||
m_network->oauth()->setClientSecret(data["client_secret"].toString());
|
m_network->oauth()->setClientSecret(data["client_secret"].toString());
|
||||||
m_network->oauth()->setRefreshToken(data["refresh_token"].toString());
|
m_network->oauth()->setRefreshToken(data["refresh_token"].toString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user