aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterpostcard.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llfloaterpostcard.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llfloaterpostcard.cpp')
-rw-r--r--linden/indra/newview/llfloaterpostcard.cpp57
1 files changed, 18 insertions, 39 deletions
diff --git a/linden/indra/newview/llfloaterpostcard.cpp b/linden/indra/newview/llfloaterpostcard.cpp
index f866e49..47f59a6 100644
--- a/linden/indra/newview/llfloaterpostcard.cpp
+++ b/linden/indra/newview/llfloaterpostcard.cpp
@@ -67,7 +67,8 @@
67/// Local function declarations, constants, enums, and typedefs 67/// Local function declarations, constants, enums, and typedefs
68///---------------------------------------------------------------------------- 68///----------------------------------------------------------------------------
69 69
70LLLinkedList<LLFloaterPostcard> LLFloaterPostcard::sInstances; 70//static
71LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances;
71 72
72///---------------------------------------------------------------------------- 73///----------------------------------------------------------------------------
73/// Class LLFloaterPostcard 74/// Class LLFloaterPostcard
@@ -97,13 +98,13 @@ void LLFloaterPostcard::init()
97 gAgent.sendReliableMessage(); 98 gAgent.sendReliableMessage();
98 } 99 }
99 100
100 sInstances.addData(this); 101 sInstances.insert(this);
101} 102}
102 103
103// Destroys the object 104// Destroys the object
104LLFloaterPostcard::~LLFloaterPostcard() 105LLFloaterPostcard::~LLFloaterPostcard()
105{ 106{
106 sInstances.removeData(this); 107 sInstances.erase(this);
107 mJPEGImage = NULL; // deletes image 108 mJPEGImage = NULL; // deletes image
108} 109}
109 110
@@ -113,25 +114,12 @@ BOOL LLFloaterPostcard::postBuild()
113 childSetAction("send_btn", onClickSend, this); 114 childSetAction("send_btn", onClickSend, this);
114 115
115 childDisable("from_form"); 116 childDisable("from_form");
116 childSetAction("publish_help_btn", onClickPublishHelp, this);
117 117
118 if (gAgent.isTeen()) 118 std::string name_string;
119 {
120 // Disable these buttons if they are PG (Teen) users
121 childDisable("allow_publish_check");
122 childHide("allow_publish_check");
123 childDisable("publish_help_btn");
124 childHide("publish_help_btn");
125 childDisable("mature_check");
126 childHide("mature_check");
127 }
128
129 LLString name_string;
130 gAgent.buildFullname(name_string); 119 gAgent.buildFullname(name_string);
131
132 childSetValue("name_form", LLSD(name_string)); 120 childSetValue("name_form", LLSD(name_string));
133 121
134 LLTextEditor *MsgField = LLUICtrlFactory::getTextEditorByName(this, "msg_form"); 122 LLTextEditor* MsgField = LLUICtrlFactory::getTextEditorByName(this, "msg_form");
135 if (MsgField) 123 if (MsgField)
136 { 124 {
137 MsgField->setWordWrap(TRUE); 125 MsgField->setWordWrap(TRUE);
@@ -170,9 +158,9 @@ void LLFloaterPostcard::draw()
170 LLGLSUIDefault gls_ui; 158 LLGLSUIDefault gls_ui;
171 LLFloater::draw(); 159 LLFloater::draw();
172 160
173 if(getVisible() && !mMinimized && mViewerImage.notNull() && mJPEGImage.notNull()) 161 if(getVisible() && !isMinimized() && mViewerImage.notNull() && mJPEGImage.notNull())
174 { 162 {
175 LLRect rect(mRect); 163 LLRect rect(getRect());
176 164
177 // first set the max extents of our preview 165 // first set the max extents of our preview
178 rect.translate(-rect.mLeft, -rect.mBottom); 166 rect.translate(-rect.mLeft, -rect.mBottom);
@@ -252,8 +240,8 @@ void LLFloaterPostcard::onClickSend(void* data)
252 { 240 {
253 LLFloaterPostcard *self = (LLFloaterPostcard *)data; 241 LLFloaterPostcard *self = (LLFloaterPostcard *)data;
254 242
255 LLString from(self->childGetValue("from_form").asString().c_str()); 243 std::string from(self->childGetValue("from_form").asString());
256 LLString to(self->childGetValue("to_form").asString().c_str()); 244 std::string to(self->childGetValue("to_form").asString());
257 245
258 if (to.empty() || to.find('@') == std::string::npos) 246 if (to.empty() || to.find('@') == std::string::npos)
259 { 247 {
@@ -267,7 +255,7 @@ void LLFloaterPostcard::onClickSend(void* data)
267 return; 255 return;
268 } 256 }
269 257
270 LLString subject(self->childGetValue("subject_form").asString().c_str()); 258 std::string subject(self->childGetValue("subject_form").asString());
271 if(subject.empty() || !self->mHasFirstMsgFocus) 259 if(subject.empty() || !self->mHasFirstMsgFocus)
272 { 260 {
273 gViewerWindow->alertXml("PromptMissingSubjMsg", missingSubjMsgAlertCallback, self); 261 gViewerWindow->alertXml("PromptMissingSubjMsg", missingSubjMsgAlertCallback, self);
@@ -286,12 +274,6 @@ void LLFloaterPostcard::onClickSend(void* data)
286} 274}
287 275
288// static 276// static
289void LLFloaterPostcard::onClickPublishHelp(void* data)
290{
291 gViewerWindow->alertXml("ClickPublishHelpPostcard");
292}
293
294// static
295void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed) 277void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, S32 result, LLExtStat ext_status) // StoreAssetData callback (fixed)
296{ 278{
297 LLFloaterPostcard *self = (LLFloaterPostcard *)user_data; 279 LLFloaterPostcard *self = (LLFloaterPostcard *)user_data;
@@ -321,8 +303,8 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
321 msg->addString("Name", self->childGetValue("name_form").asString()); 303 msg->addString("Name", self->childGetValue("name_form").asString());
322 msg->addString("Subject", self->childGetValue("subject_form").asString()); 304 msg->addString("Subject", self->childGetValue("subject_form").asString());
323 msg->addString("Msg", self->childGetValue("msg_form").asString()); 305 msg->addString("Msg", self->childGetValue("msg_form").asString());
324 msg->addBOOL("AllowPublish", self->childGetValue("allow_publish_check").asBoolean()); 306 msg->addBOOL("AllowPublish", FALSE);
325 msg->addBOOL("MaturePublish", self->childGetValue("mature_check").asBoolean()); 307 msg->addBOOL("MaturePublish", FALSE);
326 gAgent.sendReliableMessage(); 308 gAgent.sendReliableMessage();
327 } 309 }
328 310
@@ -332,11 +314,10 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
332// static 314// static
333void LLFloaterPostcard::updateUserInfo(const char *email) 315void LLFloaterPostcard::updateUserInfo(const char *email)
334{ 316{
335 LLFloaterPostcard *instance; 317 for (instance_list_t::iterator iter = sInstances.begin();
336 318 iter != sInstances.end(); ++iter)
337 sInstances.resetList();
338 while ((instance = sInstances.getNextData()))
339 { 319 {
320 LLFloaterPostcard *instance = *iter;
340 const LLString& text = instance->childGetValue("from_form").asString(); 321 const LLString& text = instance->childGetValue("from_form").asString();
341 if (text.empty()) 322 if (text.empty())
342 { 323 {
@@ -371,14 +352,14 @@ void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data)
371 if((self->childGetValue("subject_form").asString()).empty()) 352 if((self->childGetValue("subject_form").asString()).empty())
372 { 353 {
373 // Stuff the subject back into the form. 354 // Stuff the subject back into the form.
374 self->childSetValue("subject_form", self->childGetText("default_subject")); 355 self->childSetValue("subject_form", self->getString("default_subject"));
375 } 356 }
376 357
377 if(!self->mHasFirstMsgFocus) 358 if(!self->mHasFirstMsgFocus)
378 { 359 {
379 // The user never switched focus to the messagee window. 360 // The user never switched focus to the messagee window.
380 // Using the default string. 361 // Using the default string.
381 self->childSetValue("msg_form", self->childGetText("default_message")); 362 self->childSetValue("msg_form", self->getString("default_message"));
382 } 363 }
383 364
384 self->sendPostcard(); 365 self->sendPostcard();
@@ -405,8 +386,6 @@ void LLFloaterPostcard::sendPostcard()
405 body["name"] = childGetValue("name_form").asString(); 386 body["name"] = childGetValue("name_form").asString();
406 body["subject"] = childGetValue("subject_form").asString(); 387 body["subject"] = childGetValue("subject_form").asString();
407 body["msg"] = childGetValue("msg_form").asString(); 388 body["msg"] = childGetValue("msg_form").asString();
408 body["allow-publish"] = childGetValue("allow_publish_check").asBoolean();
409 body["mature-publish"] = childGetValue("mature_check").asBoolean();
410 LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG)); 389 LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG));
411 } 390 }
412 else 391 else