From d7d0416547958792517a9b739b370e51c717fb23 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 12 Oct 2012 20:15:57 -0700 Subject: CHUI-380: (In progress) Refactoring needed to fix focusing issues when selecting an existing conversation item. This commit resolves re-introducing bug CHUI-289. Will code review and cleanup code in next commit. --- indra/llkdu/llimagej2ckdu.cpp | 4 ++-- indra/newview/llchiclet.h | 1 + indra/newview/llchicletbar.h | 1 + indra/newview/llconversationlog.h | 1 + indra/newview/llconversationview.cpp | 6 ++++-- indra/newview/llimconversation.cpp | 11 ----------- indra/newview/llimconversation.h | 3 --- indra/newview/llimfloatercontainer.cpp | 19 +++++++++++++++++++ indra/newview/llimfloatercontainer.h | 3 +++ indra/newview/llimview.cpp | 13 +++++++++++++ indra/newview/llimview.h | 2 ++ indra/newview/llsyswellwindow.h | 1 + 12 files changed, 47 insertions(+), 18 deletions(-) diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index cf88de12b4..db75b6e003 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -166,12 +166,12 @@ void LLKDUMessageWarning::put_text(const kdu_uint16 *s) void LLKDUMessageError::put_text(const char *s) { - llinfos << "KDU Error: " << s << llendl; + //llinfos << "KDU Error: " << s << llendl; } void LLKDUMessageError::put_text(const kdu_uint16 *s) { - llinfos << "KDU Error: " << s << llendl; + //llinfos << "KDU Error: " << s << llendl; } void LLKDUMessageError::flush(bool end_of_message) diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index f51d7b622c..3a52b0a67b 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -874,6 +874,7 @@ class LLIMWellChiclet : public LLSysWellChiclet, LLIMSessionObserver friend class LLUICtrlFactory; public: /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} + /*virtual*/ void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id) { messageCountChanged(LLSD()); } /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) {} diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index 7d0d904810..0589a9fccc 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -51,6 +51,7 @@ public: // LLIMSessionObserver observe triggers /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id); /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 373406aa6f..70f04b21c8 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -124,6 +124,7 @@ public: // LLIMSessionObserver triggers virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + virtual void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; // Stub virtual void sessionRemoved(const LLUUID& session_id){} // Stub virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){}; // Stub virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){}; // Stub diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 70f2446752..637f30635e 100755 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -424,8 +424,10 @@ void LLConversationViewParticipant::draw() void LLConversationViewParticipant::selectItem() { LLConversationItem* vmi = this->getParentFolder() ? static_cast(this->getParentFolder()->getViewModelItem()) : NULL; - - if(vmi) + LLIMFloaterContainer* container = LLIMFloaterContainer::getInstance(); + + //Only execute when switching floaters (conversations) + if(vmi && vmi->getUUID() != container->getSelectedSession()) { //When null, show the nearby chat conversation floater if(vmi->getUUID().isNull()) diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index 2027f79eea..bd2a2419a8 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -54,7 +54,6 @@ LLIMConversation::LLIMConversation(const LLSD& session_id) , mInputEditor(NULL) , mInputEditorTopPad(0) , mRefreshTimer(new LLTimer()) - , mHasFocus(false) { mSession = LLIMModel::getInstance()->findIMSession(mSessionID); @@ -216,21 +215,11 @@ void LLIMConversation::onFocusReceived() } LLTransientDockableFloater::onFocusReceived(); - - mHadFocus = mHasFocus; - mHasFocus = true; - - if (! mHadFocus) - { - // LLIMFloaterContainer* container = LLIMFloaterContainer::getInstance(); - // container->setConvItemSelect(mSessionID); - } } void LLIMConversation::onFocusLost() { setBackgroundOpaque(false); - mHasFocus = false; LLTransientDockableFloater::onFocusLost(); } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 0960d6db88..603e0d0197 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -141,9 +141,6 @@ private: bool checkIfTornOff(); LLTimer* mRefreshTimer; ///< Defines the rate at which refresh() is called. - - bool mHadFocus; - bool mHasFocus; }; diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 5f111b39d4..0250854f36 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -101,6 +101,11 @@ void LLIMFloaterContainer::sessionAdded(const LLUUID& session_id, const std::str addConversationListItem(session_id); } +void LLIMFloaterContainer::sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + doSomething(session_id); +} + void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::addToHost(session_id, true); @@ -1069,6 +1074,19 @@ void LLIMFloaterContainer::setConvItemSelect(const LLUUID& session_id) } } +void LLIMFloaterContainer::doSomething(const LLUUID& session_id) +{ + LLConversationItem* vmi = static_cast(mConversationsRoot->getCurSelectedItem()->getParentFolder()->getViewModelItem()); + + if(session_id != vmi->getUUID()) + { + mSelectedSession = session_id; + LLFolderViewItem* widget = mConversationsWidgets[session_id]; + (widget->getRoot())->setSelection(widget, FALSE, FALSE); + } +} + + void LLIMFloaterContainer::setTimeNow(const LLUUID& session_id, const LLUUID& participant_id) { conversations_items_map::iterator item_it = mConversationsItems.find(session_id); @@ -1204,6 +1222,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin(); if (widget_it != mConversationsWidgets.end()) { + mSelectedSession = widget_it->first; LLFolderViewItem* widget = widget_it->second; widget->selectItem(); } diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index ceb054dfa3..da134c498f 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -64,6 +64,7 @@ public: BOOL select_added_floater, LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END); void setConvItemSelect(const LLUUID& session_id); + void doSomething(const LLUUID& session_id); /*virtual*/ void tabClose(); static LLFloater* getCurrentVoiceFloater(); @@ -81,11 +82,13 @@ public: // LLIMSessionObserver observe triggers /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id); /*virtual*/ void sessionRemoved(const LLUUID& session_id); /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); LLConversationViewModel& getRootViewModel() { return mConversationViewModel; } + LLUUID getSelectedSession() { return mSelectedSession; } private: typedef std::map avatarID_panel_map_t; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a604c884ca..e75db1b7af 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2654,6 +2654,11 @@ LLUUID LLIMMgr::addSession( { LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice); } + else + { + std::string session_name = LLIMModel::getInstance()->getName(session_id); + LLIMMgr::getInstance()->notifyObserverSessionAlreadyAdded(session_id, session_name, other_participant_id); + } //we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions if (!new_session) return session_id; @@ -2956,6 +2961,14 @@ void LLIMMgr::notifyObserverSessionAdded(const LLUUID& session_id, const std::st } } +void LLIMMgr::notifyObserverSessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +{ + for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++) + { + (*it)->sessionAlreadyAdded(session_id, name, other_participant_id); + } +} + void LLIMMgr::notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id) { for (session_observers_list_t::iterator it = mSessionObservers.begin(); it != mSessionObservers.end(); it++) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 82cfa394a6..a34359eb00 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -303,6 +303,7 @@ class LLIMSessionObserver public: virtual ~LLIMSessionObserver() {} virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; + virtual void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) = 0; virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) = 0; virtual void sessionRemoved(const LLUUID& session_id) = 0; virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) = 0; @@ -469,6 +470,7 @@ private: static void onInviteNameLookup(LLSD payload, const LLUUID& id, const std::string& name, bool is_group); void notifyObserverSessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + void notifyObserverSessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); void notifyObserverSessionVoiceOrIMStarted(const LLUUID& session_id); void notifyObserverSessionRemoved(const LLUUID& session_id); void notifyObserverSessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index 6be12711ac..302007c9aa 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -171,6 +171,7 @@ public: // LLIMSessionObserver observe triggers /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); + /*virtual*/ void sessionAlreadyAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {} /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id) {}; /*virtual*/ void sessionRemoved(const LLUUID& session_id); /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); -- cgit v1.2.3