diff --git a/indra/newview/llpanelmsgs.cpp b/indra/newview/llpanelmsgs.cpp index e1afe8a1f..95bb24e0a 100644 --- a/indra/newview/llpanelmsgs.cpp +++ b/indra/newview/llpanelmsgs.cpp @@ -3,10 +3,9 @@ * @brief Message popup preferences panel * * $LicenseInfo:firstyear=2003&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2003-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -34,36 +33,30 @@ #include "llpanelmsgs.h" -#include "llnotificationsutil.h" #include "llscrolllistctrl.h" -#include "llviewerwindow.h" -#include "llviewercontrol.h" #include "lluictrlfactory.h" #include "llfirstuse.h" #include "llnotificationtemplate.h" -//----------------------------------------------------------------------------- -LLPanelMsgs::LLPanelMsgs() : - LLPanel("Messages Panel") +LLPanelMsgs::LLPanelMsgs() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_popups.xml"); } LLPanelMsgs::~LLPanelMsgs() -{ } +{ +} -//----------------------------------------------------------------------------- -// postBuild() -//----------------------------------------------------------------------------- BOOL LLPanelMsgs::postBuild() { - childSetAction("enable_popup", onClickEnablePopup, this); - childSetAction("reset_dialogs_btn", onClickResetDialogs, this); - childSetAction("skip_dialogs_btn", onClickSkipDialogs, this); - childSetAction("skip_frst_btn", onClickSkipFirstTime, this); + getChild("enable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickEnablePopup, this)); + getChild("disable_popup")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickDisablePopup, this)); + getChild("reset_dialogs_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickResetDialogs, this)); + getChild("skip_dialogs_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickSkipDialogs, this)); + getChild("skip_frst_btn")->setCommitCallback(boost::bind(&LLPanelMsgs::onClickSkipFirstTime, this)); - buildLists(); + buildPopupLists(); childSetValue("accept_new_inventory", gSavedSettings.getBOOL("AutoAcceptNewInventory")); childSetValue("show_new_inventory", gSavedSettings.getBOOL("ShowNewInventory")); @@ -72,8 +65,18 @@ BOOL LLPanelMsgs::postBuild() return TRUE; } +void LLPanelMsgs::draw() +{ + BOOL has_first_selected = (getChildRef("disabled_popups").getFirstSelected()!=NULL); + childSetEnabled("enable_popup", has_first_selected); -void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in v3 + has_first_selected = (getChildRef("enabled_popups").getFirstSelected()!=NULL); + childSetEnabled("disable_popup", has_first_selected); + + LLPanel::draw(); +} + +void LLPanelMsgs::buildPopupLists() //void LLFloaterPreference::buildPopupLists() in v3 { LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); @@ -103,7 +106,7 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in LLStringUtil::format(ignore_msg,notification->getSubstitutions()); row["columns"][0]["value"] = ignore_msg; row["columns"][0]["font"] = "SANSSERIF_SMALL"; - row["columns"][0]["width"] = 300; + row["columns"][0]["width"] = 500; LLScrollListItem* item = NULL; @@ -129,13 +132,11 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in row["columns"][1]["font"] = "SANSSERIF_SMALL"; row["columns"][1]["width"] = 160; } - item = disabled_popups.addElement(row, - ADD_SORTED); + item = disabled_popups.addElement(row, ADD_SORTED); } else { - item = enabled_popups.addElement(row, - ADD_SORTED); + item = enabled_popups.addElement(row, ADD_SORTED); } if (item) @@ -145,22 +146,6 @@ void LLPanelMsgs::buildLists() //void LLFloaterPreference::buildPopupLists() in } } -void LLPanelMsgs::draw() -{ - LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); - - if (disabled_popups.getFirstSelected()) - { - childEnable("enable_popup"); - } - else - { - childDisable("enable_popup"); - } - - LLPanel::draw(); -} - void LLPanelMsgs::apply() { @@ -173,6 +158,36 @@ void LLPanelMsgs::cancel() { } +void LLPanelMsgs::onClickEnablePopup() +{ + LLScrollListCtrl& disabled_popups = getChildRef("disabled_popups"); + + std::vector items = disabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + gSavedSettings.setWarning(templatep->mName, TRUE); + } + + buildPopupLists(); +} + +void LLPanelMsgs::onClickDisablePopup() +{ + LLScrollListCtrl& enabled_popups = getChildRef("enabled_popups"); + + std::vector items = enabled_popups.getAllSelected(); + std::vector::iterator itor; + for (itor = items.begin(); itor != items.end(); ++itor) + { + LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); + gSavedSettings.setWarning(templatep->mName, false); + } + + buildPopupLists(); +} + void LLPanelMsgs::resetAllIgnored() { for (LLNotificationTemplates::TemplateMap::const_iterator iter = LLNotificationTemplates::instance().templatesBegin(); @@ -199,70 +214,22 @@ void LLPanelMsgs::setAllIgnored() } } -//static -void LLPanelMsgs::onClickEnablePopup(void* user_data) +void LLPanelMsgs::onClickResetDialogs() { - LLPanelMsgs* panelp = (LLPanelMsgs*)user_data; - - LLScrollListCtrl& disabled_popups = panelp->getChildRef("disabled_popups"); - - std::vector items = disabled_popups.getAllSelected(); - std::vector::iterator itor; - for (itor = items.begin(); itor != items.end(); ++itor) - { - LLNotificationTemplatePtr templatep = LLNotificationTemplates::instance().getTemplate(*(std::string*)((*itor)->getUserdata())); - gSavedSettings.setWarning(templatep->mName, TRUE); - } - - panelp->buildLists(); + resetAllIgnored(); + LLFirstUse::resetFirstUse(); + buildPopupLists(); } -bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp) +void LLPanelMsgs::onClickSkipDialogs() { - S32 option = LLNotification::getSelectedOption(notification, response); - if (0 == option) - { - if ( panelp ) - { - panelp->resetAllIgnored(); - LLFirstUse::resetFirstUse(); - panelp->buildLists(); - } - } - return false; + setAllIgnored(); + LLFirstUse::disableFirstUse(); + buildPopupLists(); } -// static -void LLPanelMsgs::onClickResetDialogs(void* user_data) -{ - LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, (LLPanelMsgs*)user_data)); -} - -bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLPanelMsgs* panelp) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - if (0 == option) - { - if ( panelp ) - { - panelp->setAllIgnored(); - LLFirstUse::disableFirstUse(); - panelp->buildLists(); - } - } - return false; -} - -// static -void LLPanelMsgs::onClickSkipDialogs(void* user_data) -{ - LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, (LLPanelMsgs*)user_data)); -} - -// static -void LLPanelMsgs::onClickSkipFirstTime(void* user_data) +void LLPanelMsgs::onClickSkipFirstTime() { LLFirstUse::disableFirstUse(); - LLPanelMsgs* panelp = (LLPanelMsgs*)user_data; - if(panelp) panelp->buildLists(); + buildPopupLists(); } diff --git a/indra/newview/llpanelmsgs.h b/indra/newview/llpanelmsgs.h index 1ab642809..0ff3243ec 100644 --- a/indra/newview/llpanelmsgs.h +++ b/indra/newview/llpanelmsgs.h @@ -3,10 +3,9 @@ * @brief Message popup preferences panel * * $LicenseInfo:firstyear=2003&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2003-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -35,29 +34,26 @@ #include "llpanel.h" -class LLScrollListCtrl; - class LLPanelMsgs : public LLPanel { public: LLPanelMsgs(); /*virtual*/ ~LLPanelMsgs(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); - void apply(); void cancel(); + /*virtual*/ void draw(); + /*virtual*/ BOOL postBuild(); - static void onClickEnablePopup(void* user_data); - static void onClickResetDialogs(void* user_data); - static void onClickSkipDialogs(void* user_data); - static void onClickSkipFirstTime(void* user_data); - - void buildLists(); - + void onClickEnablePopup(); + void onClickDisablePopup(); void resetAllIgnored(); void setAllIgnored(); + void onClickResetDialogs(); + void onClickSkipDialogs(); + void onClickSkipFirstTime(); + + void buildPopupLists(); }; #endif // LL_PANEL_MSGS diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 58f8eadb1..3599a2853 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -1141,28 +1141,6 @@ Please select a proposal to view. Please select a history item to view. - -Would you like to re-enable all these popups, which you previously indicated 'Don't show me again'? - - - - -Would you like to disable all popups which can be skipped? - - - - Do not show these popups: - -