diff options
Diffstat (limited to 'indra/newview/llpanellandmarks.cpp')
-rw-r--r-- | indra/newview/llpanellandmarks.cpp | 127 |
1 files changed, 40 insertions, 87 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index d825071825..8d8c996374 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -2,25 +2,30 @@ * @file llpanellandmarks.cpp * @brief Landmarks tab for Side Bar "Places" panel * - * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. * $/LicenseInfo$ */ @@ -216,6 +221,8 @@ BOOL LLLandmarksPanel::postBuild() // mast be called before any other initXXX methods to init Gear menu initListCommandsHandlers(); + U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER); + mSortByDate = sort_order & LLInventoryFilter::SO_DATE; initFavoritesInventoryPanel(); initLandmarksInventoryPanel(); initMyInventoryPanel(); @@ -273,17 +280,6 @@ void LLLandmarksPanel::onShowOnMap() doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doShowOnMap, this, _1)); } -//virtual -void LLLandmarksPanel::onShowProfile() -{ - LLFolderViewItem* cur_item = getCurSelectedItem(); - - if(!cur_item) - return; - - cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about"); -} - // virtual void LLLandmarksPanel::onTeleport() { @@ -302,25 +298,6 @@ 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() { if (!isTabVisible()) @@ -328,7 +305,6 @@ void LLLandmarksPanel::updateVerbs() bool landmark_selected = isLandmarkSelected(); mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport")); - mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info")); mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map")); // TODO: mantipov: Uncomment when mShareBtn is supported @@ -517,9 +493,6 @@ void LLLandmarksPanel::setParcelID(const LLUUID& parcel_id) { if (!parcel_id.isNull()) { - //ext-4655, defensive. remove now incase this gets called twice without a remove - LLRemoteParcelInfoProcessor::getInstance()->removeObserver(parcel_id, this); - LLRemoteParcelInfoProcessor::getInstance()->addObserver(parcel_id, this); LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(parcel_id); } @@ -598,13 +571,11 @@ void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list if (!inventory_list->getFilter()) return; - inventory_list->getFilter()->setEmptyLookupMessage("PlacesNoMatchingItems"); inventory_list->setFilterTypes(0x1 << LLInventoryType::IT_LANDMARK); inventory_list->setSelectCallback(boost::bind(&LLLandmarksPanel::onSelectionChange, this, inventory_list, _1, _2)); inventory_list->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); - updateSortOrder(inventory_list, sorting_order); + updateSortOrder(inventory_list, mSortByDate); LLPlacesFolderView* root_folder = dynamic_cast<LLPlacesFolderView*>(inventory_list->getRootFolder()); if (root_folder) @@ -692,7 +663,6 @@ void LLLandmarksPanel::initListCommandsHandlers() trash_btn->setDragAndDropHandler(boost::bind(&LLLandmarksPanel::handleDragAndDropToTrash, this , _4 // BOOL drop , _5 // EDragAndDropType cargo_type - , _6 // void* cargo_data , _7 // EAcceptance* accept )); @@ -872,12 +842,10 @@ void LLLandmarksPanel::onFoldingAction(const LLSD& userdata) } else if ("sort_by_date" == command_name) { - bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); - sorting_order=!sorting_order; - gSavedSettings.setBOOL("LandmarksSortedByDate",sorting_order); - updateSortOrder(mLandmarksInventoryPanel, sorting_order); - updateSortOrder(mMyInventoryPanel, sorting_order); - updateSortOrder(mLibraryInventoryPanel, sorting_order); + mSortByDate = !mSortByDate; + updateSortOrder(mLandmarksInventoryPanel, mSortByDate); + updateSortOrder(mMyInventoryPanel, mSortByDate); + updateSortOrder(mLibraryInventoryPanel, mSortByDate); } else { @@ -894,8 +862,7 @@ bool LLLandmarksPanel::isActionChecked(const LLSD& userdata) const if ( "sort_by_date" == command_name) { - bool sorting_order = gSavedSettings.getBOOL("LandmarksSortedByDate"); - return sorting_order; + return mSortByDate; } return false; @@ -993,13 +960,10 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const } else if("create_pick" == command_name) { - if (mCurrentSelectedList) + std::set<LLUUID> selection; + if ( mCurrentSelectedList && mCurrentSelectedList->getRootFolder()->getSelectionList(selection) ) { - std::set<LLUUID> selection = mCurrentSelectedList->getRootFolder()->getSelectionList(); - if (!selection.empty()) - { - return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() ); - } + return ( 1 == selection.size() && !LLAgentPicksInfo::getInstance()->isPickLimitReached() ); } return false; } @@ -1013,10 +977,13 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const void LLLandmarksPanel::onCustomAction(const LLSD& userdata) { + LLFolderViewItem* cur_item = getCurSelectedItem(); + if(!cur_item) + return; std::string command_name = userdata.asString(); if("more_info" == command_name) { - onShowProfile(); + cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about"); } else if ("teleport" == command_name) { @@ -1133,7 +1100,7 @@ void LLLandmarksPanel::onPickPanelExit( LLPanelPickEdit* pick_panel, LLView* own pick_panel = NULL; } -bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, void* cargo_data , EAcceptance* accept) +bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept) { *accept = ACCEPT_NO; @@ -1149,21 +1116,7 @@ bool LLLandmarksPanel::handleDragAndDropToTrash(BOOL drop, EDragAndDropType carg if (is_enabled && drop) { - // don't call onClipboardAction("delete") - // this lead to removing (N * 2 - 1) items if drag N>1 items into trash. EXT-6757 - // So, let remove items one by one. - LLInventoryItem* item = static_cast<LLInventoryItem*>(cargo_data); - if (item) - { - LLFolderViewItem* fv_item = (mCurrentSelectedList && mCurrentSelectedList->getRootFolder()) ? - mCurrentSelectedList->getRootFolder()->getItemByID(item->getUUID()) : NULL; - - if (fv_item) - { - // is Item Removable checked inside of remove() - fv_item->remove(); - } - } + onClipboardAction("delete"); } } break; |