summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-04-12 09:05:33 (GMT)
committerTobias Markmann <tm@ayena.de>2017-04-12 09:05:33 (GMT)
commit4024517891d3a222e71e6632c3609fcda08c875e (patch)
tree690020d1a9c1a4c3fd8bff0f59d196ee23b05d60 /Swift/Controllers
parent43b85e93c7acd865be2de009651e146e9faece96 (diff)
downloadswift-4024517891d3a222e71e6632c3609fcda08c875e.zip
swift-4024517891d3a222e71e6632c3609fcda08c875e.tar.bz2
Assert first page in QtUserSearchWindow wizard based on type
Converted enum to C++11 enum class in process. Coverity raised this issue. Test-Information: All unit tests pass. Using the “Add Contact…” and “Start Chat…” dialogs did not crash. Tested on macOS 10.12.4 with Qt 5.4.2. Change-Id: I0409688b001d1eaaf5fa77a25b1158ce9e611c77
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp24
-rw-r--r--Swift/Controllers/Chat/UserSearchController.h4
-rw-r--r--Swift/Controllers/MainController.cpp6
-rw-r--r--Swift/Controllers/UIInterfaces/UserSearchWindow.h4
4 files changed, 19 insertions, 19 deletions
diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index 91de670..30c3c77 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -83,17 +83,17 @@ void UserSearchController::handleUIEvent(std::shared_ptr<UIEvent> event) {
std::shared_ptr<RequestAddUserDialogUIEvent> addUserRequest = std::shared_ptr<RequestAddUserDialogUIEvent>();
auto inviteToMUCRequest = RequestInviteToMUCUIEvent::ref();
switch (type_) {
- case AddContact:
+ case Type::AddContact:
if ((addUserRequest = std::dynamic_pointer_cast<RequestAddUserDialogUIEvent>(event))) {
handle = true;
}
break;
- case StartChat:
+ case Type::StartChat:
if (std::dynamic_pointer_cast<RequestChatWithUserDialogUIEvent>(event)) {
handle = true;
}
break;
- case InviteToChat:
+ case Type::InviteToChat:
if ((inviteToMUCRequest = std::dynamic_pointer_cast<RequestInviteToMUCUIEvent>(event))) {
handle = true;
}
@@ -241,7 +241,7 @@ void UserSearchController::handleContactSuggestionsRequested(std::string text) {
}
// remove contact suggestions which are already on the contact list in add-contact-mode
- if (type_ == AddContact) {
+ if (type_ == Type::AddContact) {
if (!found && !!rosterController_->getItem((*i)->jid)) {
found = true;
}
@@ -327,16 +327,16 @@ void UserSearchController::handleDiscoWalkFinished() {
void UserSearchController::initializeUserWindow() {
if (!window_) {
- UserSearchWindow::Type windowType = UserSearchWindow::AddContact;
+ auto windowType = UserSearchWindow::Type::AddContact;
switch(type_) {
- case AddContact:
- windowType = UserSearchWindow::AddContact;
+ case Type::AddContact:
+ windowType = UserSearchWindow::Type::AddContact;
break;
- case StartChat:
- windowType = UserSearchWindow::ChatToContact;
+ case Type::StartChat:
+ windowType = UserSearchWindow::Type::ChatToContact;
break;
- case InviteToChat:
- windowType = UserSearchWindow::InviteToChat;
+ case Type::InviteToChat:
+ windowType = UserSearchWindow::Type::InviteToChat;
break;
}
diff --git a/Swift/Controllers/Chat/UserSearchController.h b/Swift/Controllers/Chat/UserSearchController.h
index 4658301..49bb63c 100644
--- a/Swift/Controllers/Chat/UserSearchController.h
+++ b/Swift/Controllers/Chat/UserSearchController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -49,7 +49,7 @@ namespace Swift {
class UserSearchController {
public:
- enum Type {AddContact, StartChat, InviteToChat};
+ enum class Type {AddContact, StartChat, InviteToChat};
UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, VCardManager* vcardManager, UserSearchWindowFactory* userSearchWindowFactory, IQRouter* iqRouter, RosterController* rosterController, ContactSuggester* contactSuggester, AvatarManager* avatarManager, PresenceOracle* presenceOracle, ProfileSettingsProvider* settings);
~UserSearchController();
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index e64b23d..b22e467 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -366,7 +366,7 @@ void MainController::handleConnected() {
contactSuggesterWithoutRoster_ = new ContactSuggester();
contactSuggesterWithRoster_ = new ContactSuggester();
- userSearchControllerInvite_ = new UserSearchController(UserSearchController::InviteToChat, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
+ userSearchControllerInvite_ = new UserSearchController(UserSearchController::Type::InviteToChat, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
#ifdef SWIFT_EXPERIMENTAL_HISTORY
historyController_ = new HistoryController(storages_->getHistoryStorage());
historyViewController_ = new HistoryViewController(jid_, uiEventStream_, historyController_, client_->getNickResolver(), client_->getAvatarManager(), client_->getPresenceOracle(), uiFactory_);
@@ -405,8 +405,8 @@ void MainController::handleConnected() {
client_->getDiscoManager()->setCapsNode(CLIENT_NODE);
client_->getDiscoManager()->setDiscoInfo(discoInfo);
- userSearchControllerChat_ = new UserSearchController(UserSearchController::StartChat, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
- userSearchControllerAdd_ = new UserSearchController(UserSearchController::AddContact, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithoutRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
+ userSearchControllerChat_ = new UserSearchController(UserSearchController::Type::StartChat, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
+ userSearchControllerAdd_ = new UserSearchController(UserSearchController::Type::AddContact, jid_, uiEventStream_, client_->getVCardManager(), uiFactory_, client_->getIQRouter(), rosterController_, contactSuggesterWithoutRoster_, client_->getAvatarManager(), client_->getPresenceOracle(), profileSettings_);
adHocManager_ = new AdHocManager(JID(boundJID_.getDomain()), uiFactory_, client_->getIQRouter(), uiEventStream_, rosterController_->getWindow());
chatsManager_->onImpromptuMUCServiceDiscovered.connect(boost::bind(&UserSearchController::setCanInitiateImpromptuMUC, userSearchControllerChat_, _1));
diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h
index 279f4f3..c13e376 100644
--- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h
+++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -20,7 +20,7 @@ namespace Swift {
class UserSearchWindow {
public:
- enum Type {AddContact, ChatToContact, InviteToChat};
+ enum class Type {AddContact, ChatToContact, InviteToChat};
virtual ~UserSearchWindow() {}
virtual void clear() = 0;