download unread only for greader too
This commit is contained in:
parent
f75d848548
commit
1415da7d96
@ -17,7 +17,7 @@
|
||||
|
||||
GreaderNetwork::GreaderNetwork(QObject* parent)
|
||||
: QObject(parent), m_service(GreaderServiceRoot::Service::FreshRss), m_username(QString()), m_password(QString()),
|
||||
m_baseUrl(QString()), m_batchSize(GREADER_DEFAULT_BATCH_SIZE) {
|
||||
m_baseUrl(QString()), m_batchSize(GREADER_DEFAULT_BATCH_SIZE), m_downloadOnlyUnreadMessages(false) {
|
||||
clearCredentials();
|
||||
}
|
||||
|
||||
@ -117,6 +117,10 @@ QList<Message> GreaderNetwork::streamContents(ServiceRoot* root, const QString&
|
||||
return {};
|
||||
}
|
||||
|
||||
if (downloadOnlyUnreadMessages()) {
|
||||
full_url += QSL("&xt=%1").arg(GREADER_API_FULL_STATE_READ);
|
||||
}
|
||||
|
||||
QByteArray output_stream;
|
||||
auto result_stream = NetworkFactory::performNetworkOperation(full_url,
|
||||
timeout,
|
||||
@ -617,3 +621,11 @@ QString GreaderNetwork::generateFullUrl(GreaderNetwork::Operations operation) co
|
||||
return sanitizedBaseUrl();
|
||||
}
|
||||
}
|
||||
|
||||
bool GreaderNetwork::downloadOnlyUnreadMessages() const {
|
||||
return m_downloadOnlyUnreadMessages;
|
||||
}
|
||||
|
||||
void GreaderNetwork::setDownloadOnlyUnreadMessages(bool download_only_unread) {
|
||||
m_downloadOnlyUnreadMessages = download_only_unread;
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ class GreaderNetwork : public QObject {
|
||||
|
||||
static QString serviceToString(GreaderServiceRoot::Service service);
|
||||
|
||||
bool downloadOnlyUnreadMessages() const;
|
||||
void setDownloadOnlyUnreadMessages(bool download_only_unread);
|
||||
|
||||
private:
|
||||
QPair<QByteArray, QByteArray> authHeader() const;
|
||||
|
||||
@ -83,6 +86,7 @@ class GreaderNetwork : public QObject {
|
||||
QString m_password;
|
||||
QString m_baseUrl;
|
||||
int m_batchSize;
|
||||
bool m_downloadOnlyUnreadMessages;
|
||||
QString m_authSid;
|
||||
QString m_authAuth;
|
||||
QString m_authToken;
|
||||
|
@ -42,6 +42,7 @@ QVariantHash GreaderServiceRoot::customDatabaseData() const {
|
||||
data["password"] = TextFactory::encrypt(m_network->password());
|
||||
data["url"] = m_network->baseUrl();
|
||||
data["batch_size"] = m_network->batchSize();
|
||||
data["download_only_unread"] = m_network->downloadOnlyUnreadMessages();
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -52,6 +53,7 @@ void GreaderServiceRoot::setCustomDatabaseData(const QVariantHash& data) {
|
||||
m_network->setPassword(TextFactory::decrypt(data["password"].toString()));
|
||||
m_network->setBaseUrl(data["url"].toString());
|
||||
m_network->setBatchSize(data["batch_size"].toInt());
|
||||
m_network->setDownloadOnlyUnreadMessages(data["download_only_unread"].toBool());
|
||||
}
|
||||
|
||||
QList<Message> GreaderServiceRoot::obtainNewMessages(const QList<Feed*>& feeds, bool* error_during_obtaining) {
|
||||
|
@ -27,6 +27,7 @@ void FormEditGreaderAccount::apply() {
|
||||
account<GreaderServiceRoot>()->network()->setUsername(m_details->m_ui.m_txtUsername->lineEdit()->text());
|
||||
account<GreaderServiceRoot>()->network()->setPassword(m_details->m_ui.m_txtPassword->lineEdit()->text());
|
||||
account<GreaderServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
|
||||
account<GreaderServiceRoot>()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_cbDownloadOnlyUnreadMessages->isChecked());
|
||||
account<GreaderServiceRoot>()->network()->setService(m_details->service());
|
||||
|
||||
account<GreaderServiceRoot>()->saveAccountDataToDatabase();
|
||||
@ -48,6 +49,7 @@ void FormEditGreaderAccount::loadAccountData() {
|
||||
m_details->m_ui.m_txtPassword->lineEdit()->setText(existing_root->network()->password());
|
||||
m_details->m_ui.m_txtUrl->lineEdit()->setText(existing_root->network()->baseUrl());
|
||||
m_details->m_ui.m_spinLimitMessages->setValue(existing_root->network()->batchSize());
|
||||
m_details->m_ui.m_cbDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages());
|
||||
}
|
||||
|
||||
void FormEditGreaderAccount::performTest() {
|
||||
|
@ -34,7 +34,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtUrl" native="true"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
@ -51,7 +51,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="m_lblLimitMessages">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -61,7 +61,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="8" 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>
|
||||
@ -112,7 +112,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_btnTestSetup">
|
||||
@ -136,7 +136,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -149,6 +149,13 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_cbDownloadOnlyUnreadMessages">
|
||||
<property name="text">
|
||||
<string>Download only unread messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -171,9 +178,11 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>m_cbDownloadOnlyUnreadMessages</tabstop>
|
||||
<tabstop>m_spinLimitMessages</tabstop>
|
||||
<tabstop>m_checkShowPassword</tabstop>
|
||||
<tabstop>m_btnTestSetup</tabstop>
|
||||
<tabstop>m_cmbService</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user