diff --git a/indra/newview/llfloaterfeed.cpp b/indra/newview/llfloaterfeed.cpp index 0fb31467e..44aa7ed67 100644 --- a/indra/newview/llfloaterfeed.cpp +++ b/indra/newview/llfloaterfeed.cpp @@ -43,6 +43,7 @@ #include "llviewerwindow.h" #include "llwebprofile.h" #include "lluploaddialog.h" +#include "lltexteditor.h" #include @@ -52,7 +53,7 @@ LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) : LLFloater(std::string("Feed Floater")), - mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index) + mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index), mHasFirstMsgFocus(false) { } @@ -66,10 +67,26 @@ BOOL LLFloaterFeed::postBuild() { getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickCancel, this)); getChild("post_btn")->setCommitCallback(boost::bind(&LLFloaterFeed::onClickPost, this)); + LLTextEditor* caption = getChild("caption"); + if (caption) + { + // For the first time a user focusess to the msg box, all text will be selected. + caption->setFocusChangedCallback(boost::bind(&LLFloaterFeed::onMsgFormFocusRecieved, this, _1, caption)); + } + childSetFocus("cancel_btn", TRUE); return true; } +void LLFloaterFeed::onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption) +{ + if (caption && caption == receiver && caption->hasFocus() && !mHasFirstMsgFocus) + { + mHasFirstMsgFocus = true; + caption->setText(LLStringUtil::null); + } +} + // static LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, int index) { @@ -148,6 +165,12 @@ void LLFloaterFeed::onClose(bool app_quitting) void LLFloaterFeed::onClickPost() { + if (!mHasFirstMsgFocus) + { + // The user never switched focus to the messagee window. + // Using the default string. + childSetValue("caption", getString("default_message")); + } if (mPNGImage.notNull()) { static LLCachedControl add_location("SnapshotFeedAddLocation"); diff --git a/indra/newview/llfloaterfeed.h b/indra/newview/llfloaterfeed.h index a204906ba..8db4f3c79 100644 --- a/indra/newview/llfloaterfeed.h +++ b/indra/newview/llfloaterfeed.h @@ -38,6 +38,8 @@ class LLImagePNG; class LLViewerTexture; +class LLFocusableElement; +class LLTextEditor; class LLFloaterFeed : public LLFloater { @@ -53,12 +55,14 @@ public: void onClickCancel(); void onClickPost(); + void onMsgFormFocusRecieved(LLFocusableElement* receiver, LLTextEditor* caption); protected: LLPointer mPNGImage; LLPointer mViewerImage; LLVector2 const mImageScale; int mSnapshotIndex; + bool mHasFirstMsgFocus; }; #endif // LL_LLFLOATERFEED_H diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 31019099f..16321763a 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -343,7 +343,7 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data, gAgent.sendReliableMessage(); } - self->close(); + self->destroy(); } // static diff --git a/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml b/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml index 50bc3ae12..d5db42f91 100644 --- a/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml +++ b/indra/newview/skins/default/xui/en-us/floater_snapshot_feed.xml @@ -18,7 +18,9 @@ left="10" right="-10" type="string" - word_wrap="true"/> + word_wrap="true"> + Type your message here. + + + Click on the 'snapshot' link above to see the larger original. + "Uploading..."