summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-26 14:34:03 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-26 14:34:03 (GMT)
commite4807335c4e38dc2f047d400641c65448854b062 (patch)
tree1fa0dba9152e41b40e3c5794fd9ab993b9348230 /Swift/Controllers
parent3ea985154d59de3a3994c43d9b3dd36d089cfe2c (diff)
downloadswift-e4807335c4e38dc2f047d400641c65448854b062.zip
swift-e4807335c4e38dc2f047d400641c65448854b062.tar.bz2
Add "Edit details" section to Add User widget.
Resolves: #618
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/UserSearchController.cpp5
-rw-r--r--Swift/Controllers/Chat/UserSearchController.h4
-rw-r--r--Swift/Controllers/MainController.cpp4
-rw-r--r--Swift/Controllers/Roster/RosterController.cpp1
-rw-r--r--Swift/Controllers/UIEvents/AddContactUIEvent.h19
-rw-r--r--Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h4
6 files changed, 28 insertions, 9 deletions
diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index 37059c2..b3403d7 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -18,9 +18,10 @@
#include <Swift/Controllers/UIEvents/RequestAddUserDialogUIEvent.h>
#include <Swift/Controllers/UIInterfaces/UserSearchWindow.h>
#include <Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h>
+#include <Swift/Controllers/Roster/RosterController.h>
namespace Swift {
-UserSearchController::UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, UserSearchWindowFactory* factory, IQRouter* iqRouter) : type_(type), jid_(jid), uiEventStream_(uiEventStream), factory_(factory), iqRouter_(iqRouter) {
+UserSearchController::UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, UserSearchWindowFactory* factory, IQRouter* iqRouter, RosterController* rosterController) : type_(type), jid_(jid), uiEventStream_(uiEventStream), factory_(factory), iqRouter_(iqRouter), rosterController_(rosterController) {
uiEventStream_->onUIEvent.connect(boost::bind(&UserSearchController::handleUIEvent, this, _1));
window_ = NULL;
discoWalker_ = NULL;
@@ -50,7 +51,7 @@ void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
}
if (handle) {
if (!window_) {
- window_ = factory_->createUserSearchWindow(type_ == AddContact ? UserSearchWindow::AddContact : UserSearchWindow::ChatToContact, uiEventStream_);
+ window_ = factory_->createUserSearchWindow(type_ == AddContact ? UserSearchWindow::AddContact : UserSearchWindow::ChatToContact, uiEventStream_, rosterController_->getGroups());
window_->onFormRequested.connect(boost::bind(&UserSearchController::handleFormRequested, this, _1));
window_->onSearchRequested.connect(boost::bind(&UserSearchController::handleSearch, this, _1, _2));
window_->setSelectedService(JID(jid_.getDomain()));
diff --git a/Swift/Controllers/Chat/UserSearchController.h b/Swift/Controllers/Chat/UserSearchController.h
index 69795fb..071ec33 100644
--- a/Swift/Controllers/Chat/UserSearchController.h
+++ b/Swift/Controllers/Chat/UserSearchController.h
@@ -25,6 +25,7 @@ namespace Swift {
class UserSearchWindowFactory;
class IQRouter;
class DiscoServiceWalker;
+ class RosterController;
class UserSearchResult {
public:
@@ -39,7 +40,7 @@ namespace Swift {
class UserSearchController {
public:
enum Type {AddContact, StartChat};
- UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, UserSearchWindowFactory* userSearchWindowFactory, IQRouter* iqRouter);
+ UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, UserSearchWindowFactory* userSearchWindowFactory, IQRouter* iqRouter, RosterController* rosterController);
~UserSearchController();
private:
@@ -58,6 +59,7 @@ namespace Swift {
UIEventStream* uiEventStream_;
UserSearchWindowFactory* factory_;
IQRouter* iqRouter_;
+ RosterController* rosterController_;
UserSearchWindow* window_;
DiscoServiceWalker* discoWalker_;
};
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index adde70a..d499335 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -262,8 +262,8 @@ void MainController::handleConnected() {
client_->getDiscoManager()->setDiscoInfo(discoInfo);
- userSearchControllerChat_ = new UserSearchController(UserSearchController::StartChat, jid_, uiEventStream_, uiFactory_, client_->getIQRouter());
- userSearchControllerAdd_ = new UserSearchController(UserSearchController::AddContact, jid_, uiEventStream_, uiFactory_, client_->getIQRouter());
+ userSearchControllerChat_ = new UserSearchController(UserSearchController::StartChat, jid_, uiEventStream_, uiFactory_, client_->getIQRouter(), rosterController_);
+ userSearchControllerAdd_ = new UserSearchController(UserSearchController::AddContact, jid_, uiEventStream_, uiFactory_, client_->getIQRouter(), rosterController_);
}
client_->requestRoster();
diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp
index 83291e4..706f50a 100644
--- a/Swift/Controllers/Roster/RosterController.cpp
+++ b/Swift/Controllers/Roster/RosterController.cpp
@@ -180,6 +180,7 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
RosterItemPayload item;
item.setName(addContactEvent->getName());
item.setJID(addContactEvent->getJID());
+ item.setGroups(std::vector<std::string>(addContactEvent->getGroups().begin(), addContactEvent->getGroups().end()));
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
roster->addItem(item);
SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_);
diff --git a/Swift/Controllers/UIEvents/AddContactUIEvent.h b/Swift/Controllers/UIEvents/AddContactUIEvent.h
index b2bf5ce..d92d3af 100644
--- a/Swift/Controllers/UIEvents/AddContactUIEvent.h
+++ b/Swift/Controllers/UIEvents/AddContactUIEvent.h
@@ -7,17 +7,30 @@
#pragma once
#include <string>
+#include <set>
#include "Swift/Controllers/UIEvents/UIEvent.h"
namespace Swift {
class AddContactUIEvent : public UIEvent {
public:
- AddContactUIEvent(const JID& jid, const std::string& name) : jid_(jid), name_(name) {};
- std::string getName() {return name_;};
- JID getJID() {return jid_;};
+ AddContactUIEvent(const JID& jid, const std::string& name, const std::set<std::string>& groups) : jid_(jid), name_(name), groups_(groups) {};
+
+ const std::string& getName() const {
+ return name_;
+ };
+
+ const JID& getJID() const {
+ return jid_;
+ };
+
+ const std::set<std::string>& getGroups() const {
+ return groups_;
+ }
+
private:
JID jid_;
std::string name_;
+ std::set<std::string> groups_;
};
}
diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h b/Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h
index 88e0a07..2a15806 100644
--- a/Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h
+++ b/Swift/Controllers/UIInterfaces/UserSearchWindowFactory.h
@@ -6,6 +6,8 @@
#pragma once
+#include <set>
+
#include "Swift/Controllers/UIInterfaces/UserSearchWindow.h"
namespace Swift {
@@ -14,6 +16,6 @@ namespace Swift {
public:
virtual ~UserSearchWindowFactory() {};
- virtual UserSearchWindow* createUserSearchWindow(UserSearchWindow::Type type, UIEventStream* eventStream) = 0;
+ virtual UserSearchWindow* createUserSearchWindow(UserSearchWindow::Type type, UIEventStream* eventStream, const std::set<std::string>& groups) = 0;
};
}