From 5f91f48844a24efa225bdce76f62af92c215e251 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Mon, 5 Aug 2019 14:33:14 +0200 Subject: [PATCH] logic: Show overview instead of empty error screen after all indexing errors were fixed --- src/lib/app/Application.cpp | 2 +- src/lib/component/controller/UndoRedoController.cpp | 11 ++++++++++- src/lib/utility/messaging/type/MessageRefreshUI.h | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/lib/app/Application.cpp b/src/lib/app/Application.cpp index 7a9e9bed..0fd1202b 100644 --- a/src/lib/app/Application.cpp +++ b/src/lib/app/Application.cpp @@ -219,7 +219,7 @@ void Application::handleMessage(MessageIndexingFinished* message) if (m_hasGUI) { - MessageRefreshUI().dispatch(); + MessageRefreshUI().afterIndexing().dispatch(); } else { diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index d36988b5..acc2f033 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -364,7 +364,16 @@ void UndoRedoController::handleMessage(MessageIndexingFinished* message) void UndoRedoController::handleMessage(MessageRefreshUI* message) { - if (m_iterator == m_list.begin()) + std::list::iterator startIterator = m_iterator; + do + { + std::advance(startIterator, -1); + } + while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); + + if (startIterator == m_list.begin() || + (message->isAfterIndexing && dynamic_cast(startIterator->message.get()) && + m_storageAccess->getErrorCount().total == 0)) { MessageActivateAll msg; msg.setSchedulerId(getSchedulerId()); diff --git a/src/lib/utility/messaging/type/MessageRefreshUI.h b/src/lib/utility/messaging/type/MessageRefreshUI.h index 399031a8..6fecd922 100644 --- a/src/lib/utility/messaging/type/MessageRefreshUI.h +++ b/src/lib/utility/messaging/type/MessageRefreshUI.h @@ -14,6 +14,7 @@ public: MessageRefreshUI() : loadStyle(true) + , isAfterIndexing(false) { } @@ -23,6 +24,12 @@ public: return *this; } + MessageRefreshUI& afterIndexing() + { + isAfterIndexing = true; + return *this; + } + void print(std::wostream& os) const override { if (loadStyle) @@ -32,6 +39,7 @@ public: } bool loadStyle; + bool isAfterIndexing; }; #endif // MESSAGE_REFRESH_UI_H