diff options
| author | Graham Linden <graham@lindenlab.com> | 2018-09-07 17:27:24 +0100 |
|---|---|---|
| committer | Graham Linden <graham@lindenlab.com> | 2018-09-07 17:27:24 +0100 |
| commit | 770baa28526cf4d860cdea6d97fa9f089a5941c7 (patch) | |
| tree | f8c0b372fbee3957d8a6fbb760a923591e79e531 /indra/newview/llfloatermyenvironment.cpp | |
| parent | 4bd2b8b98ba1c562dfd65975a87ef5ee3db35633 (diff) | |
| parent | df96fc652b452dbc9bd2daa7398ada1feb235fff (diff) | |
Merge
Diffstat (limited to 'indra/newview/llfloatermyenvironment.cpp')
| -rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 75 |
1 files changed, 54 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(); |
