Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
save ttrss work
  • Loading branch information
martinrotter committed Sep 2, 2022
1 parent 89a7731 commit 8676bfc
Show file tree
Hide file tree
Showing 8 changed files with 607 additions and 313 deletions.
3 changes: 1 addition & 2 deletions resources/desktop/com.github.rssguard.appdata.xml
Expand Up @@ -22,11 +22,10 @@
</screenshots>
<url type="homepage">https://github.com/martinrotter/rssguard</url>
<url type="bugtracker">https://github.com/martinrotter/rssguard/issues</url>
<url type="translate">https://www.transifex.com/martinrotter/rssguard</url>
<url type="donation">https://github.com/sponsors/martinrotter</url>
<content_rating type="oars-1.1" />
<releases>
<release version="4.2.3" date="2022-09-01"/>
<release version="4.2.3" date="2022-09-02"/>
</releases>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">none</content_attribute>
Expand Down
9 changes: 7 additions & 2 deletions src/librssguard/services/tt-rss/gui/formeditttrssaccount.cpp
Expand Up @@ -32,8 +32,12 @@ void FormEditTtRssAccount::apply() {
account<TtRssServiceRoot>()->network()->setAuthUsername(m_details->m_ui.m_txtHttpUsername->lineEdit()->text());
account<TtRssServiceRoot>()->network()->setAuthPassword(m_details->m_ui.m_txtHttpPassword->lineEdit()->text());
account<TtRssServiceRoot>()->network()->setBatchSize(m_details->m_ui.m_spinLimitMessages->value());
account<TtRssServiceRoot>()->network()->setForceServerSideUpdate(m_details->m_ui.m_checkServerSideUpdate->isChecked());
account<TtRssServiceRoot>()->network()->setDownloadOnlyUnreadMessages(m_details->m_ui.m_checkDownloadOnlyUnreadMessages->isChecked());
account<TtRssServiceRoot>()->network()->setIntelligentSynchronization(m_details->m_ui.m_cbNewAlgorithm->isChecked());
account<TtRssServiceRoot>()->network()->setForceServerSideUpdate(m_details->m_ui.m_checkServerSideUpdate
->isChecked());
account<TtRssServiceRoot>()
->network()
->setDownloadOnlyUnreadMessages(m_details->m_ui.m_checkDownloadOnlyUnreadMessages->isChecked());

account<TtRssServiceRoot>()->saveAccountDataToDatabase();
accept();
Expand All @@ -58,6 +62,7 @@ void FormEditTtRssAccount::loadAccountData() {
m_details->m_ui.m_spinLimitMessages->setValue(existing_root->network()->batchSize());
m_details->m_ui.m_checkServerSideUpdate->setChecked(existing_root->network()->forceServerSideUpdate());
m_details->m_ui.m_checkDownloadOnlyUnreadMessages->setChecked(existing_root->network()->downloadOnlyUnreadMessages());
m_details->m_ui.m_cbNewAlgorithm->setChecked(existing_root->network()->intelligentSynchronization());
}

void FormEditTtRssAccount::performTest() {
Expand Down
75 changes: 45 additions & 30 deletions src/librssguard/services/tt-rss/gui/ttrssaccountdetails.cpp
Expand Up @@ -11,9 +11,16 @@ TtRssAccountDetails::TtRssAccountDetails(QWidget* parent) : QWidget(parent) {
m_ui.setupUi(this);

m_ui.m_lblTestResult->label()->setWordWrap(true);
m_ui.m_lblServerSideUpdateInformation->setHelpText(tr("Leaving this option on causes that updates "
"of feeds will be probably much slower and may time-out often."),
true);
m_ui.m_lblNewAlgorithm->setHelpText(tr("If you select intelligent synchronization, then only not-yet-fetched "
"or updated articles are downloaded. Network usage is greatly reduced and "
"overall synchronization speed is greatly improved, but "
"first feed fetching could be slow anyway if your feed contains "
"huge number of articles."),
false);
m_ui.m_lblServerSideUpdateInformation
->setHelpText(tr("Leaving this option on causes that updates "
"of feeds will be probably much slower and may time-out often."),
true);
m_ui.m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username"));
m_ui.m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password"));
m_ui.m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account"));
Expand All @@ -25,7 +32,8 @@ TtRssAccountDetails::TtRssAccountDetails(QWidget* parent) : QWidget(parent) {

setTabOrder(m_ui.m_txtUrl->lineEdit(), m_ui.m_checkDownloadOnlyUnreadMessages);
setTabOrder(m_ui.m_checkDownloadOnlyUnreadMessages, m_ui.m_spinLimitMessages);
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_checkServerSideUpdate);
setTabOrder(m_ui.m_spinLimitMessages, m_ui.m_cbNewAlgorithm);
setTabOrder(m_ui.m_cbNewAlgorithm, m_ui.m_checkServerSideUpdate);
setTabOrder(m_ui.m_checkServerSideUpdate, m_ui.m_txtUsername->lineEdit());
setTabOrder(m_ui.m_txtUsername->lineEdit(), m_ui.m_txtPassword->lineEdit());
setTabOrder(m_ui.m_txtPassword->lineEdit(), m_ui.m_gbHttpAuthentication);
Expand All @@ -38,8 +46,14 @@ TtRssAccountDetails::TtRssAccountDetails(QWidget* parent) : QWidget(parent) {

connect(m_ui.m_txtPassword->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onPasswordChanged);
connect(m_ui.m_txtUsername->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onUsernameChanged);
connect(m_ui.m_txtHttpPassword->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onHttpPasswordChanged);
connect(m_ui.m_txtHttpUsername->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onHttpUsernameChanged);
connect(m_ui.m_txtHttpPassword->lineEdit(),
&BaseLineEdit::textChanged,
this,
&TtRssAccountDetails::onHttpPasswordChanged);
connect(m_ui.m_txtHttpUsername->lineEdit(),
&BaseLineEdit::textChanged,
this,
&TtRssAccountDetails::onHttpUsernameChanged);
connect(m_ui.m_txtUrl->lineEdit(), &BaseLineEdit::textChanged, this, &TtRssAccountDetails::onUrlChanged);
connect(m_ui.m_gbHttpAuthentication, &QGroupBox::toggled, this, &TtRssAccountDetails::onHttpPasswordChanged);
connect(m_ui.m_gbHttpAuthentication, &QGroupBox::toggled, this, &TtRssAccountDetails::onHttpUsernameChanged);
Expand Down Expand Up @@ -87,21 +101,24 @@ void TtRssAccountDetails::performTest(const QNetworkProxy& proxy) {
}
else if (result.apiLevel() < TTRSS_MINIMAL_API_LEVEL) {
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Installed version: %1, required at least: %2.")
.arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Selected Tiny Tiny RSS server is running unsupported version of API."));
}
else {
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Ok,
tr("Installed version: %1, required at least: %2.").arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Installed version: %1, required at least: %2.")
.arg(QString::number(result.apiLevel()),
QString::number(TTRSS_MINIMAL_API_LEVEL)),
tr("Tiny Tiny RSS server is okay."));
}
}
else if (factory.lastError() != QNetworkReply::NoError) {
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?"));
else if (factory.lastError() != QNetworkReply::NoError) {
m_ui.m_lblTestResult
->setStatus(WidgetWithStatus::StatusType::Error,
tr("Network error: '%1'.").arg(NetworkFactory::networkErrorText(factory.lastError())),
tr("Network error, have you entered correct Tiny Tiny RSS API endpoint and password?"));
}
else {
m_ui.m_lblTestResult->setStatus(WidgetWithStatus::StatusType::Error,
Expand Down Expand Up @@ -133,25 +150,23 @@ void TtRssAccountDetails::onPasswordChanged() {
}

void TtRssAccountDetails::onHttpUsernameChanged() {
const bool is_username_ok = !m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpUsername->lineEdit()->text().isEmpty();

m_ui.m_txtHttpUsername->setStatus(is_username_ok ?
LineEditWithStatus::StatusType::Ok :
LineEditWithStatus::StatusType::Warning,
is_username_ok ?
tr("Username is ok or it is not needed.") :
tr("Username is empty."));
const bool is_username_ok =
!m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpUsername->lineEdit()->text().isEmpty();

m_ui.m_txtHttpUsername->setStatus(is_username_ok ? LineEditWithStatus::StatusType::Ok
: LineEditWithStatus::StatusType::Warning,
is_username_ok ? tr("Username is ok or it is not needed.")
: tr("Username is empty."));
}

void TtRssAccountDetails::onHttpPasswordChanged() {
const bool is_username_ok = !m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpPassword->lineEdit()->text().isEmpty();

m_ui.m_txtHttpPassword->setStatus(is_username_ok ?
LineEditWithStatus::StatusType::Ok :
LineEditWithStatus::StatusType::Warning,
is_username_ok ?
tr("Password is ok or it is not needed.") :
tr("Password is empty."));
const bool is_username_ok =
!m_ui.m_gbHttpAuthentication->isChecked() || !m_ui.m_txtHttpPassword->lineEdit()->text().isEmpty();

m_ui.m_txtHttpPassword->setStatus(is_username_ok ? LineEditWithStatus::StatusType::Ok
: LineEditWithStatus::StatusType::Warning,
is_username_ok ? tr("Password is ok or it is not needed.")
: tr("Password is empty."));
}

void TtRssAccountDetails::onUrlChanged() {
Expand Down
46 changes: 28 additions & 18 deletions src/librssguard/services/tt-rss/gui/ttrssaccountdetails.ui
Expand Up @@ -11,7 +11,7 @@
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="8" column="0">
<item row="10" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -41,13 +41,6 @@
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages">
<property name="text">
<string>Download unread articles only</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
Expand Down Expand Up @@ -85,17 +78,28 @@
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkDownloadOnlyUnreadMessages">
<property name="text">
<string>Download unread articles only</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="m_cbNewAlgorithm">
<property name="text">
<string>Intelligent synchronization algorithm</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="m_checkServerSideUpdate">
<property name="text">
<string>Force execution of server-side feeds update</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_lblServerSideUpdateInformation" native="true"/>
</item>
<item row="5" column="0" colspan="2">
<item row="7" 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>
Expand Down Expand Up @@ -139,7 +143,7 @@
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="8" 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>
Expand Down Expand Up @@ -186,7 +190,7 @@
</layout>
</widget>
</item>
<item row="7" column="0" colspan="2">
<item row="9" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="m_btnTestSetup">
Expand All @@ -210,19 +214,25 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_lblNewAlgorithm" native="true"/>
</item>
<item row="6" column="0" colspan="2">
<widget class="HelpSpoiler" name="m_lblServerSideUpdateInformation" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LineEditWithStatus</class>
<class>LabelWithStatus</class>
<extends>QWidget</extends>
<header>lineeditwithstatus.h</header>
<header>labelwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LabelWithStatus</class>
<class>LineEditWithStatus</class>
<extends>QWidget</extends>
<header>labelwithstatus.h</header>
<header>lineeditwithstatus.h</header>
<container>1</container>
</customwidget>
<customwidget>
Expand Down

0 comments on commit 8676bfc

Please sign in to comment.