SL-10798 FIXED [Legacy Profiles] 'Picks' toolbar button does nothing

master
maxim_productengine 2019-03-25 15:38:26 +02:00
parent 90297f2754
commit e0b24ee960
8 changed files with 60 additions and 4 deletions

View File

@ -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"
/>
<command name="places"
available_in_toybox="true"

View File

@ -381,6 +381,20 @@ void LLAvatarActions::showPick(const LLUUID& avatar_id, const LLUUID& pick_id)
}
}
// static
bool LLAvatarActions::isPickTabSelected(const LLUUID& avatar_id)
{
if (avatar_id.notNull())
{
LLFloaterProfile* profilefloater = LLFloaterReg::findTypedInstance<LLFloaterProfile>("profile", LLSD().with("id", avatar_id));
if (profilefloater)
{
return profilefloater->isPickTabSelected();
}
}
return false;
}
// static
void LLAvatarActions::showClassifieds(const LLUUID& avatar_id)
{

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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())

View File

@ -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);

View File

@ -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")));