diff options
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index b2fc91f536..daea084759 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -845,14 +845,44 @@ void LLPanelAvatarClassified::refresh() bool allow_delete = (tab_count > 0); bool show_help = (tab_count == 0); - childSetEnabled("New...",self && allow_new); - childSetEnabled("Delete...",self && allow_delete); + // *HACK: Don't allow making new classifieds from inside the directory. + // The logic for save/don't save when closing is too hairy, and the + // directory is conceptually read-only. JC + bool in_directory = false; + LLView* view = this; + while (view) + { + if (view->getName() == "directory") + { + in_directory = true; + break; + } + view = view->getParent(); + } + childSetEnabled("New...", self && !in_directory && allow_new); + childSetVisible("New...", !in_directory); + childSetEnabled("Delete...", self && !in_directory && allow_delete); + childSetVisible("Delete...", !in_directory); childSetVisible("classified tab",!show_help); sendAvatarProfileRequestIfNeeded("avatarclassifiedsrequest"); } +BOOL LLPanelAvatarClassified::canClose() +{ + LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); + for (S32 i = 0; i < tabs->getTabCount(); i++) + { + LLPanelClassified* panel = (LLPanelClassified*)tabs->getPanelByIndex(i); + if (!panel->canClose()) + { + return FALSE; + } + } + return TRUE; +} + BOOL LLPanelAvatarClassified::titleIsValid() { LLTabContainerCommon* tabs = LLViewerUICtrlFactory::getTabContainerByName(this, "classified tab"); @@ -1280,6 +1310,11 @@ LLPanelAvatar::~LLPanelAvatar() } +BOOL LLPanelAvatar::canClose() +{ + return mPanelClassified && mPanelClassified->canClose(); +} + void LLPanelAvatar::setAvatar(LLViewerObject *avatarp) { // find the avatar and grab the name |