summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch')
-rw-r--r--Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp8
-rw-r--r--Swift/QtUI/UserSearch/QtSuggestingJIDInput.h2
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp12
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.h3
4 files changed, 17 insertions, 8 deletions
diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp
index 78842a2..57033d8 100644
--- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp
+++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp
@@ -114,7 +114,11 @@ void QtSuggestingJIDInput::keyPressEvent(QKeyEvent* event) {
QModelIndex index = treeViewPopup_->currentIndex();
if (!contactListModel_->getList().empty() && index.isValid()) {
currentContact_ = contactListModel_->getContact(index.row());
- setText(P2QSTRING(currentContact_->jid.toString()));
+ if (currentContact_->jid.isValid()) {
+ setText(P2QSTRING(currentContact_->jid.toString()));
+ } else {
+ setText(P2QSTRING(currentContact_->name));
+ }
hidePopup();
clearFocus();
} else {
@@ -144,7 +148,7 @@ void QtSuggestingJIDInput::handleSettingsChanged(const std::string& setting) {
void QtSuggestingJIDInput::handleClicked(const QModelIndex& index) {
if (index.isValid()) {
currentContact_ = contactListModel_->getContact(index.row());
- onUserSelected(currentContact_->jid);
+ onUserSelected(currentContact_);
hidePopup();
}
}
diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h
index 71cd87d..23e7b94 100644
--- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h
+++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.h
@@ -35,7 +35,7 @@ class QtSuggestingJIDInput : public QLineEdit {
void clear();
- boost::signal<void (const JID&)> onUserSelected;
+ boost::signal<void (const Contact::ref&)> onUserSelected;
signals:
void editingDone();
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 17214e4..e5bd5d0 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -78,7 +78,7 @@ void QtUserSearchWindow::handleCurrentChanged(int page) {
}
resultsPage_->emitCompletenessCheck();
if (page == 1 && lastPage_ == 3) {
- addSearchedJIDToList(getContactJID());
+ addSearchedJIDToList(getContact());
setSecondPage();
}
else if (page == 2 && lastPage_ == 1) {
@@ -270,9 +270,13 @@ JID QtUserSearchWindow::getContactJID() const {
return jid;
}
-void QtUserSearchWindow::addSearchedJIDToList(const JID& jid) {
+Contact::ref QtUserSearchWindow::getContact() const {
+ return boost::make_shared<Contact>("", getContactJID(), StatusShow::None, "");
+}
+
+void QtUserSearchWindow::addSearchedJIDToList(const Contact::ref& contact) {
std::vector<JID> jids;
- jids.push_back(jid);
+ jids.push_back(contact->jid);
handleJIDsAdded(jids);
firstMultiJIDPage_->jid_->clear();
}
@@ -343,7 +347,7 @@ void QtUserSearchWindow::setContactSuggestions(const std::vector<Contact::ref>&
void QtUserSearchWindow::setJIDs(const std::vector<JID> &jids) {
foreach(JID jid, jids) {
- addSearchedJIDToList(jid);
+ addSearchedJIDToList(boost::make_shared<Contact>("", jid, StatusShow::None, ""));
}
onJIDUpdateRequested(jids);
}
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.h b/Swift/QtUI/UserSearch/QtUserSearchWindow.h
index 0349ba4..0318b3d 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.h
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.h
@@ -77,7 +77,8 @@ namespace Swift {
JID getServerToSearch();
void handleSearch();
JID getContactJID() const;
- void addSearchedJIDToList(const JID& jid);
+ Contact::ref getContact() const;
+ void addSearchedJIDToList(const Contact::ref& contact);
private:
UIEventStream* eventStream_;