Remove all selected entries from asset blacklist

Previously, the "Remove" button in the asset blacklist floater removed
the last clicked-on entry only - even when selecting multiple rows (by
holding CTRL and clicking on entries).
This behaviour is unintuitive and tedious when trying to selectively
remove multiple entries.

The feature was requested in the group chat. Tested both removing a
single entry and multiple entries with two different avatars on Linux.
This commit is contained in:
miKaぴょん
2015-09-23 19:03:17 +02:00
parent eaf790c118
commit 8fbce02226

View File

@@ -85,7 +85,7 @@ BOOL LLFloaterBlacklist::postBuild()
}
void LLFloaterBlacklist::refresh()
{
LLScrollListCtrl* list = getChild<LLScrollListCtrl>("file_list");
list->clearRows();
for(std::map<LLUUID,LLSD>::iterator iter = blacklist_entries.begin(); iter != blacklist_entries.end(); ++iter)
@@ -207,13 +207,16 @@ void LLFloaterBlacklist::onClickRemove(void* user_data)
LLScrollListCtrl* list = floaterp->getChild<LLScrollListCtrl>("file_list");
if(list->getFirstSelected())
{
LLScrollListItem* item = list->getFirstSelected();
LLUUID selected_id = item->getColumn(0)->getValue().asUUID();
if(selected_id.isNull()) return;
list->deleteSingleItem(list->getFirstSelectedIndex());
blacklist_entries.erase(selected_id);
uuid_vec_t selectedIDs = list->getSelectedIDs();
for(typename uuid_vec_t::iterator iterator = selectedIDs.begin();
iterator != selectedIDs.end();
++iterator) {
LLUUID selectedID = *iterator;
if(selectedID.isNull()) continue;
blacklist_entries.erase(selectedID);
}
list->deleteSelectedItems();
updateBlacklists();
}
}
// static
@@ -252,12 +255,12 @@ void LLFloaterBlacklist::updateBlacklists()
{
gAssetStorage->mBlackListedAsset.push_back(LLUUID(iter->first));
}
if(blacklist_entries[iter->first]["entry_type"].asString() == "6")
{
blacklist_objects.push_back(LLUUID(iter->first));
}
}
saveToDisk();
LLFloaterBlacklist* instance = LLFloaterBlacklist::getInstance();
@@ -300,7 +303,7 @@ void LLFloaterBlacklist::onClickSave_continued(AIFilePicker* filepicker)
{
data[iter->first.asString()] = iter->second;
}
LLSDSerialize::toPrettyXML(data, export_file);
LLSDSerialize::toPrettyXML(data, export_file);
export_file.close();
}
}