From e0b24ee960c7a7eebb9e7d6e4b5974973eb3da00 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 25 Mar 2019 15:38:26 +0200 Subject: SL-10798 FIXED [Legacy Profiles] 'Picks' toolbar button does nothing --- indra/newview/app_settings/commands.xml | 6 ++---- indra/newview/llavataractions.cpp | 14 ++++++++++++++ indra/newview/llavataractions.h | 1 + indra/newview/llfloaterprofile.cpp | 5 +++++ indra/newview/llfloaterprofile.h | 1 + indra/newview/llpanelprofile.cpp | 6 ++++++ indra/newview/llpanelprofile.h | 1 + indra/newview/llviewermenu.cpp | 30 ++++++++++++++++++++++++++++++ 8 files changed, 60 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 412d3a53b3..6bc7b47c6f 100644 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -175,10 +175,8 @@ icon="Command_Picks_Icon" label_ref="Command_Picks_Label" tooltip_ref="Command_Picks_Tooltip" - execute_function="Floater.ToggleOrBringToFront" - execute_parameters="picks" - is_running_function="Floater.IsOpen" - is_running_parameters="picks" + execute_function="Avatar.TogglePicks" + is_running_function="Avatar.IsPicksTabOpen" /> ("profile", LLSD().with("id", avatar_id)); + if (profilefloater) + { + return profilefloater->isPickTabSelected(); + } + } + return false; +} + // static void LLAvatarActions::showClassifieds(const LLUUID& avatar_id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 3383b3f5f9..6845d7675b 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -103,6 +103,7 @@ public: static void showClassified(const LLUUID& avatar_id, const LLUUID& classified_id, bool edit = false); static void hideProfile(const LLUUID& avatar_id); static bool profileVisible(const LLUUID& avatar_id); + static bool isPickTabSelected(const LLUUID& avatar_id); static LLFloater* getProfileFloater(const LLUUID& avatar_id); static void showProfileWeb(const LLUUID& avatar_id); diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp index 1bf5826c29..216bcb0580 100644 --- a/indra/newview/llfloaterprofile.cpp +++ b/indra/newview/llfloaterprofile.cpp @@ -79,6 +79,11 @@ void LLFloaterProfile::showPick(const LLUUID& pick_id) mPanelProfile->showPick(pick_id); } +bool LLFloaterProfile::isPickTabSelected() +{ + return mPanelProfile->isPickTabSelected(); +} + void LLFloaterProfile::showClassified(const LLUUID& classified_id, bool edit) { mPanelProfile->showClassified(classified_id, edit); diff --git a/indra/newview/llfloaterprofile.h b/indra/newview/llfloaterprofile.h index fa06347cee..22ed47e54f 100644 --- a/indra/newview/llfloaterprofile.h +++ b/indra/newview/llfloaterprofile.h @@ -43,6 +43,7 @@ public: /*virtual*/ BOOL postBuild(); void showPick(const LLUUID& pick_id = LLUUID::null); + bool isPickTabSelected(); void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 8fbd7fe726..3a772a8104 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -1476,6 +1476,12 @@ void LLPanelProfile::showPick(const LLUUID& pick_id) mTabContainer->selectTabPanel(mPanelPicks); } +bool LLPanelProfile::isPickTabSelected() +{ + return (mTabContainer->getCurrentPanel() == mPanelPicks); +} + + void LLPanelProfile::showClassified(const LLUUID& classified_id, bool edit) { if (classified_id.notNull()) diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 72f913b522..d9b70a7f35 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -393,6 +393,7 @@ public: void apply(); void showPick(const LLUUID& pick_id = LLUUID::null); + bool isPickTabSelected(); void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 40c9e65823..1ed02a9a61 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3476,6 +3476,11 @@ bool my_profile_visible() return floaterp && floaterp->isInVisibleChain(); } +bool picks_tab_visible() +{ + return my_profile_visible() && LLAvatarActions::isPickTabSelected(gAgentID); +} + bool enable_freeze_eject(const LLSD& avatar_id) { // Use avatar_id if available, otherwise default to right-click avatar @@ -6100,6 +6105,29 @@ class LLAvatarToggleMyProfile : public view_listener_t } }; +class LLAvatarTogglePicks : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + LLFloater* instance = LLAvatarActions::getProfileFloater(gAgent.getID()); + if (LLFloater::isMinimized(instance) || (instance && !instance->hasFocus() && !instance->getIsChrome())) + { + instance->setMinimized(FALSE); + instance->setFocus(TRUE); + LLAvatarActions::showPicks(gAgent.getID()); + } + else if (picks_tab_visible()) + { + instance->closeFloater(); + } + else + { + LLAvatarActions::showPicks(gAgent.getID()); + } + return true; + } +}; + class LLAvatarResetSkeleton: public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -9182,10 +9210,12 @@ void initialize_menus() enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall)); view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse"); view_listener_t::addMenu(new LLAvatarToggleMyProfile(), "Avatar.ToggleMyProfile"); + view_listener_t::addMenu(new LLAvatarTogglePicks(), "Avatar.TogglePicks"); view_listener_t::addMenu(new LLAvatarResetSkeleton(), "Avatar.ResetSkeleton"); view_listener_t::addMenu(new LLAvatarEnableResetSkeleton(), "Avatar.EnableResetSkeleton"); view_listener_t::addMenu(new LLAvatarResetSkeletonAndAnimations(), "Avatar.ResetSkeletonAndAnimations"); enable.add("Avatar.IsMyProfileOpen", boost::bind(&my_profile_visible)); + enable.add("Avatar.IsPicksTabOpen", boost::bind(&picks_tab_visible)); commit.add("Avatar.OpenMarketplace", boost::bind(&LLWeb::loadURLExternal, gSavedSettings.getString("MarketplaceURL"))); -- cgit v1.2.3