do not force reload list of messages after msg sync is done if there is some message selected

This commit is contained in:
Martin Rotter 2021-05-17 13:53:48 +02:00
parent adeb9752fe
commit 95e9279192
3 changed files with 7 additions and 3 deletions

View File

@ -396,7 +396,7 @@ void FormMain::onFeedUpdatesFinished(const FeedDownloadResults& results) {
Q_UNUSED(results)
statusBar()->clearProgressFeeds();
tabWidget()->feedMessageViewer()->messagesView()->reloadSelections();
tabWidget()->feedMessageViewer()->messagesView()->reloadSelections(true);
}
void FormMain::onFeedUpdatesStarted() {

View File

@ -84,7 +84,7 @@ void MessagesView::keyboardSearch(const QString& search) {
setSelectionMode(QAbstractItemView::SelectionMode::ExtendedSelection);
}
void MessagesView::reloadSelections() {
void MessagesView::reloadSelections(bool only_if_nothing_selected) {
const QDateTime dt1 = QDateTime::currentDateTime();
QModelIndex current_index = selectionModel()->currentIndex();
const QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index);
@ -92,6 +92,10 @@ void MessagesView::reloadSelections() {
const int col = header()->sortIndicatorSection();
const Qt::SortOrder ord = header()->sortIndicatorOrder();
if (only_if_nothing_selected && selected_message.m_id > 0) {
return;
}
// Reload the model now.
sort(col, ord, true, false, false);

View File

@ -29,7 +29,7 @@ class MessagesView : public QTreeView {
// Called after data got changed externally
// and it needs to be reloaded to the view.
void reloadSelections();
void reloadSelections(bool only_if_nothing_selected = false);
// Loads un-deleted messages from selected feeds.
void loadItem(RootItem* item);