aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanelclassified.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpanelclassified.cpp59
1 files changed, 44 insertions, 15 deletions
diff --git a/linden/indra/newview/llpanelclassified.cpp b/linden/indra/newview/llpanelclassified.cpp
index f7ef441..5f7bb6e 100644
--- a/linden/indra/newview/llpanelclassified.cpp
+++ b/linden/indra/newview/llpanelclassified.cpp
@@ -269,7 +269,7 @@ void LLPanelClassified::apply()
269{ 269{
270 // Apply is used for automatically saving results, so only 270 // Apply is used for automatically saving results, so only
271 // do that if there is a difference, and this is a save not create. 271 // do that if there is a difference, and this is a save not create.
272 if (mDirty && mPaidFor) 272 if (checkDirty() && mPaidFor)
273 { 273 {
274 sendClassifiedInfoUpdate(); 274 sendClassifiedInfoUpdate();
275 } 275 }
@@ -313,7 +313,8 @@ void LLPanelClassified::saveCallback(S32 option, void* data)
313 313
314BOOL LLPanelClassified::canClose() 314BOOL LLPanelClassified::canClose()
315{ 315{
316 if (mForceClose || !mDirty) return TRUE; 316 if (mForceClose || !checkDirty())
317 return TRUE;
317 318
318 LLString::format_map_t args; 319 LLString::format_map_t args;
319 args["[NAME]"] = mNameEditor->getText(); 320 args["[NAME]"] = mNameEditor->getText();
@@ -676,7 +677,7 @@ void LLPanelClassified::refresh()
676 mSetBtn->setVisible(is_self); 677 mSetBtn->setVisible(is_self);
677 mSetBtn->setEnabled(is_self); 678 mSetBtn->setEnabled(is_self);
678 679
679 mUpdateBtn->setEnabled(is_self && mDirty); 680 mUpdateBtn->setEnabled(is_self && checkDirty());
680 mUpdateBtn->setVisible(is_self); 681 mUpdateBtn->setVisible(is_self);
681 } 682 }
682} 683}
@@ -736,29 +737,44 @@ void LLPanelClassified::callbackGotPriceForListing(S32 option, LLString text, vo
736 737
737} 738}
738 739
739// static
740void LLPanelClassified::callbackConfirmPublish(S32 option, void* data)
741{
742 LLPanelClassified* self = (LLPanelClassified*)data;
743 740
741// invoked from callbackConfirmPublish
742void LLPanelClassified::confirmPublish(S32 option)
743{
744 // Option 0 = publish 744 // Option 0 = publish
745 if (option != 0) return; 745 if (option != 0) return;
746 746
747 self->sendClassifiedInfoUpdate(); 747 sendClassifiedInfoUpdate();
748 748
749 // Big hack - assume that top picks are always in a browser, 749 // Big hack - assume that top picks are always in a browser,
750 // and non-finder-classifieds are always in a tab container. 750 // and non-finder-classifieds are always in a tab container.
751 if (self->mInFinder) 751 if (mInFinder)
752 { 752 {
753 // TODO: enable this 753 // TODO: enable this
754 //LLPanelDirClassifieds* panel = (LLPanelDirClassifieds*)self->getParent(); 754 //LLPanelDirClassifieds* panel = (LLPanelDirClassifieds*)getParent();
755 //panel->renameClassified(self->mClassifiedID, self->mNameEditor->getText().c_str()); 755 //panel->renameClassified(mClassifiedID, mNameEditor->getText().c_str());
756 } 756 }
757 else 757 else
758 { 758 {
759 LLTabContainerVertical* tab = (LLTabContainerVertical*)self->getParent(); 759 LLTabContainerVertical* tab = (LLTabContainerVertical*)getParent();
760 tab->setCurrentTabName(self->mNameEditor->getText()); 760 tab->setCurrentTabName(mNameEditor->getText());
761 } 761 }
762
763 // Tell all the widgets to reset their dirty state since the ad was just saved
764 mSnapshotCtrl->resetDirty();
765 mNameEditor->resetDirty();
766 mDescEditor->resetDirty();
767 mLocationEditor->resetDirty();
768 mCategoryCombo->resetDirty();
769 mMatureCheck->resetDirty();
770 mAutoRenewCheck->resetDirty();
771}
772
773// static
774void LLPanelClassified::callbackConfirmPublish(S32 option, void* data)
775{
776 LLPanelClassified* self = (LLPanelClassified*)data;
777 self->confirmPublish(option);
762} 778}
763 779
764// static 780// static
@@ -831,13 +847,27 @@ void LLPanelClassified::onClickSet(void* data)
831} 847}
832 848
833 849
850BOOL LLPanelClassified::checkDirty()
851{
852 mDirty = FALSE;
853 if ( mSnapshotCtrl ) mDirty |= mSnapshotCtrl->isDirty();
854 if ( mNameEditor ) mDirty |= mNameEditor->isDirty();
855 if ( mDescEditor ) mDirty |= mDescEditor->isDirty();
856 if ( mLocationEditor ) mDirty |= mLocationEditor->isDirty();
857 if ( mCategoryCombo ) mDirty |= mCategoryCombo->isDirty();
858 if ( mMatureCheck ) mDirty |= mMatureCheck->isDirty();
859 if ( mAutoRenewCheck ) mDirty |= mAutoRenewCheck->isDirty();
860
861 return mDirty;
862}
863
834// static 864// static
835void LLPanelClassified::onCommitAny(LLUICtrl* ctrl, void* data) 865void LLPanelClassified::onCommitAny(LLUICtrl* ctrl, void* data)
836{ 866{
837 LLPanelClassified* self = (LLPanelClassified*)data; 867 LLPanelClassified* self = (LLPanelClassified*)data;
838 if (self) 868 if (self)
839 { 869 {
840 self->mDirty = true; 870 self->checkDirty();
841 } 871 }
842} 872}
843 873
@@ -845,7 +875,6 @@ void LLPanelClassified::onCommitAny(LLUICtrl* ctrl, void* data)
845void LLPanelClassified::onFocusReceived(LLUICtrl* ctrl, void* data) 875void LLPanelClassified::onFocusReceived(LLUICtrl* ctrl, void* data)
846{ 876{
847 // allow the data to be saved 877 // allow the data to be saved
848 // Dave/Simon TODO: replace this with better isDirty() functionality
849 onCommitAny(ctrl, data); 878 onCommitAny(ctrl, data);
850} 879}
851 880