aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelinventory.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/newview/llpanelinventory.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/newview/llpanelinventory.cpp')
-rw-r--r--linden/indra/newview/llpanelinventory.cpp88
1 files changed, 50 insertions, 38 deletions
diff --git a/linden/indra/newview/llpanelinventory.cpp b/linden/indra/newview/llpanelinventory.cpp
index 05deb5f..9d60d20 100644
--- a/linden/indra/newview/llpanelinventory.cpp
+++ b/linden/indra/newview/llpanelinventory.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -117,7 +118,7 @@ public:
117 void showProperties(); 118 void showProperties();
118 void buyItem(); 119 void buyItem();
119 S32 getPrice(); 120 S32 getPrice();
120 static void commitBuyItem(S32 option, void* data); 121 static bool commitBuyItem(const LLSD& notification, const LLSD& response);
121 122
122 // LLFolderViewEventListener functionality 123 // LLFolderViewEventListener functionality
123 virtual const std::string& getName() const; 124 virtual const std::string& getName() const;
@@ -224,21 +225,21 @@ void LLTaskInvFVBridge::buyItem()
224 LLViewerObject* obj; 225 LLViewerObject* obj;
225 if( ( obj = gObjectList.findObject( mPanel->getTaskUUID() ) ) && obj->isAttachment() ) 226 if( ( obj = gObjectList.findObject( mPanel->getTaskUUID() ) ) && obj->isAttachment() )
226 { 227 {
227 gViewerWindow->alertXml("Cannot_Purchase_an_Attachment"); 228 LLNotifications::instance().add("Cannot_Purchase_an_Attachment");
228 llinfos << "Attempt to purchase an attachment" << llendl; 229 llinfos << "Attempt to purchase an attachment" << llendl;
229 delete inv; 230 delete inv;
230 } 231 }
231 else 232 else
232 { 233 {
233 LLStringUtil::format_map_t args; 234 LLSD args;
234 args["[PRICE]"] = llformat("%d",sale_info.getSalePrice()); 235 args["PRICE"] = llformat("%d",sale_info.getSalePrice());
235 args["[OWNER]"] = owner_name; 236 args["OWNER"] = owner_name;
236 if (sale_info.getSaleType() != LLSaleInfo::FS_CONTENTS) 237 if (sale_info.getSaleType() != LLSaleInfo::FS_CONTENTS)
237 { 238 {
238 U32 next_owner_mask = perm.getMaskNextOwner(); 239 U32 next_owner_mask = perm.getMaskNextOwner();
239 args["[MODIFYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_MODIFY) ? "PermYes" : "PermNo"); 240 args["MODIFYPERM"] = LLNotifications::instance().getGlobalString((next_owner_mask & PERM_MODIFY) ? "PermYes" : "PermNo");
240 args["[COPYPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_COPY) ? "PermYes" : "PermNo"); 241 args["COPYPERM"] = LLNotifications::instance().getGlobalString((next_owner_mask & PERM_COPY) ? "PermYes" : "PermNo");
241 args["[RESELLPERM]"] = LLAlertDialog::getTemplateMessage((next_owner_mask & PERM_TRANSFER) ? "PermYes" : "PermNo"); 242 args["RESELLPERM"] = LLNotifications::instance().getGlobalString((next_owner_mask & PERM_TRANSFER) ? "PermYes" : "PermNo");
242 } 243 }
243 244
244 std::string alertdesc; 245 std::string alertdesc;
@@ -256,7 +257,11 @@ void LLTaskInvFVBridge::buyItem()
256 break; 257 break;
257 } 258 }
258 259
259 gViewerWindow->alertXml(alertdesc, args, LLTaskInvFVBridge::commitBuyItem, (void*)inv); 260 LLSD payload;
261 payload["task_id"] = inv->mTaskID;
262 payload["item_id"] = inv->mItemID;
263 payload["type"] = inv->mType;
264 LLNotifications::instance().add(alertdesc, args, payload, LLTaskInvFVBridge::commitBuyItem);
260 } 265 }
261} 266}
262 267
@@ -274,14 +279,13 @@ S32 LLTaskInvFVBridge::getPrice()
274} 279}
275 280
276// static 281// static
277void LLTaskInvFVBridge::commitBuyItem(S32 option, void* data) 282bool LLTaskInvFVBridge::commitBuyItem(const LLSD& notification, const LLSD& response)
278{ 283{
279 LLBuyInvItemData* inv = (LLBuyInvItemData*)data; 284 S32 option = LLNotification::getSelectedOption(notification, response);
280 if(!inv) return;
281 if(0 == option) 285 if(0 == option)
282 { 286 {
283 LLViewerObject* object = gObjectList.findObject(inv->mTaskID); 287 LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
284 if(!object || !object->getRegion()) return; 288 if(!object || !object->getRegion()) return false;
285 289
286 290
287 LLMessageSystem* msg = gMessageSystem; 291 LLMessageSystem* msg = gMessageSystem;
@@ -290,13 +294,13 @@ void LLTaskInvFVBridge::commitBuyItem(S32 option, void* data)
290 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); 294 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
291 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); 295 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
292 msg->nextBlockFast(_PREHASH_Data); 296 msg->nextBlockFast(_PREHASH_Data);
293 msg->addUUIDFast(_PREHASH_ObjectID, inv->mTaskID); 297 msg->addUUIDFast(_PREHASH_ObjectID, notification["payload"]["task_id"].asUUID());
294 msg->addUUIDFast(_PREHASH_ItemID, inv->mItemID); 298 msg->addUUIDFast(_PREHASH_ItemID, notification["payload"]["item_id"].asUUID());
295 msg->addUUIDFast(_PREHASH_FolderID, 299 msg->addUUIDFast(_PREHASH_FolderID,
296 gInventory.findCategoryUUIDForType(inv->mType)); 300 gInventory.findCategoryUUIDForType((LLAssetType::EType)notification["payload"]["type"].asInteger()));
297 msg->sendReliable(object->getRegion()->getHost()); 301 msg->sendReliable(object->getRegion()->getHost());
298 } 302 }
299 delete inv; 303 return false;
300} 304}
301 305
302const std::string& LLTaskInvFVBridge::getName() const 306const std::string& LLTaskInvFVBridge::getName() const
@@ -425,25 +429,25 @@ BOOL LLTaskInvFVBridge::isItemRemovable()
425typedef std::pair<LLUUID, std::list<LLUUID> > two_uuids_list_t; 429typedef std::pair<LLUUID, std::list<LLUUID> > two_uuids_list_t;
426typedef std::pair<LLPanelInventory*, two_uuids_list_t> remove_data_t; 430typedef std::pair<LLPanelInventory*, two_uuids_list_t> remove_data_t;
427 431
428void remove_task_inventory_callback(S32 option, void* user_data) 432bool remove_task_inventory_callback(const LLSD& notification, const LLSD& response, LLPanelInventory* panel)
429{ 433{
430 remove_data_t* data = (remove_data_t*)user_data; 434 S32 option = LLNotification::getSelectedOption(notification, response);
431 LLViewerObject* object = NULL; 435 LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
432 object = gObjectList.findObject(data->second.first);
433 if(option == 0 && object) 436 if(option == 0 && object)
434 { 437 {
435 // yes 438 // yes
436 std::list<LLUUID>::iterator list_it; 439 LLSD::array_const_iterator list_end = notification["payload"]["inventory_ids"].endArray();
437 std::list<LLUUID>& id_list = data->second.second; 440 for (LLSD::array_const_iterator list_it = notification["payload"]["inventory_ids"].beginArray();
438 for (list_it = id_list.begin(); list_it != id_list.end(); ++list_it) 441 list_it != list_end;
442 ++list_it)
439 { 443 {
440 object->removeInventory(*list_it); 444 object->removeInventory(list_it->asUUID());
441 } 445 }
442 446
443 // refresh the UI. 447 // refresh the UI.
444 data->first->refresh(); 448 panel->refresh();
445 } 449 }
446 delete data; 450 return false;
447} 451}
448 452
449BOOL LLTaskInvFVBridge::removeItem() 453BOOL LLTaskInvFVBridge::removeItem()
@@ -465,7 +469,10 @@ BOOL LLTaskInvFVBridge::removeItem()
465 data->first = mPanel; 469 data->first = mPanel;
466 data->second.first = mPanel->getTaskUUID(); 470 data->second.first = mPanel->getTaskUUID();
467 data->second.second.push_back(mUUID); 471 data->second.second.push_back(mUUID);
468 gViewerWindow->alertXml("RemoveItemWarn", remove_task_inventory_callback, (void*)data); 472 LLSD payload;
473 payload["task_id"] = mPanel->getTaskUUID();
474 payload["inventory_ids"].append(mUUID);
475 LLNotifications::instance().add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
469 return FALSE; 476 return FALSE;
470 } 477 }
471 } 478 }
@@ -488,15 +495,15 @@ void LLTaskInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>&
488 495
489 if (!object->permModify()) 496 if (!object->permModify())
490 { 497 {
491 remove_data_t* data = new remove_data_t; 498 LLSD payload;
492 data->first = mPanel; 499 payload["task_id"] = mPanel->getTaskUUID();
493 data->second.first = mPanel->getTaskUUID();
494 for (S32 i = 0; i < (S32)batch.size(); i++) 500 for (S32 i = 0; i < (S32)batch.size(); i++)
495 { 501 {
496 LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i]; 502 LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i];
497 data->second.second.push_back(itemp->getUUID()); 503 payload["inventory_ids"].append(itemp->getUUID());
498 } 504 }
499 gViewerWindow->alertXml("RemoveItemWarn", remove_task_inventory_callback, (void*)data); 505 LLNotifications::instance().add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel));
506
500 } 507 }
501 else 508 else
502 { 509 {
@@ -630,9 +637,14 @@ void LLTaskInvFVBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
630void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) 637void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
631{ 638{
632 LLInventoryItem* item = findItem(); 639 LLInventoryItem* item = findItem();
633 if(!item) return;
634 std::vector<std::string> items; 640 std::vector<std::string> items;
635 std::vector<std::string> disabled_items; 641 std::vector<std::string> disabled_items;
642
643 if (!item)
644 {
645 hideContextEntries(menu, items, disabled_items);
646 return;
647 }
636 648
637 // *TODO: Translate 649 // *TODO: Translate
638 if(gAgent.allowOperation(PERM_OWNER, item->getPermissions(), 650 if(gAgent.allowOperation(PERM_OWNER, item->getPermissions(),
@@ -1932,7 +1944,7 @@ void LLPanelInventory::draw()
1932 // *TODO: Translate 1944 // *TODO: Translate
1933 if((LLUUID::null != mTaskUUID) && (!mHaveInventory)) 1945 if((LLUUID::null != mTaskUUID) && (!mHaveInventory))
1934 { 1946 {
1935 LLFontGL::sSansSerif->renderUTF8(std::string("Loading contents..."), 0, 1947 LLFontGL::getFontSansSerif()->renderUTF8(std::string("Loading contents..."), 0,
1936 (S32)(getRect().getWidth() * 0.5f), 1948 (S32)(getRect().getWidth() * 0.5f),
1937 10, 1949 10,
1938 LLColor4( 1, 1, 1, 1 ), 1950 LLColor4( 1, 1, 1, 1 ),
@@ -1941,7 +1953,7 @@ void LLPanelInventory::draw()
1941 } 1953 }
1942 else if(mHaveInventory) 1954 else if(mHaveInventory)
1943 { 1955 {
1944 LLFontGL::sSansSerif->renderUTF8(std::string("No contents"), 0, 1956 LLFontGL::getFontSansSerif()->renderUTF8(std::string("No contents"), 0,
1945 (S32)(getRect().getWidth() * 0.5f), 1957 (S32)(getRect().getWidth() * 0.5f),
1946 10, 1958 10,
1947 LLColor4( 1, 1, 1, 1 ), 1959 LLColor4( 1, 1, 1, 1 ),