diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtAddBookmarkWindow.cpp | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 45 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 7 |
3 files changed, 37 insertions, 22 deletions
diff --git a/Swift/QtUI/QtAddBookmarkWindow.cpp b/Swift/QtUI/QtAddBookmarkWindow.cpp index a272aa2..3596657 100644 --- a/Swift/QtUI/QtAddBookmarkWindow.cpp +++ b/Swift/QtUI/QtAddBookmarkWindow.cpp @@ -1,20 +1,19 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include "QtAddBookmarkWindow.h" -#include <qdebug.h> - namespace Swift { QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream) : eventStream_(eventStream) { - + setWindowTitle(tr("Add Bookmark Details")); } QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBookmark& bookmark) : eventStream_(eventStream) { createFormFromBookmark(bookmark); + setWindowTitle(tr("Add Bookmark Details")); } bool QtAddBookmarkWindow::commit() { diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index f25c033..b1b9f83 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -10,7 +10,6 @@ #include <boost/lexical_cast.hpp> #include <boost/smart_ptr/make_shared.hpp> -#include <qdebug.h> #include <QApplication> #include <QBoxLayout> #include <QCloseEvent> @@ -34,7 +33,8 @@ #include <QTime> #include <QToolButton> #include <QUrl> -#include <QMimeData> + +#include <qdebug.h> #include <Swiften/Base/Log.h> @@ -42,25 +42,26 @@ #include <Swift/Controllers/Roster/Roster.h> #include <Swift/Controllers/Roster/RosterItem.h> #include <Swift/Controllers/Settings/SettingsProvider.h> -#include <Swift/Controllers/UIEvents/UIEventStream.h> -#include <Swift/Controllers/UIEvents/SendFileUIEvent.h> #include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> +#include <Swift/Controllers/UIEvents/SendFileUIEvent.h> +#include <Swift/Controllers/UIEvents/UIEventStream.h> #include <SwifTools/TabComplete.h> -#include <Swift/QtUI/Roster/QtOccupantListWidget.h> #include <Swift/QtUI/QtAddBookmarkWindow.h> +#include <Swift/QtUI/QtEditBookmarkWindow.h> #include <Swift/QtUI/QtPlainChatView.h> -#include <Swift/QtUI/QtSettingsProvider.h> #include <Swift/QtUI/QtScaledAvatarCache.h> +#include <Swift/QtUI/QtSettingsProvider.h> #include <Swift/QtUI/QtTextEdit.h> #include <Swift/QtUI/QtUISettingConstants.h> #include <Swift/QtUI/QtUtilities.h> #include <Swift/QtUI/QtWebKitChatView.h> +#include <Swift/QtUI/Roster/QtOccupantListWidget.h> namespace Swift { -QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, const std::map<std::string, std::string>& emoticons) : QtTabbable(), id_(Q2PSTRING(contact)), contact_(contact), nextAlertId_(0), eventStream_(eventStream), blockingState_(BlockingUnsupported), isMUC_(false), supportsImpromptuChat_(false) { +QtChatWindow::QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, const std::map<std::string, std::string>& emoticons) : QtTabbable(), id_(Q2PSTRING(contact)), contact_(contact), nextAlertId_(0), eventStream_(eventStream), blockingState_(BlockingUnsupported), isMUC_(false), supportsImpromptuChat_(false), roomBookmarkState_(RoomNotBookmarked) { settings_ = settings; unreadCount_ = 0; isOnline_ = true; @@ -524,9 +525,6 @@ void QtChatWindow::updateTitleWithUnreadCount() { emit titleUpdated(); } - - - void QtChatWindow::flash() { emit requestFlash(); } @@ -725,8 +723,16 @@ void QtChatWindow::handleActionButtonClicked() { } } - QAction* bookmark = contextMenu.addAction(tr("Add bookmark...")); - bookmark->setEnabled(isOnline_); + QAction* bookmark = NULL; + if (isMUC_) { + if (roomBookmarkState_ == RoomNotBookmarked) { + bookmark = contextMenu.addAction(tr("Bookmark this room...")); + } + else { + bookmark = contextMenu.addAction(tr("Edit bookmark...")); + } + bookmark->setEnabled(isOnline_); + } QAction* result = contextMenu.exec(QCursor::pos()); if (result == NULL) { @@ -797,8 +803,14 @@ void QtChatWindow::setCanInitiateImpromptuChats(bool supportsImpromptu) { } void QtChatWindow::showBookmarkWindow(const MUCBookmark& bookmark) { - QtAddBookmarkWindow* window = new QtAddBookmarkWindow(eventStream_, bookmark); - window->show(); + if (roomBookmarkState_ == RoomNotBookmarked) { + QtAddBookmarkWindow* window = new QtAddBookmarkWindow(eventStream_, bookmark); + window->show(); + } + else { + QtEditBookmarkWindow* window = new QtEditBookmarkWindow(eventStream_, bookmark); + window->show(); + } } std::string QtChatWindow::getID() const { @@ -879,7 +891,6 @@ void QtChatWindow::setFileTransferStatus(std::string id, const FileTransferState messageLog_->setFileTransferStatus(id, state, msg); } - std::string QtChatWindow::addWhiteboardRequest(bool senderIsSelf) { handleAppendedToLog(); return messageLog_->addWhiteboardRequest(contact_, senderIsSelf); @@ -901,4 +912,8 @@ void QtChatWindow::setMessageReceiptState(const std::string& id, ChatWindow::Rec messageLog_->setMessageReceiptState(id, state); } +void QtChatWindow::setBookmarkState(RoomBookmarkState bookmarkState) { + roomBookmarkState_ = bookmarkState; +} + } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 5c6fa2a..06c6064 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -14,10 +14,10 @@ #include <QString> #include <QTextCursor> -#include <SwifTools/LastLineTracker.h> - #include <Swift/Controllers/UIInterfaces/ChatWindow.h> +#include <SwifTools/LastLineTracker.h> + #include <Swift/QtUI/ChatSnippet.h> #include <Swift/QtUI/QtAffiliationEditor.h> #include <Swift/QtUI/QtEmoticonsGrid.h> @@ -25,7 +25,6 @@ #include <Swift/QtUI/QtSwiftUtil.h> #include <Swift/QtUI/QtTabbable.h> - class QTextEdit; class QLineEdit; class QComboBox; @@ -133,6 +132,7 @@ namespace Swift { void setBlockingState(BlockingState state); virtual void setCanInitiateImpromptuChats(bool supportsImpromptu); virtual void showBookmarkWindow(const MUCBookmark& bookmark); + virtual void setBookmarkState(RoomBookmarkState bookmarkState); virtual std::string getID() const; public slots: @@ -225,6 +225,7 @@ namespace Swift { bool impromptu_; bool isMUC_; bool supportsImpromptuChat_; + RoomBookmarkState roomBookmarkState_; QMenu* emoticonsMenu_; }; } |