diff options
author | richard <none@none> | 2009-12-17 10:03:56 -0800 |
---|---|---|
committer | richard <none@none> | 2009-12-17 10:03:56 -0800 |
commit | 724f5fbb7f7b101774c0cf3ff43bb98f9cc4ffc1 (patch) | |
tree | bfb7b4009b32761f9f760f97dd97cc0697667a71 /indra/newview/llpanelpicks.cpp | |
parent | 9ff869a6b287a2b4b8c94219584d1c7b66ebb399 (diff) | |
parent | cf63ce4dc1176d9df4fe852821e4a6d32332f7c6 (diff) |
merge
Diffstat (limited to 'indra/newview/llpanelpicks.cpp')
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 107 |
1 files changed, 66 insertions, 41 deletions
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 7d21867efc..4d22d96072 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -38,12 +38,14 @@ #include "llagentpicksinfo.h" #include "llavatarconstants.h" #include "llcommandhandler.h" +#include "lldispatcher.h" #include "llflatlistview.h" #include "llfloaterreg.h" #include "llfloaterworldmap.h" #include "llnotificationsutil.h" #include "lltexturectrl.h" #include "lltoggleablemenu.h" +#include "lltrans.h" #include "llviewergenericmessage.h" // send_generic_message #include "llmenugl.h" #include "llviewermenu.h" @@ -56,7 +58,6 @@ #include "llpanelprofile.h" #include "llpanelpick.h" #include "llpanelclassified.h" -#include "llpanelprofileview.h" #include "llsidetray.h" static const std::string XML_BTN_NEW = "new_btn"; @@ -87,6 +88,14 @@ public: bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { + // handle app/classified/create urls first + if (params.size() == 1 && params[0].asString() == "create") + { + createClassified(); + return true; + } + + // then handle the general app/classified/{UUID}/{CMD} urls if (params.size() < 2) { return false; @@ -113,6 +122,31 @@ public: return false; } + void createClassified() + { + // open the new classified panel on the Me > Picks sidetray + LLSD params; + params["id"] = gAgent.getID(); + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "create_classified"; + LLSideTray::getInstance()->showPanel("panel_me", params); + } + + void openClassified(LLAvatarClassifiedInfo* c_info) + { + // open the classified info panel on the Me > Picks sidetray + LLSD params; + params["id"] = c_info->creator_id; + params["open_tab_name"] = "panel_picks"; + params["show_tab_panel"] = "classified_details"; + params["classified_id"] = c_info->classified_id; + params["classified_avatar_id"] = c_info->creator_id; + params["classified_snapshot_id"] = c_info->snapshot_id; + params["classified_name"] = c_info->name; + params["classified_desc"] = c_info->description; + LLSideTray::getInstance()->showPanel("panel_profile_view", params); + } + /*virtual*/ void processProperties(void* data, EAvatarProcessorType type) { if (APT_CLASSIFIED_INFO != type) @@ -127,22 +161,8 @@ public: return; } - // open the people profile page for the classified's owner - LLSD params; - params["id"] = c_info->creator_id; - params["classified"] = c_info->classified_id; - params["open_tab_name"] = "panel_profile"; - LLPanelProfileView *profile = dynamic_cast<LLPanelProfileView*>(LLSideTray::getInstance()->showPanel("panel_profile_view", params)); - - // then open the classified panel on this user's profile panel - if (profile) - { - LLPanelPicks* panel_picks = profile->getChild<LLPanelPicks>("panel_picks"); - if (panel_picks) - { - panel_picks->openClassifiedInfo(c_info); - } - } + // open the detail side tray for this classified + openClassified(c_info); // remove our observer now that we're done mClassifiedIds.erase(c_info->classified_id); @@ -197,7 +217,9 @@ LLPanelPicks::LLPanelPicks() mClassifiedsAccTab(NULL), mPanelClassifiedInfo(NULL), mPanelClassifiedEdit(NULL), - mClickThroughDisp(NULL) + mClickThroughDisp(NULL), + mNoClassifieds(false), + mNoPicks(false) { mClickThroughDisp = new LLClassifiedClickThrough(); gGenericDispatcher.addHandler("classifiedclickthrough", mClickThroughDisp); @@ -223,6 +245,11 @@ void LLPanelPicks::updateData() // Send Picks request only when we need to, not on every onOpen(during tab switch). if(isDirty()) { + mNoPicks = false; + mNoClassifieds = false; + + childSetValue("picks_panel_text", LLTrans::getString("PicksClassifiedsLoadingText")); + mPicksList->clear(); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(getAvatarId()); @@ -283,6 +310,8 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) resetDirty(); updateButtons(); } + + mNoPicks = !mPicksList->size(); } else if(APT_CLASSIFIEDS == type) { @@ -316,9 +345,14 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type) resetDirty(); updateButtons(); } + + mNoClassifieds = !mClassifiedsList->size(); + } + + if (mNoPicks && mNoClassifieds) + { + childSetValue("picks_panel_text", LLTrans::getString("NoPicksClassifiedsText")); } - if(!mPicksList->size() && !mClassifiedsList->size()) - childSetVisible("empty_picks_panel_text", true); } LLPickItem* LLPanelPicks::getSelectedPickItem() @@ -692,33 +726,24 @@ void LLPanelPicks::openClassifiedInfo() LLClassifiedItem* c_item = getSelectedClassifiedItem(); - createClassifiedInfoPanel(); - - LLSD params; - params["classified_id"] = c_item->getClassifiedId(); - params["avatar_id"] = c_item->getAvatarId(); - params["snapshot_id"] = c_item->getSnapshotId(); - params["name"] = c_item->getClassifiedName(); - params["desc"] = c_item->getDescription(); - - getProfilePanel()->openPanel(mPanelClassifiedInfo, params); + openClassifiedInfo(c_item->getClassifiedId(), c_item->getAvatarId(), + c_item->getSnapshotId(), c_item->getClassifiedName(), + c_item->getDescription()); } -void LLPanelPicks::openClassifiedInfo(LLAvatarClassifiedInfo *c_info) +void LLPanelPicks::openClassifiedInfo(const LLUUID &classified_id, + const LLUUID &avatar_id, + const LLUUID &snapshot_id, + const std::string &name, const std::string &desc) { - if (! c_info) - { - return; - } - createClassifiedInfoPanel(); LLSD params; - params["classified_id"] = c_info->classified_id; - params["avatar_id"] = c_info->creator_id; - params["snapshot_id"] = c_info->snapshot_id; - params["name"] = c_info->name; - params["desc"] = c_info->description; + params["classified_id"] = classified_id; + params["avatar_id"] = avatar_id; + params["snapshot_id"] = snapshot_id; + params["name"] = name; + params["desc"] = desc; getProfilePanel()->openPanel(mPanelClassifiedInfo, params); } |