From 750fb61bd3cda4ffe775ab5e45ff6ff2ed5cb4ba Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 21:40:25 +0300 Subject: allow store and retreive buttons work with cart. --- src/gui/windows/inventorywindow.cpp | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'src/gui/windows/inventorywindow.cpp') diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 535f87f59..36bcc64ac 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -384,7 +384,16 @@ void InventoryWindow::action(const ActionEvent &event) if (!item) return; - ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item); + if (storageWindow) + { + ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, + this, item); + } + else if (cartWindow) + { + ItemAmountWindow::showWindow(ItemAmountWindow::CartAdd, + this, item); + } } else if (eventId == "sort") { @@ -422,8 +431,14 @@ void InventoryWindow::action(const ActionEvent &event) if (isStorageActive()) { inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), item->getQuantity(), - InventoryType::STORAGE); + item->getInvIndex(), item->getQuantity(), + InventoryType::STORAGE); + } + else if (cartWindow) + { + inventoryHandler->moveItem2(InventoryType::INVENTORY, + item->getInvIndex(), item->getQuantity(), + InventoryType::CART); } else { @@ -449,8 +464,16 @@ void InventoryWindow::action(const ActionEvent &event) } else if (eventId == "retrieve") { - ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, - this, item); + if (storageWindow) + { + ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, + this, item); + } + else if (cartWindow) + { + ItemAmountWindow::showWindow(ItemAmountWindow::CartRemove, + this, item); + } } } @@ -773,7 +796,7 @@ void InventoryWindow::updateDropButton() if (!mDropButton) return; - if (isStorageActive()) + if (isStorageActive() || cartWindow) { // TRANSLATORS: inventory button mDropButton->setCaption(_("Store")); -- cgit v1.2.3-60-g2f50