diff options
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 99 |
1 files changed, 78 insertions, 21 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 88b3fb7b96..3098c6d118 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -46,6 +46,7 @@ #include "llfloaterreg.h" #include "llfloateravatarpicker.h" #include "llfloaterauction.h" +#include "llfloaterbanduration.h" #include "llfloatergroups.h" #include "llfloaterscriptlimits.h" #include "llavataractions.h" @@ -415,6 +416,7 @@ BOOL LLPanelLandGeneral::postBuild() mTextSalePending = getChild<LLTextBox>("SalePending"); mTextOwnerLabel = getChild<LLTextBox>("Owner:"); mTextOwner = getChild<LLTextBox>("OwnerText"); + mTextOwner->setIsFriendCallback(LLAvatarActions::isFriend); mContentRating = getChild<LLTextBox>("ContentRatingText"); mLandType = getChild<LLTextBox>("LandTypeText"); @@ -1191,6 +1193,7 @@ BOOL LLPanelLandObjects::postBuild() mIconGroup = LLUIImageList::getInstance()->getUIImage("icon_group.tga", 0); mOwnerList = getChild<LLNameListCtrl>("owner list"); + mOwnerList->setIsFriendCallback(LLAvatarActions::isFriend); mOwnerList->sortByColumnIndex(3, FALSE); childSetCommitCallback("owner list", onCommitList, this); mOwnerList->setDoubleClickCallback(onDoubleClickOwner, this); @@ -1874,6 +1877,7 @@ LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel) mLandingTypeCombo(NULL), mSnapshotCtrl(NULL), mLocationText(NULL), + mSeeAvatarsText(NULL), mSetBtn(NULL), mClearBtn(NULL), mMatureCtrl(NULL), @@ -1920,6 +1924,14 @@ BOOL LLPanelLandOptions::postBuild() mSeeAvatarsCtrl = getChild<LLCheckBoxCtrl>( "SeeAvatarsCheck"); childSetCommitCallback("SeeAvatarsCheck", onCommitAny, this); + mSeeAvatarsText = getChild<LLTextBox>("allow_see_label"); + if (mSeeAvatarsText) + { + mSeeAvatarsText->setShowCursorHand(false); + mSeeAvatarsText->setSoundFlags(LLView::MOUSE_UP); + mSeeAvatarsText->setClickedCallback(boost::bind(&toggleSeeAvatars, this)); + } + mCheckShowDirectory = getChild<LLCheckBoxCtrl>( "ShowDirectoryCheck"); childSetCommitCallback("ShowDirectoryCheck", onCommitAny, this); @@ -2013,6 +2025,7 @@ void LLPanelLandOptions::refresh() mSeeAvatarsCtrl->set(TRUE); mSeeAvatarsCtrl->setEnabled(FALSE); + mSeeAvatarsText->setEnabled(FALSE); mLandingTypeCombo->setCurrentByIndex(0); mLandingTypeCombo->setEnabled(FALSE); @@ -2071,6 +2084,7 @@ void LLPanelLandOptions::refresh() mSeeAvatarsCtrl->set(parcel->getSeeAVs()); mSeeAvatarsCtrl->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData()); + mSeeAvatarsText->setEnabled(can_change_options && parcel->getHaveNewParcelLimitData()); BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_SET_LANDING_POINT); @@ -2361,7 +2375,16 @@ void LLPanelLandOptions::onClickClear(void* userdata) self->refresh(); } - +void LLPanelLandOptions::toggleSeeAvatars(void* userdata) +{ + LLPanelLandOptions* self = (LLPanelLandOptions*)userdata; + if (self) + { + self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->toggle(); + self->getChild<LLCheckBoxCtrl>("SeeAvatarsCheck")->setBtnFocus(); + self->onCommitAny(NULL, userdata); + } +} //--------------------------------------------------------------------------- // LLPanelLandAccess //--------------------------------------------------------------------------- @@ -2502,33 +2525,49 @@ void LLPanelLandAccess::refresh() cit != parcel->mBanList.end(); ++cit) { const LLAccessEntry& entry = (*cit).second; - std::string prefix; + std::string duration; if (entry.mTime != 0) { LLStringUtil::format_map_t args; S32 now = time(NULL); - S32 seconds = entry.mTime - now; + S32 seconds = entry.mTime - now; if (seconds < 0) seconds = 0; - prefix.assign(" ("); - if (seconds >= 120) + + if (seconds >= 7200) { - args["[MINUTES]"] = llformat("%d", (seconds/60)); - std::string buf = parent_floater->getString ("Minutes", args); - prefix.append(buf); + args["[HOURS]"] = llformat("%d", (seconds / 3600)); + duration = parent_floater->getString("Hours", args); + } + else if (seconds >= 3600) + { + duration = "1 " + parent_floater->getString("Hour"); + } + else if (seconds >= 120) + { + args["[MINUTES]"] = llformat("%d", (seconds / 60)); + duration = parent_floater->getString("Minutes", args); } else if (seconds >= 60) { - prefix.append("1 " + parent_floater->getString("Minute")); + duration = "1 " + parent_floater->getString("Minute"); } else { args["[SECONDS]"] = llformat("%d", seconds); - std::string buf = parent_floater->getString ("Seconds", args); - prefix.append(buf); + duration = parent_floater->getString("Seconds", args); } - prefix.append(" " + parent_floater->getString("Remaining") + ") "); } - mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix); + else + { + duration = parent_floater->getString("Always"); + } + LLSD item; + item["id"] = entry.mID; + LLSD& columns = item["columns"]; + columns[0]["column"] = "name"; // to be populated later + columns[1]["column"] = "duration"; + columns[1]["value"] = duration; + mListBanned->addElement(item); } mListBanned->sortByName(TRUE); } @@ -2880,7 +2919,7 @@ void LLPanelLandAccess::onClickAddBanned() LLView * button = findChild<LLButton>("add_banned"); LLFloater * root_floater = gFloaterView->getParentFloater(this); LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show( - boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button); + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button); if (picker) { root_floater->addDependentFloater(picker); @@ -2890,23 +2929,41 @@ void LLPanelLandAccess::onClickAddBanned() // static void LLPanelLandAccess::callbackAvatarCBBanned(const uuid_vec_t& ids) { - if (!ids.empty()) + LLFloater * root_floater = gFloaterView->getParentFloater(this); + LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show( + boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids); + if (duration_floater) { - LLUUID id = ids[0]; - LLParcel* parcel = mParcel->getParcel(); - if (parcel && parcel->addToBanList(id, 0)) + root_floater->addDependentFloater(duration_floater); + } +} + +void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration) +{ + LLParcel* parcel = mParcel->getParcel(); + if (!parcel) return; + + U32 lists_to_update = 0; + + for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++) + { + LLUUID id = *it; + if (parcel->addToBanList(id, duration)) { - U32 lists_to_update = AL_BAN; + lists_to_update |= AL_BAN; // agent was successfully added to ban list // but we also need to check access list to ensure that agent will not be in two lists simultaneously if (parcel->removeFromAccessList(id)) { lists_to_update |= AL_ACCESS; } - LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update); - refresh(); } } + if (lists_to_update > 0) + { + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update); + refresh(); + } } // static |