diff options
author | Tobias Markmann <tm@ayena.de> | 2016-08-01 16:18:41 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-08-03 09:25:24 (GMT) |
commit | 331c6d2570b76f126491e9c955963879c5a76a54 (patch) | |
tree | af964ad4e106e85c5d2a7c699495d4aada3d806a /Swift/Controllers/Roster | |
parent | dbd57ffd259b9dba6990de0b02b450fa2a59a563 (diff) | |
download | swift-331c6d2570b76f126491e9c955963879c5a76a54.zip swift-331c6d2570b76f126491e9c955963879c5a76a54.tar.bz2 |
Open corresponding chat window when sending files via roster
Incoming and outgoing file transfers open the corresponding
chat window, but only for outgoing file transfers the window
is activated, i.e. shown at the top and focused. For incoming
transfers the window is opened in the background.
Test-Information:
Tested on OS X 10.11.6 with Qt 5.5.1 against another Swift
instance.
Change-Id: Ie786c135d4f7854a558561cadd715dc87a209316
Diffstat (limited to 'Swift/Controllers/Roster')
-rw-r--r-- | Swift/Controllers/Roster/RosterController.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index 47c24fc..1c750a3 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp @@ -12,7 +12,6 @@ #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Path.h> -#include <Swiften/Base/foreach.h> #include <Swiften/Base/format.h> #include <Swiften/Client/ClientBlockListManager.h> #include <Swiften/Client/NickManager.h> @@ -141,7 +140,7 @@ void RosterController::handleOnJIDAdded(const JID& jid) { std::vector<std::string> groups = xmppRoster_->getGroupsForJID(jid); std::string name = nickResolver_->jidToNick(jid); if (!groups.empty()) { - foreach(const std::string& group, groups) { + for (const auto& group : groups) { roster_->addContact(jid, jid, name, group, avatarManager_->getAvatarPath(jid)); } } @@ -152,7 +151,7 @@ void RosterController::handleOnJIDAdded(const JID& jid) { } void RosterController::applyAllPresenceTo(const JID& jid) { - foreach (Presence::ref presence, presenceOracle_->getAllPresence(jid)) { + for (auto&& presence : presenceOracle_->getAllPresence(jid)) { roster_->applyOnItems(SetPresence(presence)); } } @@ -179,12 +178,12 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const std::string& old if (groups.empty()) { groups.push_back(contactsGroup); } - foreach(const std::string& group, groups) { + for (const auto& group : groups) { if (std::find(oldGroups.begin(), oldGroups.end(), group) == oldGroups.end()) { roster_->addContact(jid, jid, name, group, avatarManager_->getAvatarPath(jid)); } } - foreach(const std::string& group, oldGroups) { + for (const auto& group : oldGroups) { if (std::find(groups.begin(), groups.end(), group) == groups.end()) { roster_->removeContactFromGroup(jid, group); if (roster_->getGroup(group)->getChildren().size() == 0) { @@ -203,7 +202,7 @@ void RosterController::handleSettingChanged(const std::string& settingPath) { void RosterController::handleBlockingStateChanged() { if (clientBlockListManager_->getBlockList()->getState() == BlockList::Available) { - foreach(const JID& jid, clientBlockListManager_->getBlockList()->getItems()) { + for (const auto& jid : clientBlockListManager_->getBlockList()->getItems()) { roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsBlocked)); } } @@ -256,7 +255,7 @@ void RosterController::handleUIEvent(std::shared_ptr<UIEvent> event) { if (group == QT_TRANSLATE_NOOP("", "Contacts")) { group = ""; } - foreach(XMPPRosterItem& item, items) { + for (auto& item : items) { std::vector<std::string> groups = item.getGroups(); if ( (group.empty() && groups.empty()) || std::find(groups.begin(), groups.end(), group) != groups.end()) { groups.erase(std::remove(groups.begin(), groups.end(), group), groups.end()); @@ -269,7 +268,6 @@ void RosterController::handleUIEvent(std::shared_ptr<UIEvent> event) { } } else if (std::shared_ptr<SendFileUIEvent> sendFileEvent = std::dynamic_pointer_cast<SendFileUIEvent>(event)) { - //TODO add send file dialog to ChatView of receipient jid ftOverview_->sendFile(sendFileEvent->getJID(), sendFileEvent->getFilename()); } } @@ -298,7 +296,7 @@ void RosterController::initBlockingCommand() { blockingOnItemRemovedConnection_ = blockList->onItemRemoved.connect(boost::bind(&RosterController::handleBlockingItemRemoved, this, _1)); roster_->setBlockingSupported(true); if (blockList->getState() == BlockList::Available) { - foreach(const JID& jid, blockList->getItems()) { + for (const auto& jid : blockList->getItems()) { roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsBlocked)); } } |