diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG
index a8a95c8b2..857548f00 100755
--- a/resources/text/CHANGELOG
+++ b/resources/text/CHANGELOG
@@ -2,11 +2,12 @@
—————
Fixed:
-
+▪ Fixed some problems, that "Add category to selected account" was enabled when it shouldn't be.
▪ ♥ Auto-updating of feeds fixed (again?!). ♥
Changed:
+▪ Tweaked "remove duplicates" policy.
▪ TT-RSS plugin can now restore messages from local recycle bin.
3.0.2
diff --git a/src/gui/dialogs/formsettings.ui b/src/gui/dialogs/formsettings.ui
index ca7285db0..7b4bf9042 100755
--- a/src/gui/dialogs/formsettings.ui
+++ b/src/gui/dialogs/formsettings.ui
@@ -88,7 +88,7 @@
-
- 3
+ 6
@@ -417,8 +417,8 @@ Authors of this application are NOT responsible for lost data.
0
0
- 782
- 451
+ 100
+ 30
@@ -463,7 +463,7 @@ Authors of this application are NOT responsible for lost data.
QTabWidget::North
- 1
+ 0
@@ -1492,7 +1492,7 @@ Authors of this application are NOT responsible for lost data.
When new message arrives from feed and duplicate exists, then its content is updated and new message is dropped.
- Remove duplicate messages
+ Remove duplicate messages (standard account only)
diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp
index 3ca490594..bf7942c97 100755
--- a/src/gui/feedmessageviewer.cpp
+++ b/src/gui/feedmessageviewer.cpp
@@ -214,6 +214,7 @@ void FeedMessageViewer::updateFeedButtonsAvailability() {
form_main->m_ui->m_actionServiceDelete->setEnabled(service_selected);
form_main->m_ui->m_actionServiceEdit->setEnabled(service_selected);
form_main->m_ui->m_actionAddFeedIntoSelectedAccount->setEnabled(anything_selected);
+ form_main->m_ui->m_actionAddCategoryIntoSelectedAccount->setEnabled(anything_selected);
form_main->m_ui->m_menuAddItem->setEnabled(!critical_action_running);
form_main->m_ui->m_menuAccounts->setEnabled(!critical_action_running);
diff --git a/src/services/standard/standardfeed.cpp b/src/services/standard/standardfeed.cpp
index 09c2fe096..b624bad4b 100755
--- a/src/services/standard/standardfeed.cpp
+++ b/src/services/standard/standardfeed.cpp
@@ -29,6 +29,7 @@
#include "gui/dialogs/formmain.h"
#include "gui/feedmessageviewer.h"
#include "gui/feedsview.h"
+#include "services/abstract/recyclebin.h"
#include "services/standard/standardserviceroot.h"
#include "services/standard/gui/formstandardfeeddetails.h"
@@ -616,6 +617,7 @@ bool StandardFeed::editItself(StandardFeed *new_feed_data) {
int StandardFeed::updateMessages(const QList &messages) {
int feed_id = id();
int updated_messages = 0;
+ bool anything_duplicated = false;
QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);
bool remove_duplicates = qApp->settings()->value(GROUP(Messages), SETTING(Messages::RemoveDuplicates)).toBool();
int account_id = serviceRoot()->accountId();
@@ -629,7 +631,7 @@ int StandardFeed::updateMessages(const QList &messages) {
// WARNING: One feed CANNOT contain two (or more) messages with same AUTHOR AND TITLE AND URL AND DATE_CREATED.
query_select.setForwardOnly(true);
query_select.prepare("SELECT id, feed, date_created FROM Messages "
- "WHERE feed = :feed AND title = :title AND url = :url AND author = :author AND account_id = :account_id;");
+ "WHERE feed = :feed AND url = :url AND author = :author AND account_id = :account_id;");
// Used to insert new messages.
query_insert.setForwardOnly(true);
@@ -639,7 +641,9 @@ int StandardFeed::updateMessages(const QList &messages) {
if (remove_duplicates) {
query_update.setForwardOnly(true);
- query_update.prepare(QSL("UPDATE Messages SET contents = :contents, enclosures = :enclosures WHERE id = :id;"));
+ query_update.prepare("UPDATE Messages SET is_read = 0, is_deleted = 0, is_pdeleted = 0, "
+ "contents = :contents, enclosures = :enclosures, date_created = :date_created "
+ "WHERE id = :id;");
}
if (!database.transaction()) {
@@ -663,7 +667,6 @@ int StandardFeed::updateMessages(const QList &messages) {
}
query_select.bindValue(QSL(":feed"), feed_id);
- query_select.bindValue(QSL(":title"), message.m_title);
query_select.bindValue(QSL(":url"), message.m_url);
query_select.bindValue(QSL(":author"), message.m_author);
query_select.bindValue(QSL(":account_id"), account_id);
@@ -703,9 +706,15 @@ int StandardFeed::updateMessages(const QList &messages) {
// messages and there is exactly ONE existing duplicate.
query_update.bindValue(QSL(":id"), ids.at(0));
query_update.bindValue(QSL(":contents"), message.m_contents);
+ query_update.bindValue(QSL(":date_created"), message.m_created.toMSecsSinceEpoch());
query_update.bindValue(QSL(":enclosures"), Enclosures::encodeEnclosuresToString(message.m_enclosures));
query_update.exec();
query_update.finish();
+
+ QString sss = query_update.lastError().text();
+
+ anything_duplicated = true;
+
qDebug("Updating contents of duplicate message '%s'.", qPrintable(message.m_title));
}
else {
@@ -738,8 +747,17 @@ int StandardFeed::updateMessages(const QList &messages) {
qDebug("Transaction commit for message downloader failed.");
}
else {
+ QList items_to_update;
+
updateCounts(true);
- serviceRoot()->itemChanged(QList() << this);
+ items_to_update.append(this);
+
+ if (anything_duplicated) {
+ serviceRoot()->recycleBin()->updateCounts(true);
+ items_to_update.append(serviceRoot()->recycleBin());
+ }
+
+ serviceRoot()->itemChanged(items_to_update);
}
return updated_messages;