From 32887cdc5407c7ced2d030cc8423fb0ab688170f Mon Sep 17 00:00:00 2001 From: Sergey Borushevsky Date: Tue, 1 Dec 2009 17:13:35 +0200 Subject: Implemented normal task EXT-2750 (Add context menu for group and ad-hoc chiclet) Added menu to ad-hoc chiclet, which contains one 'End Session' item. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 41 ++++++++++++++++++++++ indra/newview/llchiclet.h | 11 ++++++ .../skins/default/xui/en/menu_imchiclet_adhoc.xml | 19 ++++++++++ 3 files changed, 71 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/menu_imchiclet_adhoc.xml diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index f41e326dd0..d533743cfc 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -595,8 +595,49 @@ void LLAdHocChiclet::setCounter(S32 counter) setShowNewMessagesIcon(counter); } +void LLAdHocChiclet::createPopupMenu() +{ + if(mPopupMenu) + { + llwarns << "Menu already exists" << llendl; + return; + } + if(getSessionId().isNull()) + { + return; + } + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("IMChicletMenu.Action", boost::bind(&LLAdHocChiclet::onMenuItemClicked, this, _2)); + + mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile + ("menu_imchiclet_adhoc.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); +} + +void LLAdHocChiclet::onMenuItemClicked(const LLSD& user_data) +{ + std::string level = user_data.asString(); + LLUUID group_id = getSessionId(); + + if("end" == level) + { + LLGroupActions::endIM(group_id); + } +} + BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) { + if(!mPopupMenu) + { + createPopupMenu(); + } + + if (mPopupMenu) + { + mPopupMenu->arrangeAndClear(); + LLMenuGL::showPopup(this, mPopupMenu, x, y); + } + return TRUE; } diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 1ea141e6c4..ed4bcbc6ac 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -517,6 +517,17 @@ protected: LLAdHocChiclet(const Params& p); friend class LLUICtrlFactory; + /** + * Creates chiclet popup menu. Will create AdHoc Chat menu + * based on other participant's id. + */ + virtual void createPopupMenu(); + + /** + * Processes clicks on chiclet popup menu. + */ + virtual void onMenuItemClicked(const LLSD& user_data); + /** * Displays popup menu. */ diff --git a/indra/newview/skins/default/xui/en/menu_imchiclet_adhoc.xml b/indra/newview/skins/default/xui/en/menu_imchiclet_adhoc.xml new file mode 100644 index 0000000000..eb5e31b57d --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_imchiclet_adhoc.xml @@ -0,0 +1,19 @@ + + + + + + -- cgit v1.2.3