summaryrefslogtreecommitdiff
path: root/indra/newview/lllocationinputctrl.cpp
diff options
context:
space:
mode:
authorDenis Serdjuk <dserduk@productengine.com>2010-02-25 19:15:59 +0200
committerDenis Serdjuk <dserduk@productengine.com>2010-02-25 19:15:59 +0200
commite235e71b907d7fa4d6bd15852e0a3eae3cbd07c5 (patch)
treebba20f93df8c5e92d5bcba6d2b197ed9606da8dd /indra/newview/lllocationinputctrl.cpp
parent087ea1cef62d383821e8e340551e757cb604b553 (diff)
Bug Low EXT-5194 SLURL field dropdown should display empty menu rather than do nothing when empty
Solution: Button of dropdown list will be disabled if there are no items in location history --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/lllocationinputctrl.cpp')
-rw-r--r--indra/newview/lllocationinputctrl.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 5f233bece0..0ea4b1f6da 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -52,7 +52,6 @@
#include "llinventoryobserver.h"
#include "lllandmarkactions.h"
#include "lllandmarklist.h"
-#include "lllocationhistory.h"
#include "llteleporthistory.h"
#include "llsidetray.h"
#include "llslurl.h"
@@ -377,9 +376,10 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
// - Update the location string on parcel change.
mParcelMgrConnection = LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(
boost::bind(&LLLocationInputCtrl::onAgentParcelChange, this));
-
- mLocationHistoryConnection = LLLocationHistory::getInstance()->setLoadedCallback(
- boost::bind(&LLLocationInputCtrl::onLocationHistoryLoaded, this));
+ // LLLocationHistory instance is being created before the location input control, so we have to update initial state of button manually.
+ mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
+ mLocationHistoryConnection = LLLocationHistory::getInstance()->setChangedCallback(
+ boost::bind(&LLLocationInputCtrl::onLocationHistoryChanged, this,_1));
mRemoveLandmarkObserver = new LLRemoveLandmarkObserver(this);
mAddLandmarkObserver = new LLAddLandmarkObserver(this);
@@ -620,9 +620,13 @@ void LLLocationInputCtrl::onLandmarkLoaded(LLLandmark* lm)
updateAddLandmarkButton();
}
-void LLLocationInputCtrl::onLocationHistoryLoaded()
+void LLLocationInputCtrl::onLocationHistoryChanged(LLLocationHistory::EChangeType event)
{
- rebuildLocationHistory();
+ if(event == LLLocationHistory::LOAD)
+ {
+ rebuildLocationHistory();
+ }
+ mButton->setEnabled(LLLocationHistory::instance().getItemCount() > 0);
}
void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
@@ -893,7 +897,7 @@ void LLLocationInputCtrl::positionMaturityIcon()
mMaturityIcon->setVisible(rect.mRight < mTextEntry->getRect().getWidth() - right_pad);
}
-void LLLocationInputCtrl::rebuildLocationHistory(std::string filter)
+void LLLocationInputCtrl::rebuildLocationHistory(const std::string& filter)
{
LLLocationHistory::location_list_t filtered_items;
const LLLocationHistory::location_list_t* itemsp = NULL;