diff options
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 5 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatListWindow.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/UIInterfaces/ChatWindow.h | 1 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 15 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 4 | ||||
-rw-r--r-- | Swiften/MUC/MUC.cpp | 4 | ||||
-rw-r--r-- | Swiften/MUC/MUC.h | 1 |
10 files changed, 37 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 83f66a3..edc1a79 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -86,6 +86,7 @@ ChatsManager::ChatsManager( chatListWindow_ = chatListWindowFactory->createChatListWindow(uiEventStream_); chatListWindow_->onMUCBookmarkActivated.connect(boost::bind(&ChatsManager::handleMUCBookmarkActivated, this, _1)); chatListWindow_->onRecentActivated.connect(boost::bind(&ChatsManager::handleRecentActivated, this, _1)); + chatListWindow_->onClearRecentsRequested.connect(boost::bind(&ChatsManager::handleClearRecentsRequested, this)); joinMUCWindow_ = NULL; mucSearchController_ = new MUCSearchController(jid_, mucSearchWindowFactory, iqRouter, settings); @@ -126,6 +127,12 @@ void ChatsManager::saveRecents() { profileSettings_->storeString(RECENT_CHATS, recents); } +void ChatsManager::handleClearRecentsRequested() { + recentChats_.clear(); + saveRecents(); + handleUnreadCountChanged(NULL); +} + void ChatsManager::loadRecents() { std::string recentsString(profileSettings_->getStringSetting(RECENT_CHATS)); std::vector<std::string> recents; diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 46c104d..57643eb 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -80,6 +80,7 @@ namespace Swift { void handleRecentActivated(const ChatListWindow::Chat&); void handleUnreadCountChanged(ChatControllerBase* controller); void handleAvatarChanged(const JID& jid); + void handleClearRecentsRequested(); ChatController* getChatControllerOrFindAnother(const JID &contact); ChatController* createNewChatController(const JID &contact); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 8fcef8c..178f4b6 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -72,6 +72,7 @@ MUCController::MUCController ( chatWindow_->onOccupantSelectionChanged.connect(boost::bind(&MUCController::handleWindowOccupantSelectionChanged, this, _1)); chatWindow_->onOccupantActionSelected.connect(boost::bind(&MUCController::handleActionRequestedOnOccupant, this, _1, _2)); chatWindow_->onChangeSubjectRequest.connect(boost::bind(&MUCController::handleChangeSubjectRequest, this, _1)); + chatWindow_->onConfigureRequest.connect(boost::bind(&MUCController::handleConfigureRequest, this)); muc_->onJoinComplete.connect(boost::bind(&MUCController::handleJoinComplete, this, _1)); muc_->onJoinFailed.connect(boost::bind(&MUCController::handleJoinFailed, this, _1)); muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1)); @@ -576,4 +577,8 @@ void MUCController::handleChangeSubjectRequest(const std::string& subject) { muc_->changeSubject(subject); } +void MUCController::handleConfigureRequest() { + muc_->requestConfigurationForm(); +} + } diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index fc87738..08a3fc3 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -88,6 +88,7 @@ namespace Swift { void dayTicked() {lastWasPresence_ = false;} void processUserPart(); void handleBareJIDCapsChanged(const JID& jid); + void handleConfigureRequest(); private: MUC::ref muc_; diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h index 85700cb..d047f8c 100644 --- a/Swift/Controllers/UIInterfaces/ChatListWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h @@ -55,5 +55,6 @@ namespace Swift { boost::signal<void (const MUCBookmark&)> onMUCBookmarkActivated; boost::signal<void (const Chat&)> onRecentActivated; + boost::signal<void ()> onClearRecentsRequested; }; } diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 39fb7f8..7004324 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -97,6 +97,7 @@ namespace Swift { boost::signal<void (ContactRosterItem*)> onOccupantSelectionChanged; boost::signal<void (ChatWindow::OccupantAction, ContactRosterItem*)> onOccupantActionSelected; boost::signal<void (const std::string&)> onChangeSubjectRequest; + boost::signal<void ()> onConfigureRequest; // File transfer related boost::signal<void (std::string /* id */)> onFileTransferCancel; diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 9beb9dc..e5c63f6 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -123,9 +123,6 @@ void QtChatListWindow::handleEditBookmark() { void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { - if (!bookmarksEnabled_) { - return; - } QModelIndex index = indexAt(event->pos()); ChatListItem* baseItem = index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : NULL; contextMenuItem_ = baseItem; @@ -135,8 +132,20 @@ void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { } ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(baseItem); if (mucItem) { + if (!bookmarksEnabled_) { + return; + } mucMenu_->exec(QCursor::pos()); } + else { + QMenu menu; + QAction* clearRecents = menu.addAction(tr("Clear recents")); + menu.addAction(clearRecents); + QAction* result = menu.exec(event->globalPos()); + if (result == clearRecents) { + onClearRecentsRequested(); + } + } } } diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index e188e6a..2e3a225 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -694,6 +694,7 @@ void QtChatWindow::setSubject(const std::string& subject) { void QtChatWindow::handleActionButtonClicked() { QMenu contextMenu; QAction* changeSubject = contextMenu.addAction(tr("Change subject")); + //QAction* configure = contextMenu.addAction(tr("Configure room")); QAction* result = contextMenu.exec(QCursor::pos()); if (result == changeSubject) { bool ok; @@ -702,6 +703,9 @@ void QtChatWindow::handleActionButtonClicked() { onChangeSubjectRequest(Q2PSTRING(subject)); } } + //else if (result == configure) { + // onConfigureRequest(); + //} } } diff --git a/Swiften/MUC/MUC.cpp b/Swiften/MUC/MUC.cpp index 59917f9..43d3f36 100644 --- a/Swiften/MUC/MUC.cpp +++ b/Swiften/MUC/MUC.cpp @@ -244,6 +244,10 @@ void MUC::changeSubject(const std::string& subject) { stanzaChannel->sendMessage(message); } +void MUC::requestConfigurationForm() { + +} + //FIXME: Recognise Topic changes //TODO: Invites(direct/mediated) diff --git a/Swiften/MUC/MUC.h b/Swiften/MUC/MUC.h index 26247c5..e223de8 100644 --- a/Swiften/MUC/MUC.h +++ b/Swiften/MUC/MUC.h @@ -57,6 +57,7 @@ namespace Swift { bool hasOccupant(const std::string& nick); void kickUser(const JID& jid); void changeSubject(const std::string& subject); + void requestConfigurationForm(); public: boost::signal<void (const std::string& /*nick*/)> onJoinComplete; boost::signal<void (ErrorPayload::ref)> onJoinFailed; |