From 431b668f28fef4fe5e94d45d2a201b6bf550274a Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 8 Dec 2013 14:02:28 +0100 Subject: [PATCH] Changes... --- CMakeLists.txt | 2 +- localization/rssguard_cs.ts | 75 ++++++++++++++++-- localization/rssguard_en.ts | 75 ++++++++++++++++-- localization/rssguard_nl.ts | 76 ++++++++++++++++-- src/core/messagesmodel.cpp | 66 ++++++++++++++++ src/core/messagesproxymodel.cpp | 15 ++-- src/core/messagesproxymodel.h | 4 +- src/gui/dynamicshortcutswidget.cpp | 25 ++---- src/gui/feedmessageviewer.cpp | 17 +++- src/gui/feedmessageviewer.h | 2 +- src/gui/formmain.cpp | 4 +- src/gui/formmain.ui | 15 ++-- src/gui/formsettings.cpp | 24 +++--- src/gui/formsettings.ui | 123 +++++++++++++++++++++++++++-- src/gui/messagesview.cpp | 106 +++++++++++++++++-------- src/gui/messagesview.h | 11 ++- 16 files changed, 524 insertions(+), 116 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29e135e7c..889e69833 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ set(MINIMUM_QT_VERSION 4.7.3) set(SOURCE_PACKAGE_SUFFIX "Source") set(EXE_NAME ${APP_LOW_NAME}) -option(USE_QT_5 "Use Qt 5 for building" ON) +option(USE_QT_5 "Use Qt 5 for building" OFF) message(STATUS "[${APP_LOW_NAME}] Welcome to ${APP_NAME} compilation process.") message(STATUS "[${APP_LOW_NAME}] Compilation process begins right now.") diff --git a/localization/rssguard_cs.ts b/localization/rssguard_cs.ts index de2099a39..7a3b34541 100644 --- a/localization/rssguard_cs.ts +++ b/localization/rssguard_cs.ts @@ -97,6 +97,18 @@ Toolbar for messages Panel zpráv + + Update selected/all feeds + Aktualizovat všechny/vybrané kanály + + + Select which feeds you want to update. + Zvolte, zda chcete aktualizovat vybrané nebo všechny kanály. + + + Feed update menu + Menu aktualizace kanálů + FormAbout @@ -415,6 +427,30 @@ Add new feed. + + Open selected messages in external browser + + + + Open selected messages in external browser. + + + + Open selected messages in internal browser + + + + Open selected messages in internal browser. + + + + Open selected source articles in external browser + + + + Open selected source messages in external browser. + + FormSettings @@ -638,11 +674,6 @@ no icon theme žádné téma ikon - - Some keyboard shortcuts are not unique. - - Některé klávesové zkrátky jsou duplicitní. - Cannot save settings Nastavení nelze uložit @@ -693,7 +724,32 @@ - • language changed + Feeds & messages + + + + • some keyboard shortcuts are not unique + + + + Some critical settings are not set. You must fix these settings in order confirm new settings. + + + + List of errors: + %1. + + + + • language changed + + + + • icon theme changed + + + + • skin changed @@ -766,6 +822,13 @@ Obsah + + MessagesView + + Context menu for messages + Kontextové menu pro zprávy + + QObject diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts index e9c8bd951..91212bc42 100644 --- a/localization/rssguard_en.ts +++ b/localization/rssguard_en.ts @@ -97,6 +97,18 @@ Toolbar for messages + + Update selected/all feeds + + + + Select which feeds you want to update. + + + + Feed update menu + + FormAbout @@ -415,6 +427,30 @@ Add new feed. + + Open selected messages in external browser + + + + Open selected messages in external browser. + + + + Open selected messages in internal browser + + + + Open selected messages in internal browser. + + + + Open selected source articles in external browser + + + + Open selected source messages in external browser. + + FormSettings @@ -632,11 +668,6 @@ no icon theme - - Some keyboard shortcuts are not unique. - - - Cannot save settings @@ -687,7 +718,32 @@ - • language changed + Feeds & messages + + + + • some keyboard shortcuts are not unique + + + + Some critical settings are not set. You must fix these settings in order confirm new settings. + + + + List of errors: + %1. + + + + • language changed + + + + • icon theme changed + + + + • skin changed @@ -760,6 +816,13 @@ + + MessagesView + + Context menu for messages + + + QObject diff --git a/localization/rssguard_nl.ts b/localization/rssguard_nl.ts index a7e416437..5dd05ef50 100644 --- a/localization/rssguard_nl.ts +++ b/localization/rssguard_nl.ts @@ -97,6 +97,18 @@ Toolbar for messages Werkbalk voor berichten + + Update selected/all feeds + + + + Select which feeds you want to update. + + + + Feed update menu + + FormAbout @@ -415,6 +427,30 @@ Add new feed. + + Open selected messages in external browser + + + + Open selected messages in external browser. + + + + Open selected messages in internal browser + + + + Open selected messages in internal browser. + + + + Open selected source articles in external browser + + + + Open selected source messages in external browser. + + FormSettings @@ -638,12 +674,6 @@ no icon theme Geen pictogram thema - - Some keyboard shortcuts are not unique. - - Sommige sneltoetsen voor toetsenbord zijn niet uniek. - - Cannot save settings Kan instellingen niet opslaan @@ -694,7 +724,32 @@ - • language changed + Feeds & messages + + + + • some keyboard shortcuts are not unique + + + + Some critical settings are not set. You must fix these settings in order confirm new settings. + + + + List of errors: + %1. + + + + • language changed + + + + • icon theme changed + + + + • skin changed @@ -767,6 +822,13 @@ Inhoud + + MessagesView + + Context menu for messages + + + QObject diff --git a/src/core/messagesmodel.cpp b/src/core/messagesmodel.cpp index 07c5f6be5..5311aea4a 100644 --- a/src/core/messagesmodel.cpp +++ b/src/core/messagesmodel.cpp @@ -236,11 +236,77 @@ bool MessagesModel::switchBatchMessageImportance(const QModelIndexList &messages } bool MessagesModel::setBatchMessagesDeleted(const QModelIndexList &messages, int deleted) { + // Submit changes first. + submitAll(); + if (!database().transaction()) { + qWarning("Starting transaction for batch message deletion."); + return false; + } + + QSqlDatabase db_handle = database(); + int message_id; + QSqlQuery query_delete_msg(db_handle); + if (!query_delete_msg.prepare("UPDATE messages SET deleted = :deleted " + "WHERE id = :id")) { + qWarning("Query preparation failed for message deletion."); + return false; + } + + foreach (const QModelIndex &message, messages) { + message_id = messageId(message.row()); + query_delete_msg.bindValue(":id", message_id); + query_delete_msg.bindValue(":deleted", deleted); + query_delete_msg.exec(); + } + + // Commit changes. + if (db_handle.commit()) { + // FULLY reload the model if underlying data is changed. + select(); + fetchAll(); + return true; + } + else { + return db_handle.rollback(); + } } bool MessagesModel::setBatchMessagesRead(const QModelIndexList &messages, int read) { + // Submit changes first. + submitAll(); + if (!database().transaction()) { + qWarning("Starting transaction for batch message read change."); + return false; + } + + QSqlDatabase db_handle = database(); + int message_id; + QSqlQuery query_delete_msg(db_handle); + if (!query_delete_msg.prepare("UPDATE messages SET read = :read " + "WHERE id = :id")) { + qWarning("Query preparation failed for message read change."); + return false; + } + + foreach (const QModelIndex &message, messages) { + message_id = messageId(message.row()); + query_delete_msg.bindValue(":id", message_id); + query_delete_msg.bindValue(":read", read); + query_delete_msg.exec(); + } + + // Commit changes. + if (db_handle.commit()) { + // FULLY reload the model if underlying data is changed. + select(); + fetchAll(); + return true; + } + else { + return db_handle.rollback(); + } } bool MessagesModel::switchAllMessageImportance() { diff --git a/src/core/messagesproxymodel.cpp b/src/core/messagesproxymodel.cpp index e82aa098c..1ce916314 100644 --- a/src/core/messagesproxymodel.cpp +++ b/src/core/messagesproxymodel.cpp @@ -28,20 +28,25 @@ bool MessagesProxyModel::lessThan(const QModelIndex &left, const QModelIndex &ri return QSortFilterProxyModel::lessThan(left, right); } -QModelIndexList MessagesProxyModel::mapListFromSource(const QModelIndexList &idxs) { +QModelIndexList MessagesProxyModel::mapListFromSource(const QModelIndexList &indexes, bool deep) { QModelIndexList mapped_idxs; - foreach (const QModelIndex &index, idxs) { - mapped_idxs << mapFromSource(index); + foreach (const QModelIndex &index, indexes) { + if (deep) { + mapped_idxs << mapFromSource(m_sourceModel->index(index.row(), index.column())); + } + else { + mapped_idxs << mapFromSource(index); + } } return mapped_idxs; } -QModelIndexList MessagesProxyModel::mapListToSource(const QModelIndexList &idxs) { +QModelIndexList MessagesProxyModel::mapListToSource(const QModelIndexList &indexes) { QModelIndexList source_idxs; - foreach (const QModelIndex &index, idxs) { + foreach (const QModelIndex &index, indexes) { source_idxs << mapToSource(index); } diff --git a/src/core/messagesproxymodel.h b/src/core/messagesproxymodel.h index 6d8496225..cbdf27b19 100644 --- a/src/core/messagesproxymodel.h +++ b/src/core/messagesproxymodel.h @@ -18,8 +18,8 @@ class MessagesProxyModel : public QSortFilterProxyModel { MessagesModel *sourceModel(); // Maps list of indexes. - QModelIndexList mapListToSource(const QModelIndexList &idxs); - QModelIndexList mapListFromSource(const QModelIndexList &idxs); + QModelIndexList mapListToSource(const QModelIndexList &indexes); + QModelIndexList mapListFromSource(const QModelIndexList &indexes, bool deep = false); protected: // Compares two rows of data. diff --git a/src/gui/dynamicshortcutswidget.cpp b/src/gui/dynamicshortcutswidget.cpp index 0eb240cd9..9e362cb29 100644 --- a/src/gui/dynamicshortcutswidget.cpp +++ b/src/gui/dynamicshortcutswidget.cpp @@ -48,7 +48,6 @@ void DynamicShortcutsWidget::populate(const QList actions) { m_actionBindings.clear(); int row_id = 0; - bool second_column = false; foreach (QAction *action, actions) { // Create shortcut catcher for this action and set default shortcut. @@ -68,27 +67,13 @@ void DynamicShortcutsWidget::populate(const QList actions) { label->setText(action->text().remove('&')); label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - if (second_column) { - m_layout->addWidget(label, row_id, 2); - m_layout->addWidget(catcher, row_id, 3); - second_column = false; + m_layout->addWidget(label, row_id, 0); + m_layout->addWidget(catcher, row_id, 1); - // Continue to the next row. - row_id++; - } - else { - QMargins catcher_margins = catcher->contentsMargins(); - catcher_margins.setRight(10); - - catcher->setContentsMargins(catcher_margins); - - m_layout->addWidget(label, row_id, 0); - m_layout->addWidget(catcher, row_id, 1); - - second_column = true; - } + row_id++; } // Make sure that "spacer" is added. - m_layout->setRowStretch(second_column ? ++row_id : row_id, 1); + m_layout->setRowStretch(row_id, 1); + m_layout->setColumnStretch(0, 1); } diff --git a/src/gui/feedmessageviewer.cpp b/src/gui/feedmessageviewer.cpp index cccb88dce..1805159f9 100644 --- a/src/gui/feedmessageviewer.cpp +++ b/src/gui/feedmessageviewer.cpp @@ -25,10 +25,10 @@ FeedMessageViewer::FeedMessageViewer(QWidget *parent) m_messagesBrowser(new WebBrowser(this)) { initialize(); initializeViews(); - setupConnections(); + createConnections(); } -void FeedMessageViewer::setupConnections() { +void FeedMessageViewer::createConnections() { // General connections. connect(m_messagesView, SIGNAL(currentMessageRemoved()), m_messagesBrowser, SLOT(clear())); @@ -38,7 +38,18 @@ void FeedMessageViewer::setupConnections() { // Toolbar forwardings. connect(FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages, SIGNAL(triggered()), m_messagesView, SLOT(switchSelectedMessagesImportance())); - + connect(FormMain::getInstance()->m_ui->m_actionDeleteSelectedMessages, + SIGNAL(triggered()), m_messagesView, SLOT(deleteSelectedMessages())); + connect(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead, + SIGNAL(triggered()), m_messagesView, SLOT(markSelectedMessagesRead())); + connect(FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread, + SIGNAL(triggered()), m_messagesView, SLOT(markSelectedMessagesUnread())); + connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesExternally, + SIGNAL(triggered()), m_messagesView, SLOT(openSelectedSourceArticlesExternally())); + connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesInternally, + SIGNAL(triggered()), m_messagesView, SLOT(openSelectedSourceMessagesInternally())); + connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesInternally, + SIGNAL(triggered()), m_messagesView, SLOT(openSelectedMessagesInternally())); } void FeedMessageViewer::initialize() { diff --git a/src/gui/feedmessageviewer.h b/src/gui/feedmessageviewer.h index 23018788b..821757f32 100644 --- a/src/gui/feedmessageviewer.h +++ b/src/gui/feedmessageviewer.h @@ -28,7 +28,7 @@ class FeedMessageViewer : public TabContent { void initializeViews(); // Sets up connections. - void setupConnections(); + void createConnections(); private: QToolBar *m_toolBar; diff --git a/src/gui/formmain.cpp b/src/gui/formmain.cpp index 76032d787..28ea2c35b 100644 --- a/src/gui/formmain.cpp +++ b/src/gui/formmain.cpp @@ -70,7 +70,7 @@ QList FormMain::getActions() { // Add feeds/messages actions. actions << m_ui->m_actionOpenSelectedSourceArticlesExternally << - m_ui->m_actionOpenSelectedMessagesExternally << + m_ui->m_actionOpenSelectedSourceArticlesInternally << m_ui->m_actionOpenSelectedMessagesInternally << m_ui->m_actionMarkAllMessagesAsRead << m_ui->m_actionMarkAllMessagesAsUnread << @@ -186,7 +186,7 @@ void FormMain::setupIcons() { m_ui->m_actionMarkSelectedMessagesAsRead->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-read")); m_ui->m_actionMarkSelectedMessagesAsUnread->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-unread")); m_ui->m_actionSwitchImportanceOfSelectedMessages->setIcon(IconThemeFactory::getInstance()->fromTheme("mail-mark-important")); - m_ui->m_actionOpenSelectedMessagesExternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open")); + m_ui->m_actionOpenSelectedSourceArticlesInternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open")); m_ui->m_actionOpenSelectedSourceArticlesExternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open")); m_ui->m_actionOpenSelectedMessagesInternally->setIcon(IconThemeFactory::getInstance()->fromTheme("document-open")); diff --git a/src/gui/formmain.ui b/src/gui/formmain.ui index ba94398da..9a4c04fb2 100644 --- a/src/gui/formmain.ui +++ b/src/gui/formmain.ui @@ -357,15 +357,12 @@ Add new feed. - + - Open selected messages in external browser + Open selected source articles in external browser - Open selected messages in external browser. - - - + Open selected source articles in external browser. @@ -379,12 +376,12 @@ - + - Open selected source articles in external browser + Open selected source articles in internal browser - Open selected source messages in external browser. + Open selected source messages in internal browser. diff --git a/src/gui/formsettings.cpp b/src/gui/formsettings.cpp index 34d86756d..17835f562 100644 --- a/src/gui/formsettings.cpp +++ b/src/gui/formsettings.cpp @@ -353,17 +353,17 @@ void FormSettings::loadGeneral() { // Load auto-start status. SystemFactory::AutoStartStatus autostart_status = SystemFactory::getAutoStartStatus(); switch (autostart_status) { - case SystemFactory::Enabled: - m_ui->m_checkAutostart->setChecked(true); - break; - case SystemFactory::Disabled: - m_ui->m_checkAutostart->setChecked(false); - break; - default: - m_ui->m_checkAutostart->setEnabled(false); - m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text() + - tr(" (not supported on this platform)")); - break; + case SystemFactory::Enabled: + m_ui->m_checkAutostart->setChecked(true); + break; + case SystemFactory::Disabled: + m_ui->m_checkAutostart->setChecked(false); + break; + default: + m_ui->m_checkAutostart->setEnabled(false); + m_ui->m_checkAutostart->setText(m_ui->m_checkAutostart->text() + + tr(" (not supported on this platform)")); + break; } } @@ -408,9 +408,11 @@ void FormSettings::loadInterface() { foreach (const QString &icon_theme_name, IconThemeFactory::getInstance()->getInstalledIconThemes()) { if (icon_theme_name == APP_THEME_SYSTEM) { #if defined(Q_OS_LINUX) + // Add "default theme" and "no theme" on Linux. m_ui->m_cmbIconTheme->addItem(tr("system icon theme (default)"), APP_THEME_SYSTEM); #else + // Add just "no theme" on other systems. m_ui->m_cmbIconTheme->addItem(tr("no icon theme"), APP_THEME_SYSTEM); #endif diff --git a/src/gui/formsettings.ui b/src/gui/formsettings.ui index f254c6940..a0472afb5 100644 --- a/src/gui/formsettings.ui +++ b/src/gui/formsettings.ui @@ -6,8 +6,8 @@ 0 0 - 966 - 445 + 803 + 373 @@ -147,8 +147,8 @@ 0 0 - 167 - 219 + 195 + 238 @@ -634,7 +634,120 @@ - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 1 + + + + Feeds + + + + + Messages + + + + + + External web browser for message viewing + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Preset + + + + + + + + custom + + + + + Chromium + + + + + Google Chrome + + + + + Opera + + + + + Mozilla Firefox + + + + + + + + Web browser executable + + + + + + + + + + + + ... + + + + + + + + + Executable arguments + + + + + + + + + + + + + + + diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index e3e1edf3d..c24ed4a6f 100644 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -120,13 +120,9 @@ void MessagesView::contextMenuEvent(QContextMenuEvent *event) { void MessagesView::initializeContextMenu() { m_contextMenu = new QMenu(tr("Context menu for messages"), this); - - connect(FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesExternally, - SIGNAL(triggered()), this, SLOT(openSelectedMessagesExternally())); - m_contextMenu->addActions(QList() << FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesExternally << - FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesExternally << + FormMain::getInstance()->m_ui->m_actionOpenSelectedSourceArticlesInternally << FormMain::getInstance()->m_ui->m_actionOpenSelectedMessagesInternally << FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsRead << FormMain::getInstance()->m_ui->m_actionMarkSelectedMessagesAsUnread << @@ -160,32 +156,89 @@ void MessagesView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { QModelIndex mapped_current_index = m_proxyModel->mapToSource(current); - qDebug("Current row changed, row [%d,%d] source %d %d", current.row(), current.column(), mapped_current_index.row(), mapped_current_index.column()); - if (mapped_current_index.isValid()) { - m_sourceModel->setMessageRead(mapped_current_index.row(), 1); - emit currentMessageChanged(m_sourceModel->messageAt(mapped_current_index.row())); - } - else { - emit currentMessageRemoved(); + if (!signalsBlocked()) { + if (mapped_current_index.isValid()) { + m_sourceModel->setMessageRead(mapped_current_index.row(), 1); + emit currentMessageChanged(m_sourceModel->messageAt(mapped_current_index.row())); + } + else { + emit currentMessageRemoved(); + } } QTreeView::currentChanged(current, previous); } -void MessagesView::openSelectedMessagesExternally() { +void MessagesView::openSelectedSourceArticlesExternally() { // TODO: otevře vybrane zpravy v externim prohlizeci } void MessagesView::openSelectedSourceMessagesInternally() { - // TODO: otevre vybrane nactene zpravy v internch tabech + // TODO: otevre vybrane zpravy ze zdrojovych webz v internch tabech } -void MessagesView::openSelectedTargetMessagesInternally() { - // TODO: otevre vybrane zpravy ze zdrojovych webz v internich tabech +void MessagesView::openSelectedMessagesInternally() { + // TODO: otevre vybrane nactene zpravy v internich tabech +} + +void MessagesView::markSelectedMessagesRead() { + setSelectedMessagesReadStatus(1); +} + +void MessagesView::markSelectedMessagesUnread() { + setSelectedMessagesReadStatus(0); +} + +void MessagesView::setSelectedMessagesReadStatus(int read) { + QModelIndex current_index = selectionModel()->currentIndex(); + QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index); + QModelIndexList selected_indexes = selectionModel()->selectedRows(); + QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes); + + m_sourceModel->setBatchMessagesRead(mapped_indexes, read); + + sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); + + selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true); + current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), + mapped_current_index.column())); + + if (read == 0) { + // User selected to mark some messages as unread, if one + // of them will be marked as current, then it will be read again. + blockSignals(true); + setCurrentIndex(current_index); + blockSignals(false); + } + else { + setCurrentIndex(current_index); + } + + scrollTo(current_index); + reselectIndexes(selected_indexes); +} + +void MessagesView::deleteSelectedMessages() { + QModelIndex current_index = selectionModel()->currentIndex(); + QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index); + QModelIndexList selected_indexes = selectionModel()->selectedRows(); + QModelIndexList mapped_indexes = m_proxyModel->mapListToSource(selected_indexes); + + m_sourceModel->setBatchMessagesDeleted(mapped_indexes, 1); + + sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); + + selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true); + current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), + mapped_current_index.column())); + + setCurrentIndex(current_index); + scrollTo(current_index); + reselectIndexes(selected_indexes); } void MessagesView::switchSelectedMessagesImportance() { @@ -196,16 +249,11 @@ void MessagesView::switchSelectedMessagesImportance() { m_sourceModel->switchBatchMessageImportance(mapped_indexes); - selected_indexes.clear(); sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); - foreach (const QModelIndex &index, mapped_indexes) { - selected_indexes << m_proxyModel->mapFromSource(m_sourceModel->index(index.row(), - index.column())); - } - + selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true); current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), - mapped_current_index.column())); + mapped_current_index.column())); setCurrentIndex(current_index); scrollTo(current_index); @@ -221,15 +269,3 @@ void MessagesView::reselectIndexes(const QModelIndexList &indexes) { QItemSelectionModel::Rows); } } - -void MessagesView::setAllMessagesRead() { - selectAll(); - QModelIndexList selected_indexes = selectedIndexes(); - QModelIndexList mapp; - - foreach (const QModelIndex &index, selected_indexes) { - mapp << m_proxyModel->mapToSource(index); - } - - m_sourceModel->switchBatchMessageImportance(mapp); -} diff --git a/src/gui/messagesview.h b/src/gui/messagesview.h index e389544d4..146670b6d 100644 --- a/src/gui/messagesview.h +++ b/src/gui/messagesview.h @@ -24,13 +24,18 @@ class MessagesView : public QTreeView { public slots: // Message manipulators. - void openSelectedMessagesExternally(); + void openSelectedSourceArticlesExternally(); void openSelectedSourceMessagesInternally(); - void openSelectedTargetMessagesInternally(); + void openSelectedMessagesInternally(); + + void setSelectedMessagesReadStatus(int read); + void markSelectedMessagesRead(); + void markSelectedMessagesUnread(); + void deleteSelectedMessages(); void switchSelectedMessagesImportance(); - void setAllMessagesRead(); protected slots: + // Marks given indexes as selected. void reselectIndexes(const QModelIndexList &indexes); protected: