diff options
Diffstat (limited to 'Swift/Controllers/HighlightEditorController.cpp')
-rw-r--r-- | Swift/Controllers/HighlightEditorController.cpp | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/Swift/Controllers/HighlightEditorController.cpp b/Swift/Controllers/HighlightEditorController.cpp index 35eb404..1f5f928 100644 --- a/Swift/Controllers/HighlightEditorController.cpp +++ b/Swift/Controllers/HighlightEditorController.cpp @@ -5,52 +5,53 @@ */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ +#include <Swift/Controllers/HighlightEditorController.h> + #include <boost/bind.hpp> -#include <Swift/Controllers/HighlightEditorController.h> +#include <Swift/Controllers/ContactSuggester.h> #include <Swift/Controllers/UIEvents/RequestHighlightEditorUIEvent.h> #include <Swift/Controllers/UIEvents/UIEventStream.h> -#include <Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h> #include <Swift/Controllers/UIInterfaces/HighlightEditorWindow.h> -#include <Swift/Controllers/ContactSuggester.h> +#include <Swift/Controllers/UIInterfaces/HighlightEditorWindowFactory.h> namespace Swift { HighlightEditorController::HighlightEditorController(UIEventStream* uiEventStream, HighlightEditorWindowFactory* highlightEditorWindowFactory, HighlightManager* highlightManager) -: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(NULL), highlightManager_(highlightManager), contactSuggester_(0) +: highlightEditorWindowFactory_(highlightEditorWindowFactory), highlightEditorWindow_(nullptr), highlightManager_(highlightManager), contactSuggester_(nullptr) { - uiEventStream->onUIEvent.connect(boost::bind(&HighlightEditorController::handleUIEvent, this, _1)); + uiEventStream->onUIEvent.connect(boost::bind(&HighlightEditorController::handleUIEvent, this, _1)); } HighlightEditorController::~HighlightEditorController() { - delete highlightEditorWindow_; - highlightEditorWindow_ = NULL; + delete highlightEditorWindow_; + highlightEditorWindow_ = nullptr; } -void HighlightEditorController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) +void HighlightEditorController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { - boost::shared_ptr<RequestHighlightEditorUIEvent> event = boost::dynamic_pointer_cast<RequestHighlightEditorUIEvent>(rawEvent); - if (event) { - if (!highlightEditorWindow_) { - highlightEditorWindow_ = highlightEditorWindowFactory_->createHighlightEditorWindow(); - highlightEditorWindow_->setHighlightManager(highlightManager_); - highlightEditorWindow_->onContactSuggestionsRequested.connect(boost::bind(&HighlightEditorController::handleContactSuggestionsRequested, this, _1)); - } - highlightEditorWindow_->show(); - } + std::shared_ptr<RequestHighlightEditorUIEvent> event = std::dynamic_pointer_cast<RequestHighlightEditorUIEvent>(rawEvent); + if (event) { + if (!highlightEditorWindow_) { + highlightEditorWindow_ = highlightEditorWindowFactory_->createHighlightEditorWindow(); + highlightEditorWindow_->setHighlightManager(highlightManager_); + highlightEditorWindow_->onContactSuggestionsRequested.connect(boost::bind(&HighlightEditorController::handleContactSuggestionsRequested, this, _1)); + } + highlightEditorWindow_->show(); + } } void HighlightEditorController::handleContactSuggestionsRequested(const std::string& text) { - if (contactSuggester_) { - highlightEditorWindow_->setContactSuggestions(contactSuggester_->getSuggestions(text, true)); - } + if (contactSuggester_) { + highlightEditorWindow_->setContactSuggestions(contactSuggester_->getSuggestions(text, true)); + } } } |