[FIXED] CATZ-553: Give-to-#RLV with nested subfolders
parent
57feec9763
commit
980d418311
|
|
@ -452,6 +452,11 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
|
|||
AISUpdate::parseUUIDArray(result, "_created_categories", ids);
|
||||
}
|
||||
break;
|
||||
case UPDATECATEGORY:
|
||||
{
|
||||
AISUpdate::parseUUIDArray(result, "_updated_categories", ids);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,7 +381,10 @@ void update_all_marketplace_count()
|
|||
return;
|
||||
}
|
||||
|
||||
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name)
|
||||
//void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name)
|
||||
// [RLVa:KB] - Checked: RLVa-2.3 (Give-to-#RLV)
|
||||
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name, LLPointer<LLInventoryCallback> cb)
|
||||
// [/RLVa:KB]
|
||||
{
|
||||
LLViewerInventoryCategory* cat;
|
||||
|
||||
|
|
@ -395,7 +398,10 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s
|
|||
|
||||
LLSD updates;
|
||||
updates["name"] = new_name;
|
||||
update_inventory_category(cat_id, updates, NULL);
|
||||
// [RLVa:KB] - Checked: RLVa-2.3 (Give-to-#RLV)
|
||||
update_inventory_category(cat_id, updates, cb);
|
||||
// [/RLVa:KB]
|
||||
// update_inventory_category(cat_id, updates, NULL);
|
||||
}
|
||||
|
||||
void copy_inventory_category(LLInventoryModel* model,
|
||||
|
|
|
|||
|
|
@ -68,7 +68,10 @@ void update_marketplace_category(const LLUUID& cat_id, bool perform_consistency_
|
|||
// Nudge all listing categories to signal that their marketplace status changed
|
||||
void update_all_marketplace_count();
|
||||
|
||||
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
|
||||
// [RLVa:KB] - Checked: RLVa-2.3 (Give-to-#RLV)
|
||||
void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name, LLPointer<LLInventoryCallback> cb = nullptr);
|
||||
// [/RLVa:KB]
|
||||
//void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::string& new_name);
|
||||
|
||||
void copy_inventory_category(LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& parent_id, const LLUUID& root_copy_id = LLUUID::null, bool move_no_copy_items = false);
|
||||
|
||||
|
|
|
|||
|
|
@ -578,36 +578,56 @@ void RlvGiveToRLVOffer::onCategoryCreateCallback(LLUUID idFolder, RlvGiveToRLVOf
|
|||
pInstance->onDestinationCreated(idFolder, pInstance->m_DestPath.front());
|
||||
}
|
||||
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVOffer::moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName)
|
||||
// static
|
||||
void RlvGiveToRLVOffer::moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName, const LLPointer<LLInventoryCallback> cbFinal)
|
||||
{
|
||||
const LLViewerInventoryCategory* pDest = gInventory.getCategory(idDestination);
|
||||
const LLViewerInventoryCategory* pFolder = gInventory.getCategory(idFolder);
|
||||
if ( (pDest) && (pFolder) )
|
||||
if ( (idDestination.notNull()) && (pFolder) )
|
||||
{
|
||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
||||
if (pDest->getUUID() != pFolder->getParentUUID())
|
||||
{
|
||||
LLInventoryModel::update_list_t update;
|
||||
LLInventoryModel::LLCategoryUpdate updOldParent(pFolder->getParentUUID(), -1);
|
||||
update.push_back(updOldParent);
|
||||
LLInventoryModel::LLCategoryUpdate updNewParent(pDest->getUUID(), 1);
|
||||
update.push_back(updNewParent);
|
||||
gInventory.accountForUpdate(update);
|
||||
bool needsRename = (pFolder->getName() != strName);
|
||||
|
||||
pNewFolder->setParent(pDest->getUUID());
|
||||
pNewFolder->updateParentOnServer(FALSE);
|
||||
LLPointer<LLInventoryCallback> cbMove;
|
||||
if (idDestination != pFolder->getParentUUID())
|
||||
{
|
||||
// We have to move *after* the rename operation completes or AIS will drop it
|
||||
if (!needsRename)
|
||||
{
|
||||
LLInventoryModel::update_list_t update;
|
||||
LLInventoryModel::LLCategoryUpdate updOldParent(pFolder->getParentUUID(), -1);
|
||||
update.push_back(updOldParent);
|
||||
LLInventoryModel::LLCategoryUpdate updNewParent(idDestination, 1);
|
||||
update.push_back(updNewParent);
|
||||
gInventory.accountForUpdate(update);
|
||||
|
||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
||||
pNewFolder->setParent(idDestination);
|
||||
pNewFolder->updateParentOnServer(FALSE);
|
||||
|
||||
gInventory.updateCategory(pNewFolder);
|
||||
gInventory.notifyObservers();
|
||||
|
||||
if (cbFinal)
|
||||
{
|
||||
cbFinal.get()->fire(idFolder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cbMove = new LLBoostFuncInventoryCallback(boost::bind(RlvGiveToRLVOffer::moveAndRename, _1, idDestination, strName, cbFinal));
|
||||
}
|
||||
}
|
||||
|
||||
pNewFolder->rename(strName);
|
||||
pNewFolder->updateServer(FALSE);
|
||||
gInventory.updateCategory(pNewFolder);
|
||||
|
||||
gInventory.notifyObservers();
|
||||
if (needsRename)
|
||||
{
|
||||
rename_category(&gInventory, idFolder, strName, (cbMove) ? cbMove : cbFinal);
|
||||
}
|
||||
}
|
||||
else if (cbFinal)
|
||||
{
|
||||
cbFinal.get()->fire(LLUUID::null);
|
||||
}
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||
{
|
||||
if (mask & LLInventoryObserver::ADD)
|
||||
|
|
@ -633,7 +653,6 @@ void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
|||
}
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVTaskOffer::done()
|
||||
{
|
||||
gInventory.removeObserver(this);
|
||||
|
|
@ -642,22 +661,29 @@ void RlvGiveToRLVTaskOffer::done()
|
|||
doOnIdleOneTime(boost::bind(&RlvGiveToRLVTaskOffer::doneIdle, this));
|
||||
}
|
||||
|
||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
||||
void RlvGiveToRLVTaskOffer::doneIdle()
|
||||
{
|
||||
const LLViewerInventoryCategory* pFolder = (m_Folders.size()) ? gInventory.getCategory(m_Folders.front()) : NULL;
|
||||
const LLViewerInventoryCategory* pFolder = (m_Folders.size()) ? gInventory.getCategory(m_Folders.front()) : nullptr;
|
||||
if ( (!pFolder) || (!createDestinationFolder(pFolder->getName())) )
|
||||
delete this;
|
||||
}
|
||||
|
||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
||||
void RlvGiveToRLVTaskOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
||||
void RlvGiveToRLVTaskOffer::onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName)
|
||||
{
|
||||
const LLViewerInventoryCategory* pTarget = (idFolder.notNull()) ? gInventory.getCategory(idFolder) : NULL;
|
||||
if (pTarget)
|
||||
if (const LLViewerInventoryCategory* pTarget = (idDestFolder.notNull()) ? gInventory.getCategory(idDestFolder) : nullptr)
|
||||
{
|
||||
moveAndRename(m_Folders.front(), idDestFolder, strName, new LLBoostFuncInventoryCallback(boost::bind(&RlvGiveToRLVTaskOffer::onOfferCompleted, this, _1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
onOfferCompleted(LLUUID::null);
|
||||
}
|
||||
}
|
||||
|
||||
void RlvGiveToRLVTaskOffer::onOfferCompleted(const LLUUID& idOfferedFolder)
|
||||
{
|
||||
if (idOfferedFolder.notNull())
|
||||
{
|
||||
const LLUUID& idOfferedFolder = m_Folders.front();
|
||||
moveAndRename(idOfferedFolder, idFolder, strName);
|
||||
RlvBehaviourNotifyHandler::sendNotification("accepted_in_rlv inv_offer " + RlvInventory::instance().getSharedPath(idOfferedFolder));
|
||||
}
|
||||
delete this;
|
||||
|
|
@ -684,7 +710,7 @@ void RlvGiveToRLVAgentOffer::doneIdle()
|
|||
void RlvGiveToRLVAgentOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
||||
{
|
||||
if ( (idFolder.notNull()) && (mComplete.size()) )
|
||||
moveAndRename(mComplete[0], idFolder, strName);
|
||||
moveAndRename(mComplete[0], idFolder, strName, nullptr);
|
||||
delete this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ protected:
|
|||
virtual ~RlvGiveToRLVOffer() {}
|
||||
protected:
|
||||
bool createDestinationFolder(const std::string& strPath);
|
||||
virtual void onDestinationCreated(const LLUUID& idFolder, const std::string& strName) = 0;
|
||||
void moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName);
|
||||
virtual void onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName) = 0;
|
||||
static void moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName, LLPointer<LLInventoryCallback> cb);
|
||||
private:
|
||||
static void onCategoryCreateCallback(LLUUID idFolder, RlvGiveToRLVOffer* pInstance);
|
||||
|
||||
|
|
@ -147,11 +147,12 @@ class RlvGiveToRLVTaskOffer : public LLInventoryObserver, RlvGiveToRLVOffer
|
|||
{
|
||||
public:
|
||||
RlvGiveToRLVTaskOffer(const LLUUID& idTransaction) : RlvGiveToRLVOffer(), m_idTransaction(idTransaction) {}
|
||||
/*virtual*/ void changed(U32 mask);
|
||||
void changed(U32 mask) override;
|
||||
protected:
|
||||
/*virtual*/ void done();
|
||||
void doneIdle();
|
||||
/*virtual*/ void onDestinationCreated(const LLUUID& idFolder, const std::string& strName);
|
||||
void done();
|
||||
void doneIdle();
|
||||
void onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName) override;
|
||||
void onOfferCompleted(const LLUUID& idOfferedFolder);
|
||||
|
||||
protected:
|
||||
typedef std::vector<LLUUID> folder_ref_t;
|
||||
|
|
|
|||
Loading…
Reference in New Issue