summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch/QtUserSearchWindow.cpp')
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 40b4e28..260ccfe 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -264,25 +264,21 @@ JID QtUserSearchWindow::getContactJID() const {
}
}
else {
jid = JID(Q2PSTRING(firstPage_->jid_->text().trimmed()));
}
return jid;
}
void QtUserSearchWindow::addSearchedJIDToList(const JID& jid) {
- Contact::ref contact = boost::make_shared<Contact>(jid, jid.toString(), StatusShow::None, "");
- contactVector_.push_back(contact);
- firstMultiJIDPage_->contactList_->setList(contactVector_);
- firstMultiJIDPage_->emitCompletenessCheck();
- if (type_ == ChatToContact) {
- firstMultiJIDPage_->groupBox->setEnabled(supportsImpromptu_ ? 1 : (contactVector_.size() < 1));
- }
+ std::vector<JID> jids;
+ jids.push_back(jid);
+ handleJIDsAdded(jids);
}
void QtUserSearchWindow::show() {
clear();
QWidget::show();
}
void QtUserSearchWindow::addSavedServices(const std::vector<JID>& services) {
if (type_ == AddContact) {
@@ -388,20 +384,26 @@ void QtUserSearchWindow::addContacts(const std::vector<Contact::ref>& contacts)
if (newContact->jid == oldContact->jid) {
found = true;
break;
}
}
if (!found) {
contactVector_.push_back(newContact);
}
}
+ if (!supportsImpromptu_ && contactVector_.size() > 1) {
+ contactVector_.resize(1); /* can't chat with more than one user */
+ }
firstMultiJIDPage_->contactList_->setList(contactVector_);
firstMultiJIDPage_->emitCompletenessCheck();
+ if (type_ == ChatToContact) {
+ firstMultiJIDPage_->groupBox->setEnabled(supportsImpromptu_ ? true : (contactVector_.size() < 1));
+ }
}
}
void QtUserSearchWindow::setCanSupplyDescription(bool allowed) {
firstMultiJIDPage_->label->setVisible(allowed);
firstMultiJIDPage_->reason_->setVisible(allowed);
}
void QtUserSearchWindow::handleAddViaSearch() {