summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelclassified.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelclassified.cpp')
-rw-r--r--indra/newview/llpanelclassified.cpp102
1 files changed, 49 insertions, 53 deletions
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 9e4f9709a8..c77d089af7 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -40,11 +40,14 @@
#include "lldir.h"
#include "lldispatcher.h"
+#include "llfloaterreg.h"
#include "llparcel.h"
+#include "lltabcontainer.h"
#include "message.h"
#include "llagent.h"
#include "llalertdialog.h"
+#include "llavataractions.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llclassifiedflags.h"
@@ -52,13 +55,10 @@
#include "llcommandhandler.h" // for classified HTML detail page click tracking
#include "llviewercontrol.h"
#include "lllineeditor.h"
-#include "llfloateravatarinfo.h"
-#include "llfloaterclassified.h"
-#include "lltabcontainervertical.h"
#include "lltextbox.h"
#include "llcombobox.h"
-#include "llviewertexteditor.h"
#include "lltexturectrl.h"
+#include "lltexteditor.h"
#include "lluiconstants.h"
#include "llurldispatcher.h" // for classified HTML detail click teleports
#include "lluictrlfactory.h"
@@ -70,6 +70,7 @@
#include "llviewerregion.h"
#include "llviewerwindow.h" // for window width, height
#include "llappviewer.h" // abortQuit()
+#include "lltrans.h"
const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$
const S32 MATURE_UNDEFINED = -1;
@@ -141,7 +142,7 @@ public:
const bool from_search = true;
LLPanelClassified::sendClassifiedClickMessage(classified_id, "teleport", from_search);
// Invoke teleport
- LLWebBrowserCtrl* web = NULL;
+ LLMediaCtrl* web = NULL;
const bool trusted_browser = true;
return LLURLDispatcher::dispatch(url, web, trusted_browser);
}
@@ -151,7 +152,7 @@ LLClassifiedTeleportHandler gClassifiedTeleportHandler;
*/
LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search)
-: LLPanel(std::string("Classified Panel")),
+: LLPanel(),
mInFinder(in_finder),
mFromSearch(from_search),
mDirty(false),
@@ -231,44 +232,36 @@ void LLPanelClassified::reset()
BOOL LLPanelClassified::postBuild()
{
mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
- mSnapshotCtrl->setCommitCallback(onCommitAny);
- mSnapshotCtrl->setCallbackUserData(this);
+ mSnapshotCtrl->setCommitCallback(onCommitAny, this);
mSnapshotSize = mSnapshotCtrl->getRect();
mNameEditor = getChild<LLLineEditor>("given_name_editor");
mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN);
mNameEditor->setCommitOnFocusLost(TRUE);
mNameEditor->setFocusReceivedCallback(focusReceived, this);
- mNameEditor->setCommitCallback(onCommitAny);
- mNameEditor->setCallbackUserData(this);
+ mNameEditor->setCommitCallback(onCommitAny, this);
mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
mDescEditor = getChild<LLTextEditor>("desc_editor");
mDescEditor->setCommitOnFocusLost(TRUE);
mDescEditor->setFocusReceivedCallback(focusReceived, this);
- mDescEditor->setCommitCallback(onCommitAny);
- mDescEditor->setCallbackUserData(this);
- mDescEditor->setTabsToNextField(TRUE);
-
+ mDescEditor->setCommitCallback(onCommitAny, this);
+
mLocationEditor = getChild<LLLineEditor>("location_editor");
mSetBtn = getChild<LLButton>( "set_location_btn");
- mSetBtn->setClickedCallback(onClickSet);
- mSetBtn->setCallbackUserData(this);
+ mSetBtn->setClickedCallback(onClickSet, this);
mTeleportBtn = getChild<LLButton>( "classified_teleport_btn");
- mTeleportBtn->setClickedCallback(onClickTeleport);
- mTeleportBtn->setCallbackUserData(this);
+ mTeleportBtn->setClickedCallback(onClickTeleport, this);
mMapBtn = getChild<LLButton>( "classified_map_btn");
- mMapBtn->setClickedCallback(onClickMap);
- mMapBtn->setCallbackUserData(this);
+ mMapBtn->setClickedCallback(onClickMap, this);
if(mInFinder)
{
mProfileBtn = getChild<LLButton>( "classified_profile_btn");
- mProfileBtn->setClickedCallback(onClickProfile);
- mProfileBtn->setCallbackUserData(this);
+ mProfileBtn->setClickedCallback(onClickProfile, this);
}
mCategoryCombo = getChild<LLComboBox>( "classified_category_combo");
@@ -277,16 +270,14 @@ BOOL LLPanelClassified::postBuild()
iter != LLClassifiedInfo::sCategories.end();
iter++)
{
- mCategoryCombo->add(iter->second, (void *)((intptr_t)iter->first), ADD_BOTTOM);
+ mCategoryCombo->add(LLTrans::getString(iter->second), (void *)((intptr_t)iter->first), ADD_BOTTOM);
}
mCategoryCombo->setCurrentByIndex(0);
- mCategoryCombo->setCommitCallback(onCommitAny);
- mCategoryCombo->setCallbackUserData(this);
+ mCategoryCombo->setCommitCallback(onCommitAny, this);
mMatureCombo = getChild<LLComboBox>( "classified_mature_check");
mMatureCombo->setCurrentByIndex(0);
- mMatureCombo->setCommitCallback(onCommitAny);
- mMatureCombo->setCallbackUserData(this);
+ mMatureCombo->setCommitCallback(onCommitAny, this);
if (gAgent.wantsPGOnly())
{
// Teens don't get to set mature flag. JC
@@ -297,13 +288,11 @@ BOOL LLPanelClassified::postBuild()
if (!mInFinder)
{
mAutoRenewCheck = getChild<LLCheckBoxCtrl>( "auto_renew_check");
- mAutoRenewCheck->setCommitCallback(onCommitAny);
- mAutoRenewCheck->setCallbackUserData(this);
+ mAutoRenewCheck->setCommitCallback(onCommitAny, this);
}
mUpdateBtn = getChild<LLButton>("classified_update_btn");
- mUpdateBtn->setClickedCallback(onClickUpdate);
- mUpdateBtn->setCallbackUserData(this);
+ mUpdateBtn->setClickedCallback(onClickUpdate, this);
if (!mInFinder)
{
@@ -360,7 +349,7 @@ bool LLPanelClassified::saveCallback(const LLSD& notification, const LLSD& respo
LLFloater* parent_floater = gFloaterView->getParentFloater(this);
if (parent_floater)
{
- parent_floater->close();
+ parent_floater->closeFloater();
}
}
break;
@@ -455,10 +444,11 @@ void LLPanelClassified::setClickThrough(const LLUUID& classified_id,
if (self->mClickThroughText)
{
- std::string msg = llformat("Clicks: %d teleport, %d map, %d profile",
- self->mTeleportClicksNew + self->mTeleportClicksOld,
- self->mMapClicksNew + self->mMapClicksOld,
- self->mProfileClicksNew + self->mProfileClicksOld);
+ LLStringUtil::format_map_t args;
+ args["[TELEPORT]"] = llformat ("%d", self->mTeleportClicksNew + self->mTeleportClicksOld);
+ args["[MAP]"] = llformat ("%d", self->mMapClicksNew + self->mMapClicksOld);
+ args["[PROFILE]"] = llformat ("%d", self->mProfileClicksNew + self->mProfileClicksOld);
+ std::string msg = LLTrans::getString ("ClassifiedClicksTxt", args);
self->mClickThroughText->setText(msg);
}
}
@@ -623,7 +613,6 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
U32 date = 0;
msg->getU32Fast(_PREHASH_Data, _PREHASH_CreationDate, date);
time_t tim = date;
- tm *now=localtime(&tim);
// future use
U32 expiration_date = 0;
@@ -674,9 +663,13 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
self->mAutoRenewCheck->set(auto_renew);
}
- std::string datestr = llformat("%02d/%02d/%d", now->tm_mon+1, now->tm_mday, now->tm_year+1900);
+ std::string dateStr = self->getString("dateStr");
+ LLSD substitution;
+ substitution["datetime"] = (S32) tim;
+ LLStringUtil::format (dateStr, substitution);
+
LLStringUtil::format_map_t string_args;
- string_args["[DATE]"] = datestr;
+ string_args["[DATE]"] = dateStr;
string_args["[AMT]"] = llformat("%d", price_for_listing);
self->childSetText("classified_info_text", self->getString("ad_placed_paid", string_args));
@@ -846,7 +839,7 @@ void LLPanelClassified::gotMature()
if (mPaidFor)
{
LLNotification::Params params("PublishClassified");
- params.functor(boost::bind(&LLPanelClassified::confirmPublish, this, _1, _2));
+ params.functor.function(boost::bind(&LLPanelClassified::confirmPublish, this, _1, _2));
LLNotifications::instance().forceResponse(params, 0);
}
else
@@ -937,12 +930,12 @@ bool LLPanelClassified::confirmPublish(const LLSD& notification, const LLSD& res
void LLPanelClassified::onClickTeleport(void* data)
{
LLPanelClassified* self = (LLPanelClassified*)data;
-
- if (!self->mPosGlobal.isExactlyZero())
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+
+ if (!self->mPosGlobal.isExactlyZero()&&worldmap_instance)
{
- gAgent.teleportViaLocation(self->mPosGlobal);
- gFloaterWorldMap->trackLocation(self->mPosGlobal);
-
+ gAgent.teleportViaLocation(self->mPosGlobal);
+ worldmap_instance->trackLocation(self->mPosGlobal);
self->sendClassifiedClickMessage("teleport");
}
}
@@ -952,9 +945,12 @@ void LLPanelClassified::onClickTeleport(void* data)
void LLPanelClassified::onClickMap(void* data)
{
LLPanelClassified* self = (LLPanelClassified*)data;
- gFloaterWorldMap->trackLocation(self->mPosGlobal);
- LLFloaterWorldMap::show(NULL, TRUE);
-
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if(worldmap_instance)
+ {
+ worldmap_instance->trackLocation(self->mPosGlobal);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
self->sendClassifiedClickMessage("map");
}
@@ -962,7 +958,7 @@ void LLPanelClassified::onClickMap(void* data)
void LLPanelClassified::onClickProfile(void* data)
{
LLPanelClassified* self = (LLPanelClassified*)data;
- LLFloaterAvatarInfo::showFromDirectory(self->mCreatorID);
+ LLAvatarActions::showProfile(self->mCreatorID);
self->sendClassifiedClickMessage("profile");
}
@@ -984,7 +980,7 @@ void LLPanelClassified::onClickSet(void* data)
self->mPosGlobal = gAgent.getPositionGlobal();
std::string location_text;
- std::string regionName = "(will update after publish)";
+ std::string regionName = LLTrans::getString("ClassifiedUpdateAfterPublish");
LLViewerRegion* pRegion = gAgent.getRegion();
if (pRegion)
{
@@ -1065,7 +1061,7 @@ void LLPanelClassified::sendClassifiedClickMessage(const std::string& type)
////////////////////////////////////////////////////////////////////////////////////////////
LLFloaterPriceForListing::LLFloaterPriceForListing()
-: LLFloater(std::string("PriceForListing")),
+: LLFloater(LLSD()),
mCallback(NULL),
mUserData(NULL)
{ }
@@ -1101,7 +1097,7 @@ void LLFloaterPriceForListing::show( void (*callback)(S32, std::string, void*),
LLFloaterPriceForListing *self = new LLFloaterPriceForListing();
// Builds and adds to gFloaterView
- LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml");
+ LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml", NULL);
self->center();
self->mCallback = callback;
@@ -1129,7 +1125,7 @@ void LLFloaterPriceForListing::buttonCore(S32 button, void* data)
{
std::string text = self->childGetText("price_edit");
self->mCallback(button, text, self->mUserData);
- self->close();
+ self->closeFloater();
}
}