diff options
| -rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 9 | ||||
| -rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 3 | ||||
| -rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 5 | ||||
| -rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 3 | ||||
| -rw-r--r-- | Swift/QtUI/QtAddBookmarkWindow.cpp | 6 | ||||
| -rw-r--r-- | Swift/QtUI/QtAddBookmarkWindow.h | 3 | ||||
| -rw-r--r-- | Swift/QtUI/QtBookmarkDetailWindow.cpp | 26 | ||||
| -rw-r--r-- | Swift/QtUI/QtBookmarkDetailWindow.h | 5 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 10 | ||||
| -rw-r--r-- | Swift/QtUI/QtChatWindow.h | 1 |
10 files changed, 64 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index df99368..cb2616c 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -95,2 +95,3 @@ MUCController::MUCController ( chatWindow_->onChangeSubjectRequest.connect(boost::bind(&MUCController::handleChangeSubjectRequest, this, _1)); + chatWindow_->onBookmarkRequest.connect(boost::bind(&MUCController::handleBookmarkRequest, this)); chatWindow_->onConfigureRequest.connect(boost::bind(&MUCController::handleConfigureRequest, this, _1)); @@ -801,2 +802,10 @@ void MUCController::handleChangeSubjectRequest(const std::string& subject) { +void MUCController::handleBookmarkRequest() { + const JID jid = muc_->getJID(); + MUCBookmark bookmark(jid, jid.toBare().toString()); + bookmark.setPassword(password_); + bookmark.setNick(nick_); + chatWindow_->showBookmarkWindow(bookmark); +} + void MUCController::handleConfigureRequest(Form::ref form) { diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 317f579..e78ff77 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2013 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -95,2 +95,3 @@ namespace Swift { void handleChangeSubjectRequest(const std::string&); + void handleBookmarkRequest(); std::string roleToGroupName(MUCOccupant::Role role); diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 771872a..096a59a 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010-2012 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -21,2 +21,3 @@ #include <Swiften/Elements/MUCOccupant.h> +#include <Swiften/MUC/MUCBookmark.h> #include <Swift/Controllers/HighlightManager.h> @@ -150,2 +151,3 @@ namespace Swift { virtual void setCanInitiateImpromptuChats(bool supportsImpromptu) = 0; + virtual void showBookmarkWindow(const MUCBookmark& bookmark) = 0; /** @@ -182,2 +184,3 @@ namespace Swift { boost::signal<void (const std::string&)> onChangeSubjectRequest; + boost::signal<void ()> onBookmarkRequest; boost::signal<void (Form::ref)> onConfigureRequest; diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 8aa645d..c2e2c9f 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -73,2 +73,3 @@ namespace Swift { virtual void setCanInitiateImpromptuChats(bool /*supportsImpromptu*/) {} + virtual void showBookmarkWindow(const MUCBookmark& /*bookmark*/) {} diff --git a/Swift/QtUI/QtAddBookmarkWindow.cpp b/Swift/QtUI/QtAddBookmarkWindow.cpp index 675ea03..230f2ed 100644 --- a/Swift/QtUI/QtAddBookmarkWindow.cpp +++ b/Swift/QtUI/QtAddBookmarkWindow.cpp @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -15,2 +15,6 @@ QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream) : eventStre +QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBookmark& bookmark) : eventStream_(eventStream) { + createFormFromBookmark(bookmark); +} + bool QtAddBookmarkWindow::commit() { diff --git a/Swift/QtUI/QtAddBookmarkWindow.h b/Swift/QtUI/QtAddBookmarkWindow.h index f026cc3..c0dc214 100644 --- a/Swift/QtUI/QtAddBookmarkWindow.h +++ b/Swift/QtUI/QtAddBookmarkWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -18,2 +18,3 @@ namespace Swift { QtAddBookmarkWindow(UIEventStream* eventStream); + QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBookmark& bookmark); bool commit(); diff --git a/Swift/QtUI/QtBookmarkDetailWindow.cpp b/Swift/QtUI/QtBookmarkDetailWindow.cpp index ae84b4b..3e501f2 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.cpp +++ b/Swift/QtUI/QtBookmarkDetailWindow.cpp @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -51,2 +51,26 @@ boost::optional<MUCBookmark> QtBookmarkDetailWindow::createBookmarkFromForm() { +void QtBookmarkDetailWindow::createFormFromBookmark(const MUCBookmark& bookmark) { + if (bookmark.getRoom().isValid()) { + room_->setText(P2QSTRING(bookmark.getRoom().toString())); + } + + if (!bookmark.getName().empty()) { + name_->setText(P2QSTRING(bookmark.getName())); + } + + if (bookmark.getNick()) { + nick_->setText(P2QSTRING((*bookmark.getNick()))); + } + + if (bookmark.getPassword()) { + password_->setText(P2QSTRING((*bookmark.getPassword()))); + } + + if (bookmark.getAutojoin()) { + autojoin_->setCheckState(Qt::Checked); + } else { + autojoin_->setCheckState(Qt::Unchecked); + } +} + } diff --git a/Swift/QtUI/QtBookmarkDetailWindow.h b/Swift/QtUI/QtBookmarkDetailWindow.h index fd2b7b4..b223719 100644 --- a/Swift/QtUI/QtBookmarkDetailWindow.h +++ b/Swift/QtUI/QtBookmarkDetailWindow.h @@ -1,3 +1,3 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. @@ -24,2 +24,5 @@ namespace Swift { + protected: + void createFormFromBookmark(const MUCBookmark& bookmark); + public slots: diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index d3cce6d..f58c11b 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -48,2 +48,3 @@ #include <Swift/QtUI/Roster/QtOccupantListWidget.h> +#include <Swift/QtUI/QtAddBookmarkWindow.h> #include <Swift/QtUI/QtPlainChatView.h> @@ -629,2 +630,4 @@ void QtChatWindow::handleActionButtonClicked() { + QAction* bookmark = contextMenu.addAction(tr("Add boomark...")); + QAction* result = contextMenu.exec(QCursor::pos()); @@ -670,2 +673,4 @@ void QtChatWindow::handleActionButtonClicked() { onUnblockUserRequest(); + } else if (result == bookmark) { + onBookmarkRequest(); } @@ -694,2 +699,7 @@ void QtChatWindow::setCanInitiateImpromptuChats(bool supportsImpromptu) { +void QtChatWindow::showBookmarkWindow(const MUCBookmark& bookmark) { + QtAddBookmarkWindow* window = new QtAddBookmarkWindow(eventStream_, bookmark); + window->show(); +} + void QtChatWindow::showRoomConfigurationForm(Form::ref form) { diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 5a4fe95..de7e45e 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -130,2 +130,3 @@ namespace Swift { virtual void setCanInitiateImpromptuChats(bool supportsImpromptu); + virtual void showBookmarkWindow(const MUCBookmark& bookmark); |
Swift