diff options
Diffstat (limited to 'Swift/QtUI/UserSearch/QtUserSearchWindow.cpp')
| -rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index ed0fae2..c154c8f 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -132,3 +132,3 @@ void QtUserSearchWindow::handleAccepted() { if (contactVector_.size() == 1) { - boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0].jid)); + boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid)); eventStream_->send(event); @@ -137,4 +137,4 @@ void QtUserSearchWindow::handleAccepted() { - foreach(const Contact& contact, contactVector_) { - jids.push_back(contact.jid); + foreach(Contact::ref contact, contactVector_) { + jids.push_back(contact->jid); } @@ -144,4 +144,4 @@ void QtUserSearchWindow::handleAccepted() { case InviteToChat: - foreach(const Contact& contact, contactVector_) { - jids.push_back(contact.jid); + foreach(Contact::ref contact, contactVector_) { + jids.push_back(contact->jid); } @@ -158,5 +158,4 @@ void QtUserSearchWindow::handleContactSuggestionRequested(const QString& text) { void QtUserSearchWindow::addContact() { - if (firstMultiJIDPage_->jid_->getContact() != 0) { - Contact contact = *(firstMultiJIDPage_->jid_->getContact()); - contactVector_.push_back(contact); + if (!!firstMultiJIDPage_->jid_->getContact()) { + contactVector_.push_back(firstMultiJIDPage_->jid_->getContact()); } @@ -273,3 +272,3 @@ JID QtUserSearchWindow::getContactJID() const { void QtUserSearchWindow::addSearchedJIDToList(const JID& jid) { - Contact contact(jid, jid.toString(), StatusShow::None, ""); + Contact::ref contact = boost::make_shared<Contact>(jid, jid.toString(), StatusShow::None, ""); contactVector_.push_back(contact); @@ -338,3 +337,3 @@ void QtUserSearchWindow::prepopulateJIDAndName(const JID& jid, const std::string -void QtUserSearchWindow::setContactSuggestions(const std::vector<Contact>& suggestions) { +void QtUserSearchWindow::setContactSuggestions(const std::vector<Contact::ref>& suggestions) { if (type_ == AddContact) { @@ -363,4 +362,4 @@ std::vector<JID> QtUserSearchWindow::getJIDs() const { std::vector<JID> jids; - foreach (const Contact& contact, contactVector_) { - jids.push_back(contact.jid); + foreach (Contact::ref contact, contactVector_) { + jids.push_back(contact->jid); } @@ -376,3 +375,3 @@ void QtUserSearchWindow::setCanStartImpromptuChats(bool supportsImpromptu) { -void QtUserSearchWindow::updateContacts(const std::vector<Contact>& contacts) { +void QtUserSearchWindow::updateContacts(const std::vector<Contact::ref>& contacts) { if (type_ != AddContact) { @@ -382,9 +381,9 @@ void QtUserSearchWindow::updateContacts(const std::vector<Contact>& contacts) { -void QtUserSearchWindow::addContacts(const std::vector<Contact>& contacts) { +void QtUserSearchWindow::addContacts(const std::vector<Contact::ref>& contacts) { if (type_ != AddContact) { /* prevent duplicate JIDs from appearing in the contact list */ - foreach (const Contact& newContact, contacts) { + foreach (Contact::ref newContact, contacts) { bool found = false; - foreach (const Contact& oldContact, contactVector_) { - if (newContact.jid == oldContact.jid) { + foreach (Contact::ref oldContact, contactVector_) { + if (newContact->jid == oldContact->jid) { found = true; @@ -407,3 +406,3 @@ void QtUserSearchWindow::handleAddViaSearch() { -void QtUserSearchWindow::handleListChanged(std::vector<Contact> list) { +void QtUserSearchWindow::handleListChanged(std::vector<Contact::ref> list) { contactVector_ = list; @@ -472,3 +471,3 @@ void QtUserSearchWindow::setFirstPage(QString title) { connect(firstMultiJIDPage_->addViaSearchButton_, SIGNAL(clicked()), this, SLOT(handleAddViaSearch())); - connect(firstMultiJIDPage_->contactList_, SIGNAL(onListChanged(std::vector<Contact>)), this, SLOT(handleListChanged(std::vector<Contact>))); + connect(firstMultiJIDPage_->contactList_, SIGNAL(onListChanged(std::vector<Contact::ref>)), this, SLOT(handleListChanged(std::vector<Contact::ref>))); connect(firstMultiJIDPage_->contactList_, SIGNAL(onJIDsAdded(std::vector<JID>)), this, SLOT(handleJIDsAdded(std::vector<JID>))); |
Swift