Implemented major sub-task EXT-3525 (Context menu for Notifications well)
--HG-- branch : product-enginemeow-7.2.2
parent
2a49de3bef
commit
5f237f8559
|
|
@ -154,6 +154,7 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p)
|
|||
, mMaxDisplayedCount(p.max_displayed_count)
|
||||
, mIsNewMessagesState(false)
|
||||
, mFlashToLitTimer(NULL)
|
||||
, mContextMenu(NULL)
|
||||
{
|
||||
LLButton::Params button_params = p.button;
|
||||
mButton = LLUICtrlFactory::create<LLButton>(button_params);
|
||||
|
|
@ -229,6 +230,21 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages)
|
|||
mIsNewMessagesState = new_messages;
|
||||
}
|
||||
|
||||
// virtual
|
||||
BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if(!mContextMenu)
|
||||
{
|
||||
createMenu();
|
||||
}
|
||||
if (mContextMenu)
|
||||
{
|
||||
mContextMenu->show(x, y);
|
||||
LLMenuGL::showPopup(this, mContextMenu, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* LLIMWellChiclet implementation */
|
||||
/************************************************************************/
|
||||
|
|
@ -248,6 +264,11 @@ LLIMWellChiclet::~LLIMWellChiclet()
|
|||
LLIMMgr::getInstance()->removeSessionObserver(this);
|
||||
}
|
||||
|
||||
void LLIMWellChiclet::createMenu()
|
||||
{
|
||||
// TODO: implement context menu for IM well
|
||||
}
|
||||
|
||||
void LLIMWellChiclet::messageCountChanged(const LLSD& session_data)
|
||||
{
|
||||
setCounter(LLBottomTray::getInstance()->getTotalUnreadIMCount());
|
||||
|
|
@ -281,6 +302,47 @@ void LLNotificationChiclet::connectCounterUpdatersToSignal(const std::string& no
|
|||
}
|
||||
}
|
||||
|
||||
void LLNotificationChiclet::onMenuItemClicked(const LLSD& user_data)
|
||||
{
|
||||
std::string action = user_data.asString();
|
||||
if("close all" == action)
|
||||
{
|
||||
LLNotificationWellWindow::getInstance()->closeAll();
|
||||
}
|
||||
}
|
||||
|
||||
bool LLNotificationChiclet::enableMenuItem(const LLSD& user_data)
|
||||
{
|
||||
std::string item = user_data.asString();
|
||||
if (item == "can close all")
|
||||
{
|
||||
return mUreadSystemNotifications != 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void LLNotificationChiclet::createMenu()
|
||||
{
|
||||
if(mContextMenu)
|
||||
{
|
||||
llwarns << "Menu already exists" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
registrar.add("NotificationWellChicletMenu.Action",
|
||||
boost::bind(&LLNotificationChiclet::onMenuItemClicked, this, _2));
|
||||
|
||||
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
enable_registrar.add("NotificationWellChicletMenu.EnableItem",
|
||||
boost::bind(&LLNotificationChiclet::enableMenuItem, this, _2));
|
||||
|
||||
mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
|
||||
("menu_notification_well_button.xml",
|
||||
LLMenuGL::sMenuContainer,
|
||||
LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -806,6 +806,13 @@ protected:
|
|||
*/
|
||||
void changeLitState();
|
||||
|
||||
/**
|
||||
* Displays menu.
|
||||
*/
|
||||
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
|
||||
virtual void createMenu() = 0;
|
||||
|
||||
protected:
|
||||
class FlashToLitTimer;
|
||||
LLButton* mButton;
|
||||
|
|
@ -814,7 +821,7 @@ protected:
|
|||
bool mIsNewMessagesState;
|
||||
|
||||
FlashToLitTimer* mFlashToLitTimer;
|
||||
|
||||
LLContextMenu* mContextMenu;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -834,6 +841,11 @@ public:
|
|||
protected:
|
||||
LLIMWellChiclet(const Params& p);
|
||||
|
||||
/**
|
||||
* Creates menu.
|
||||
*/
|
||||
/*virtual*/ void createMenu();
|
||||
|
||||
/**
|
||||
* Handles changes in a session (message was added, messages were read, etc.)
|
||||
*
|
||||
|
|
@ -854,6 +866,21 @@ class LLNotificationChiclet : public LLSysWellChiclet
|
|||
protected:
|
||||
LLNotificationChiclet(const Params& p);
|
||||
|
||||
/**
|
||||
* Processes clicks on chiclet menu.
|
||||
*/
|
||||
void onMenuItemClicked(const LLSD& user_data);
|
||||
|
||||
/**
|
||||
* Enables chiclet menu items.
|
||||
*/
|
||||
bool enableMenuItem(const LLSD& user_data);
|
||||
|
||||
/**
|
||||
* Creates menu.
|
||||
*/
|
||||
/*virtual*/ void createMenu();
|
||||
|
||||
// connect counter updaters to the corresponding signals
|
||||
void connectCounterUpdatersToSignal(const std::string& notification_type);
|
||||
|
||||
|
|
|
|||
|
|
@ -610,6 +610,23 @@ void LLNotificationWellWindow::addItem(LLSysWellItem::Params p)
|
|||
}
|
||||
}
|
||||
|
||||
void LLNotificationWellWindow::closeAll()
|
||||
{
|
||||
// Need to clear notification channel, to add storable toasts into the list.
|
||||
clearScreenChannels();
|
||||
std::vector<LLPanel*> items;
|
||||
mMessageList->getItems(items);
|
||||
for (std::vector<LLPanel*>::iterator
|
||||
iter = items.begin(),
|
||||
iter_end = items.end();
|
||||
iter != iter_end; ++iter)
|
||||
{
|
||||
LLSysWellItem* sys_well_item = dynamic_cast<LLSysWellItem*>(*iter);
|
||||
if (sys_well_item)
|
||||
onItemClose(sys_well_item);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// PRIVATE METHODS
|
||||
void LLNotificationWellWindow::initChannel()
|
||||
|
|
|
|||
|
|
@ -147,6 +147,9 @@ public:
|
|||
// Operating with items
|
||||
void addItem(LLSysWellItem::Params p);
|
||||
|
||||
// Closes all notifications and removes them from the Notification Well
|
||||
void closeAll();
|
||||
|
||||
protected:
|
||||
/*virtual*/ const std::string& getAnchorViewName() { return NOTIFICATION_WELL_ANCHOR_NAME; }
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<context_menu
|
||||
layout="topleft"
|
||||
name="Notification Well Button Context Menu">
|
||||
<menu_item_call
|
||||
label="Close All"
|
||||
layout="topleft"
|
||||
name="Close All">
|
||||
<menu_item_call.on_click
|
||||
function="NotificationWellChicletMenu.Action"
|
||||
parameter="close all" />
|
||||
<menu_item_call.on_enable
|
||||
function="NotificationWellChicletMenu.EnableItem"
|
||||
parameter="can close all" />
|
||||
</menu_item_call>
|
||||
</context_menu>
|
||||
Loading…
Reference in New Issue