summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch')
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.cpp4
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.h1
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.cpp4
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp16
4 files changed, 17 insertions, 8 deletions
diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.cpp b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
index 4adc929..6504f3e 100644
--- a/Swift/QtUI/UserSearch/QtContactListWidget.cpp
+++ b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
@@ -77,6 +77,10 @@ void QtContactListWidget::setMaximumNoOfContactsToOne(bool limited) {
limited_ = limited;
}
+bool QtContactListWidget::isFull() const {
+ return limited_ && (getList().size() == 1);
+}
+
void QtContactListWidget::updateContacts(const std::vector<Contact::ref>& contactUpdates) {
std::vector<Contact::ref> contacts = contactListModel_->getList();
foreach(const Contact::ref& contactUpdate, contactUpdates) {
diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.h b/Swift/QtUI/UserSearch/QtContactListWidget.h
index 601d320..112f3ee 100644
--- a/Swift/QtUI/UserSearch/QtContactListWidget.h
+++ b/Swift/QtUI/UserSearch/QtContactListWidget.h
@@ -40,6 +40,7 @@ public:
std::vector<Contact::ref> getList() const;
Contact::ref getContact(const size_t i);
void setMaximumNoOfContactsToOne(bool limited);
+ bool isFull() const;
public slots:
void updateContacts(const std::vector<Contact::ref>& contactUpdates);
diff --git a/Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.cpp
index 597c88b..8ea49c4 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchFirstMultiJIDPage.cpp
@@ -72,7 +72,9 @@ void QtUserSearchFirstMultiJIDPage::handleEditingDone() {
void QtUserSearchFirstMultiJIDPage::dragEnterEvent(QDragEnterEvent *event) {
if (event->mimeData()->hasFormat("application/vnd.swift.contact-jid-list")
|| event->mimeData()->hasFormat("application/vnd.swift.contact-jid-muc")) {
- event->acceptProposedAction();
+ if (!contactList_->isFull()) {
+ event->acceptProposedAction();
+ }
}
}
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
@@ -270,13 +270,9 @@ JID QtUserSearchWindow::getContactJID() const {
}
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() {
@@ -394,8 +390,14 @@ void QtUserSearchWindow::addContacts(const std::vector<Contact::ref>& contacts)
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));
+ }
}
}