From b107fd2655f633c48f0f3d5dd6063f520d9039c1 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 17 Dec 2015 13:23:45 +0100 Subject: [PATCH] ui: Fixed activation of unparsed file with errors not showing anything --- bin/app/data/projects/tictactoe/src/field.h | 2 +- .../controller/helper/ActivationTranslator.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/app/data/projects/tictactoe/src/field.h b/bin/app/data/projects/tictactoe/src/field.h index ef3201e8..a4d95f5f 100644 --- a/bin/app/data/projects/tictactoe/src/field.h +++ b/bin/app/data/projects/tictactoe/src/field.h @@ -9,7 +9,7 @@ public: PlayerB = 4 }; - static Token Opponent( Token token ); + static Token Opponent( oken token ); struct Move { int row; diff --git a/src/lib/component/controller/helper/ActivationTranslator.cpp b/src/lib/component/controller/helper/ActivationTranslator.cpp index 703ef9bc..4e56f73a 100644 --- a/src/lib/component/controller/helper/ActivationTranslator.cpp +++ b/src/lib/component/controller/helper/ActivationTranslator.cpp @@ -6,6 +6,7 @@ #include "utility/messaging/type/MessageActivateNodes.h" #include "utility/messaging/type/MessageActivateTokens.h" #include "utility/messaging/type/MessageSearch.h" +#include "utility/messaging/type/MessageShowFile.h" ActivationTranslator::ActivationTranslator(StorageAccess* storageAccess) : m_storageAccess(storageAccess) @@ -50,8 +51,19 @@ std::shared_ptr ActivationTranslator::translateMessage(co std::shared_ptr ActivationTranslator::translateMessage(const MessageActivateFile* message) const { + Id fileId = m_storageAccess->getTokenIdForFileNode(message->filePath); + + if (fileId == 0) + { + MessageShowFile msg(message->filePath, true); + msg.undoRedoType = message->undoRedoType; + msg.setKeepContent(message->keepContent()); + msg.dispatch(); + return nullptr; + } + std::shared_ptr m; - m = std::make_shared(std::vector(1, m_storageAccess->getTokenIdForFileNode(message->filePath))); + m = std::make_shared(std::vector(1, fileId)); m->undoRedoType = message->undoRedoType; m->setKeepContent(message->keepContent()); return m;