diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 2719f10a3dc6e76f6e0c3b932ef53ccf8ae3b7c0..660018530f242ef9553879f915975281d626aead 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -722,8 +722,11 @@ void LLIMP2PChiclet::updateMenuItems() if(getSessionId().isNull()) return; + LLIMFloater* open_im_floater = LLIMFloater::findInstance(getSessionId()); + bool open_window_exists = open_im_floater && open_im_floater->getVisible(); + mPopupMenu->getChild<LLUICtrl>("Send IM")->setEnabled(!open_window_exists); + bool is_friend = LLAvatarActions::isFriend(getOtherParticipantId()); - mPopupMenu->getChild<LLUICtrl>("Add Friend")->setEnabled(!is_friend); } @@ -1067,6 +1070,18 @@ void LLIMGroupChiclet::changed(LLGroupChange gc) } } +void LLIMGroupChiclet::updateMenuItems() +{ + if(!mPopupMenu) + return; + if(getSessionId().isNull()) + return; + + LLIMFloater* open_im_floater = LLIMFloater::findInstance(getSessionId()); + bool open_window_exists = open_im_floater && open_im_floater->getVisible(); + mPopupMenu->getChild<LLUICtrl>("Chat")->setEnabled(!open_window_exists); +} + BOOL LLIMGroupChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { if(!mPopupMenu) @@ -1076,6 +1091,7 @@ BOOL LLIMGroupChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) if (mPopupMenu) { + updateMenuItems(); mPopupMenu->arrangeAndClear(); LLMenuGL::showPopup(this, mPopupMenu, x, y); } diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 511b85b0b6236129f631d898765cc6ddbae50fdf..8c797ef98fa21b47d50fbe983c0f5aeb5e647de0 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -521,6 +521,7 @@ class LLIMP2PChiclet : public LLIMChiclet /** * Enables/disables menus based on relationship with other participant. + * Enables/disables "show session" menu item depending on visible IM floater existence. */ virtual void updateMenuItems(); @@ -751,6 +752,11 @@ class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver */ virtual void onMenuItemClicked(const LLSD& user_data); + /** + * Enables/disables "show session" menu item depending on visible IM floater existence. + */ + virtual void updateMenuItems(); + /** * Displays popup menu. */