diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/RosterController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/MainWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtMainWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtNameWidget.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.cpp | 2 | ||||
-rw-r--r-- | Swift/QtUI/QtRosterHeader.h | 1 |
8 files changed, 20 insertions, 10 deletions
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp index 0f149f6..0144c97 100644 --- a/Swift/Controllers/RosterController.cpp +++ b/Swift/Controllers/RosterController.cpp @@ -7,7 +7,6 @@ #include "Swift/Controllers/RosterController.h" #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include "Swiften/Base/foreach.h" #include "Swift/Controllers/UIInterfaces/MainWindow.h" @@ -33,7 +32,6 @@ #include "Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h" #include "Swift/Controllers/UIEvents/RegroupRosterItemUIEvent.h" #include "Swift/Controllers/UIEvents/ToggleShowOfflineUIEvent.h" -#include "Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h" #include <Swiften/Client/NickManager.h> namespace Swift { @@ -56,7 +54,6 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata changeStatusConnection_ = mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2)); signOutConnection_ = mainWindow_->onSignOutRequest.connect(boost::bind(boost::ref(onSignOutRequest))); - mainWindow_->onEditProfileRequest.connect(boost::bind(&RosterController::handleEditProfileRequest, this)); xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1)); xmppRoster_->onJIDUpdated.connect(boost::bind(&RosterController::handleOnJIDUpdated, this, _1, _2, _3)); xmppRoster_->onJIDRemoved.connect(boost::bind(&RosterController::handleOnJIDRemoved, this, _1)); @@ -83,7 +80,6 @@ RosterController::~RosterController() { delete offlineFilter_; delete expandiness_; - mainWindow_->onEditProfileRequest.disconnect(boost::bind(&RosterController::handleEditProfileRequest, this)); mainWindow_->setRosterModel(NULL); if (mainWindow_->canDelete()) { delete mainWindow_; @@ -285,8 +281,4 @@ void RosterController::handleAvatarChanged(const JID& jid) { } } -void RosterController::handleEditProfileRequest() { - uiEventStream_->onUIEvent(boost::make_shared<RequestProfileEditorUIEvent>()); -} - } diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h index 55087fe..125aae5 100644 --- a/Swift/Controllers/UIInterfaces/MainWindow.h +++ b/Swift/Controllers/UIInterfaces/MainWindow.h @@ -36,7 +36,6 @@ namespace Swift { boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest; boost::signal<void ()> onSignOutRequest; - boost::signal<void ()> onEditProfileRequest; private: bool canDelete_; diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index d313aba..ccf5a59 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -28,6 +28,7 @@ #include "Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h" #include "Swift/Controllers/UIEvents/RequestAddUserDialogUIEvent.h" #include "Swift/Controllers/UIEvents/RequestChatWithUserDialogUIEvent.h" +#include "Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h" #include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h" #include "Swift/Controllers/UIEvents/ToggleShowOfflineUIEvent.h" @@ -42,6 +43,7 @@ QtMainWindow::QtMainWindow(QtSettingsProvider* settings, UIEventStream* uiEventS meView_ = new QtRosterHeader(settings, this); mainLayout->addWidget(meView_); connect(meView_, SIGNAL(onChangeStatusRequest(StatusShow::Type, const QString&)), this, SLOT(handleStatusChanged(StatusShow::Type, const QString&))); + connect(meView_, SIGNAL(onEditProfileRequest()), this, SLOT(handleEditProfileRequest())); tabs_ = new QtTabWidget(this); #if QT_VERSION >= 0x040500 @@ -121,6 +123,10 @@ void QtMainWindow::setRosterModel(Roster* roster) { treeWidget_->setRosterModel(roster); } +void QtMainWindow::handleEditProfileRequest() { + uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); +} + void QtMainWindow::handleEventCountUpdated(int count) { QColor eventTabColor = (count == 0) ? QColor() : QColor(255, 0, 0); // invalid resets to default int eventIndex = 1; @@ -147,7 +153,7 @@ void QtMainWindow::handleSignOutAction() { } void QtMainWindow::handleEditProfileAction() { - onEditProfileRequest(); + uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleJoinMUCAction() { diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index 938feff..67b89d8 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -58,6 +58,7 @@ namespace Swift { void handleAddUserActionTriggered(bool checked); void handleChatUserActionTriggered(bool checked); void handleEventCountUpdated(int count); + void handleEditProfileRequest(); private: std::vector<QMenu*> menus_; diff --git a/Swift/QtUI/QtNameWidget.cpp b/Swift/QtUI/QtNameWidget.cpp index 705d8af..c85b2e9 100644 --- a/Swift/QtUI/QtNameWidget.cpp +++ b/Swift/QtUI/QtNameWidget.cpp @@ -57,6 +57,9 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) { } menu.addAction(showAsJID); + QAction* editProfile = new QAction("Edit Profile", this); + menu.addAction(editProfile); + QAction* result = menu.exec(event->globalPos()); if (result == showAsJID) { mode = ShowJID; @@ -64,6 +67,9 @@ void QtNameWidget::mousePressEvent(QMouseEvent* event) { else if (result == showAsNick) { mode = ShowNick; } + else if (result == editProfile) { + emit onChangeNickRequest(); + } settings->storeBool("showNickInRosterHeader", mode == ShowNick); updateText(); } diff --git a/Swift/QtUI/QtNameWidget.h b/Swift/QtUI/QtNameWidget.h index 313108d..674d55c 100644 --- a/Swift/QtUI/QtNameWidget.h +++ b/Swift/QtUI/QtNameWidget.h @@ -21,6 +21,9 @@ namespace Swift { void setNick(const QString& text); void setJID(const QString& jid); + signals: + void onChangeNickRequest(); + private: void updateText(); virtual void mousePressEvent(QMouseEvent* event); diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 855c861..0fad137 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -33,6 +33,7 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) : setAvatar(":/icons/avatar.png"); avatarLabel_->setScaledContents(false); topLayout->addWidget(avatarLabel_); + //connect(avatarLabel_, SIGNAL(clicked()), this, SIGNAL(onEditProfileRequest())); /* FIXME: clickableish signal for label */ QVBoxLayout* rightLayout = new QVBoxLayout(); rightLayout->setSpacing(4); @@ -40,6 +41,7 @@ QtRosterHeader::QtRosterHeader(QtSettingsProvider* settings, QWidget* parent) : topLayout->addLayout(rightLayout); nameWidget_ = new QtNameWidget(settings, this); + connect(nameWidget_, SIGNAL(onChangeNickRequest()), this, SIGNAL(onEditProfileRequest())); rightLayout->addWidget(nameWidget_); diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 5634bdf..6c76993 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -38,6 +38,7 @@ namespace Swift { void setConnecting(); signals: void onChangeStatusRequest(StatusShow::Type showType, const QString &statusMessage); + void onEditProfileRequest(); private slots: void handleChangeStatusRequest(StatusShow::Type type, const QString &statusMessage); |