aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelclassified.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:50 -0500
committerJacek Antonelli2008-08-15 23:45:50 -0500
commit2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch)
tree95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/newview/llpanelclassified.cpp
parentSecond Life viewer sources 1.20.6 (diff)
downloadmeta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2
meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/newview/llpanelclassified.cpp')
-rw-r--r--linden/indra/newview/llpanelclassified.cpp89
1 files changed, 73 insertions, 16 deletions
diff --git a/linden/indra/newview/llpanelclassified.cpp b/linden/indra/newview/llpanelclassified.cpp
index 7908ccc..45ceeba 100644
--- a/linden/indra/newview/llpanelclassified.cpp
+++ b/linden/indra/newview/llpanelclassified.cpp
@@ -71,6 +71,9 @@
71#include "llappviewer.h" // abortQuit() 71#include "llappviewer.h" // abortQuit()
72 72
73const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$ 73const S32 MINIMUM_PRICE_FOR_LISTING = 50; // L$
74const S32 MATURE_CONTENT = 1;
75const S32 NON_MATURE_CONTENT = 2;
76const S32 DECLINE_TO_STATE = 0;
74 77
75//static 78//static
76std::list<LLPanelClassified*> LLPanelClassified::sAllPanels; 79std::list<LLPanelClassified*> LLPanelClassified::sAllPanels;
@@ -162,7 +165,7 @@ LLPanelClassified::LLPanelClassified(bool in_finder, bool from_search)
162 mDescEditor(NULL), 165 mDescEditor(NULL),
163 mLocationEditor(NULL), 166 mLocationEditor(NULL),
164 mCategoryCombo(NULL), 167 mCategoryCombo(NULL),
165 mMatureCheck(NULL), 168 mMatureCombo(NULL),
166 mAutoRenewCheck(NULL), 169 mAutoRenewCheck(NULL),
167 mUpdateBtn(NULL), 170 mUpdateBtn(NULL),
168 mTeleportBtn(NULL), 171 mTeleportBtn(NULL),
@@ -276,13 +279,15 @@ BOOL LLPanelClassified::postBuild()
276 mCategoryCombo->setCommitCallback(onCommitAny); 279 mCategoryCombo->setCommitCallback(onCommitAny);
277 mCategoryCombo->setCallbackUserData(this); 280 mCategoryCombo->setCallbackUserData(this);
278 281
279 mMatureCheck = getChild<LLCheckBoxCtrl>( "classified_mature_check"); 282 mMatureCombo = getChild<LLComboBox>( "classified_mature_check");
280 mMatureCheck->setCommitCallback(onCommitAny); 283 mMatureCombo->setCurrentByIndex(0);
281 mMatureCheck->setCallbackUserData(this); 284 mMatureCombo->setCommitCallback(onCommitAny);
285 mMatureCombo->setCallbackUserData(this);
282 if (gAgent.isTeen()) 286 if (gAgent.isTeen())
283 { 287 {
284 // Teens don't get to set mature flag. JC 288 // Teens don't get to set mature flag. JC
285 mMatureCheck->setVisible(FALSE); 289 mMatureCombo->setVisible(FALSE);
290 mMatureCombo->setCurrentByIndex(NON_MATURE_CONTENT);
286 } 291 }
287 292
288 if (!mInFinder) 293 if (!mInFinder)
@@ -532,7 +537,7 @@ void LLPanelClassified::sendClassifiedInfoUpdate()
532 msg->addU32Fast(_PREHASH_ParentEstate, 0); 537 msg->addU32Fast(_PREHASH_ParentEstate, 0);
533 msg->addUUIDFast(_PREHASH_SnapshotID, mSnapshotCtrl->getImageAssetID()); 538 msg->addUUIDFast(_PREHASH_SnapshotID, mSnapshotCtrl->getImageAssetID());
534 msg->addVector3dFast(_PREHASH_PosGlobal, mPosGlobal); 539 msg->addVector3dFast(_PREHASH_PosGlobal, mPosGlobal);
535 BOOL mature = mMatureCheck->get(); 540 BOOL mature = mMatureCombo->getCurrentIndex() == MATURE_CONTENT;
536 BOOL auto_renew = FALSE; 541 BOOL auto_renew = FALSE;
537 if (mAutoRenewCheck) 542 if (mAutoRenewCheck)
538 { 543 {
@@ -656,7 +661,14 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
656 self->mLocationChanged = false; 661 self->mLocationChanged = false;
657 662
658 self->mCategoryCombo->setCurrentByIndex(category - 1); 663 self->mCategoryCombo->setCurrentByIndex(category - 1);
659 self->mMatureCheck->set(mature); 664 if(mature)
665 {
666 self->mMatureCombo->setCurrentByIndex(MATURE_CONTENT);
667 }
668 else
669 {
670 self->mMatureCombo->setCurrentByIndex(NON_MATURE_CONTENT);
671 }
660 if (self->mAutoRenewCheck) 672 if (self->mAutoRenewCheck)
661 { 673 {
662 self->mAutoRenewCheck->set(auto_renew); 674 self->mAutoRenewCheck->set(auto_renew);
@@ -722,8 +734,8 @@ void LLPanelClassified::refresh()
722 mCategoryCombo->setEnabled(godlike); 734 mCategoryCombo->setEnabled(godlike);
723 mCategoryCombo->setVisible(godlike); 735 mCategoryCombo->setVisible(godlike);
724 736
725 mMatureCheck->setEnabled(godlike); 737 mMatureCombo->setEnabled(godlike);
726 mMatureCheck->setVisible(godlike); 738 mMatureCombo->setVisible(godlike);
727 739
728 // Jesse (who is the only one who uses this, as far as we can tell 740 // Jesse (who is the only one who uses this, as far as we can tell
729 // Says that he does not want a set location button - he has used it 741 // Says that he does not want a set location button - he has used it
@@ -742,7 +754,7 @@ void LLPanelClassified::refresh()
742 //mPriceEditor->setEnabled(is_self); 754 //mPriceEditor->setEnabled(is_self);
743 mCategoryCombo->setEnabled(is_self); 755 mCategoryCombo->setEnabled(is_self);
744 756
745 mMatureCheck->setEnabled(is_self); 757 mMatureCombo->setEnabled(is_self);
746 758
747 if (mAutoRenewCheck) 759 if (mAutoRenewCheck)
748 { 760 {
@@ -775,15 +787,60 @@ void LLPanelClassified::onClickUpdate(void* data)
775 return; 787 return;
776 }; 788 };
777 789
790 // If user has not set mature, do not allow publish
791 if(self->mMatureCombo->getCurrentIndex() == DECLINE_TO_STATE)
792 {
793 LLString::format_map_t args;
794 gViewerWindow->alertXml("SetClassifiedMature", &callbackConfirmMature, self);
795 return;
796 }
797
798 // Mature content flag is set, proceed
799 self->gotMature();
800}
801
802// static
803void LLPanelClassified::callbackConfirmMature(S32 option, void* data)
804{
805 LLPanelClassified* self = (LLPanelClassified*)data;
806 self->confirmMature(option);
807}
808
809// invoked from callbackConfirmMature
810void LLPanelClassified::confirmMature(S32 option)
811{
812 // 0 == Yes
813 // 1 == No
814 // 2 == Cancel
815 switch(option)
816 {
817 case 0:
818 mMatureCombo->setCurrentByIndex(MATURE_CONTENT);
819 break;
820 case 1:
821 mMatureCombo->setCurrentByIndex(NON_MATURE_CONTENT);
822 break;
823 default:
824 return;
825 }
826
827 // If we got here it means they set a valid value
828 gotMature();
829}
830
831// Called after we have determined whether this classified has
832// mature content or not.
833void LLPanelClassified::gotMature()
834{
778 // if already paid for, just do the update 835 // if already paid for, just do the update
779 if (self->mPaidFor) 836 if (mPaidFor)
780 { 837 {
781 callbackConfirmPublish(0, self); 838 callbackConfirmPublish(0, this);
782 } 839 }
783 else 840 else
784 { 841 {
785 // Ask the user how much they want to pay 842 // Ask the user how much they want to pay
786 LLFloaterPriceForListing::show( callbackGotPriceForListing, self ); 843 LLFloaterPriceForListing::show( callbackGotPriceForListing, this );
787 } 844 }
788} 845}
789 846
@@ -830,8 +887,8 @@ void LLPanelClassified::resetDirty()
830 mLocationChanged = false; 887 mLocationChanged = false;
831 if (mCategoryCombo) 888 if (mCategoryCombo)
832 mCategoryCombo->resetDirty(); 889 mCategoryCombo->resetDirty();
833 if (mMatureCheck) 890 if (mMatureCombo)
834 mMatureCheck->resetDirty(); 891 mMatureCombo->resetDirty();
835 if (mAutoRenewCheck) 892 if (mAutoRenewCheck)
836 mAutoRenewCheck->resetDirty(); 893 mAutoRenewCheck->resetDirty();
837} 894}
@@ -948,7 +1005,7 @@ BOOL LLPanelClassified::checkDirty()
948 if ( mLocationEditor ) mDirty |= mLocationEditor->isDirty(); 1005 if ( mLocationEditor ) mDirty |= mLocationEditor->isDirty();
949 if ( mLocationChanged ) mDirty |= TRUE; 1006 if ( mLocationChanged ) mDirty |= TRUE;
950 if ( mCategoryCombo ) mDirty |= mCategoryCombo->isDirty(); 1007 if ( mCategoryCombo ) mDirty |= mCategoryCombo->isDirty();
951 if ( mMatureCheck ) mDirty |= mMatureCheck->isDirty(); 1008 if ( mMatureCombo ) mDirty |= mMatureCombo->isDirty();
952 if ( mAutoRenewCheck ) mDirty |= mAutoRenewCheck->isDirty(); 1009 if ( mAutoRenewCheck ) mDirty |= mAutoRenewCheck->isDirty();
953 1010
954 return mDirty; 1011 return mDirty;