diff options
Diffstat (limited to 'Swift')
| -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 @@ -94,4 +94,5 @@ MUCController::MUCController (  	chatWindow_->onOccupantActionSelected.connect(boost::bind(&MUCController::handleActionRequestedOnOccupant, this, _1, _2));  	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));  	chatWindow_->onConfigurationFormCancelled.connect(boost::bind(&MUCController::handleConfigurationCancelled, this)); @@ -800,4 +801,12 @@ 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) {  	if (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,4 +1,4 @@  /* - * Copyright (c) 2010-2013 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -94,4 +94,5 @@ namespace Swift {  			void handleJoinTimeoutTick();  			void handleChangeSubjectRequest(const std::string&); +			void handleBookmarkRequest();  			std::string roleToGroupName(MUCOccupant::Role role);  			std::string roleToSortName(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,4 +1,4 @@  /* - * Copyright (c) 2010-2012 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -20,4 +20,5 @@  #include <Swiften/Elements/Form.h>  #include <Swiften/Elements/MUCOccupant.h> +#include <Swiften/MUC/MUCBookmark.h>  #include <Swift/Controllers/HighlightManager.h> @@ -149,4 +150,5 @@ namespace Swift {  			virtual void setBlockingState(BlockingState state) = 0;  			virtual void setCanInitiateImpromptuChats(bool supportsImpromptu) = 0; +			virtual void showBookmarkWindow(const MUCBookmark& bookmark) = 0;  			/**  			 * Set an alert on the window. @@ -181,4 +183,5 @@ namespace Swift {  			boost::signal<void (ChatWindow::OccupantAction, ContactRosterItem*)> onOccupantActionSelected;  			boost::signal<void (const std::string&)> onChangeSubjectRequest; +			boost::signal<void ()> onBookmarkRequest;  			boost::signal<void (Form::ref)> onConfigureRequest;  			boost::signal<void ()> onDestroyRequest; 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,4 +1,4 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -72,4 +72,5 @@ namespace Swift {  			virtual void setBlockingState(BlockingState) {}  			virtual void setCanInitiateImpromptuChats(bool /*supportsImpromptu*/) {} +			virtual void showBookmarkWindow(const MUCBookmark& /*bookmark*/) {}  			std::string bodyFromMessage(const ChatMessage& message) { 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,4 +1,4 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -14,4 +14,8 @@ QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream) : eventStre  } +QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBookmark& bookmark) : eventStream_(eventStream) { +	createFormFromBookmark(bookmark); +} +  bool QtAddBookmarkWindow::commit() {  	boost::optional<MUCBookmark> bookmark = createBookmarkFromForm(); 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,4 +1,4 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -17,4 +17,5 @@ namespace Swift {  		public:  			QtAddBookmarkWindow(UIEventStream* eventStream); +			QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBookmark& bookmark);  			bool commit();  		private: 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,4 +1,4 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -50,3 +50,27 @@ 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,4 +1,4 @@  /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information. @@ -23,4 +23,7 @@ namespace Swift {  			boost::optional<MUCBookmark> createBookmarkFromForm(); +		protected: +			void createFormFromBookmark(const MUCBookmark& bookmark); +  		public slots:  			void accept(); 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 @@ -47,4 +47,5 @@  #include <Swift/QtUI/Roster/QtOccupantListWidget.h> +#include <Swift/QtUI/QtAddBookmarkWindow.h>  #include <Swift/QtUI/QtPlainChatView.h>  #include <Swift/QtUI/QtSettingsProvider.h> @@ -628,4 +629,6 @@ void QtChatWindow::handleActionButtonClicked() {  	} +	QAction* bookmark = contextMenu.addAction(tr("Add boomark...")); +  	QAction* result = contextMenu.exec(QCursor::pos());  	if (result == NULL) { @@ -669,4 +672,6 @@ void QtChatWindow::handleActionButtonClicked() {  	else if (result == unblock) {  		onUnblockUserRequest(); +	} else if (result == bookmark) { +		onBookmarkRequest();  	}  } @@ -693,4 +698,9 @@ 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) {  	if (mucConfigurationWindow_) { 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 @@ -129,4 +129,5 @@ namespace Swift {  			void setBlockingState(BlockingState state);  			virtual void setCanInitiateImpromptuChats(bool supportsImpromptu); +			virtual void showBookmarkWindow(const MUCBookmark& bookmark);  		public slots: | 
 Swift
 Swift