offer predefined URLs for some greader sites

This commit is contained in:
Martin Rotter 2021-03-21 18:58:46 +01:00 committed by Martin Rotter
parent 279256c27d
commit 234d0b13c6
3 changed files with 28 additions and 0 deletions

View File

@ -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.

View File

@ -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<int>::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;
}
}

View File

@ -28,6 +28,7 @@ class GreaderAccountDetails : public QWidget {
void onUsernameChanged();
void onPasswordChanged();
void onUrlChanged();
void fillPredefinedUrl();
private:
Ui::GreaderAccountDetails m_ui;