fixed #393
This commit is contained in:
parent
f5856679d4
commit
9c670b8629
@ -65,6 +65,11 @@ void FeedDownloader::synchronizeAccountCaches(const QList<CacheForServiceRoot*>&
|
||||
void FeedDownloader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
QMutexLocker locker(m_mutex);
|
||||
|
||||
m_results.clear();
|
||||
m_feeds = feeds;
|
||||
m_feedsOriginalCount = m_feeds.size();
|
||||
m_feedsUpdated = 0;
|
||||
|
||||
if (feeds.isEmpty()) {
|
||||
qDebugNN << LOGSEC_FEEDDOWNLOADER << "No feeds to update in worker thread, aborting update.";
|
||||
}
|
||||
@ -72,10 +77,6 @@ void FeedDownloader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
qDebugNN << LOGSEC_FEEDDOWNLOADER
|
||||
<< "Starting feed updates from worker in thread: '"
|
||||
<< QThread::currentThreadId() << "'.";
|
||||
m_feeds = feeds;
|
||||
m_feedsOriginalCount = m_feeds.size();
|
||||
m_results.clear();
|
||||
m_feedsUpdated = 0;
|
||||
|
||||
// Job starts now.
|
||||
emit updateStarted();
|
||||
|
@ -457,8 +457,15 @@ void FeedsModel::setupFonts() {
|
||||
fon.fromString(qApp->settings()->value(GROUP(Feeds), Feeds::ListFont, Application::font("FeedsView").toString()).toString());
|
||||
|
||||
m_normalFont = fon;
|
||||
|
||||
m_boldFont = m_normalFont;
|
||||
m_boldFont.setBold(true);
|
||||
|
||||
m_normalStrikedFont = m_normalFont;
|
||||
m_normalStrikedFont.setStrikeOut(true);
|
||||
|
||||
m_boldStrikedFont = m_boldFont;
|
||||
m_boldStrikedFont.setStrikeOut(true);
|
||||
}
|
||||
|
||||
void FeedsModel::reloadWholeLayout() {
|
||||
@ -566,8 +573,20 @@ bool FeedsModel::markItemCleared(RootItem* item, bool clean_read_only) {
|
||||
|
||||
QVariant FeedsModel::data(const QModelIndex& index, int role) const {
|
||||
switch (role) {
|
||||
case Qt::ItemDataRole::FontRole:
|
||||
return itemForIndex(index)->countOfUnreadMessages() > 0 ? m_boldFont : m_normalFont;
|
||||
case Qt::ItemDataRole::FontRole: {
|
||||
RootItem* it = itemForIndex(index);
|
||||
bool is_bold = it->countOfUnreadMessages() > 0;
|
||||
bool is_striked = it->kind() == RootItem::Kind::Feed
|
||||
? qobject_cast<Feed*>(it)->isSwitchedOff()
|
||||
: false;
|
||||
|
||||
if (is_bold) {
|
||||
return is_striked ? m_boldStrikedFont : m_boldFont;
|
||||
}
|
||||
else {
|
||||
return is_striked ? m_normalStrikedFont : m_normalFont;
|
||||
}
|
||||
}
|
||||
|
||||
case Qt::ItemDataRole::ToolTipRole:
|
||||
if (!qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::EnableTooltipsFeedsMessages)).toBool()) {
|
||||
|
@ -153,6 +153,8 @@ class RSSGUARD_DLLSPEC FeedsModel : public QAbstractItemModel {
|
||||
QIcon m_countsIcon;
|
||||
QFont m_normalFont;
|
||||
QFont m_boldFont;
|
||||
QFont m_normalStrikedFont;
|
||||
QFont m_boldStrikedFont;
|
||||
};
|
||||
|
||||
#endif // FEEDSMODEL_H
|
||||
|
@ -74,6 +74,14 @@ QList<ServiceEntryPoint*> FeedReader::feedServices() {
|
||||
}
|
||||
|
||||
void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
auto my_feeds = feeds;
|
||||
|
||||
for (int i = 0; i < my_feeds.size(); i++) {
|
||||
if (my_feeds.at(i)->isSwitchedOff()) {
|
||||
my_feeds.removeAt(i--);
|
||||
}
|
||||
}
|
||||
|
||||
if (!qApp->feedUpdateLock()->tryLock()) {
|
||||
qApp->showGuiMessage(Notification::Event::GeneralEvent, {
|
||||
tr("Cannot fetch articles at this point"),
|
||||
@ -84,7 +92,7 @@ void FeedReader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
|
||||
QMetaObject::invokeMethod(m_feedDownloader, "updateFeeds",
|
||||
Qt::ConnectionType::QueuedConnection,
|
||||
Q_ARG(QList<Feed*>, feeds));
|
||||
Q_ARG(QList<Feed*>, my_feeds));
|
||||
}
|
||||
|
||||
void FeedReader::synchronizeMessageData(const QList<CacheForServiceRoot*>& caches) {
|
||||
|
@ -48,6 +48,7 @@ void FormFeedDetails::apply() {
|
||||
m_ui->m_cmbAutoUpdateType->currentIndex()).toInt()));
|
||||
m_feed->setAutoUpdateInitialInterval(int(m_ui->m_spinAutoUpdateInterval->value()));
|
||||
m_feed->setOpenArticlesDirectly(m_ui->m_cbOpenArticlesAutomatically->isChecked());
|
||||
m_feed->setIsSwitchedOff(m_ui->m_cbDisableFeed->isChecked());
|
||||
|
||||
if (!m_creatingNew) {
|
||||
// We need to make sure that common data are saved.
|
||||
@ -92,6 +93,7 @@ void FormFeedDetails::loadFeedData() {
|
||||
m_ui->m_cmbAutoUpdateType->setCurrentIndex(m_ui->m_cmbAutoUpdateType->findData(QVariant::fromValue(int(m_feed->autoUpdateType()))));
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(m_feed->autoUpdateInitialInterval());
|
||||
m_ui->m_cbOpenArticlesAutomatically->setChecked(m_feed->openArticlesDirectly());
|
||||
m_ui->m_cbDisableFeed->setChecked(m_feed->isSwitchedOff());
|
||||
}
|
||||
|
||||
void FormFeedDetails::acceptIfPossible() {
|
||||
|
@ -61,6 +61,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabMisc">
|
||||
<attribute name="title">
|
||||
<string>Miscellaneous</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="m_cbDisableFeed">
|
||||
<property name="text">
|
||||
<string>Disable this feed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -89,20 +89,6 @@ void FormStandardFeedDetails::apply() {
|
||||
|
||||
try {
|
||||
DatabaseQueries::createOverwriteFeed(database, std_feed, m_serviceRoot->accountId(), parent->id());
|
||||
|
||||
// Feed is added, save cookies.
|
||||
|
||||
/*if (std_feed->sourceType() == StandardFeed::SourceType::Url) {
|
||||
auto cookies = qApp->web()->cookieJar()->extractCookiesFromUrl(std_feed->source());
|
||||
|
||||
if (!cookies.isEmpty()) {
|
||||
qDebugNN << LOGSEC_NETWORK
|
||||
<< "Detected some cookies in URL"
|
||||
<< QUOTE_W_SPACE_DOT(std_feed->source());
|
||||
|
||||
qApp->web()->cookieJar()->insertCookies(cookies);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
catch (const ApplicationException& ex) {
|
||||
qFatal("Cannot save feed: '%s'.", qPrintable(ex.message()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user