summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/UserSearch')
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp2
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchResultsPage.h2
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.cpp27
-rw-r--r--Swift/QtUI/UserSearch/QtUserSearchWindow.h5
4 files changed, 25 insertions, 11 deletions
diff --git a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
index c5fa85a..bc6933e7 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.cpp
@@ -11,7 +11,7 @@ namespace Swift {
QtUserSearchResultsPage::QtUserSearchResultsPage() {
setupUi(this);
connect(results_, SIGNAL(activated(const QModelIndex&)), this, SLOT(emitCompletenessCheck()));
- connect(results_, SIGNAL(activated(const QModelIndex&)), this, SIGNAL(onUserTriggersFinish()));
+ connect(results_, SIGNAL(activated(const QModelIndex&)), this, SIGNAL(onUserTriggersContinue()));
connect(results_, SIGNAL(clicked(const QModelIndex&)), this, SLOT(emitCompletenessCheck()));
connect(results_, SIGNAL(entered(const QModelIndex&)), this, SLOT(emitCompletenessCheck()));
results_->setExpandsOnDoubleClick(false);
diff --git a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
index 855d6b3..2bb4fa5 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
+++ b/Swift/QtUI/UserSearch/QtUserSearchResultsPage.h
@@ -17,7 +17,7 @@ namespace Swift {
QtUserSearchResultsPage();
virtual bool isComplete() const;
signals:
- void onUserTriggersFinish();
+ void onUserTriggersContinue();
public slots:
void emitCompletenessCheck();
};
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
index 2927c9b..2c1de3d 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp
@@ -6,10 +6,10 @@
#include "Swift/QtUI/UserSearch/QtUserSearchWindow.h"
-#include <qdebug.h>
#include <QModelIndex>
#include <QWizardPage>
#include <QMovie>
+#include <boost/smart_ptr/make_shared.hpp>
#include "Swift/Controllers/UIEvents/UIEventStream.h"
#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h"
@@ -20,10 +20,11 @@
#include "QtUserSearchFirstPage.h"
#include "QtUserSearchFieldsPage.h"
#include "QtUserSearchResultsPage.h"
+#include "QtUserSearchDetailsPage.h"
namespace Swift {
-QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type) : eventStream_(eventStream), type_(type) {
+QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set<std::string>& groups) : eventStream_(eventStream), type_(type) {
setupUi(this);
#ifndef Q_WS_MAC
setWindowIcon(QIcon(":/logo-icon-16.png"));
@@ -56,8 +57,16 @@ QtUserSearchWindow::QtUserSearchWindow(UIEventStream* eventStream, UserSearchWin
#ifdef SWIFT_PLATFORM_MACOSX
resultsPage_->results_->setAlternatingRowColors(true);
#endif
+ if (type == AddContact) {
+ connect(resultsPage_, SIGNAL(onUserTriggersContinue()), this, SLOT(next()));
+ }
+ else {
+ connect(resultsPage_, SIGNAL(onUserTriggersContinue()), this, SLOT(accept()));
+ }
setPage(3, resultsPage_);
- connect(resultsPage_, SIGNAL(onUserTriggersFinish()), this, SLOT(accept()));
+
+ detailsPage_ = new QtUserSearchDetailsPage(groups);
+ setPage(4, detailsPage_);
connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(handleCurrentChanged(int)));
connect(this, SIGNAL(accepted()), this, SLOT(handleAccepted()));
@@ -79,6 +88,9 @@ void QtUserSearchWindow::handleCurrentChanged(int page) {
else if (page == 3 && lastPage_ == 2) {
handleSearch();
}
+ else if (page == 4) {
+ detailsPage_->clear();
+ }
lastPage_ = page;
}
@@ -97,10 +109,9 @@ void QtUserSearchWindow::handleAccepted() {
else {
jid = JID(Q2PSTRING(firstPage_->jid_->text()));
}
+
if (type_ == AddContact) {
- /* FIXME: allow specifying a nick */
- boost::shared_ptr<UIEvent> event(new AddContactUIEvent(jid, jid.toString()));
- eventStream_->send(event);
+ eventStream_->send(boost::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups()));
}
else {
boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(jid));
@@ -110,9 +121,9 @@ void QtUserSearchWindow::handleAccepted() {
int QtUserSearchWindow::nextId() const {
switch (currentId()) {
- case 1: return firstPage_->byJID_->isChecked() ? -1 : 2;
+ case 1: return firstPage_->byJID_->isChecked() ? (type_ == AddContact ? 4 : -1) : 2;
case 2: return 3;
- case 3: return 4;
+ case 3: return type_ == AddContact ? 4 : -1;
case 4: return -1;
default: return -1;
}
diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.h b/Swift/QtUI/UserSearch/QtUserSearchWindow.h
index 6c90731..bb40cd3 100644
--- a/Swift/QtUI/UserSearch/QtUserSearchWindow.h
+++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.h
@@ -7,6 +7,7 @@
#pragma once
#include <QWizard>
+#include <set>
#include <Swift/QtUI/UserSearch/ui_QtUserSearchWizard.h>
#include <Swift/Controllers/UIInterfaces/UserSearchWindow.h>
@@ -19,11 +20,12 @@ namespace Swift {
class QtUserSearchFirstPage;
class QtUserSearchFieldsPage;
class QtUserSearchResultsPage;
+ class QtUserSearchDetailsPage;
class QtUserSearchWindow : public QWizard, public UserSearchWindow, private Ui::QtUserSearchWizard {
Q_OBJECT
public:
- QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type);
+ QtUserSearchWindow(UIEventStream* eventStream, UserSearchWindow::Type type, const std::set<std::string>& groups);
virtual ~QtUserSearchWindow();
virtual void addSavedServices(const std::vector<JID>& services);
@@ -55,6 +57,7 @@ namespace Swift {
QtUserSearchFirstPage* firstPage_;
QtUserSearchFieldsPage* fieldsPage_;
QtUserSearchResultsPage* resultsPage_;
+ QtUserSearchDetailsPage* detailsPage_;
JID myServer_;
int lastPage_;
};