diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 112a2f662478d2d6e8bc659ed333a4bf987d4872..25ba7c365f4f76e48c614faac10e5547a0561f2f 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<LLFloaterProfile*>(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<LLFloaterProfile*>(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 f4eca1e92c0223f393dd960b53b7d32572e11063..86183cc1191f2e1f3596117d0c01c2f662f0438a 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -99,8 +99,10 @@ class LLAvatarActions 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 624075e9fdeaffc10e6bc15b75ed95a0466de5cc..6ccdace6c5d9ad49770b97a5cd5d7bd5e056a679 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 c2b90a1dce5dedbc83c25f91dedf90f209c8ee4c..b3ed02fc2c625929061a3d8a98e99c4fc5442fc6 100644 --- a/indra/newview/llfloaterprofile.h +++ b/indra/newview/llfloaterprofile.h @@ -52,6 +52,7 @@ class LLFloaterProfile : public LLFloater 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 2f4da59cfd10b1f2ea1b4a06fcdfb6a2494887b1..29c9329a266b64f45f8b4463ff568aefb09d1703 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 41533c137f1c86f58e26bebf3bd25614e4d4576c..ca6ef3f79459f375dd04f96286fad815d1120c31 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -382,6 +382,7 @@ class LLPanelProfile 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 bf8a67a03a2e14b337ffe39fcac5dd424d771b89..a3913ddc49e49e6ef021670adf1f532a1761a977 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -98,7 +98,7 @@ class LLClassifiedHandler : public LLCommandHandler, public LLAvatarPropertiesOb // 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<LLTabContainer>("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 9a9f2185e8f32d2123313e5954370f8b52e3b227..912819e86bce0729096def3ede8c3c0b76c48a05 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -80,6 +80,8 @@ class LLPanelProfileClassifieds void selectClassified(const LLUUID& classified_id, bool edit); + void createClassified(); + void processProperties(void* data, EAvatarProcessorType type) override; void resetData() override; @@ -108,6 +110,7 @@ class LLPanelProfileClassifieds LLUUID mClassifiedToSelectOnLoad; bool mClassifiedEditOnLoad; + bool mSheduledClassifiedCreation; }; diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index cf693f41b241fa156d96ca1bfc313d337df6ab43..774119f16975e48fdb88ab6a84acf6b327bff26c 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -77,10 +77,10 @@ class LLPickHandler : public LLCommandHandler 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())