diff options
| author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-15 14:49:05 (GMT) |
|---|---|---|
| committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-25 08:38:30 (GMT) |
| commit | b42a5c5849813fe8db3bd3889378a53238cc36f7 (patch) | |
| tree | 2c9265025c0281acfde3077d884e17c834400358 | |
| parent | d5f701fdd6826421c0c83b8e299918065b6c99d1 (diff) | |
| download | swift-contrib-b42a5c5849813fe8db3bd3889378a53238cc36f7.zip swift-contrib-b42a5c5849813fe8db3bd3889378a53238cc36f7.tar.bz2 | |
Hide reason field in impromptu chat invites.
Change-Id: Icb5075f85a23fc181ff8f5ee00633bb768c4eb5f
| -rw-r--r-- | Swift/Controllers/Chat/ChatController.cpp | 4 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 5 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/UserSearchController.cpp | 1 | ||||
| -rw-r--r-- | Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h | 19 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/UserSearchWindow.h | 1 | ||||
| -rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.cpp | 5 | ||||
| -rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.h | 1 |
7 files changed, 31 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index fb69366..10cf54b 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -1,11 +1,11 @@ /* - * Copyright (c) 2010-2013 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swift/Controllers/Chat/ChatController.h> #include <boost/bind.hpp> #include <boost/smart_ptr/make_shared.hpp> #include <stdio.h> @@ -290,19 +290,19 @@ void ChatController::handleBlockUserRequest() { void ChatController::handleUnblockUserRequest() { if (isInMUC_) { eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_)); } else { eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_.toBare())); } } void ChatController::handleInviteToChat(const std::vector<JID>& droppedJIDs) { - boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(toJID_.toBare(), droppedJIDs)); + boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(toJID_.toBare(), droppedJIDs, RequestInviteToMUCUIEvent::Impromptu)); eventStream_->send(event); } void ChatController::handleUIEvent(boost::shared_ptr<UIEvent> event) { boost::shared_ptr<InviteToMUCUIEvent> inviteEvent = boost::dynamic_pointer_cast<InviteToMUCUIEvent>(event); if (inviteEvent && inviteEvent->getRoom() == toJID_.toBare()) { onConvertToMUC(detachChatWindow(), inviteEvent->getInvites(), inviteEvent->getReason()); } } diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index f83a772..df99368 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -1,11 +1,11 @@ /* - * Copyright (c) 2010-2013 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include <Swift/Controllers/Chat/MUCController.h> #include <boost/bind.hpp> #include <boost/regex.hpp> #include <boost/algorithm/string.hpp> @@ -839,19 +839,20 @@ void MUCController::handleConfigurationFormReceived(Form::ref form) { void MUCController::handleConfigurationCancelled() { muc_->cancelConfigureRoom(); } void MUCController::handleDestroyRoomRequest() { muc_->destroyRoom(); } void MUCController::handleInvitePersonToThisMUCRequest(const std::vector<JID>& jidsToInvite) { - boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(muc_->getJID(), jidsToInvite)); + RequestInviteToMUCUIEvent::ImpromptuMode mode = isImpromptu_ ? RequestInviteToMUCUIEvent::Impromptu : RequestInviteToMUCUIEvent::NotImpromptu; + boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(muc_->getJID(), jidsToInvite, mode)); eventStream_->send(event); } void MUCController::handleUIEvent(boost::shared_ptr<UIEvent> event) { boost::shared_ptr<InviteToMUCUIEvent> inviteEvent = boost::dynamic_pointer_cast<InviteToMUCUIEvent>(event); if (inviteEvent && inviteEvent->getRoom() == muc_->getJID()) { foreach (const JID& jid, inviteEvent->getInvites()) { muc_->invitePerson(jid, inviteEvent->getReason(), isImpromptu_); } diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index 12c6777..f259a9a 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -92,18 +92,19 @@ void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) { initializeUserWindow(); window_->show(); if (addUserRequest) { const std::string& name = addUserRequest->getPredefinedName(); const JID& jid = addUserRequest->getPredefinedJID(); if (!name.empty() && jid.isValid()) { window_->prepopulateJIDAndName(jid, name); } } else if (inviteToMUCRequest) { + window_->setCanSupplyDescription(!inviteToMUCRequest->isImpromptu()); window_->setJIDs(inviteToMUCRequest->getInvites()); window_->setRoomJID(inviteToMUCRequest->getRoom()); } return; } } void UserSearchController::handleFormRequested(const JID& service) { window_->setSearchError(false); diff --git a/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h b/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h index 69aa0cd..58f45d1 100644 --- a/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h @@ -1,35 +1,52 @@ /* * Copyright (c) 2013 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + #pragma once #include <boost/shared_ptr.hpp> #include <vector> #include <Swift/Controllers/UIEvents/UIEvent.h> #include <Swiften/JID/JID.h> namespace Swift { class RequestInviteToMUCUIEvent : public UIEvent { public: typedef boost::shared_ptr<RequestInviteToMUCUIEvent> ref; - RequestInviteToMUCUIEvent(const JID& room, const std::vector<JID>& JIDsToInvite) : room_(room), invite_(JIDsToInvite) { + enum ImpromptuMode { + Impromptu, + NotImpromptu + }; + + RequestInviteToMUCUIEvent(const JID& room, const std::vector<JID>& JIDsToInvite, ImpromptuMode impromptu) : room_(room), invite_(JIDsToInvite) { + isImpromptu_ = impromptu == Impromptu; } const JID& getRoom() const { return room_; } const std::vector<JID> getInvites() const { return invite_; } + bool isImpromptu() const { + return isImpromptu_; + } + private: JID room_; std::vector<JID> invite_; + bool isImpromptu_; }; } diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h index 56992cc..9a095aa 100644 --- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h @@ -34,18 +34,19 @@ namespace Swift { virtual void prepopulateJIDAndName(const JID& jid, const std::string& name) = 0; virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions) = 0; virtual void setJIDs(const std::vector<JID>&) = 0; virtual void setRoomJID(const JID& roomJID) = 0; virtual std::string getReason() const = 0; virtual std::vector<JID> getJIDs() const = 0; virtual void setCanStartImpromptuChats(bool supportsImpromptu) = 0; virtual void updateContacts(const std::vector<Contact::ref>& contacts) = 0; virtual void addContacts(const std::vector<Contact::ref>& contacts) = 0; + virtual void setCanSupplyDescription(bool allowed) = 0; virtual void show() = 0; boost::signal<void (const JID&)> onFormRequested; boost::signal<void (boost::shared_ptr<SearchPayload>, const JID&)> onSearchRequested; boost::signal<void (const JID&)> onNameSuggestionRequested; boost::signal<void (const std::string&)> onContactSuggestionsRequested; boost::signal<void (const std::vector<JID>&)> onJIDUpdateRequested; boost::signal<void (const std::vector<JID>&)> onJIDAddRequested; diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index c154c8f..40b4e28 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -393,18 +393,23 @@ void QtUserSearchWindow::addContacts(const std::vector<Contact::ref>& contacts) if (!found) { contactVector_.push_back(newContact); } } firstMultiJIDPage_->contactList_->setList(contactVector_); firstMultiJIDPage_->emitCompletenessCheck(); } } +void QtUserSearchWindow::setCanSupplyDescription(bool allowed) { + firstMultiJIDPage_->label->setVisible(allowed); + firstMultiJIDPage_->reason_->setVisible(allowed); +} + void QtUserSearchWindow::handleAddViaSearch() { searchNext_ = true; next(); } void QtUserSearchWindow::handleListChanged(std::vector<Contact::ref> list) { contactVector_ = list; if (type_ == ChatToContact) { firstMultiJIDPage_->groupBox->setEnabled(supportsImpromptu_ ? 1 : (contactVector_.size() < 1)); diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.h b/Swift/QtUI/UserSearch/QtUserSearchWindow.h index bb89e51..0349ba4 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.h +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.h @@ -45,18 +45,19 @@ namespace Swift { virtual void prepopulateJIDAndName(const JID& jid, const std::string& name); virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions); virtual void setJIDs(const std::vector<JID> &jids); virtual void setRoomJID(const JID &roomJID); virtual std::string getReason() const; virtual std::vector<JID> getJIDs() const; virtual void setCanStartImpromptuChats(bool supportsImpromptu); virtual void updateContacts(const std::vector<Contact::ref> &contacts); virtual void addContacts(const std::vector<Contact::ref>& contacts); + virtual void setCanSupplyDescription(bool allowed); protected: virtual int nextId() const; private slots: void handleFirstPageRadioChange(); virtual void handleCurrentChanged(int); virtual void handleAccepted(); void handleContactSuggestionRequested(const QString& text); |
Swift