Added script remove function; patch from Holy Gavenkrantz (FIRE-1048)

Ansariel 2012-05-26 00:31:25 +02:00
parent 31c48c6d84
commit bc2b99cc8f
7 changed files with 98 additions and 0 deletions

View File

@ -785,6 +785,60 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
nextObject();
}
// <FS> Delete scripts
///----------------------------------------------------------------------------
/// Class LLFloaterDeleteQueue
///----------------------------------------------------------------------------
LLFloaterDeleteQueue::LLFloaterDeleteQueue(const LLSD& key)
: LLFloaterScriptQueue(key)
{
setTitle(LLTrans::getString("DeleteQueueTitle"));
setStartString(LLTrans::getString("DeleteQueueStart"));
}
LLFloaterDeleteQueue::~LLFloaterDeleteQueue()
{
}
void LLFloaterDeleteQueue::handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv)
{
// find all of the lsl, leaving off duplicates. We'll remove
// all matching asset uuids on compilation success.
LLDynamicArray<const char*> names;
LLInventoryObject::object_list_t::const_iterator it = inv->begin();
LLInventoryObject::object_list_t::const_iterator end = inv->end();
for ( ; it != end; ++it)
{
if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
{
LLViewerObject* object = gObjectList.findObject(viewer_obj->getID());
if (object)
{
LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
std::string buffer;
buffer = getString("Deleting") + (": ") + item->getName();
getChild<LLScrollListCtrl>("queue output")->addCommentText(buffer);
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RemoveTaskInventory);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_InventoryData);
msg->addU32Fast(_PREHASH_LocalID, viewer_obj->getLocalID());
msg->addUUIDFast(_PREHASH_ItemID, (*it)->getUUID());
msg->sendReliable(object->getRegion()->getHost());
}
}
}
nextObject();
}
// </FS> Delete scripts
///----------------------------------------------------------------------------
/// Local function definitions
///----------------------------------------------------------------------------

View File

@ -225,4 +225,24 @@ protected:
LLInventoryObject::object_list_t* inv);
};
// <FS> Delete scripts
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLFloaterDeleteQueue
//
// This script queue will delete each script.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLFloaterDeleteQueue : public LLFloaterScriptQueue
{
friend class LLFloaterReg;
protected:
LLFloaterDeleteQueue(const LLSD& key);
virtual ~LLFloaterDeleteQueue();
// This is called by inventoryChanged
virtual void handleInventory(LLViewerObject* viewer_obj,
LLInventoryObject::object_list_t* inv);
};
// </FS> Delete scripts
#endif // LL_LLCOMPILEQUEUE_H

View File

@ -400,5 +400,7 @@ void LLViewerFloaterReg::registerFloaters()
// <FS:Ansariel> Group titles
LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSGroupTitles>);
LLFloaterReg::add("delete_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterDeleteQueue>);
LLFloaterReg::registerControlVariables(); // Make sure visibility and rect controls get preserved when saving
}

View File

@ -7580,6 +7580,13 @@ class LLToolsSelectedScriptAction : public view_listener_t
name = "stop_queue";
msg = "SetRunningNot";
}
// <FS> Delete scripts
else if (action == "delete")
{
name = "delete_queue";
msg = "delete";
}
// </FS> Delete scripts
LLUUID id; id.generate();
LLFloaterScriptQueue* queue =LLFloaterReg::getTypedInstance<LLFloaterScriptQueue>(name, LLSD(id));

View File

@ -29,6 +29,10 @@
name="NotRunning">
Not running
</floater.string>
<floater.string
name="Deleting">
Deleting
</floater.string>
<button
follows="right|bottom"
height="24"

View File

@ -1283,6 +1283,15 @@
<menu_item_call.on_enable
function="EditableSelected" />
</menu_item_call>
<menu_item_call
label="Remove Scripts From Selection"
name="Remove Scripts From Selection">
<menu_item_call.on_click
function="Tools.SelectedScriptAction"
parameter="delete" />
<menu_item_call.on_enable
function="EditableSelected" />
</menu_item_call>
</menu>
<menu_item_separator/>

View File

@ -2440,6 +2440,8 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale
<string name="RunQueueStart">set running</string>
<string name="NotRunQueueTitle">Set Not Running Progress</string>
<string name="NotRunQueueStart">set not running</string>
<string name="DeleteQueueTitle">Delete Progress</string>
<string name="DeleteQueueStart">Deleting</string>
<!-- compile comment text-->
<string name="CompileSuccessful">Compile successful!</string>