/indra/newview/llfloaterwhitelistentry.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 91 lines · 41 code · 15 blank · 35 comment · 1 complexity · 94f43f6b2aeb4e0d68844ca569ba3096 MD5 · raw file

  1. /**
  2. * @file llfloaterwhitelistentry.cpp
  3. * @brief LLFloaterWhistListEntry class implementation
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llfloaterreg.h"
  28. #include "llfloatermediasettings.h"
  29. #include "llfloaterwhitelistentry.h"
  30. #include "llpanelmediasettingssecurity.h"
  31. #include "lluictrlfactory.h"
  32. #include "llwindow.h"
  33. #include "llviewerwindow.h"
  34. #include "lllineeditor.h"
  35. ///////////////////////////////////////////////////////////////////////////////
  36. //
  37. LLFloaterWhiteListEntry::LLFloaterWhiteListEntry( const LLSD& key ) :
  38. LLFloater(key)
  39. {
  40. }
  41. ///////////////////////////////////////////////////////////////////////////////
  42. //
  43. LLFloaterWhiteListEntry::~LLFloaterWhiteListEntry()
  44. {
  45. }
  46. ///////////////////////////////////////////////////////////////////////////////
  47. //
  48. BOOL LLFloaterWhiteListEntry::postBuild()
  49. {
  50. mWhiteListEdit = getChild<LLLineEditor>("whitelist_entry");
  51. childSetAction("cancel_btn", onBtnCancel, this);
  52. childSetAction("ok_btn", onBtnOK, this);
  53. setDefaultBtn("ok_btn");
  54. return TRUE;
  55. }
  56. ///////////////////////////////////////////////////////////////////////////////
  57. // static
  58. void LLFloaterWhiteListEntry::onBtnOK( void* userdata )
  59. {
  60. LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
  61. LLPanelMediaSettingsSecurity* panel = LLFloaterReg::getTypedInstance<LLFloaterMediaSettings>("media_settings")->getPanelSecurity();
  62. if ( panel )
  63. {
  64. std::string white_list_item = self->mWhiteListEdit->getText();
  65. panel->addWhiteListEntry( white_list_item );
  66. panel->updateWhitelistEnableStatus();
  67. };
  68. self->closeFloater();
  69. }
  70. ///////////////////////////////////////////////////////////////////////////////
  71. // static
  72. void LLFloaterWhiteListEntry::onBtnCancel( void* userdata )
  73. {
  74. LLFloaterWhiteListEntry *self =(LLFloaterWhiteListEntry *)userdata;
  75. self->closeFloater();
  76. }