DD-84 : Fix all active listing modification actions. Add specific message when listing will unlist. Make update skip consistency check when called from internal level (not public API).

master
Merov Linden 2014-06-03 19:46:33 -07:00
parent d5cd32a2a8
commit 86d75052f6
11 changed files with 156 additions and 53 deletions

View File

@ -946,7 +946,7 @@ void LLFolderView::cut()
if (listener)
{
listener->cutToClipboard();
listener->removeItem();
//listener->removeItem();
}
}

View File

@ -169,7 +169,7 @@ public:
virtual BOOL isItemCopyable() const = 0;
virtual BOOL copyToClipboard() const = 0;
virtual BOOL cutToClipboard() const = 0;
virtual BOOL cutToClipboard() = 0;
virtual BOOL isClipboardPasteable() const = 0;
virtual void pasteFromClipboard() = 0;

View File

@ -86,7 +86,7 @@ public:
virtual void move( LLFolderViewModelItem* parent_listener ) { }
virtual BOOL isItemCopyable() const { return FALSE; }
virtual BOOL copyToClipboard() const { return FALSE; }
virtual BOOL cutToClipboard() const { return FALSE; }
virtual BOOL cutToClipboard() { return FALSE; }
virtual BOOL isClipboardPasteable() const { return FALSE; }
virtual void pasteFromClipboard() { }
virtual void pasteLinkFromClipboard() { }

View File

@ -263,13 +263,50 @@ BOOL LLInvFVBridge::isLibraryItem() const
/**
* @brief Adds this item into clipboard storage
*/
BOOL LLInvFVBridge::cutToClipboard() const
BOOL LLInvFVBridge::cutToClipboard()
{
const LLInventoryObject* obj = gInventory.getObject(mUUID);
if (obj && isItemMovable() && isItemRemovable())
{
const LLUUID &marketplacelistings_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
const BOOL cut_from_marketplacelistings = gInventory.isObjectDescendentOf(mUUID, marketplacelistings_id);
if (cut_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID))
{
// Prompt the user if cutting from marketplace active listing
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInvFVBridge::callback_cutToClipboard, this, _1, _2));
}
else
{
// Otherwise just do the cut
return perform_cutToClipboard();
}
}
return FALSE;
}
// Callback for cutToClipboard if DAMA required...
BOOL LLInvFVBridge::callback_cutToClipboard(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
return perform_cutToClipboard();
}
return FALSE;
}
BOOL LLInvFVBridge::perform_cutToClipboard()
{
const LLInventoryObject* obj = gInventory.getObject(mUUID);
if (obj && isItemMovable() && isItemRemovable())
{
LLClipboard::instance().setCutMode(true);
return LLClipboard::instance().addToClipboard(mUUID);
if (LLClipboard::instance().addToClipboard(mUUID))
{
removeObject(&gInventory, mUUID);
return TRUE;
}
}
return FALSE;
}
@ -1480,7 +1517,7 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
removeObject(model, mUUID);
//removeObject(model, mUUID);
return;
}
else if ("copy" == action)
@ -2455,7 +2492,16 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
if ((move_is_from_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(cat_id)) ||
(move_is_into_marketplacelistings && LLMarketplaceData::instance().isInActiveFolder(mUUID)))
{
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat));
if (move_is_from_marketplacelistings && (LLMarketplaceData::instance().isListed(cat_id) || LLMarketplaceData::instance().isVersionFolder(cat_id)))
{
// Move the active version folder or listing folder itself outside marketplace listings will unlist the listing so ask that question specifically
LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat));
}
else
{
// Any other case will simply modify but not unlist a listing
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_dropCategoryIntoFolder, this, _1, _2, inv_cat));
}
return true;
}
}
@ -2891,7 +2937,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
else if ("cut" == action)
{
cutToClipboard();
removeObject(model, mUUID);
//removeObject(model, mUUID);
return;
}
else if ("copy" == action)
@ -3192,20 +3238,53 @@ void LLFolderBridge::updateHierarchyCreationDate(time_t date)
void LLFolderBridge::pasteFromClipboard()
{
LLInventoryModel* model = getInventoryModel();
if(model && isClipboardPasteable())
if (model && isClipboardPasteable())
{
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
const BOOL paste_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
if (paste_into_marketplacelistings && !LLMarketplaceData::instance().isListed(mUUID) && LLMarketplaceData::instance().isInActiveFolder(mUUID))
{
// Prompt the user if pasting in marketplace active version listing (note that pasting right in the listing folder doesn't need a prompt)
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLFolderBridge::callback_pasteFromClipboard, this, _1, _2));
}
else
{
// Otherwise just do the paste
perform_pasteFromClipboard();
}
}
}
// Callback for pasteFromClipboard if DAMA required...
void LLFolderBridge::callback_pasteFromClipboard(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
perform_pasteFromClipboard();
}
}
void LLFolderBridge::perform_pasteFromClipboard()
{
LLInventoryModel* model = getInventoryModel();
if (model && isClipboardPasteable())
{
const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
const LLUUID &outbox_id = model->findCategoryUUIDForType(LLFolderType::FT_OUTBOX, false);
const LLUUID &marketplacelistings_id = model->findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS, false);
const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
const BOOL move_is_into_outbox = model->isObjectDescendentOf(mUUID, outbox_id);
const BOOL move_is_into_marketplacelistings = model->isObjectDescendentOf(mUUID, marketplacelistings_id);
std::vector<LLUUID> objects;
std::vector<LLUUID> objects;
LLClipboard::instance().pasteFromClipboard(objects);
if (move_is_into_outbox || move_is_into_marketplacelistings)
{
std::string error_msg;
@ -3234,15 +3313,15 @@ void LLFolderBridge::pasteFromClipboard()
return;
}
}
const LLUUID parent_id(mUUID);
for (std::vector<LLUUID>::const_iterator iter = objects.begin();
iter != objects.end();
++iter)
{
const LLUUID& item_id = (*iter);
LLInventoryItem *item = model->getItem(item_id);
LLInventoryObject *obj = model->getObject(item_id);
if (obj)
@ -3338,12 +3417,12 @@ void LLFolderBridge::pasteFromClipboard()
else
{
copy_inventory_item(
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
parent_id,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
gAgent.getID(),
item->getPermissions().getOwner(),
item->getUUID(),
parent_id,
std::string(),
LLPointer<LLInventoryCallback>(NULL));
}
}
}

View File

@ -114,7 +114,7 @@ public:
virtual void move(LLFolderViewModelItem* new_parent_bridge) {}
virtual BOOL isItemCopyable() const { return FALSE; }
virtual BOOL copyToClipboard() const;
virtual BOOL cutToClipboard() const;
virtual BOOL cutToClipboard();
virtual BOOL isClipboardPasteable() const;
virtual BOOL isClipboardPasteableAsLink() const;
virtual void pasteFromClipboard() {}
@ -176,6 +176,9 @@ protected:
const LLUUID& new_parent,
BOOL restamp);
void removeBatchNoCheck(std::vector<LLFolderViewModelItem*>& batch);
BOOL callback_cutToClipboard(const LLSD& notification, const LLSD& response);
BOOL perform_cutToClipboard();
protected:
LLHandle<LLInventoryPanel> mInventoryPanel;
LLFolderView* mRoot;
@ -356,6 +359,8 @@ public:
static void staticFolderOptionsMenu();
private:
void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response);
void perform_pasteFromClipboard();
bool mCallingCards;
bool mWearables;

View File

@ -141,7 +141,7 @@ void update_marketplace_folder_hierarchy(const LLUUID cat_id)
return;
}
void update_marketplace_category(const LLUUID& cur_uuid)
void update_marketplace_category(const LLUUID& cur_uuid, bool skip_consistency_enforcement)
{
// When changing the marketplace status of an item, we usually have to change the status of all
// folders in the same listing. This is because the display of each folder is affected by the
@ -160,12 +160,11 @@ void update_marketplace_category(const LLUUID& cur_uuid)
LLUUID listing_uuid = nested_parent_id(cur_uuid, depth);
// Verify marketplace data consistency for this listing
if (LLMarketplaceData::instance().isListed(listing_uuid))
if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(listing_uuid))
{
LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolder(listing_uuid);
if (version_folder_uuid.notNull() && !gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid))
{
// *TODO : Confirm with Producer that this is what we want to happen in that case!
LL_INFOS("SLM") << "Unlist as the version folder is not under the listing folder anymore!!" << LL_ENDL;
LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null);
LLMarketplaceData::instance().activateListing(listing_uuid, false);
@ -177,9 +176,8 @@ void update_marketplace_category(const LLUUID& cur_uuid)
}
else if (depth < 0)
{
if (LLMarketplaceData::instance().isListed(cur_uuid))
if (!skip_consistency_enforcement && LLMarketplaceData::instance().isListed(cur_uuid))
{
// *TODO : Confirm with Producer that this is what we want to happen in that case!
LL_INFOS("SLM") << "Disassociate as the listing folder is not under the marketplace folder anymore!!" << LL_ENDL;
LLMarketplaceData::instance().clearListing(cur_uuid);
}
@ -1928,21 +1926,16 @@ void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LL
void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm)
{
if ("rename" == action)
{
root->startRenamingSelectedItem();
return;
}
std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
// Prompt the user for some marketplace active listing edits
if (user_confirm && (("paste" == action) || ("cut" == action) || ("delete" == action)))
if (user_confirm && (("cut" == action) || ("delete" == action) || ("rename" == action) || ("properties" == action) || ("task_properties" == action)))
{
std::set<LLFolderViewItem*>::iterator set_iter = selected_items.begin();
LLFolderViewModelItemInventory * viewModel = NULL;
for (; set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewModelItemInventory * viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem());
viewModel = dynamic_cast<LLFolderViewModelItemInventory *>((*set_iter)->getViewModelItem());
if (viewModel && LLMarketplaceData::instance().isInActiveFolder(viewModel->getUUID()))
{
break;
@ -1950,11 +1943,26 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
}
if (set_iter != selected_items.end())
{
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
if ((("cut" == action) || ("delete" == action)) && (LLMarketplaceData::instance().isListed(viewModel->getUUID()) || LLMarketplaceData::instance().isVersionFolder(viewModel->getUUID())))
{
// Cut or delete of the active version folder or listing folder itself will unlist the listing so ask that question specifically
LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
}
else
{
// Any other case will simply modify but not unlist a listing
LLNotificationsUtil::add("ConfirmMerchantActiveChange", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, model, root, action));
}
return;
}
}
if ("rename" == action)
{
root->startRenamingSelectedItem();
return;
}
if ("delete" == action)
{
LLSD args;

View File

@ -59,7 +59,7 @@ void show_item_original(const LLUUID& item_uuid);
void reset_inventory_filter();
// Nudge the listing categories in the inventory to signal that their marketplace status changed
void update_marketplace_category(const LLUUID& cat_id);
void update_marketplace_category(const LLUUID& cat_id, bool skip_consistency_enforcement = false);
// Nudge all listing categories to signal that their marketplace status changed
void update_all_marketplace_count();

View File

@ -1537,11 +1537,11 @@ void LLInventoryModel::addChangedMask(U32 mask, const LLUUID& referent)
}
}
mModifyMask |= mask;
mModifyMask |= mask;
if (referent.notNull() && (mChangedItemIDs.find(referent) == mChangedItemIDs.end()))
{
mChangedItemIDs.insert(referent);
update_marketplace_category(referent);
update_marketplace_category(referent, true);
if (mask & LLInventoryObserver::ADD)
{

View File

@ -1318,7 +1318,7 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons
}
mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed);
update_marketplace_category(folder_id);
update_marketplace_category(folder_id, true);
gInventory.notifyObservers();
return true;
}
@ -1334,7 +1334,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm)
if (update_slm)
{
update_marketplace_category(folder_id);
update_marketplace_category(folder_id, true);
gInventory.notifyObservers();
}
return true;
@ -1422,11 +1422,9 @@ bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id)
{
S32 depth = depth_nesting_in_marketplace(obj_id);
LLUUID listing_uuid = nested_parent_id(obj_id, depth);
// *TODO: use true activation status once SLM is in decent shape again
//bool active = getActivationState(listing_uuid); Hack waiting for SLM to allow activation again...
bool active = true;
bool active = getActivationState(listing_uuid);
LLUUID version_uuid = getVersionFolder(listing_uuid);
return (active && gInventory.isObjectDescendentOf(obj_id, version_uuid));
return (active && ((obj_id == listing_uuid) || (obj_id == version_uuid) || gInventory.isObjectDescendentOf(obj_id, version_uuid)));
}
// Private Modifiers
@ -1440,7 +1438,7 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id)
(it->second).mListingId = listing_id;
update_marketplace_category(folder_id);
update_marketplace_category(folder_id, true);
gInventory.notifyObservers();
return true;
}
@ -1461,8 +1459,8 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID
(it->second).mVersionFolderId = version_id;
update_marketplace_category(old_version_id);
update_marketplace_category(version_id);
update_marketplace_category(old_version_id, true);
update_marketplace_category(version_id, true);
gInventory.notifyObservers();
return true;
}
@ -1477,7 +1475,7 @@ bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activat
(it->second).mIsActive = activate;
update_marketplace_category((it->second).mListingFolderId);
update_marketplace_category((it->second).mListingFolderId, true);
gInventory.notifyObservers();
return true;
}

View File

@ -130,7 +130,7 @@ public:
virtual void move(LLFolderViewModelItem* parent_listener);
virtual BOOL isItemCopyable() const;
virtual BOOL copyToClipboard() const;
virtual BOOL cutToClipboard() const;
virtual BOOL cutToClipboard();
virtual BOOL isClipboardPasteable() const;
virtual void pasteFromClipboard();
virtual void pasteLinkFromClipboard();
@ -542,7 +542,7 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const
return FALSE;
}
BOOL LLTaskInvFVBridge::cutToClipboard() const
BOOL LLTaskInvFVBridge::cutToClipboard()
{
return FALSE;
}

View File

@ -319,6 +319,19 @@ Initialization with the Marketplace failed because of a system or network error.
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="ConfirmMerchantUnlist"
type="alertmodal">
This action will unlist this listing. Do you want to continue?
<tag>confirm</tag>
<usetemplate
ignoretext="Confirm before I unlist an active listing on the marketplace"
name="okcancelignore"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="CompileQueueSaveText"