diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llnotificationlistitem.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llnotificationlistitem.h | 10 |
2 files changed, 42 insertions, 10 deletions
diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 23a2399ed3..ddbc5f3916 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -99,14 +99,35 @@ LLNotificationListItem::~LLNotificationListItem() } //static -std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp) +std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp, ETimeType time_type) { - std::string timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/[" - +LLTrans::getString("LTimeDay")+"]/[" - +LLTrans::getString("LTimeYear")+"] [" - +LLTrans::getString("LTimeHour")+"]:[" - +LLTrans::getString("LTimeMin")+"]"; - + std::string timeStr; + switch(time_type) + { + case Local: + timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/[" + +LLTrans::getString("LTimeDay")+"]/[" + +LLTrans::getString("LTimeYear")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+ "]"; + break; + case UTC: + timeStr = "[" + LLTrans::getString("UTCTimeMth") + "]/[" + +LLTrans::getString("UTCTimeDay")+"]/[" + +LLTrans::getString("UTCTimeYr")+"] [" + +LLTrans::getString("UTCTimeHr")+"]:[" + +LLTrans::getString("UTCTimeMin")+"] [" + +LLTrans::getString("UTCTimeTimezone")+"]"; + break; + case SLT: + default: + timeStr = "[" + LLTrans::getString("TimeMonth") + "]/[" + +LLTrans::getString("TimeDay")+"]/[" + +LLTrans::getString("TimeYear")+"] [" + +LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"]"; + break; + } LLSD substitution; substitution["datetime"] = time_stamp; LLStringUtil::format(timeStr, substitution); @@ -330,11 +351,14 @@ BOOL LLGroupNoticeNotificationListItem::postBuild() mTitleBox->setValue(mParams.subject); mTitleBoxExp->setValue(mParams.subject); mNoticeTextExp->setValue(mParams.message); + + mTimeBox->setValue(buildNotificationDate(mParams.time_stamp, UTC)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.time_stamp, UTC)); //Workaround: in case server timestamp is 0 - we use the time when notification was actually received if (mParams.time_stamp.isNull()) { - mTimeBox->setValue(buildNotificationDate(mParams.received_time)); - mTimeBoxExp->setValue(buildNotificationDate(mParams.received_time)); + mTimeBox->setValue(buildNotificationDate(mParams.received_time, UTC)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.received_time, UTC)); } setSender(mParams.sender); diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index 6801e77342..d00016fc15 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -89,11 +89,19 @@ public: void setExpanded(BOOL value); virtual BOOL postBuild(); + + typedef enum e_time_type + { + SLT = 1, + Local = 2, + UTC = 3, + }ETimeType; + protected: LLNotificationListItem(const Params& p); virtual ~LLNotificationListItem(); - static std::string buildNotificationDate(const LLDate&); + static std::string buildNotificationDate(const LLDate& time_stamp, ETimeType time_type = SLT); void onClickExpandBtn(); void onClickCondenseBtn(); void onClickCloseBtn(); |