MAINT-1660 Don't hide script editor floater immediately after removing script from inventory.

meow-7.2.2
Mnikolenko Productengine 2016-07-29 17:53:33 +03:00
parent c86ab13b6b
commit bcadc2c1b3
5 changed files with 30 additions and 7 deletions

View File

@ -1933,13 +1933,15 @@ BOOL LLItemBridge::removeItem()
}
// move it to the trash
LLPreview::hide(mUUID, TRUE);
LLInventoryModel* model = getInventoryModel();
if(!model) return FALSE;
const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
LLViewerInventoryItem* item = getItem();
if (!item) return FALSE;
if (item->getType() != LLAssetType::AT_LSL_TEXT)
{
LLPreview::hide(mUUID, TRUE);
}
// Already in trash
if (model->isObjectDescendentOf(mUUID, trash_id)) return FALSE;

View File

@ -1395,7 +1395,11 @@ void LLInventoryModel::onObjectDeletedFromServer(const LLUUID& object_id, bool f
}
// From purgeObject()
LLPreview::hide(object_id);
LLViewerInventoryItem *item = getItem(object_id);
if (item && (item->getType() != LLAssetType::AT_LSL_TEXT))
{
LLPreview::hide(object_id, TRUE);
}
deleteObject(object_id, fix_broken_links, do_notify_observers);
}
}

View File

@ -375,7 +375,8 @@ LLScriptEdCore::LLScriptEdCore(
mLiveFile(NULL),
mLive(live),
mContainer(container),
mHasScriptData(FALSE)
mHasScriptData(FALSE),
mScriptRemoved(FALSE)
{
setFollowsAll();
setBorderVisible(FALSE);
@ -666,7 +667,7 @@ bool LLScriptEdCore::hasChanged()
void LLScriptEdCore::draw()
{
BOOL script_changed = hasChanged();
getChildView("Save_btn")->setEnabled(script_changed);
getChildView("Save_btn")->setEnabled(script_changed && !mScriptRemoved);
if( mEditor->hasFocus() )
{
@ -840,7 +841,7 @@ void LLScriptEdCore::addHelpItemToHistory(const std::string& help_string)
BOOL LLScriptEdCore::canClose()
{
if(mForceClose || !hasChanged())
if(mForceClose || !hasChanged() || mScriptRemoved)
{
return TRUE;
}
@ -1511,6 +1512,17 @@ BOOL LLPreviewLSL::postBuild()
return LLPreview::postBuild();
}
void LLPreviewLSL::draw()
{
const LLInventoryItem* item = getItem();
if(!item)
{
setTitle(LLTrans::getString("ScriptWasDeleted"));
mScriptEd->setItemRemoved(TRUE);
}
LLPreview::draw();
}
// virtual
void LLPreviewLSL::callbackLSLCompileSucceeded()
{

View File

@ -119,6 +119,8 @@ public:
void setScriptName(const std::string& name){mScriptName = name;};
void setItemRemoved(bool script_removed){mScriptRemoved = script_removed;};
private:
void onBtnHelp();
void onBtnDynamicHelp();
@ -163,6 +165,7 @@ private:
BOOL mHasScriptData;
LLLiveLSLFile* mLiveFile;
LLUUID mAssociatedExperience;
BOOL mScriptRemoved;
LLScriptEdContainer* mContainer; // parent view
@ -198,6 +201,7 @@ public:
/*virtual*/ BOOL postBuild();
protected:
virtual void draw();
virtual BOOL canClose();
void closeIfNeeded();

View File

@ -2566,7 +2566,8 @@ This feature is currently in Beta. Please add your name to this [http://goo.gl/f
<string name="SaveComplete">Save complete.</string>
<string name="UploadFailed">File upload failed: </string>
<string name="ObjectOutOfRange">Script (object out of range)</string>
<string name="ScriptWasDeleted">Script (deleted from inventory)</string>
<!-- god tools -->
<string name="GodToolsObjectOwnedBy">Object [OBJECT] owned by [OWNER]</string>