EXT-7075 FIXED Map button now is always enabled and shows current user location if no other item is selected
- Added new pure virtual member function isSingleItemSelected() to the LLPanelPlacesTab. It is used in the LLPanelPlaces class inside onShowOnMapButtonClicked() to check if something was selected on the active panel. If so then selection is shown on the world map. Otherwise current agent position is shown on the world map. - Implemented isSingleItemSelected() in the both LLPanelPlacesTab derived classes: LLLandmarksPanel and LLTeleportHistoryPanel - Removed functionality which disables Map button if no selection is made Reviewed by Sergey Litovchuk at https://codereview.productengine.com/secondlife/r/355/ --HG-- branch : product-enginemeow-7.2.2
parent
9027f4430d
commit
b46ba199ff
|
|
@ -308,6 +308,25 @@ void LLLandmarksPanel::onTeleport()
|
|||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
bool LLLandmarksPanel::isSingleItemSelected()
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
if (mCurrentSelectedList != NULL)
|
||||
{
|
||||
LLPlacesFolderView* root_view =
|
||||
static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder());
|
||||
|
||||
if (root_view->getSelectedCount() == 1)
|
||||
{
|
||||
result = isLandmarkSelected();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLLandmarksPanel::updateVerbs()
|
||||
{
|
||||
|
|
@ -316,8 +335,8 @@ void LLLandmarksPanel::updateVerbs()
|
|||
|
||||
bool landmark_selected = isLandmarkSelected();
|
||||
mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport"));
|
||||
mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map"));
|
||||
mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info"));
|
||||
mShowOnMapBtn->setEnabled(true);
|
||||
|
||||
// TODO: mantipov: Uncomment when mShareBtn is supported
|
||||
// Share button should be enabled when neither a folder nor a landmark is selected
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public:
|
|||
/*virtual*/ void onShowProfile();
|
||||
/*virtual*/ void onTeleport();
|
||||
/*virtual*/ void updateVerbs();
|
||||
/*virtual*/ bool isSingleItemSelected();
|
||||
|
||||
void onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
|
||||
void onSelectorButtonClicked();
|
||||
|
|
|
|||
|
|
@ -615,8 +615,21 @@ void LLPanelPlaces::onShowOnMapButtonClicked()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mActivePanel)
|
||||
if (mActivePanel && mActivePanel->isSingleItemSelected())
|
||||
{
|
||||
mActivePanel->onShowOnMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
|
||||
LLVector3d global_pos = gAgent.getPositionGlobal();
|
||||
|
||||
if (!global_pos.isExactlyZero() && worldmap_instance)
|
||||
{
|
||||
worldmap_instance->trackLocation(global_pos);
|
||||
LLFloaterReg::showInstance("world_map", "center");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1072,7 +1085,6 @@ void LLPanelPlaces::updateVerbs()
|
|||
mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn);
|
||||
mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn);
|
||||
|
||||
mShowOnMapBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
|
||||
mPlaceInfoBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos);
|
||||
|
||||
if (is_place_info_visible)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public:
|
|||
virtual void onShowOnMap() = 0;
|
||||
virtual void onShowProfile() = 0;
|
||||
virtual void onTeleport() = 0;
|
||||
virtual bool isSingleItemSelected() = 0;
|
||||
|
||||
bool isTabVisible(); // Check if parent TabContainer is visible.
|
||||
|
||||
|
|
|
|||
|
|
@ -476,6 +476,12 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string)
|
|||
showTeleportHistory();
|
||||
}
|
||||
|
||||
// virtual
|
||||
bool LLTeleportHistoryPanel::isSingleItemSelected()
|
||||
{
|
||||
return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem();
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLTeleportHistoryPanel::onShowOnMap()
|
||||
{
|
||||
|
|
@ -557,7 +563,6 @@ void LLTeleportHistoryPanel::updateVerbs()
|
|||
if (!mLastSelectedFlatlList)
|
||||
{
|
||||
mTeleportBtn->setEnabled(false);
|
||||
mShowOnMapBtn->setEnabled(false);
|
||||
mShowProfile->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
|
@ -565,8 +570,8 @@ void LLTeleportHistoryPanel::updateVerbs()
|
|||
LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
|
||||
|
||||
mTeleportBtn->setEnabled(NULL != itemp);
|
||||
mShowOnMapBtn->setEnabled(NULL != itemp);
|
||||
mShowProfile->setEnabled(NULL != itemp);
|
||||
mShowOnMapBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, LLDate& tab_date)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public:
|
|||
/*virtual*/ void onTeleport();
|
||||
///*virtual*/ void onCopySLURL();
|
||||
/*virtual*/ void updateVerbs();
|
||||
/*virtual*/ bool isSingleItemSelected();
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -123,4 +124,6 @@ private:
|
|||
LLHandle<LLView> mGearMenuHandle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //LL_LLPANELTELEPORTHISTORY_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue