From c7f54151ba693e7f57378b77cc567d5aa26cf4cf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 14 Feb 2015 23:28:02 +0300 Subject: Enable publish button in personal buy shop only if it allowed by server. --- src/gui/windows/shopwindow.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/gui/windows/shopwindow.cpp') diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 307c6ac61..6490ff746 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -88,6 +88,7 @@ ShopWindow::ShopWindow() : SelectionListener(), VendingModeListener(), VendingSlotsListener(), + BuyingStoreSlotsListener(), // TRANSLATORS: shop window button mCloseButton(new Button(this, _("Close"), "close", this)), mBuyShopItems(new ShopItems), @@ -117,6 +118,7 @@ ShopWindow::ShopWindow() : mRandCounter(0), mTradeMoney(0), mSellShopSize(0), + mBuyShopSize(0), isBuySelected(true), mHaveVending(serverFeatures->haveVending()), mEnableVending(false) @@ -412,7 +414,10 @@ void ShopWindow::updateButtonsAndLabels() { mPublishButton->setCaption(_("Publish")); mPublishButton->adjustSize(); - mPublishButton->setEnabled(true); + if (mBuyShopSize > 0) + mPublishButton->setEnabled(true); + else + mPublishButton->setEnabled(false); } } else @@ -428,8 +433,7 @@ void ShopWindow::updateButtonsAndLabels() else mPublishButton->setCaption(_("Publish")); mPublishButton->adjustSize(); - if (!isBuySelected - && sellNotEmpty + if (sellNotEmpty && mSellShopSize > 0 && localPlayer && localPlayer->getHaveCart()) @@ -1053,3 +1057,9 @@ void ShopWindow::setShopName(const std::string &name) serverConfig.setValue("sellShopName", mSellShopName); updateShopName(); } + +void ShopWindow::buyingStoreSlotsChanged(const int slots) +{ + mBuyShopSize = slots; + updateButtonsAndLabels(); +} -- cgit v1.2.3-60-g2f50