From c4335939d90346a778eb18acb7611135742231df Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 10 Aug 2022 19:03:12 +0300 Subject: SL-17925 Fix SLURL based creation of picks and classifieds --- indra/newview/llavataractions.cpp | 40 +++++++++++++++++++++++++ indra/newview/llavataractions.h | 2 ++ indra/newview/llfloaterprofile.cpp | 5 ++++ indra/newview/llfloaterprofile.h | 1 + indra/newview/llpanelprofile.cpp | 6 +++- indra/newview/llpanelprofile.h | 1 + indra/newview/llpanelprofileclassifieds.cpp | 46 ++++++++++++++++++++++++++--- indra/newview/llpanelprofileclassifieds.h | 3 ++ indra/newview/llpanelprofilepicks.cpp | 7 +++-- 9 files changed, 103 insertions(+), 8 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 112a2f6624..25ba7c365f 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -63,12 +63,14 @@ #include "llnotificationsutil.h" // for LLNotificationsUtil #include "llpaneloutfitedit.h" #include "llpanelprofile.h" +#include "llparcel.h" #include "llrecentpeople.h" #include "lltrans.h" #include "llviewercontrol.h" #include "llviewerobjectlist.h" #include "llviewermessage.h" // for handle_lure #include "llviewernetwork.h" //LLGridManager +#include "llviewerparcelmgr.h" #include "llviewerregion.h" #include "lltrans.h" #include "llcallingcard.h" @@ -366,6 +368,34 @@ void LLAvatarActions::showPick(const LLUUID& avatar_id, const LLUUID& pick_id) } } +// static +void LLAvatarActions::createPick() +{ + LLFloaterProfile* profilefloater = dynamic_cast(LLFloaterReg::showInstance("profile", LLSD().with("id", gAgent.getID()))); + LLViewerRegion* region = gAgent.getRegion(); + if (profilefloater && region) + { + LLPickData data; + data.pos_global = gAgent.getPositionGlobal(); + data.sim_name = region->getName(); + + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (parcel) + { + data.name = parcel->getName(); + data.desc = parcel->getDesc(); + data.snapshot_id = parcel->getSnapshotID(); + data.parcel_id = parcel->getID(); + } + else + { + data.name = region->getName(); + } + + profilefloater->createPick(data); + } +} + // static bool LLAvatarActions::isPickTabSelected(const LLUUID& avatar_id) { @@ -406,6 +436,16 @@ void LLAvatarActions::showClassified(const LLUUID& avatar_id, const LLUUID& clas } } +// static +void LLAvatarActions::createClassified() +{ + LLFloaterProfile* profilefloater = dynamic_cast(LLFloaterReg::showInstance("profile", LLSD().with("id", gAgent.getID()))); + if (profilefloater) + { + profilefloater->createClassified(); + } +} + //static bool LLAvatarActions::profileVisible(const LLUUID& avatar_id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index f4eca1e92c..86183cc119 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -99,8 +99,10 @@ public: static void showProfile(const LLUUID& avatar_id); static void showPicks(const LLUUID& avatar_id); static void showPick(const LLUUID& avatar_id, const LLUUID& pick_id); + static void createPick(); static void showClassifieds(const LLUUID& avatar_id); static void showClassified(const LLUUID& avatar_id, const LLUUID& classified_id, bool edit = false); + static void createClassified(); static void hideProfile(const LLUUID& avatar_id); static bool profileVisible(const LLUUID& avatar_id); static bool isPickTabSelected(const LLUUID& avatar_id); diff --git a/indra/newview/llfloaterprofile.cpp b/indra/newview/llfloaterprofile.cpp index 624075e9fd..6ccdace6c5 100644 --- a/indra/newview/llfloaterprofile.cpp +++ b/indra/newview/llfloaterprofile.cpp @@ -156,6 +156,11 @@ void LLFloaterProfile::showClassified(const LLUUID& classified_id, bool edit) mPanelProfile->showClassified(classified_id, edit); } +void LLFloaterProfile::createClassified() +{ + mPanelProfile->createClassified(); +} + void LLFloaterProfile::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { mNameCallbackConnection.disconnect(); diff --git a/indra/newview/llfloaterprofile.h b/indra/newview/llfloaterprofile.h index c2b90a1dce..b3ed02fc2c 100644 --- a/indra/newview/llfloaterprofile.h +++ b/indra/newview/llfloaterprofile.h @@ -52,6 +52,7 @@ public: void refreshName(); void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false); + void createClassified(); private: LLAvatarNameCache::callback_connection_t mNameCallbackConnection; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 2f4da59cfd..29c9329a26 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -2646,5 +2646,9 @@ void LLPanelProfile::showClassified(const LLUUID& classified_id, bool edit) mTabContainer->selectTabPanel(mPanelClassifieds); } - +void LLPanelProfile::createClassified() +{ + mPanelClassifieds->createClassified(); + mTabContainer->selectTabPanel(mPanelClassifieds); +} diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 41533c137f..ca6ef3f794 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -382,6 +382,7 @@ public: void commitUnsavedChanges() override; void showClassified(const LLUUID& classified_id = LLUUID::null, bool edit = false); + void createClassified(); LLAvatarData getAvatarData() { return mAvatarData; }; diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index bf8a67a03a..a3913ddc49 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -98,7 +98,7 @@ public: // handle app/classified/create urls first if (params.size() == 1 && params[0].asString() == "create") { - LLAvatarActions::showClassifieds(gAgent.getID()); + LLAvatarActions::createClassified(); return true; } @@ -199,6 +199,7 @@ LLPanelProfileClassifieds::LLPanelProfileClassifieds() : LLPanelProfilePropertiesProcessorTab() , mClassifiedToSelectOnLoad(LLUUID::null) , mClassifiedEditOnLoad(false) + , mSheduledClassifiedCreation(false) { } @@ -254,6 +255,26 @@ void LLPanelProfileClassifieds::selectClassified(const LLUUID& classified_id, bo } } +void LLPanelProfileClassifieds::createClassified() +{ + if (getIsLoaded()) + { + mNoItemsLabel->setVisible(FALSE); + LLPanelProfileClassified* classified_panel = LLPanelProfileClassified::create(); + classified_panel->onOpen(LLSD()); + mTabContainer->addTabPanel( + LLTabContainer::TabPanelParams(). + panel(classified_panel). + select_tab(true). + label(classified_panel->getClassifiedName())); + updateButtons(); + } + else + { + mSheduledClassifiedCreation = true; + } +} + BOOL LLPanelProfileClassifieds::postBuild() { mTabContainer = getChild("tab_classifieds"); @@ -335,6 +356,7 @@ void LLPanelProfileClassifieds::processProperties(void* data, EAvatarProcessorTy // do not clear classified list in case we will receive two or more data packets. // list has been cleared in updateData(). (fix for EXT-6436) LLUUID selected_id = mClassifiedToSelectOnLoad; + bool has_selection = false; LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin(); for (; c_info->classifieds_list.end() != it; ++it) @@ -359,11 +381,27 @@ void LLPanelProfileClassifieds::processProperties(void* data, EAvatarProcessorTy if (selected_id == c_data.classified_id) { - mClassifiedToSelectOnLoad = LLUUID::null; - mClassifiedEditOnLoad = false; + has_selection = true; } } + if (mSheduledClassifiedCreation) + { + LLPanelProfileClassified* classified_panel = LLPanelProfileClassified::create(); + classified_panel->onOpen(LLSD()); + mTabContainer->addTabPanel( + LLTabContainer::TabPanelParams(). + panel(classified_panel). + select_tab(!has_selection). + label(classified_panel->getClassifiedName())); + has_selection = true; + } + + // reset 'do on load' values + mClassifiedToSelectOnLoad = LLUUID::null; + mClassifiedEditOnLoad = false; + mSheduledClassifiedCreation = false; + // set even if not visible, user might delete own // calassified and this string will need to be shown if (getSelfProfile()) @@ -377,7 +415,7 @@ void LLPanelProfileClassifieds::processProperties(void* data, EAvatarProcessorTy bool has_data = mTabContainer->getTabCount() > 0; mNoItemsLabel->setVisible(!has_data); - if (has_data && selected_id.isNull()) + if (has_data && !has_selection) { mTabContainer->selectFirstTab(); } diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index 9a9f2185e8..912819e86b 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -80,6 +80,8 @@ public: void selectClassified(const LLUUID& classified_id, bool edit); + void createClassified(); + void processProperties(void* data, EAvatarProcessorType type) override; void resetData() override; @@ -108,6 +110,7 @@ private: LLUUID mClassifiedToSelectOnLoad; bool mClassifiedEditOnLoad; + bool mSheduledClassifiedCreation; }; diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index cf693f41b2..774119f169 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -77,10 +77,10 @@ public: return true; } - // handle app/classified/create urls first + // handle app/pick/create urls first if (params.size() == 1 && params[0].asString() == "create") { - LLAvatarActions::showPicks(gAgent.getID()); + LLAvatarActions::createPick(); return true; } @@ -317,7 +317,6 @@ void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks) if (selected_id == pick_id) { - mPickToSelectOnLoad = LLUUID::null; has_selection = true; } } @@ -340,6 +339,8 @@ void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks) has_selection = true; } + // reset 'do on load' values + mPickToSelectOnLoad = LLUUID::null; mSheduledPickCreation.clear(); if (getSelfProfile()) -- cgit v1.2.3