diff options
author | Merov Linden <merov@lindenlab.com> | 2012-02-07 22:46:04 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-02-07 22:46:04 -0800 |
commit | ee3c3c15b714f8f68e98a2d4064afaec665bd64a (patch) | |
tree | a75780d299d9cff782186107bebc7e193046de11 /indra/newview | |
parent | c744603af9b53c6bc73fefbd56de68cf2778ed70 (diff) |
EXP-1841 : Final deep scrub on LLClipboard API, clean up the use of copy and cut everywhere.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfloatergesture.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llfoldervieweventlistener.h | 2 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 52 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 6 | ||||
-rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 5 |
6 files changed, 37 insertions, 44 deletions
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 4308bf2d3c..d4bce1e3a1 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1187,7 +1187,7 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) } else if (action == "copy") { - LLClipboard::getInstance()->store(mSelectedItemID); + LLClipboard::getInstance()->copyToClipboard(mSelectedItemID, LLAssetType::AT_LANDMARK); } else if (action == "paste") { @@ -1217,7 +1217,7 @@ BOOL LLFavoritesBarCtrl::isClipboardPasteable() const } LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -1246,7 +1246,7 @@ void LLFavoritesBarCtrl::pastFromClipboard() const { LLInventoryItem* item = NULL; LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); LLUUID parent_id(mFavoriteFolderId); for(S32 i = 0; i < count; i++) diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp index 3c647284f6..d449c4ff1b 100644 --- a/indra/newview/llfloatergesture.cpp +++ b/indra/newview/llfloatergesture.cpp @@ -395,7 +395,7 @@ bool LLFloaterGesture::isActionEnabled(const LLSD& command) return false; LLDynamicArray<LLUUID> ids; - LLClipboard::getInstance()->retrieve(ids); + LLClipboard::getInstance()->pasteFromClipboard(ids); for(LLDynamicArray<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); @@ -490,26 +490,26 @@ void LLFloaterGesture::onActivateBtnClick() void LLFloaterGesture::onCopyPasteAction(const LLSD& command) { std::string command_name = command.asString(); - // since we select this comman inventory item had already arrived . + // Since we select this command, the inventory items must have already arrived if("copy_gesture" == command_name) { uuid_vec_t ids; getSelectedIds(ids); - // make sure that clopboard is empty + // Make sure the clipboard is empty LLClipboard::getInstance()->reset(); for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++) { LLInventoryItem* item = gInventory.getItem(*it); if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) { - LLClipboard::getInstance()->add(item->getUUID()); + LLClipboard::getInstance()->addToClipboard(item->getUUID(),LLAssetType::AT_GESTURE); } } } else if ("paste" == command_name) { LLDynamicArray<LLUUID> ids; - LLClipboard::getInstance()->retrieve(ids); + LLClipboard::getInstance()->pasteFromClipboard(ids); if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID)) return; LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index aee31ca033..06682dcbf1 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -75,7 +75,7 @@ public: virtual void move( LLFolderViewEventListener* parent_listener ) = 0; virtual BOOL isItemCopyable() const = 0; virtual BOOL copyToClipboard() const = 0; - virtual void cutToClipboard() = 0; + virtual BOOL cutToClipboard() const = 0; virtual BOOL isClipboardPasteable() const = 0; virtual void pasteFromClipboard() = 0; virtual void pasteLinkFromClipboard() = 0; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 7ba914eaf6..9775e54d6a 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -208,13 +208,27 @@ BOOL LLInvFVBridge::isLink() const /** * @brief Adds this item into clipboard storage */ -void LLInvFVBridge::cutToClipboard() +BOOL LLInvFVBridge::cutToClipboard() const { - if (isItemMovable() && isItemRemovable()) + LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); + if (inv_item && isItemMovable() && isItemRemovable()) { - LLClipboard::getInstance()->cut(mUUID); + LLClipboard::getInstance()->setCutMode(true); + return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); } + return FALSE; } + +BOOL LLInvFVBridge::copyToClipboard() const +{ + LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID); + if (inv_item && isItemCopyable()) + { + return LLClipboard::getInstance()->addToClipboard(mUUID,inv_item->getType()); + } + return FALSE; +} + // *TODO: make sure this does the right thing void LLInvFVBridge::showProperties() { @@ -413,7 +427,7 @@ BOOL LLInvFVBridge::isClipboardPasteable() const // 1. folders should be pastable // 2. when pasting, we should paste what is authorized and let the rest not pasted LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -451,7 +465,7 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const } LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -1673,16 +1687,6 @@ BOOL LLItemBridge::isItemCopyable() const return FALSE; } -BOOL LLItemBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLClipboard::getInstance()->add(mUUID); - return TRUE; - } - return FALSE; -} - LLViewerInventoryItem* LLItemBridge::getItem() const { LLViewerInventoryItem* item = NULL; @@ -1785,16 +1789,6 @@ BOOL LLFolderBridge::isItemCopyable() const return gSavedSettings.getBOOL("InventoryLinking"); } -BOOL LLFolderBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLClipboard::getInstance()->add(mUUID); - return TRUE; - } - return FALSE; -} - BOOL LLFolderBridge::isClipboardPasteable() const { if ( ! LLInvFVBridge::isClipboardPasteable() ) @@ -1810,7 +1804,7 @@ BOOL LLFolderBridge::isClipboardPasteable() const } LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); const LLViewerInventoryCategory *current_cat = getCategory(); // Search for the direct descendent of current Friends subfolder among all pasted items, @@ -1848,7 +1842,7 @@ BOOL LLFolderBridge::isClipboardPasteableAsLink() const const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); const LLUUID ¤t_cat_id = current_cat->getUUID(); LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); S32 count = objects.count(); for(S32 i = 0; i < count; i++) { @@ -2844,7 +2838,7 @@ void LLFolderBridge::pasteFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) @@ -2900,7 +2894,7 @@ void LLFolderBridge::pasteLinkFromClipboard() const LLUUID parent_id(mUUID); LLDynamicArray<LLUUID> objects; - LLClipboard::getInstance()->retrieve(objects); + LLClipboard::getInstance()->pasteFromClipboard(objects); for (LLDynamicArray<LLUUID>::const_iterator iter = objects.begin(); iter != objects.end(); ++iter) diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 3bcd71557c..f13ff15bc5 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -105,8 +105,8 @@ public: virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch); virtual void move(LLFolderViewEventListener* new_parent_bridge) {} virtual BOOL isItemCopyable() const { return FALSE; } - virtual BOOL copyToClipboard() const { return FALSE; } - virtual void cutToClipboard(); + virtual BOOL copyToClipboard() const; + virtual BOOL cutToClipboard() const; virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; virtual void pasteFromClipboard() {} @@ -211,7 +211,6 @@ public: virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); virtual BOOL isItemCopyable() const; - virtual BOOL copyToClipboard() const; virtual BOOL hasChildren() const { return FALSE; } virtual BOOL isUpToDate() const { return TRUE; } @@ -274,7 +273,6 @@ public: virtual BOOL isItemCopyable() const; virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; - virtual BOOL copyToClipboard() const; static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 98ea680504..eb0a257def 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -124,7 +124,7 @@ public: virtual void move(LLFolderViewEventListener* parent_listener); virtual BOOL isItemCopyable() const; virtual BOOL copyToClipboard() const; - virtual void cutToClipboard(); + virtual BOOL cutToClipboard() const; virtual BOOL isClipboardPasteable() const; virtual void pasteFromClipboard(); virtual void pasteLinkFromClipboard(); @@ -524,8 +524,9 @@ BOOL LLTaskInvFVBridge::copyToClipboard() const return FALSE; } -void LLTaskInvFVBridge::cutToClipboard() +BOOL LLTaskInvFVBridge::cutToClipboard() const { + return FALSE; } BOOL LLTaskInvFVBridge::isClipboardPasteable() const |