summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llinventorygallery.cpp103
-rw-r--r--indra/newview/llinventorygallery.h9
-rw-r--r--indra/newview/llinventorygallerymenu.h2
3 files changed, 109 insertions, 5 deletions
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index efc78c5357..f4bd98a9f7 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -858,6 +858,109 @@ BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask)
return res;
}
+
+BOOL LLInventoryGallery::handleKeyHere(KEY key, MASK mask)
+{
+ BOOL handled = FALSE;
+ switch (key)
+ {
+ case KEY_RETURN:
+ // Open selected items if enter key hit on the inventory panel
+ if (mask == MASK_NONE && mInventoryGalleryMenu && mSelectedItemID.notNull())
+ {
+ LLViewerInventoryCategory* category = gInventory.getCategory(mSelectedItemID);
+ if (category)
+ {
+ setRootFolder(mSelectedItemID);
+ handled = TRUE;
+ }
+ }
+ break;
+ case KEY_DELETE:
+#if LL_DARWIN
+ case KEY_BACKSPACE:
+#endif
+ // Delete selected items if delete or backspace key hit on the inventory panel
+ // Note: on Mac laptop keyboards, backspace and delete are one and the same
+ if (mSelectedItemID.notNull())
+ {
+ LLViewerInventoryCategory* category = gInventory.getCategory(mSelectedItemID);
+ if (category)
+ {
+ if (get_is_category_removable(&gInventory, mSelectedItemID))
+ {
+ gInventory.removeCategory(mSelectedItemID);
+ handled = TRUE;
+ }
+ }
+ else
+ {
+ if (get_is_item_removable(&gInventory, mSelectedItemID))
+ {
+ gInventory.removeItem(mSelectedItemID);
+ handled = TRUE;
+ }
+ }
+ }
+ break;
+
+ case KEY_F2:
+ mFilterSubString.clear();
+ if (mInventoryGalleryMenu && mSelectedItemID.notNull())
+ {
+ mInventoryGalleryMenu->doToSelected("rename", mSelectedItemID);
+ }
+ handled = TRUE;
+ break;
+
+ case KEY_PAGE_UP:
+ mFilterSubString.clear();
+ if (mScrollPanel)
+ {
+ mScrollPanel->pageUp(30);
+ }
+ handled = TRUE;
+ break;
+
+ case KEY_PAGE_DOWN:
+ mFilterSubString.clear();
+ if (mScrollPanel)
+ {
+ mScrollPanel->pageDown(30);
+ }
+ handled = TRUE;
+ break;
+
+ case KEY_HOME:
+ mFilterSubString.clear();
+ if (mScrollPanel)
+ {
+ mScrollPanel->goToTop();
+ }
+ handled = TRUE;
+ break;
+
+ case KEY_END:
+ mFilterSubString.clear();
+ if (mScrollPanel)
+ {
+ mScrollPanel->goToBottom();
+ }
+ handled = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ if (handled)
+ {
+ mInventoryGalleryMenu->hide();
+ }
+
+ return handled;
+}
+
void LLInventoryGallery::showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id)
{
if (mInventoryGalleryMenu && item_id.notNull())
diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h
index 7e4ed9725b..de0cba6e63 100644
--- a/indra/newview/llinventorygallery.h
+++ b/indra/newview/llinventorygallery.h
@@ -73,12 +73,13 @@ public:
LLInventoryGallery(const LLInventoryGallery::Params& params = getDefaultParams());
~LLInventoryGallery();
- BOOL postBuild();
+ BOOL postBuild() override;
void initGallery();
- void draw();
+ void draw() override;
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type,
- void* cargo_data, EAcceptance* accept, std::string& tooltip_msg);
- BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
+ void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) override;
+ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override;
+ BOOL handleKeyHere(KEY key, MASK mask) override;
void setFilterSubString(const std::string& string);
std::string getFilterSubString() { return mFilterSubString; }
diff --git a/indra/newview/llinventorygallerymenu.h b/indra/newview/llinventorygallerymenu.h
index fd542e7d79..67cf9a569a 100644
--- a/indra/newview/llinventorygallerymenu.h
+++ b/indra/newview/llinventorygallerymenu.h
@@ -39,12 +39,12 @@ public:
bool isRootFolder() { return mRootFolder; }
void setRootFolder(bool is_root) { mRootFolder = is_root; }
+ void doToSelected(const LLSD& userdata, const LLUUID& selected_id);
protected:
//virtual void buildContextMenu(class LLMenuGL& menu, U32 flags);
void updateMenuItemsVisibility(LLContextMenu* menu);
- void doToSelected(const LLSD& userdata, const LLUUID& selected_id);
void fileUploadLocation(const LLSD& userdata, const LLUUID& selected_id);
static void onRename(const LLSD& notification, const LLSD& response);