[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);
|
AISUpdate::parseUUIDArray(result, "_created_categories", ids);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case UPDATECATEGORY:
|
||||||
|
{
|
||||||
|
AISUpdate::parseUUIDArray(result, "_updated_categories", ids);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,10 @@ void update_all_marketplace_count()
|
||||||
return;
|
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;
|
LLViewerInventoryCategory* cat;
|
||||||
|
|
||||||
|
|
@ -395,7 +398,10 @@ void rename_category(LLInventoryModel* model, const LLUUID& cat_id, const std::s
|
||||||
|
|
||||||
LLSD updates;
|
LLSD updates;
|
||||||
updates["name"] = new_name;
|
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,
|
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
|
// Nudge all listing categories to signal that their marketplace status changed
|
||||||
void update_all_marketplace_count();
|
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);
|
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());
|
pInstance->onDestinationCreated(idFolder, pInstance->m_DestPath.front());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
// static
|
||||||
void RlvGiveToRLVOffer::moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName)
|
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);
|
const LLViewerInventoryCategory* pFolder = gInventory.getCategory(idFolder);
|
||||||
if ( (pDest) && (pFolder) )
|
if ( (idDestination.notNull()) && (pFolder) )
|
||||||
{
|
{
|
||||||
LLPointer<LLViewerInventoryCategory> pNewFolder = new LLViewerInventoryCategory(pFolder);
|
bool needsRename = (pFolder->getName() != strName);
|
||||||
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);
|
|
||||||
|
|
||||||
pNewFolder->setParent(pDest->getUUID());
|
LLPointer<LLInventoryCallback> cbMove;
|
||||||
pNewFolder->updateParentOnServer(FALSE);
|
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);
|
if (needsRename)
|
||||||
pNewFolder->updateServer(FALSE);
|
{
|
||||||
gInventory.updateCategory(pNewFolder);
|
rename_category(&gInventory, idFolder, strName, (cbMove) ? cbMove : cbFinal);
|
||||||
|
}
|
||||||
gInventory.notifyObservers();
|
}
|
||||||
|
else if (cbFinal)
|
||||||
|
{
|
||||||
|
cbFinal.get()->fire(LLUUID::null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
|
||||||
void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||||
{
|
{
|
||||||
if (mask & LLInventoryObserver::ADD)
|
if (mask & LLInventoryObserver::ADD)
|
||||||
|
|
@ -633,7 +653,6 @@ void RlvGiveToRLVTaskOffer::changed(U32 mask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
|
||||||
void RlvGiveToRLVTaskOffer::done()
|
void RlvGiveToRLVTaskOffer::done()
|
||||||
{
|
{
|
||||||
gInventory.removeObserver(this);
|
gInventory.removeObserver(this);
|
||||||
|
|
@ -642,22 +661,29 @@ void RlvGiveToRLVTaskOffer::done()
|
||||||
doOnIdleOneTime(boost::bind(&RlvGiveToRLVTaskOffer::doneIdle, this));
|
doOnIdleOneTime(boost::bind(&RlvGiveToRLVTaskOffer::doneIdle, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checked: 2014-01-07 (RLVa-1.4.10)
|
|
||||||
void RlvGiveToRLVTaskOffer::doneIdle()
|
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())) )
|
if ( (!pFolder) || (!createDestinationFolder(pFolder->getName())) )
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checked: 2010-04-18 (RLVa-1.2.0)
|
void RlvGiveToRLVTaskOffer::onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName)
|
||||||
void RlvGiveToRLVTaskOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
|
||||||
{
|
{
|
||||||
const LLViewerInventoryCategory* pTarget = (idFolder.notNull()) ? gInventory.getCategory(idFolder) : NULL;
|
if (const LLViewerInventoryCategory* pTarget = (idDestFolder.notNull()) ? gInventory.getCategory(idDestFolder) : nullptr)
|
||||||
if (pTarget)
|
{
|
||||||
|
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));
|
RlvBehaviourNotifyHandler::sendNotification("accepted_in_rlv inv_offer " + RlvInventory::instance().getSharedPath(idOfferedFolder));
|
||||||
}
|
}
|
||||||
delete this;
|
delete this;
|
||||||
|
|
@ -684,7 +710,7 @@ void RlvGiveToRLVAgentOffer::doneIdle()
|
||||||
void RlvGiveToRLVAgentOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
void RlvGiveToRLVAgentOffer::onDestinationCreated(const LLUUID& idFolder, const std::string& strName)
|
||||||
{
|
{
|
||||||
if ( (idFolder.notNull()) && (mComplete.size()) )
|
if ( (idFolder.notNull()) && (mComplete.size()) )
|
||||||
moveAndRename(mComplete[0], idFolder, strName);
|
moveAndRename(mComplete[0], idFolder, strName, nullptr);
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ protected:
|
||||||
virtual ~RlvGiveToRLVOffer() {}
|
virtual ~RlvGiveToRLVOffer() {}
|
||||||
protected:
|
protected:
|
||||||
bool createDestinationFolder(const std::string& strPath);
|
bool createDestinationFolder(const std::string& strPath);
|
||||||
virtual void onDestinationCreated(const LLUUID& idFolder, const std::string& strName) = 0;
|
virtual void onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName) = 0;
|
||||||
void moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName);
|
static void moveAndRename(const LLUUID& idFolder, const LLUUID& idDestination, const std::string& strName, LLPointer<LLInventoryCallback> cb);
|
||||||
private:
|
private:
|
||||||
static void onCategoryCreateCallback(LLUUID idFolder, RlvGiveToRLVOffer* pInstance);
|
static void onCategoryCreateCallback(LLUUID idFolder, RlvGiveToRLVOffer* pInstance);
|
||||||
|
|
||||||
|
|
@ -147,11 +147,12 @@ class RlvGiveToRLVTaskOffer : public LLInventoryObserver, RlvGiveToRLVOffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RlvGiveToRLVTaskOffer(const LLUUID& idTransaction) : RlvGiveToRLVOffer(), m_idTransaction(idTransaction) {}
|
RlvGiveToRLVTaskOffer(const LLUUID& idTransaction) : RlvGiveToRLVOffer(), m_idTransaction(idTransaction) {}
|
||||||
/*virtual*/ void changed(U32 mask);
|
void changed(U32 mask) override;
|
||||||
protected:
|
protected:
|
||||||
/*virtual*/ void done();
|
void done();
|
||||||
void doneIdle();
|
void doneIdle();
|
||||||
/*virtual*/ void onDestinationCreated(const LLUUID& idFolder, const std::string& strName);
|
void onDestinationCreated(const LLUUID& idDestFolder, const std::string& strName) override;
|
||||||
|
void onOfferCompleted(const LLUUID& idOfferedFolder);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<LLUUID> folder_ref_t;
|
typedef std::vector<LLUUID> folder_ref_t;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue