summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtMainWindow.cpp')
-rw-r--r--Swift/QtUI/QtMainWindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index cf4bfd2..b02a86e 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -1,5 +1,6 @@
#include "QtMainWindow.h"
+#include "QtAddContactDialog.h"
#include "QtJoinMUCDialog.h"
#include "QtSwiftUtil.h"
#include "Roster/QtTreeWidgetFactory.h"
@@ -13,6 +14,7 @@
#include <QPushButton>
#include <QMenuBar>
#include <QToolBar>
+#include <QAction>
namespace Swift {
@@ -29,6 +31,13 @@ QtMainWindow::QtMainWindow(QtTreeWidgetFactory *treeWidgetFactory) : QWidget() {
treeWidget_ = dynamic_cast<QtTreeWidget*>(treeWidgetFactory->createTreeWidget());
mainLayout->addWidget(treeWidget_);
+ bottomBar_ = new QToolBar(this);
+ mainLayout->addWidget(bottomBar_);
+
+ addAction_ = new QAction("Add Contact", this);
+ bottomBar_->addAction(addAction_);
+ connect(addAction_, SIGNAL(triggered(bool)), this, SLOT(handleAddActionTriggered(bool)));
+
this->setLayout(mainLayout);
QMenu* viewMenu = new QMenu(tr("View"), this);
@@ -46,6 +55,17 @@ QtMainWindow::QtMainWindow(QtTreeWidgetFactory *treeWidgetFactory) : QWidget() {
chatMenu->addAction(joinMUCAction);
}
+void QtMainWindow::handleAddActionTriggered(bool checked) {
+ Q_UNUSED(checked);
+ QtAddContactDialog* addContact = new QtAddContactDialog(this);
+ connect(addContact, SIGNAL(onAddCommand(const JID&, const QString&)), SLOT(handleAddContactDialogComplete(const JID&, const QString&)));
+ addContact->show();
+}
+
+void QtMainWindow::handleAddContactDialogComplete(const JID& contact, const QString& name) {
+ onAddContactRequest(contact, Q2PSTRING(name));
+}
+
TreeWidget* QtMainWindow::getTreeWidget() {
return treeWidget_;
}