summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloatermyenvironment.cpp75
-rw-r--r--indra/newview/llfloatermyenvironment.h2
2 files changed, 56 insertions, 21 deletions
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp
index 35f43d57e2..6dcff7c264 100644
--- a/indra/newview/llfloatermyenvironment.cpp
+++ b/indra/newview/llfloatermyenvironment.cpp
@@ -157,9 +157,9 @@ LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) :
mSelectedAsset()
{
mCommitCallbackRegistrar.add(ACTION_DOCREATE, [this](LLUICtrl *, const LLSD &userdata) { onDoCreate(userdata); });
- mCommitCallbackRegistrar.add(ACTION_DOEDIT, [](LLUICtrl *, const LLSD &userdata) { });
+ mCommitCallbackRegistrar.add(ACTION_DOEDIT, [this](LLUICtrl *, const LLSD &userdata) { mInventoryList->openSelected(); });
mCommitCallbackRegistrar.add(ACTION_DOAPPLY, [this](LLUICtrl *, const LLSD &userdata) { onDoApply(userdata.asString()); });
- mCommitCallbackRegistrar.add(ACTION_COPYPASTE, [](LLUICtrl *, const LLSD &userdata) { });
+ mCommitCallbackRegistrar.add(ACTION_COPYPASTE, [this](LLUICtrl *, const LLSD &userdata) { mInventoryList->doToSelected(userdata.asString()); });
mEnableCallbackRegistrar.add(ENABLE_ACTION, [this](LLUICtrl *, const LLSD &userdata) { return canAction(userdata.asString()); });
mEnableCallbackRegistrar.add(ENABLE_CANAPPLY, [this](LLUICtrl *, const LLSD &userdata) { return canApply(userdata.asString()); });
@@ -343,27 +343,49 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context)
}
}
-
bool LLFloaterMyEnvironment::canAction(const std::string &context)
{
-// uuid_vec_t selected;
-// getSelectedIds(selected);
-//
-// if (selected.empty())
-// return false;
-//
-// if (context == PARAMETER_EDIT)
-// {
-// }
-// else if (context == PARAMETER_COPY)
-// {
-// }
-// else if (context == PARAMETER_PASTE)
-// {
-// }
-// else if (context == PARAMETER_COPYUUID)
-// {
-// }
+ uuid_vec_t selected;
+ getSelectedIds(selected);
+
+ if (selected.empty())
+ return false;
+
+ if (context == PARAMETER_EDIT)
+ {
+ return (selected.size() == 1) && isSettingSelected(selected.front());
+ }
+ else if (context == PARAMETER_COPY)
+ {
+ for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++)
+ {
+ if(!isSettingSelected(*it))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ else if (context == PARAMETER_PASTE)
+ {
+ if (!LLClipboard::instance().hasContents())
+ return false;
+
+ std::vector<LLUUID> ids;
+ LLClipboard::instance().pasteFromClipboard(ids);
+ for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+ {
+ if (!isSettingSelected(*it))
+ {
+ return false;
+ }
+ }
+ return (selected.size() == 1);
+ }
+ else if (context == PARAMETER_COPYUUID)
+ {
+ return (selected.size() == 1) && isSettingSelected(selected.front());
+ }
return false;
}
@@ -449,6 +471,17 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_
return LLUUID::null;
}
+bool LLFloaterMyEnvironment::isSettingSelected(LLUUID item_id)
+{
+ LLInventoryItem* itemp = gInventory.getItem(item_id);
+
+ if (itemp && itemp->getInventoryType() == LLInventoryType::IT_SETTINGS)
+ {
+ return true;
+ }
+ return false;
+}
+
void LLFloaterMyEnvironment::getSelectedIds(uuid_vec_t& ids) const
{
LLInventoryPanel::selected_items_t items = mInventoryList->getSelectedItems();
diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h
index 9d9659576d..10d64eaa93 100644
--- a/indra/newview/llfloatermyenvironment.h
+++ b/indra/newview/llfloatermyenvironment.h
@@ -76,6 +76,8 @@ private:
void getSelectedIds(uuid_vec_t& ids) const;
void refreshButtonStates();
+ bool isSettingSelected(LLUUID item_id);
+
static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library);
#if 0