diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index b55fcdfce..8663f5466 100755 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -439,17 +439,17 @@ bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, RootIt bool MessagesModel::setBatchMessagesRestored(const QModelIndexList &messages) { QStringList message_ids; - QList message_ids_num; + QList msgs; // Obtain IDs of all desired messages. foreach (const QModelIndex &message, messages) { - int msg_id = messageId(message.row()); + Message msg = messageAt(message.row()); - message_ids_num.append(msg_id); - message_ids.append(QString::number(msg_id)); + msgs.append(msg); + message_ids.append(QString::number(msg.m_id)); } - if (!m_selectedItem->getParentServiceRoot()->onBeforeMessagesRestoredFromBin(m_selectedItem, message_ids_num)) { + if (!m_selectedItem->getParentServiceRoot()->onBeforeMessagesRestoredFromBin(m_selectedItem, msgs)) { return false; } @@ -461,7 +461,7 @@ bool MessagesModel::setBatchMessagesRestored(const QModelIndexList &messages) { if (query_read_msg.exec(sql_delete_query)) { fetchAllData(); - return m_selectedItem->getParentServiceRoot()->onAfterMessagesRestoredFromBin(m_selectedItem, message_ids_num); + return m_selectedItem->getParentServiceRoot()->onAfterMessagesRestoredFromBin(m_selectedItem, msgs); } else { return false; diff --git a/src/services/abstract/serviceroot.h b/src/services/abstract/serviceroot.h index b3ce5906d..33a839daa 100755 --- a/src/services/abstract/serviceroot.h +++ b/src/services/abstract/serviceroot.h @@ -130,12 +130,12 @@ class ServiceRoot : public RootItem { // Called BEFORE the list of messages is about to be restored from recycle bin // by the user from message list. // Selected item is naturally recycle bin. - virtual bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) = 0; + virtual bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) = 0; // Called AFTER the list of messages was restored from recycle bin // by the user from message list. // Selected item is naturally recycle bin. - virtual bool onAfterMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) = 0; + virtual bool onAfterMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) = 0; ///////////////////////////////////////// // Members to override. */ diff --git a/src/services/standard/standardserviceroot.cpp b/src/services/standard/standardserviceroot.cpp index ae0363239..75c403fbf 100755 --- a/src/services/standard/standardserviceroot.cpp +++ b/src/services/standard/standardserviceroot.cpp @@ -565,13 +565,13 @@ bool StandardServiceRoot::onAfterMessagesDelete(RootItem *selected_item, const Q return true; } -bool StandardServiceRoot::onBeforeMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) { +bool StandardServiceRoot::onBeforeMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) { return true; } -bool StandardServiceRoot::onAfterMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) { +bool StandardServiceRoot::onAfterMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) { Q_UNUSED(selected_item) - Q_UNUSED(message_db_ids) + Q_UNUSED(messages) updateCounts(true); itemChanged(getSubTree()); diff --git a/src/services/standard/standardserviceroot.h b/src/services/standard/standardserviceroot.h index 3ea582ba8..31cc877e1 100755 --- a/src/services/standard/standardserviceroot.h +++ b/src/services/standard/standardserviceroot.h @@ -72,8 +72,8 @@ class StandardServiceRoot : public ServiceRoot { bool onBeforeMessagesDelete(RootItem *selected_item, const QList &messages); bool onAfterMessagesDelete(RootItem *selected_item, const QList &messages); - bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids); - bool onAfterMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids); + bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, const QList &messages); + bool onAfterMessagesRestoredFromBin(RootItem *selected_item, const QList &messages); // Returns all standard categories which are lying under given root node. // This does NOT include the root node even if the node is category. diff --git a/src/services/tt-rss/ttrssserviceroot.cpp b/src/services/tt-rss/ttrssserviceroot.cpp index ebf0d4241..76e20de3a 100755 --- a/src/services/tt-rss/ttrssserviceroot.cpp +++ b/src/services/tt-rss/ttrssserviceroot.cpp @@ -210,11 +210,11 @@ bool TtRssServiceRoot::onAfterMessagesDelete(RootItem *selected_item, const QLis return false; } -bool TtRssServiceRoot::onBeforeMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) { +bool TtRssServiceRoot::onBeforeMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) { return false; } -bool TtRssServiceRoot::onAfterMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids) { +bool TtRssServiceRoot::onAfterMessagesRestoredFromBin(RootItem *selected_item, const QList &messages) { return false; } diff --git a/src/services/tt-rss/ttrssserviceroot.h b/src/services/tt-rss/ttrssserviceroot.h index 61a560a66..903100cb9 100755 --- a/src/services/tt-rss/ttrssserviceroot.h +++ b/src/services/tt-rss/ttrssserviceroot.h @@ -63,8 +63,8 @@ class TtRssServiceRoot : public ServiceRoot { bool onBeforeMessagesDelete(RootItem *selected_item, const QList &messages); bool onAfterMessagesDelete(RootItem *selected_item, const QList &messages); - bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids); - bool onAfterMessagesRestoredFromBin(RootItem *selected_item, QList message_db_ids); + bool onBeforeMessagesRestoredFromBin(RootItem *selected_item, const QList &messages); + bool onAfterMessagesRestoredFromBin(RootItem *selected_item, const QList &messages); TtRssNetworkFactory *network() const;