summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lltoastnotifypanel.cpp43
-rw-r--r--indra/newview/lltoastnotifypanel.h15
2 files changed, 57 insertions, 1 deletions
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 77d1d1fc0b..530110239e 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -54,7 +54,9 @@ S32 BUTTON_WIDTH = 90;
const LLFontGL* LLToastNotifyPanel::sFont = NULL;
const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL;
+LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal;
LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) :
+
LLToastPanel(notification),
mTextBox(NULL),
mInfoPanel(NULL),
@@ -202,6 +204,18 @@ mCloseNotificationOnDestroy(true)
// adjust panel's height to the text size
mInfoPanel->setFollowsAll();
snapToMessageHeight(mTextBox, MAX_LENGTH);
+
+ if(notification->getPayload()["reusable"].asBoolean())
+ {
+ mButtonClickConnection = sButtonClickSignal.connect(
+ boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2));
+
+ if(notification->isRespondedTo())
+ {
+ // User selected an option in toast, now disable required buttons in IM window
+ disableRespondedOptions(notification);
+ }
+ }
}
void LLToastNotifyPanel::addDefaultButton()
{
@@ -269,6 +283,8 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt
LLToastNotifyPanel::~LLToastNotifyPanel()
{
+ mButtonClickConnection.disconnect();
+
std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer());
if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL)
{
@@ -431,7 +447,7 @@ void LLToastNotifyPanel::onClickButton(void* data)
if(is_reusable)
{
- self->disableButtons(self->mNotification->getName(), button_name);
+ sButtonClickSignal(self->mNotification->getID(), button_name);
if(new_info)
{
@@ -445,3 +461,28 @@ void LLToastNotifyPanel::onClickButton(void* data)
self->mControlPanel->setEnabled(FALSE);
}
}
+
+void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name)
+{
+ if(mNotification->getID() == notification_id)
+ {
+ disableButtons(mNotification->getName(), btn_name);
+ }
+}
+
+void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification)
+{
+ LLSD response = notification->getResponse();
+ for (LLSD::map_const_iterator response_it = response.beginMap();
+ response_it != response.endMap(); ++response_it)
+ {
+ if (response_it->second.isBoolean() && response_it->second.asBoolean())
+ {
+ // that after multiple responses there can be many pressed buttons
+ // need to process them all
+ disableButtons(notification->getName(), response_it->first);
+ }
+ }
+}
+
+// EOF
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index 1539c613af..d565085e3c 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -108,6 +108,21 @@ private:
// internal handler for button being clicked
static void onClickButton(void* data);
+ typedef boost::signals2::signal <void (const LLUUID& notification_id, const std::string btn_name)>
+ button_click_signal_t;
+ static button_click_signal_t sButtonClickSignal;
+ boost::signals2::connection mButtonClickConnection;
+
+ /**
+ * handle sButtonClickSignal (to disable buttons) across all panels with given notification_id
+ */
+ void onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name);
+
+ /**
+ * Process response data. Will disable selected options
+ */
+ void disableRespondedOptions(LLNotificationPtr& notification);
+
bool mIsTip;
bool mAddedDefaultBtn;
bool mIsScriptDialog;