diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewer.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.cpp | 67 | ||||
-rw-r--r-- | indra/newview/llpanelgroup.h | 8 |
3 files changed, 85 insertions, 1 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ddc818172d..fd449d4190 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -78,6 +78,8 @@ #include "lllocationhistory.h" #include "llfasttimerview.h" #include "llvoicechannel.h" +#include "llsidetray.h" + #include "llweb.h" #include "llsecondlifeurls.h" @@ -2858,6 +2860,8 @@ void LLAppViewer::requestQuit() gFloaterView->closeAllChildren(true); } + LLSideTray::getInstance()->notifyChildren(LLSD().with("request","quit")); + send_stats(); gLogoutTimer.reset(); @@ -3762,6 +3766,13 @@ void LLAppViewer::idleShutdown() { return; } + + if (LLSideTray::getInstance()->notifyChildren(LLSD().with("request","wait_quit"))) + { + return; + } + + // ProductEngine: Try moving this code to where we shut down sTextureCache in cleanup() // *TODO: ugly diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 2cb3967685..e0f159cfeb 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -90,6 +90,7 @@ LLPanelGroup::LLPanelGroup() : LLPanel(), LLGroupMgrObserver( LLUUID() ), mAllowEdit( TRUE ) + ,mShowingNotifyDialog(false) { // Set up the factory callbacks. // Roles sub tabs @@ -538,3 +539,69 @@ void LLPanelGroup::showNotice(const std::string& subject, } +bool LLPanelGroup::canClose() +{ + if(getVisible() == false) + return true; + + bool need_save = false; + std::string mesg; + for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it) + if(need_save|=(*it)->needsApply(mesg)) + break; + if(!need_save) + return false; + // If no message was provided, give a generic one.
+ if (mesg.empty())
+ {
+ mesg = mDefaultNeedsApplyMesg;
+ }
+ // Create a notify box, telling the user about the unapplied tab.
+ LLSD args;
+ args["NEEDS_APPLY_MESSAGE"] = mesg;
+ args["WANT_APPLY_MESSAGE"] = mWantApplyMesg;
+
+ LLNotificationsUtil::add("SaveChanges", args, LLSD(), boost::bind(&LLPanelGroup::handleNotifyCallback,this, _1, _2));
+
+ mShowingNotifyDialog = true;
+
+ return false;
+} + +bool LLPanelGroup::notifyChildren(const LLSD& info) +{ + if(info.has("request") && mID.isNull() ) + { + std::string str_action = info["request"]; + + if (str_action == "quit" ) + { + canClose();
+ return true;
+ } + if(str_action == "wait_quit") + return mShowingNotifyDialog; + } + return false; +} +bool LLPanelGroup::handleNotifyCallback(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+ mShowingNotifyDialog = false;
+ switch (option)
+ {
+ case 0: // "Apply Changes"
+ apply();
+ break;
+ case 1: // "Ignore Changes"
+ break;
+ case 2: // "Cancel"
+ default:
+ // Do nothing. The user is canceling the action.
+ // If we were quitting, we didn't really mean it.
+ LLAppViewer::instance()->abortQuit();
+ break;
+ }
+ return false;
+}
+ diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h index 306e6575fc..f6aefdb676 100644 --- a/indra/newview/llpanelgroup.h +++ b/indra/newview/llpanelgroup.h @@ -89,7 +89,10 @@ public: const std::string& inventory_name, LLOfferInfo* inventory_offer); - + + bool notifyChildren (const LLSD& info); + bool handleNotifyCallback(const LLSD&, const LLSD&); + protected: virtual void update(LLGroupChange gc); @@ -107,6 +110,9 @@ protected: protected: bool apply(LLPanelGroupTab* tab); + bool canClose(); + + bool mShowingNotifyDialog; LLTimer mRefreshTimer; |