From 234d0b13c6c3c6ba32cfabb1e487356bda4b0a01 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 21 Mar 2021 18:58:46 +0100 Subject: [PATCH] offer predefined URLs for some greader sites --- .../services/greader/definitions.h | 5 +++++ .../greader/gui/greaderaccountdetails.cpp | 22 +++++++++++++++++++ .../greader/gui/greaderaccountdetails.h | 1 + 3 files changed, 28 insertions(+) diff --git a/src/librssguard/services/greader/definitions.h b/src/librssguard/services/greader/definitions.h index 42f1e0c9a..2c13ddf58 100755 --- a/src/librssguard/services/greader/definitions.h +++ b/src/librssguard/services/greader/definitions.h @@ -4,6 +4,11 @@ #define GREADER_UNLIMITED_BATCH_SIZE -1 #define GREADER_DEFAULT_BATCH_SIZE 100 +// URLs. +#define GREADER_URL_REEDAH "https://www.reedah.com" +#define GREADER_URL_TOR "https://theoldreader.com" +#define GREADER_URL_BAZQUX "https://bazqux.com" + // States. // Means "unread" message. diff --git a/src/librssguard/services/greader/gui/greaderaccountdetails.cpp b/src/librssguard/services/greader/gui/greaderaccountdetails.cpp index 225ee9fc0..ab25a5bed 100755 --- a/src/librssguard/services/greader/gui/greaderaccountdetails.cpp +++ b/src/librssguard/services/greader/gui/greaderaccountdetails.cpp @@ -46,6 +46,7 @@ GreaderAccountDetails::GreaderAccountDetails(QWidget* parent) : QWidget(parent) connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onPasswordChanged); connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUsernameChanged); connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &GreaderAccountDetails::onUrlChanged); + connect(m_ui.m_cmbService, QOverload::of(&QComboBox::currentIndexChanged), this, &GreaderAccountDetails::fillPredefinedUrl); setTabOrder(m_ui.m_cmbService, m_ui.m_txtUrl->lineEdit()); setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_spinLimitMessages); @@ -127,3 +128,24 @@ void GreaderAccountDetails::onUrlChanged() { m_ui.m_txtUrl->setStatus(WidgetWithStatus::StatusType::Ok, tr("URL is okay.")); } } + +void GreaderAccountDetails::fillPredefinedUrl() { + switch (service()) { + case GreaderServiceRoot::Service::Reedah: + m_ui.m_txtUrl->lineEdit()->setText(QSL(GREADER_URL_REEDAH)); + break; + + case GreaderServiceRoot::Service::Bazqux: + m_ui.m_txtUrl->lineEdit()->setText(QSL(GREADER_URL_BAZQUX)); + break; + + case GreaderServiceRoot::Service::TheOldReader: + m_ui.m_txtUrl->lineEdit()->setText(QSL(GREADER_URL_TOR)); + break; + + default: + m_ui.m_txtUrl->lineEdit()->clear(); + m_ui.m_txtUrl->setFocus(); + break; + } +} diff --git a/src/librssguard/services/greader/gui/greaderaccountdetails.h b/src/librssguard/services/greader/gui/greaderaccountdetails.h index bc2450769..669e15d83 100755 --- a/src/librssguard/services/greader/gui/greaderaccountdetails.h +++ b/src/librssguard/services/greader/gui/greaderaccountdetails.h @@ -28,6 +28,7 @@ class GreaderAccountDetails : public QWidget { void onUsernameChanged(); void onPasswordChanged(); void onUrlChanged(); + void fillPredefinedUrl(); private: Ui::GreaderAccountDetails m_ui;