diff options
author | Logan Dethrow <log@lindenlab.com> | 2011-09-19 14:50:08 -0400 |
---|---|---|
committer | Logan Dethrow <log@lindenlab.com> | 2011-09-19 14:50:08 -0400 |
commit | 5b7b3cbbbbec439880a33af8944d10c7bb527c3a (patch) | |
tree | 3e37afeba3e2bb67f53327719de72b4506d2605e /indra/newview/llpanelmarketplaceinboxinventory.cpp | |
parent | c7dd3aac83eb9bde5fe0febaebcd998847bf1889 (diff) | |
parent | 2fba01d160716b886a7dfc0c86abda767a25d23f (diff) |
Merge
Diffstat (limited to 'indra/newview/llpanelmarketplaceinboxinventory.cpp')
-rw-r--r-- | indra/newview/llpanelmarketplaceinboxinventory.cpp | 94 |
1 files changed, 72 insertions, 22 deletions
diff --git a/indra/newview/llpanelmarketplaceinboxinventory.cpp b/indra/newview/llpanelmarketplaceinboxinventory.cpp index 2c97d539a1..d51aa73c93 100644 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp @@ -37,6 +37,8 @@ #include "llviewerfoldertype.h" +#define DEBUGGING_FRESHNESS 0 + // // statics // @@ -66,7 +68,7 @@ void LLInboxInventoryPanel::buildFolderView(const LLInventoryPanel::Params& para LLUUID root_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_INBOX, false, false); - // leslie -- temporary HACK to work around sim not creating inbox and outbox with proper system folder type + // leslie -- temporary HACK to work around sim not creating inbox with proper system folder type if (root_id.isNull()) { std::string start_folder_name(params.start_folder()); @@ -133,6 +135,27 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge return LLUICtrlFactory::create<LLInboxFolderViewFolder>(params); } +LLFolderViewItem * LLInboxInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge) +{ + LLFolderViewItem::Params params; + + params.name = bridge->getDisplayName(); + params.icon = bridge->getIcon(); + params.icon_open = bridge->getOpenIcon(); + + if (mShowItemLinkOverlays) // if false, then links show up just like normal items + { + params.icon_overlay = LLUI::getUIImage("Inv_Link"); + } + + params.creation_date = bridge->getCreationDate(); + params.root = mFolderRoot; + params.listener = bridge; + params.rect = LLRect (0, 0, 0, 0); + params.tool_tip = params.name; + + return LLUICtrlFactory::create<LLInboxFolderViewItem>(params); +} // // LLInboxFolderViewFolder Implementation @@ -141,7 +164,7 @@ LLFolderViewFolder * LLInboxInventoryPanel::createFolderViewFolder(LLInvFVBridge LLInboxFolderViewFolder::LLInboxFolderViewFolder(const Params& p) : LLFolderViewFolder(p) , LLBadgeOwner(getHandle()) - , mFresh(true) + , mFresh(false) { #if SUPPORTING_FRESH_ITEM_COUNT initBadgeParams(p.new_badge()); @@ -153,19 +176,6 @@ LLInboxFolderViewFolder::~LLInboxFolderViewFolder() } // virtual -time_t LLInboxFolderViewFolder::getCreationDate() const -{ - time_t ret_val = LLFolderViewFolder::getCreationDate(); - - if (!mCreationDate) - { - updateFlag(); - } - - return ret_val; -} - -// virtual void LLInboxFolderViewFolder::draw() { #if SUPPORTING_FRESH_ITEM_COUNT @@ -180,29 +190,69 @@ void LLInboxFolderViewFolder::draw() LLFolderViewFolder::draw(); } -void LLInboxFolderViewFolder::updateFlag() const +void LLInboxFolderViewFolder::computeFreshness() +{ + const std::string& last_expansion = gSavedPerAccountSettings.getString("LastInventoryInboxActivity"); + + if (!last_expansion.empty()) + { + // Inventory DB timezone is hardcoded to PDT or GMT-7, which is 7 hours behind GMT + const F64 SEVEN_HOURS_IN_SECONDS = 7 * 60 * 60; + const F64 saved_freshness_inventory_db_timezone = LLDate(last_expansion).secondsSinceEpoch() - SEVEN_HOURS_IN_SECONDS; + + mFresh = (mCreationDate > saved_freshness_inventory_db_timezone); + +#if DEBUGGING_FRESHNESS + if (mFresh) + { + llinfos << "Item is fresh! -- creation " << mCreationDate << ", saved_freshness_date " << saved_freshness_inventory_db_timezone << llendl; + } +#endif + } + else + { + mFresh = true; + } +} + +void LLInboxFolderViewFolder::deFreshify() { - LLDate saved_freshness_date = LLDate(gSavedPerAccountSettings.getString("LastInventoryInboxExpand")); - mFresh = (mCreationDate > saved_freshness_date.secondsSinceEpoch()); + mFresh = false; + + gSavedPerAccountSettings.setString("LastInventoryInboxActivity", LLDate::now().asString()); } void LLInboxFolderViewFolder::selectItem() { - mFresh = false; LLFolderViewFolder::selectItem(); + + deFreshify(); } void LLInboxFolderViewFolder::toggleOpen() { - mFresh = false; LLFolderViewFolder::toggleOpen(); + + deFreshify(); } -void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) const +void LLInboxFolderViewFolder::setCreationDate(time_t creation_date_utc) { mCreationDate = creation_date_utc; - updateFlag(); + + if (mParentFolder == mRoot) + { + computeFreshness(); + } } +// +// LLInboxFolderViewItem Implementation +// + +BOOL LLInboxFolderViewItem::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + return TRUE; +} // eof |