summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index ca84759..e309265 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -213,71 +213,71 @@ void QtUserSearchWindow::handleSearch() {
if (fieldsPage_->getFormWidget()) {
search->setForm(fieldsPage_->getFormWidget()->getCompletedForm());
} else {
if (fieldsPage_->nickInput_->isEnabled()) {
search->setNick(Q2PSTRING(fieldsPage_->nickInput_->text()));
}
if (fieldsPage_->firstInput_->isEnabled()) {
search->setFirst(Q2PSTRING(fieldsPage_->firstInput_->text()));
}
if (fieldsPage_->lastInput_->isEnabled()) {
search->setLast(Q2PSTRING(fieldsPage_->lastInput_->text()));
}
if (fieldsPage_->emailInput_->isEnabled()) {
search->setEMail(Q2PSTRING(fieldsPage_->emailInput_->text()));
}
}
onSearchRequested(search, getServerToSearch());
}
JID QtUserSearchWindow::getContactJID() const {
JID jid;
bool useSearchResult;
if (type_ == AddContact) {
useSearchResult = !firstPage_->byJID_->isChecked();
} else {
useSearchResult = true;
}
if (useSearchResult) {
if (dynamic_cast<UserSearchModel*>(model_)) {
UserSearchResult* userItem = static_cast<UserSearchResult*>(resultsPage_->results_->currentIndex().internalPointer());
if (userItem) { /* Remember to leave this if we change to dynamic cast */
jid = userItem->getJID();
}
- } else {
+ } else if (dynamic_cast<QtFormResultItemModel*>(model_)) {
int row = resultsPage_->results_->currentIndex().row();
Form::FormItem item = dynamic_cast<QtFormResultItemModel*>(model_)->getForm()->getItems().at(row);
JID fallbackJid;
foreach(FormField::ref field, item) {
if (field->getType() == FormField::JIDSingleType) {
jid = JID(field->getJIDSingleValue());
break;
}
if (field->getName() == "jid") {
fallbackJid = field->getValues()[0];
}
}
if (!jid.isValid()) {
jid = fallbackJid;
}
}
}
else {
jid = JID(Q2PSTRING(firstPage_->jid_->text().trimmed()));
}
return jid;
}
void QtUserSearchWindow::addSearchedJIDToList(const JID& jid) {
std::vector<JID> jids;
jids.push_back(jid);
handleJIDsAdded(jids);
firstMultiJIDPage_->jid_->clear();
}
void QtUserSearchWindow::show() {
clear();
QWidget::show();
}