diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/UserSearch/QtUserSearchWindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 29ee306..babe115 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -180,81 +180,82 @@ int QtUserSearchWindow::nextId() const { switch (currentId()) { case 1: return searchNext_ ? 2 : -1; case 2: return 3; case 3: return 1; case 4: return -1; default: return -1; } } } void QtUserSearchWindow::handleFirstPageRadioChange() { if (firstPage_->byJID_->isChecked()) { firstPage_->jid_->setText(""); firstPage_->jid_->setEnabled(true); firstPage_->service_->setEnabled(false); restart(); } else if (firstPage_->byRemoteSearch_->isChecked()) { firstPage_->service_->setEditText(""); firstPage_->jid_->setEnabled(false); firstPage_->service_->setEnabled(true); //firstPage_->jid_->setText(""); restart(); } else { firstPage_->jid_->setEnabled(false); firstPage_->service_->setEnabled(false); restart(); } } void QtUserSearchWindow::handleSearch() { boost::shared_ptr<SearchPayload> search(new SearchPayload()); if (fieldsPage_->getFormWidget()) { search->setForm(fieldsPage_->getFormWidget()->getCompletedForm()); + search->getForm()->clearEmptyTextFields(); } else { - if (fieldsPage_->nickInput_->isEnabled()) { + if (fieldsPage_->nickInput_->isEnabled() && !fieldsPage_->nickInput_->text().isEmpty()) { search->setNick(Q2PSTRING(fieldsPage_->nickInput_->text())); } - if (fieldsPage_->firstInput_->isEnabled()) { + if (fieldsPage_->firstInput_->isEnabled() && !fieldsPage_->firstInput_->text().isEmpty()) { search->setFirst(Q2PSTRING(fieldsPage_->firstInput_->text())); } - if (fieldsPage_->lastInput_->isEnabled()) { + if (fieldsPage_->lastInput_->isEnabled() && !fieldsPage_->lastInput_->text().isEmpty()) { search->setLast(Q2PSTRING(fieldsPage_->lastInput_->text())); } - if (fieldsPage_->emailInput_->isEnabled()) { + if (fieldsPage_->emailInput_->isEnabled() && !fieldsPage_->emailInput_->text().isEmpty()) { 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 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]; } |