Fix newspaper msg state change for non-webengine newspaper too.

This commit is contained in:
Martin Rotter 2020-06-10 11:11:38 +02:00
parent 88771a4f3d
commit 69925d8f56
7 changed files with 9 additions and 13 deletions

View File

@ -362,8 +362,6 @@ bool MessagesModel::setMessageRead(int row_index, RootItem::ReadStatus read) {
} }
bool MessagesModel::setMessageReadById(int id, RootItem::ReadStatus read) { bool MessagesModel::setMessageReadById(int id, RootItem::ReadStatus read) {
int a = 5;
for (int i = 0; i < rowCount(); i++) { for (int i = 0; i < rowCount(); i++) {
int found_id = data(i, MSG_DB_ID_INDEX, Qt::EditRole).toInt(); int found_id = data(i, MSG_DB_ID_INDEX, Qt::EditRole).toInt();

View File

@ -199,8 +199,8 @@ void FeedMessageViewer::createConnections() {
#else #else
connect(m_messagesView, &MessagesView::currentMessageRemoved, m_messagesBrowser, &MessagePreviewer::clear); connect(m_messagesView, &MessagesView::currentMessageRemoved, m_messagesBrowser, &MessagePreviewer::clear);
connect(m_messagesBrowser, &MessagePreviewer::markMessageRead, m_messagesView->sourceModel(), &MessagesModel::setMessageReadById); connect(m_messagesBrowser, &MessagePreviewer::markMessageRead, m_messagesView->sourceModel(), &MessagesModel::setMessageReadById);
connect(m_messagesBrowser, &MessagePreviewer::markMessageImportant, m_messagesView->sourceModel(), connect(m_messagesBrowser, &MessagePreviewer::markMessageImportant,
&MessagesModel::setMessageImportantById); m_messagesView->sourceModel(), &MessagesModel::setMessageImportantById);
#endif #endif
connect(m_messagesView, &MessagesView::currentMessageChanged, this, &FeedMessageViewer::displayMessage); connect(m_messagesView, &MessagesView::currentMessageChanged, this, &FeedMessageViewer::displayMessage);

View File

@ -43,7 +43,6 @@ class MessagePreviewer : public QWidget {
signals: signals:
void markMessageRead(int id, RootItem::ReadStatus read); void markMessageRead(int id, RootItem::ReadStatus read);
void markMessageImportant(int id, RootItem::Importance important); void markMessageImportant(int id, RootItem::Importance important);
void requestMessageListReload(bool mark_current_as_read);
private: private:
void createConnections(); void createConnections();
@ -55,9 +54,7 @@ class MessagePreviewer : public QWidget {
Ui::MessagePreviewer m_ui; Ui::MessagePreviewer m_ui;
Message m_message; Message m_message;
QStringList m_pictures; QStringList m_pictures;
QPointer<RootItem> m_root; QPointer<RootItem> m_root;
QAction* m_actionMarkRead; QAction* m_actionMarkRead;
QAction* m_actionMarkUnread; QAction* m_actionMarkUnread;
QAction* m_actionSwitchImportance; QAction* m_actionSwitchImportance;

View File

@ -24,7 +24,9 @@ void NewspaperPreviewer::showMoreMessages() {
auto* prev = new MessagePreviewer(this); auto* prev = new MessagePreviewer(this);
QMargins margins = prev->layout()->contentsMargins(); QMargins margins = prev->layout()->contentsMargins();
connect(prev, &MessagePreviewer::requestMessageListReload, this, &NewspaperPreviewer::requestMessageListReload); connect(prev, &MessagePreviewer::markMessageRead, this, &NewspaperPreviewer::markMessageRead);
connect(prev, &MessagePreviewer::markMessageImportant, this, &NewspaperPreviewer::markMessageImportant);
margins.setRight(0); margins.setRight(0);
prev->layout()->setContentsMargins(margins); prev->layout()->setContentsMargins(margins);
prev->setFixedHeight(300); prev->setFixedHeight(300);

View File

@ -30,7 +30,8 @@ class NewspaperPreviewer : public TabContent {
void showMoreMessages(); void showMoreMessages();
signals: signals:
void requestMessageListReload(bool mark_current_as_read); void markMessageRead(int id, RootItem::ReadStatus read);
void markMessageImportant(int id, RootItem::Importance important);
private: private:
QScopedPointer<Ui::NewspaperPreviewer> m_ui; QScopedPointer<Ui::NewspaperPreviewer> m_ui;

View File

@ -192,9 +192,9 @@ int TabWidget::addNewspaperView(RootItem* root, const QList<Message>& messages)
#else #else
NewspaperPreviewer* prev = new NewspaperPreviewer(root, messages, this); NewspaperPreviewer* prev = new NewspaperPreviewer(root, messages, this);
connect(prev, &MessagePreviewer::markMessageRead, connect(prev, &NewspaperPreviewer::markMessageRead,
m_feedMessageViewer->messagesView()->sourceModel(), &MessagesModel::setMessageReadById); m_feedMessageViewer->messagesView()->sourceModel(), &MessagesModel::setMessageReadById);
connect(prev, &MessagePreviewer::markMessageImportant, connect(prev, &NewspaperPreviewer::markMessageImportant,
m_feedMessageViewer->messagesView()->sourceModel(), &MessagesModel::setMessageImportantById); m_feedMessageViewer->messagesView()->sourceModel(), &MessagesModel::setMessageImportantById);
#endif #endif

View File

@ -79,7 +79,6 @@ class WebBrowser : public TabContent {
void markMessageRead(int id, RootItem::ReadStatus read); void markMessageRead(int id, RootItem::ReadStatus read);
void markMessageImportant(int id, RootItem::Importance important); void markMessageImportant(int id, RootItem::Importance important);
void requestMessageListReload(bool mark_current_as_read);
private: private:
void initializeLayout(); void initializeLayout();
@ -100,7 +99,6 @@ class WebBrowser : public TabContent {
QAction* m_actionForward; QAction* m_actionForward;
QAction* m_actionReload; QAction* m_actionReload;
QAction* m_actionStop; QAction* m_actionStop;
QList<Message> m_messages; QList<Message> m_messages;
QPointer<RootItem> m_root; QPointer<RootItem> m_root;
}; };