fix newscloud news msg download + feed edit dialog
This commit is contained in:
parent
16e8d9a42f
commit
86b1d6d10e
@ -1 +1 @@
|
||||
Subproject commit 9c10723bfbaf6cb85107d6ee16e0324e9e487749
|
||||
Subproject commit 47f4125753452eff8800dbd6600c5a05540b15d9
|
@ -36,7 +36,7 @@ CREATE TABLE Feeds (
|
||||
description TEXT,
|
||||
date_created BIGINT,
|
||||
icon °°,
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Root feeds contain -1 here. */
|
||||
category INTEGER NOT NULL CHECK (category >= -1), /* Physical category ID, also root feeds contain -1 here. */
|
||||
source TEXT,
|
||||
update_type INTEGER NOT NULL CHECK (update_type >= 0),
|
||||
update_interval INTEGER NOT NULL DEFAULT 15 CHECK (update_interval >= 1),
|
||||
|
@ -3,12 +3,13 @@
|
||||
#include "services/abstract/gui/formfeeddetails.h"
|
||||
|
||||
#include "core/feedsmodel.h"
|
||||
#include "database/databasequeries.h"
|
||||
#include "definitions/definitions.h"
|
||||
#include "exceptions/applicationexception.h"
|
||||
#include "gui/baselineedit.h"
|
||||
#include "gui/guiutilities.h"
|
||||
#include "gui/messagebox.h"
|
||||
#include "gui/systemtrayicon.h"
|
||||
#include "database/databasequeries.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
#include "network-web/networkfactory.h"
|
||||
@ -46,6 +47,13 @@ void FormFeedDetails::apply() {
|
||||
m_feed->setAutoUpdateType(static_cast<Feed::AutoUpdateType>(m_ui->m_cmbAutoUpdateType->itemData(
|
||||
m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
|
||||
m_feed->setAutoUpdateInitialInterval(int(m_ui->m_spinAutoUpdateInterval->value()));
|
||||
|
||||
if (!m_creatingNew) {
|
||||
// We need to make sure that common data are saved.
|
||||
QSqlDatabase database = qApp->database()->driver()->connection(metaObject()->className());
|
||||
|
||||
DatabaseQueries::createOverwriteFeed(database, m_feed, m_serviceRoot->accountId(), m_feed->parent()->id());
|
||||
}
|
||||
}
|
||||
|
||||
void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
|
||||
@ -63,7 +71,7 @@ void FormFeedDetails::onAutoUpdateTypeChanged(int new_index) {
|
||||
}
|
||||
|
||||
void FormFeedDetails::createConnections() {
|
||||
connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::apply);
|
||||
connect(m_ui->m_buttonBox, &QDialogButtonBox::accepted, this, &FormFeedDetails::acceptIfPossible);
|
||||
connect(m_ui->m_cmbAutoUpdateType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&FormFeedDetails::onAutoUpdateTypeChanged);
|
||||
}
|
||||
@ -80,6 +88,20 @@ void FormFeedDetails::loadFeedData() {
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(m_feed->autoUpdateInitialInterval());
|
||||
}
|
||||
|
||||
void FormFeedDetails::acceptIfPossible() {
|
||||
try {
|
||||
apply();
|
||||
accept();
|
||||
}
|
||||
catch (const ApplicationException& ex) {
|
||||
qApp->showGuiMessage(tr("Error"),
|
||||
tr("Cannot save changes: %1").arg(ex.message()),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
this,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
void FormFeedDetails::initialize() {
|
||||
m_ui.reset(new Ui::FormFeedDetails());
|
||||
m_ui->setupUi(this);
|
||||
|
@ -47,6 +47,7 @@ class FormFeedDetails : public QDialog {
|
||||
virtual void loadFeedData();
|
||||
|
||||
private slots:
|
||||
void acceptIfPossible();
|
||||
void onAutoUpdateTypeChanged(int new_index);
|
||||
|
||||
private:
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#include "services/owncloud/owncloudserviceroot.h"
|
||||
|
||||
#include "database/databasequeries.h"
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "database/databasequeries.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
#include "miscellaneous/mutex.h"
|
||||
#include "miscellaneous/textfactory.h"
|
||||
@ -153,7 +153,7 @@ QList<Message> OwnCloudServiceRoot::obtainNewMessages(const QList<Feed*>& feeds,
|
||||
QList<Message> msgs;
|
||||
|
||||
for (Feed* feed : feeds) {
|
||||
OwnCloudGetMessagesResponse messages = network()->getMessages(customNumericId(), networkProxy());
|
||||
OwnCloudGetMessagesResponse messages = network()->getMessages(feed->customNumericId(), networkProxy());
|
||||
|
||||
if (messages.networkError() != QNetworkReply::NetworkError::NoError) {
|
||||
feed->setStatus(Feed::Status::NetworkError);
|
||||
|
@ -110,7 +110,6 @@ void FormStandardFeedDetails::apply() {
|
||||
|
||||
m_serviceRoot->requestItemReassignment(m_feed, parent);
|
||||
m_serviceRoot->itemChanged({ m_feed });
|
||||
accept();
|
||||
}
|
||||
|
||||
void FormStandardFeedDetails::loadFeedData() {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "services/tt-rss/gui/formttrssfeeddetails.h"
|
||||
|
||||
#include "exceptions/applicationexception.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "services/abstract/feed.h"
|
||||
#include "services/abstract/gui/authenticationdetails.h"
|
||||
@ -43,18 +44,13 @@ void FormTtRssFeedDetails::apply() {
|
||||
|
||||
if (response.code() == STF_INSERTED) {
|
||||
// Feed was added online.
|
||||
accept();
|
||||
qApp->showGuiMessage(tr("Feed added"),
|
||||
tr("Feed was added, obtaining new tree of feeds now."),
|
||||
QSystemTrayIcon::MessageIcon::Information);
|
||||
QTimer::singleShot(300, root, &TtRssServiceRoot::syncIn);
|
||||
}
|
||||
else {
|
||||
qApp->showGuiMessage(tr("Cannot add feed"),
|
||||
tr("Feed was not added due to error."),
|
||||
QSystemTrayIcon::MessageIcon::Critical,
|
||||
qApp->mainFormWidget(),
|
||||
true);
|
||||
throw ApplicationException(tr("API returned error code %1").arg(QString::number(response.code())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user