summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llfloatermarketplacelistings.cpp65
-rwxr-xr-xindra/newview/llfloatermarketplacelistings.h24
-rwxr-xr-xindra/newview/llinventorybridge.cpp4
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp37
-rwxr-xr-xindra/newview/llmarketplacefunctions.h2
-rwxr-xr-xindra/newview/llviewerfloaterreg.cpp1
-rwxr-xr-xindra/newview/skins/default/xui/en/floater_associate_listing.xml53
7 files changed, 184 insertions, 2 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 7db78ff290..be48005e67 100755
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -510,4 +510,69 @@ void LLFloaterMarketplaceListings::importReportResults(U32 status, const LLSD& c
updateView();
}
+//-----------------------------------------------------------------------------
+// LLFloaterAssociateListing()
+//-----------------------------------------------------------------------------
+
+LLFloaterAssociateListing::LLFloaterAssociateListing(const LLSD& key)
+: LLFloater(key)
+, mUUID()
+{
+}
+
+LLFloaterAssociateListing::~LLFloaterAssociateListing()
+{
+ gFocusMgr.releaseFocusIfNeeded( this );
+}
+
+BOOL LLFloaterAssociateListing::postBuild()
+{
+ getChild<LLButton>("OK")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::apply, this));
+ getChild<LLButton>("Cancel")->setCommitCallback(boost::bind(&LLFloaterAssociateListing::cancel, this));
+ center();
+
+ return LLFloater::postBuild();
+}
+
+BOOL LLFloaterAssociateListing::handleKeyHere(KEY key, MASK mask)
+{
+ if (key == KEY_RETURN && mask == MASK_NONE)
+ {
+ apply();
+ return TRUE;
+ }
+ else if (key == KEY_ESCAPE && mask == MASK_NONE)
+ {
+ cancel();
+ return TRUE;
+ }
+
+ return LLFloater::handleKeyHere(key, mask);
+}
+
+// static
+LLFloaterAssociateListing* LLFloaterAssociateListing::show(const LLUUID& folder_id)
+{
+ LLFloaterAssociateListing* floater = LLFloaterReg::showTypedInstance<LLFloaterAssociateListing>("associate_listing");
+
+ floater->mUUID = folder_id;
+
+ return floater;
+}
+
+void LLFloaterAssociateListing::apply()
+{
+ if (mUUID.notNull())
+ {
+ const std::string& id = getChild<LLUICtrl>("listing_id")->getValue().asString();
+ LLMarketplaceData::instance().associateListing(mUUID,id);
+ }
+ closeFloater();
+}
+
+void LLFloaterAssociateListing::cancel()
+{
+ closeFloater();
+}
+
diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h
index 960b6c55e0..f2ff58a712 100755
--- a/indra/newview/llfloatermarketplacelistings.h
+++ b/indra/newview/llfloatermarketplacelistings.h
@@ -122,4 +122,28 @@ private:
LLPanelMarketplaceListings * mPanelListings;
};
+
+//-----------------------------------------------------------------------------
+// LLFloaterAssociateListing()
+//-----------------------------------------------------------------------------
+class LLFloaterAssociateListing : public LLFloater
+{
+ friend class LLFloaterReg;
+public:
+ virtual BOOL postBuild();
+ virtual BOOL handleKeyHere(KEY key, MASK mask);
+
+ static LLFloaterAssociateListing* show(const LLUUID& folder_id);
+
+private:
+ LLFloaterAssociateListing(const LLSD& key);
+ virtual ~LLFloaterAssociateListing();
+
+ // UI Callbacks
+ void apply();
+ void cancel();
+
+ LLUUID mUUID;
+};
+
#endif // LL_LLFLOATERMARKETPLACELISTINGS_H
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 6dd181501a..1eb647b1b2 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -40,6 +40,7 @@
#include "llfavoritesbar.h" // management of favorites folder
#include "llfloateropenobject.h"
#include "llfloaterreg.h"
+#include "llfloatermarketplacelistings.h"
#include "llfloatersidepanelcontainer.h"
#include "llfloaterworldmap.h"
#include "llfolderview.h"
@@ -3209,8 +3210,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
}
else if ("marketplace_associate_listing" == action)
{
- // *TODO : Get a list of listing IDs and let the user choose one, delist the old one and relist the new one
- LLMarketplaceData::instance().addListing(mUUID);
+ LLFloaterAssociateListing::show(mUUID);
return;
}
else if ("marketplace_edit_listing" == action)
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 9465401d88..6ff6ba6714 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -584,6 +584,28 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id)
return true;
}
+bool LLMarketplaceData::associateListing(const LLUUID& folder_id, std::string listing_id)
+{
+ if (isListed(folder_id))
+ {
+ // Listing already exists -> exit with error
+ return false;
+ }
+ mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id);
+
+ // Check that the listing ID is not already associated to some other record
+ LLUUID old_listing = getListingFolder(listing_id);
+ if (old_listing.notNull())
+ {
+ // If it is already used, unlist the old record (we can't have 2 listings with the same listing ID)
+ deleteListing(old_listing);
+ }
+
+ setListingID(folder_id,listing_id);
+ update_marketplace_category(folder_id);
+ return true;
+}
+
bool LLMarketplaceData::deleteListing(const LLUUID& folder_id)
{
if (!isListed(folder_id))
@@ -630,6 +652,21 @@ LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id)
return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mVersionFolderId);
}
+// Reverse lookup : find the listing folder id from the listing id
+LLUUID LLMarketplaceData::getListingFolder(std::string listing_id)
+{
+ marketplace_items_list_t::iterator it = mMarketplaceItems.begin();
+ while (it != mMarketplaceItems.end())
+ {
+ if ((it->second).mListingId == listing_id)
+ {
+ return (it->second).mListingFolderId;
+ }
+ it++;
+ }
+ return LLUUID::null;
+}
+
bool LLMarketplaceData::isListed(const LLUUID& folder_id)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 9485311b66..f279c24fb2 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -153,6 +153,7 @@ public:
// Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error
bool addListing(const LLUUID& folder_id);
+ bool associateListing(const LLUUID& folder_id, std::string listing_id);
bool deleteListing(const LLUUID& folder_id);
// Access Marketplace data set : each method returns a default value if the folder_id can't be found
@@ -160,6 +161,7 @@ public:
std::string getListingID(const LLUUID& folder_id);
LLUUID getVersionFolderID(const LLUUID& folder_id);
std::string getListingURL(const LLUUID& folder_id);
+ LLUUID getListingFolder(std::string listing_id);
// Modify Marketplace data set : each method returns true if the function succeeds, false if error
bool setListingID(const LLUUID& folder_id, std::string listing_id);
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 9bb6153e56..e5f19d3cce 100755
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -178,6 +178,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("fast_timers", "floater_fast_timers.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFastTimerView>);
LLFloaterReg::add("about_land", "floater_about_land.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterLand>);
LLFloaterReg::add("appearance", "floater_my_appearance.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSidePanelContainer>);
+ LLFloaterReg::add("associate_listing", "floater_associate_listing.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAssociateListing>);
LLFloaterReg::add("auction", "floater_auction.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAuction>);
LLFloaterReg::add("avatar", "floater_avatar.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatar>);
LLFloaterReg::add("avatar_picker", "floater_avatar_picker.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterAvatarPicker>);
diff --git a/indra/newview/skins/default/xui/en/floater_associate_listing.xml b/indra/newview/skins/default/xui/en/floater_associate_listing.xml
new file mode 100755
index 0000000000..e019ed58dd
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_associate_listing.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ can_minimize="false"
+ height="110"
+ layout="topleft"
+ name="associate listing"
+ help_topic="associate_listing"
+ title="ASSOCIATE LISTING"
+ width="375">
+ <text
+ type="string"
+ length="1"
+ follows="top|left"
+ font="SansSerifLarge"
+ height="16"
+ layout="topleft"
+ left="10"
+ top="25"
+ name="message">
+ Listing ID:
+ </text>
+ <line_editor
+ type="string"
+ length="1"
+ follows="top|right"
+ font="SansSerif"
+ height="20"
+ layout="topleft"
+ left_delta="0"
+ name="listing_id"
+ top_pad="5"
+ width="350">
+ Type ID here
+ </line_editor>
+ <button
+ follows="bottom|left"
+ height="23"
+ label="OK"
+ layout="topleft"
+ left="155"
+ name="OK"
+ top_pad="10"
+ width="100" />
+ <button
+ follows="bottom|right"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ left_pad="5"
+ name="Cancel"
+ width="100" />
+</floater>