summaryrefslogtreecommitdiff
path: root/indra/newview/llpanellandmarks.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-28 20:47:43 -0400
commitcde1174345224d33d6b45b1e3243fa39043223e5 (patch)
tree6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/newview/llpanellandmarks.cpp
parent6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff)
parent35efadf78315f9b351415930dca4fae251ef4dd0 (diff)
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r--indra/newview/llpanellandmarks.cpp56
1 files changed, 32 insertions, 24 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index f8bb0f71a7..5a0cd1a823 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -66,7 +66,7 @@ static void collapse_all_folders(LLFolderView* root_folder);
static void expand_all_folders(LLFolderView* root_folder);
static bool has_expanded_folders(LLFolderView* root_folder);
static bool has_collapsed_folders(LLFolderView* root_folder);
-static void toggle_restore_menu(LLMenuGL* menu, BOOL visible, BOOL enabled);
+static void toggle_restore_menu(LLMenuGL* menu, bool visible, bool enabled);
/**
* Functor counting expanded and collapsed folders in folder view tree to know
@@ -136,7 +136,7 @@ void LLOpenFolderByID::doFolder(LLFolderViewFolder* folder)
{
if (!folder->isOpen())
{
- folder->setOpen(TRUE);
+ folder->setOpen(true);
mIsFolderOpen = true;
}
}
@@ -175,16 +175,16 @@ LLLandmarksPanel::~LLLandmarksPanel()
{
}
-BOOL LLLandmarksPanel::postBuild()
+bool LLLandmarksPanel::postBuild()
{
if (!gInventory.isInventoryUsable())
- return FALSE;
+ return false;
// mast be called before any other initXXX methods to init Gear menu
initListCommandsHandlers();
initLandmarksInventoryPanel();
- return TRUE;
+ return true;
}
// virtual
@@ -292,7 +292,7 @@ void LLLandmarksPanel::updateVerbs()
}
}
-void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus)
+void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, bool take_keyboard_focus)
{
if (!mCurrentSelectedList)
return;
@@ -301,7 +301,7 @@ void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_
LLFolderViewItem* item = mCurrentSelectedList->getItemByID(obj_id);
if (!item)
return;
- root->setSelection(item, FALSE, take_keyboard_focus);
+ root->setSelection(item, false, take_keyboard_focus);
root->scrollToShowSelection();
}
@@ -473,18 +473,18 @@ void LLLandmarksPanel::initListCommandsHandlers()
{
mGearLandmarkMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2));
// show menus even if all items are disabled
- mGearLandmarkMenu->setAlwaysShowMenu(TRUE);
+ mGearLandmarkMenu->setAlwaysShowMenu(true);
} // Else corrupted files?
if (mGearFolderMenu)
{
mGearFolderMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2));
- mGearFolderMenu->setAlwaysShowMenu(TRUE);
+ mGearFolderMenu->setAlwaysShowMenu(true);
}
if (mAddMenu)
{
- mAddMenu->setAlwaysShowMenu(TRUE);
+ mAddMenu->setAlwaysShowMenu(true);
}
}
@@ -647,10 +647,18 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
if ("collapse_all" == command_name)
{
+ if (!mCurrentSelectedList)
+ {
+ return false;
+ }
return has_expanded_folders(mCurrentSelectedList->getRootFolder());
}
else if ("expand_all" == command_name)
{
+ if (!mCurrentSelectedList)
+ {
+ return false;
+ }
return has_collapsed_folders(mCurrentSelectedList->getRootFolder());
}
else if ("sort_by_date" == command_name)
@@ -887,8 +895,8 @@ void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param)
// We don't have to update items visibility if the menu is hiding.
if (!new_visibility) return;
- BOOL are_any_items_in_trash = FALSE;
- BOOL are_all_items_in_trash = TRUE;
+ bool are_any_items_in_trash = false;
+ bool are_all_items_in_trash = true;
LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
if(root_folder_view)
@@ -959,12 +967,12 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
// then ask LLFolderView permissions
- LLFolderView* root_folder = mCurrentSelectedList->getRootFolder();
+ LLFolderView* root_folder = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : nullptr;
if ("copy" == command_name)
{
// we shouldn't be able to copy folders from My Inventory Panel
- return can_be_modified && root_folder->canCopy();
+ return can_be_modified && root_folder && root_folder->canCopy();
}
else if ("collapse" == command_name)
{
@@ -981,7 +989,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
if ("cut" == command_name)
{
- can_be_modified = root_folder->canCut();
+ can_be_modified = root_folder && root_folder->canCut();
}
else if ("rename" == command_name)
{
@@ -993,7 +1001,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
}
else if("paste" == command_name)
{
- can_be_modified = root_folder->canPaste();
+ can_be_modified = root_folder && root_folder->canPaste();
}
else
{
@@ -1004,7 +1012,7 @@ bool LLLandmarksPanel::canItemBeModified(const std::string& command_name, LLFold
return can_be_modified;
}
-bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
+bool LLLandmarksPanel::handleDragAndDropToTrash(bool drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept)
{
*accept = ACCEPT_NO;
@@ -1062,7 +1070,7 @@ void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark)
if (mGearLandmarkMenu)
{
- mGearLandmarkMenu->setItemEnabled("show_on_map", TRUE);
+ mGearLandmarkMenu->setItemEnabled("show_on_map", true);
}
}
@@ -1151,7 +1159,7 @@ static void collapse_all_folders(LLFolderView* root_folder)
if (!root_folder)
return;
- root_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
+ root_folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN);
root_folder->arrangeAll();
}
@@ -1160,7 +1168,7 @@ static void expand_all_folders(LLFolderView* root_folder)
if (!root_folder)
return;
- root_folder->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
+ root_folder->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_DOWN);
root_folder->arrangeAll();
}
@@ -1195,7 +1203,7 @@ static bool has_collapsed_folders(LLFolderView* root_folder)
// Displays "Restore Item" context menu entry while hiding
// all other entries or vice versa.
// Sets "Restore Item" enabled state.
-void toggle_restore_menu(LLMenuGL *menu, BOOL visible, BOOL enabled)
+void toggle_restore_menu(LLMenuGL *menu, bool visible, bool enabled)
{
if (!menu) return;
@@ -1225,17 +1233,17 @@ LLFavoritesPanel::LLFavoritesPanel()
buildFromFile("panel_favorites.xml");
}
-BOOL LLFavoritesPanel::postBuild()
+bool LLFavoritesPanel::postBuild()
{
if (!gInventory.isInventoryUsable())
- return FALSE;
+ return false;
// mast be called before any other initXXX methods to init Gear menu
LLLandmarksPanel::initListCommandsHandlers();
initFavoritesInventoryPanel();
- return TRUE;
+ return true;
}
void LLFavoritesPanel::initFavoritesInventoryPanel()