logic: Disable activation of errors while indexing
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Application.h"
|
||||
#include "component/view/DialogView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "project/Project.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
ErrorController::ErrorController(StorageAccess* storageAccess)
|
||||
@@ -114,12 +115,18 @@ void ErrorController::handleMessage(MessageErrorCountUpdate* message)
|
||||
|
||||
void ErrorController::handleMessage(MessageErrorsAll* message)
|
||||
{
|
||||
MessageActivateErrors(getView()->getErrorFilter()).dispatch();
|
||||
if (canDisplayErrors())
|
||||
{
|
||||
MessageActivateErrors(getView()->getErrorFilter()).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageErrorsForFile* message)
|
||||
{
|
||||
MessageActivateErrors(ErrorFilter(), message->file).dispatch();
|
||||
if (canDisplayErrors())
|
||||
{
|
||||
MessageActivateErrors(ErrorFilter(), message->file).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorController::handleMessage(MessageErrorsHelpMessage* message)
|
||||
@@ -205,3 +212,17 @@ bool ErrorController::showErrors(const ErrorFilter& filter, bool scrollTo)
|
||||
|
||||
return errors.size();
|
||||
}
|
||||
|
||||
bool ErrorController::canDisplayErrors() const
|
||||
{
|
||||
Project* project = Application::getInstance()->getCurrentProject().get();
|
||||
if (project && project->isIndexing())
|
||||
{
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm(
|
||||
"Errors cannot be activated while indexing."
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ private:
|
||||
virtual void clear();
|
||||
|
||||
bool showErrors(const ErrorFilter& filter, bool scrollTo);
|
||||
bool canDisplayErrors() const;
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Application.h"
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "project/Project.h"
|
||||
|
||||
UndoRedoController::UndoRedoController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
@@ -473,8 +474,6 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
|
||||
void UndoRedoController::replayCommand(std::list<Command>::iterator it)
|
||||
{
|
||||
std::shared_ptr<MessageBase> m = it->message;
|
||||
m->setIsReplayed(true);
|
||||
m->setIsLast(it == std::prev(m_iterator));
|
||||
|
||||
if (m->getType() == MessageActivateTokens::getStaticType())
|
||||
{
|
||||
@@ -489,6 +488,33 @@ void UndoRedoController::replayCommand(std::list<Command>::iterator it)
|
||||
msg->searchMatches = ret.second;
|
||||
}
|
||||
}
|
||||
else if (m->getType() == MessageActivateErrors::getStaticType())
|
||||
{
|
||||
Project* project = Application::getInstance()->getCurrentProject().get();
|
||||
if (project && project->isIndexing())
|
||||
{
|
||||
Application::getInstance()->getDialogView(DialogView::UseCase::GENERAL)->confirm(
|
||||
"Errors cannot be activated while indexing."
|
||||
);
|
||||
|
||||
ErrorFilter filter;
|
||||
filter.error = false;
|
||||
filter.fatal = false;
|
||||
filter.unindexedError = false;
|
||||
filter.unindexedFatal = false;
|
||||
|
||||
MessageActivateErrors msg(filter);
|
||||
msg.setIsReplayed(true);
|
||||
msg.setIsLast(it == std::prev(m_iterator));
|
||||
msg.dispatch();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
m->setIsReplayed(true);
|
||||
m->setIsLast(it == std::prev(m_iterator));
|
||||
|
||||
m->dispatch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user