diff options
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rw-r--r-- | indra/newview/llpreviewtexture.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 698f6152b4..26694ac433 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -76,29 +76,12 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key) mAspectRatio(0.f), mPreviewToSave(FALSE) { - const LLInventoryItem *item = getItem(); + const LLViewerInventoryItem *item = static_cast<const LLViewerInventoryItem*>(getItem()); if(item) { mShowKeepDiscard = item->getPermissions().getCreator() != gAgent.getID(); mImageID = item->getAssetUUID(); - const LLPermissions& perm = item->getPermissions(); - U32 mask = PERM_NONE; - if(perm.getOwner() == gAgent.getID()) - { - mask = perm.getMaskBase(); - } - else if(gAgent.isInGroup(perm.getGroup())) - { - mask = perm.getMaskGroup(); - } - else - { - mask = perm.getMaskEveryone(); - } - if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - mIsCopyable = TRUE; - } + mIsCopyable = item->checkPermissionsSet(PERM_ITEM_UNRESTRICTED); } else // not an item, assume it's an asset id { @@ -145,6 +128,9 @@ BOOL LLPreviewTexture::postBuild() childSetVisible("Discard", false); } + childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this); + childSetVisible("save_tex_btn", canSaveAs()); + if (!mCopyToInv) { const LLInventoryItem* item = getItem(); @@ -164,6 +150,13 @@ BOOL LLPreviewTexture::postBuild() return LLPreview::postBuild(); } +// static +void LLPreviewTexture::onSaveAsBtn(void* data) +{ + LLPreviewTexture* self = (LLPreviewTexture*)data; + self->saveAs(); +} + void LLPreviewTexture::draw() { if (mUpdateDimensions) @@ -576,6 +569,7 @@ void LLPreviewTexture::loadAsset() mImage->forceToSaveRawImage(0) ; mAssetStatus = PREVIEW_ASSET_LOADING; updateDimensions(); + childSetVisible("save_tex_btn", canSaveAs()); } LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus() |