/indra/newview/llpanelgroupnotices.cpp

https://bitbucket.org/lindenlab/viewer-beta/ · C++ · 678 lines · 469 code · 125 blank · 84 comment · 34 complexity · 6daa9ee7567ccb6d4f2da3121329eb5a MD5 · raw file

  1. /**
  2. * @file llpanelgroupnotices.cpp
  3. * @brief A panel to display group notices.
  4. *
  5. * $LicenseInfo:firstyear=2006&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 "llpanelgroupnotices.h"
  28. #include "llview.h"
  29. #include "llavatarnamecache.h"
  30. #include "llinventory.h"
  31. #include "llviewerinventory.h"
  32. #include "llinventorydefines.h"
  33. #include "llinventoryfunctions.h"
  34. #include "llinventorymodel.h"
  35. #include "llfloaterinventory.h"
  36. #include "llagent.h"
  37. #include "llagentui.h"
  38. #include "lllineeditor.h"
  39. #include "lltexteditor.h"
  40. #include "llbutton.h"
  41. #include "lliconctrl.h"
  42. #include "llcheckboxctrl.h"
  43. #include "llscrolllistctrl.h"
  44. #include "llscrolllistitem.h"
  45. #include "lltextbox.h"
  46. #include "lltrans.h"
  47. #include "roles_constants.h"
  48. #include "llviewerwindow.h"
  49. #include "llviewermessage.h"
  50. #include "llnotificationsutil.h"
  51. #include "llgiveinventory.h"
  52. static LLRegisterPanelClassWrapper<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
  53. /////////////////////////
  54. // LLPanelGroupNotices //
  55. /////////////////////////
  56. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  57. // Class LLDropTarget
  58. //
  59. // This handy class is a simple way to drop something on another
  60. // view. It handles drop events, always setting itself to the size of
  61. // its parent.
  62. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  63. class LLGroupDropTarget : public LLView
  64. {
  65. public:
  66. struct Params : public LLInitParam::Block<Params, LLView::Params>
  67. {
  68. // *NOTE: These parameters logically Mandatory, but are not
  69. // specified in XML files, hence Optional
  70. Optional<LLPanelGroupNotices*> panel;
  71. Optional<LLUUID> group_id;
  72. Params()
  73. : panel("panel"),
  74. group_id("group_id")
  75. {
  76. changeDefault(mouse_opaque, false);
  77. changeDefault(follows.flags, FOLLOWS_ALL);
  78. }
  79. };
  80. LLGroupDropTarget(const Params&);
  81. ~LLGroupDropTarget() {};
  82. void doDrop(EDragAndDropType cargo_type, void* cargo_data);
  83. //
  84. // LLView functionality
  85. virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
  86. EDragAndDropType cargo_type,
  87. void* cargo_data,
  88. EAcceptance* accept,
  89. std::string& tooltip_msg);
  90. void setPanel (LLPanelGroupNotices* panel) {mGroupNoticesPanel = panel;};
  91. void setGroup (LLUUID group) {mGroupID = group;};
  92. protected:
  93. LLPanelGroupNotices* mGroupNoticesPanel;
  94. LLUUID mGroupID;
  95. };
  96. static LLDefaultChildRegistry::Register<LLGroupDropTarget> r("group_drop_target");
  97. LLGroupDropTarget::LLGroupDropTarget(const LLGroupDropTarget::Params& p)
  98. : LLView(p),
  99. mGroupNoticesPanel(p.panel),
  100. mGroupID(p.group_id)
  101. {}
  102. void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
  103. {
  104. llinfos << "LLGroupDropTarget::doDrop()" << llendl;
  105. }
  106. BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
  107. EDragAndDropType cargo_type,
  108. void* cargo_data,
  109. EAcceptance* accept,
  110. std::string& tooltip_msg)
  111. {
  112. BOOL handled = FALSE;
  113. if (!gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND))
  114. {
  115. *accept = ACCEPT_NO;
  116. return TRUE;
  117. }
  118. if(getParent())
  119. {
  120. // check if inside
  121. //LLRect parent_rect = mParentView->getRect();
  122. //getRect().set(0, parent_rect.getHeight(), parent_rect.getWidth(), 0);
  123. handled = TRUE;
  124. // check the type
  125. switch(cargo_type)
  126. {
  127. case DAD_TEXTURE:
  128. case DAD_SOUND:
  129. case DAD_LANDMARK:
  130. case DAD_SCRIPT:
  131. case DAD_OBJECT:
  132. case DAD_NOTECARD:
  133. case DAD_CLOTHING:
  134. case DAD_BODYPART:
  135. case DAD_ANIMATION:
  136. case DAD_GESTURE:
  137. case DAD_CALLINGCARD:
  138. case DAD_MESH:
  139. {
  140. LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
  141. if(gInventory.getItem(inv_item->getUUID())
  142. && LLGiveInventory::isInventoryGroupGiveAcceptable(inv_item))
  143. {
  144. // *TODO: get multiple object transfers working
  145. *accept = ACCEPT_YES_COPY_SINGLE;
  146. if(drop)
  147. {
  148. mGroupNoticesPanel->setItem(inv_item);
  149. }
  150. }
  151. else
  152. {
  153. // It's not in the user's inventory (it's probably
  154. // in an object's contents), so disallow dragging
  155. // it here. You can't give something you don't
  156. // yet have.
  157. *accept = ACCEPT_NO;
  158. }
  159. break;
  160. }
  161. case DAD_CATEGORY:
  162. default:
  163. *accept = ACCEPT_NO;
  164. break;
  165. }
  166. }
  167. return handled;
  168. }
  169. //-----------------------------------------------------------------------------
  170. // LLPanelGroupNotices
  171. //-----------------------------------------------------------------------------
  172. std::string build_notice_date(const U32& the_time)
  173. {
  174. // ISO 8601 date format
  175. time_t t = (time_t)the_time;
  176. if (!t)
  177. {
  178. time(&t);
  179. }
  180. std::string dateStr = "["+LLTrans::getString("LTimeMthNum")+"]/["
  181. +LLTrans::getString("LTimeDay")+"]/["
  182. +LLTrans::getString("LTimeYear")+"]";
  183. LLSD substitution;
  184. substitution["datetime"] = (S32) t;
  185. LLStringUtil::format (dateStr, substitution);
  186. return dateStr;
  187. }
  188. LLPanelGroupNotices::LLPanelGroupNotices() :
  189. LLPanelGroupTab(),
  190. mInventoryItem(NULL),
  191. mInventoryOffer(NULL)
  192. {
  193. }
  194. LLPanelGroupNotices::~LLPanelGroupNotices()
  195. {
  196. sInstances.erase(mGroupID);
  197. if (mInventoryOffer)
  198. {
  199. // Cancel the inventory offer.
  200. mInventoryOffer->forceResponse(IOR_DECLINE);
  201. mInventoryOffer = NULL;
  202. }
  203. }
  204. BOOL LLPanelGroupNotices::isVisibleByAgent(LLAgent* agentp)
  205. {
  206. return mAllowEdit &&
  207. agentp->hasPowerInGroup(mGroupID, GP_NOTICES_SEND | GP_NOTICES_RECEIVE);
  208. }
  209. BOOL LLPanelGroupNotices::postBuild()
  210. {
  211. bool recurse = true;
  212. mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
  213. mNoticesList->setCommitOnSelectionChange(TRUE);
  214. mNoticesList->setCommitCallback(onSelectNotice, this);
  215. mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
  216. mBtnNewMessage->setClickedCallback(onClickNewMessage, this);
  217. mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
  218. mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
  219. mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices, this);
  220. // Create
  221. mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
  222. mCreateMessage = getChild<LLTextEditor>("create_message",recurse);
  223. mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name",recurse);
  224. mCreateInventoryName->setTabStop(FALSE);
  225. mCreateInventoryName->setEnabled(FALSE);
  226. mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",recurse);
  227. mCreateInventoryIcon->setVisible(FALSE);
  228. mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
  229. mBtnSendMessage->setClickedCallback(onClickSendMessage, this);
  230. mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
  231. mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment, this);
  232. mBtnRemoveAttachment->setEnabled(FALSE);
  233. // View
  234. mViewSubject = getChild<LLLineEditor>("view_subject",recurse);
  235. mViewMessage = getChild<LLTextEditor>("view_message",recurse);
  236. mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",recurse);
  237. mViewInventoryName->setTabStop(FALSE);
  238. mViewInventoryName->setEnabled(FALSE);
  239. mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon",recurse);
  240. mViewInventoryIcon->setVisible(FALSE);
  241. mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
  242. mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment, this);
  243. mNoNoticesStr = getString("no_notices_text");
  244. mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
  245. mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
  246. LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
  247. target->setPanel (this);
  248. target->setGroup (mGroupID);
  249. arrangeNoticeView(VIEW_PAST_NOTICE);
  250. return LLPanelGroupTab::postBuild();
  251. }
  252. void LLPanelGroupNotices::activate()
  253. {
  254. if(mNoticesList)
  255. mNoticesList->deleteAllItems();
  256. BOOL can_send = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_SEND);
  257. BOOL can_receive = gAgent.hasPowerInGroup(mGroupID,GP_NOTICES_RECEIVE);
  258. mPanelViewNotice->setEnabled(can_receive);
  259. mPanelCreateNotice->setEnabled(can_send);
  260. // Always disabled to stop direct editing of attachment names
  261. mCreateInventoryName->setEnabled(FALSE);
  262. mViewInventoryName->setEnabled(FALSE);
  263. // If we can receive notices, grab them right away.
  264. if (can_receive)
  265. {
  266. onClickRefreshNotices(this);
  267. }
  268. }
  269. void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
  270. {
  271. mInventoryItem = inv_item;
  272. BOOL item_is_multi = FALSE;
  273. if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
  274. {
  275. item_is_multi = TRUE;
  276. };
  277. std::string icon_name = LLInventoryIcon::getIconName(inv_item->getType(),
  278. inv_item->getInventoryType(),
  279. inv_item->getFlags(),
  280. item_is_multi );
  281. mCreateInventoryIcon->setValue(icon_name);
  282. mCreateInventoryIcon->setVisible(TRUE);
  283. std::stringstream ss;
  284. ss << " " << mInventoryItem->getName();
  285. mCreateInventoryName->setText(ss.str());
  286. mBtnRemoveAttachment->setEnabled(TRUE);
  287. }
  288. void LLPanelGroupNotices::onClickRemoveAttachment(void* data)
  289. {
  290. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  291. self->mInventoryItem = NULL;
  292. self->mCreateInventoryName->clear();
  293. self->mCreateInventoryIcon->setVisible(FALSE);
  294. self->mBtnRemoveAttachment->setEnabled(FALSE);
  295. }
  296. //static
  297. void LLPanelGroupNotices::onClickOpenAttachment(void* data)
  298. {
  299. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  300. self->mInventoryOffer->forceResponse(IOR_ACCEPT);
  301. self->mInventoryOffer = NULL;
  302. self->mBtnOpenAttachment->setEnabled(FALSE);
  303. }
  304. void LLPanelGroupNotices::onClickSendMessage(void* data)
  305. {
  306. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  307. if (self->mCreateSubject->getText().empty())
  308. {
  309. // Must supply a subject
  310. LLNotificationsUtil::add("MustSpecifyGroupNoticeSubject");
  311. return;
  312. }
  313. send_group_notice(
  314. self->mGroupID,
  315. self->mCreateSubject->getText(),
  316. self->mCreateMessage->getText(),
  317. self->mInventoryItem);
  318. //instantly add new notice. actual notice will be added after ferreshNotices call
  319. LLUUID id = LLUUID::generateNewID();
  320. std::string subj = self->mCreateSubject->getText();
  321. std::string name ;
  322. LLAgentUI::buildFullname(name);
  323. U32 timestamp = 0;
  324. LLSD row;
  325. row["id"] = id;
  326. row["columns"][0]["column"] = "icon";
  327. row["columns"][1]["column"] = "subject";
  328. row["columns"][1]["value"] = subj;
  329. row["columns"][2]["column"] = "from";
  330. row["columns"][2]["value"] = name;
  331. row["columns"][3]["column"] = "date";
  332. row["columns"][3]["value"] = build_notice_date(timestamp);
  333. row["columns"][4]["column"] = "sort";
  334. row["columns"][4]["value"] = llformat( "%u", timestamp);
  335. self->mNoticesList->addElement(row, ADD_BOTTOM);
  336. self->mCreateMessage->clear();
  337. self->mCreateSubject->clear();
  338. onClickRemoveAttachment(data);
  339. self->arrangeNoticeView(VIEW_PAST_NOTICE);
  340. }
  341. //static
  342. void LLPanelGroupNotices::onClickNewMessage(void* data)
  343. {
  344. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  345. self->arrangeNoticeView(CREATE_NEW_NOTICE);
  346. if (self->mInventoryOffer)
  347. {
  348. self->mInventoryOffer->forceResponse(IOR_DECLINE);
  349. self->mInventoryOffer = NULL;
  350. }
  351. self->mCreateSubject->clear();
  352. self->mCreateMessage->clear();
  353. if (self->mInventoryItem) onClickRemoveAttachment(self);
  354. self->mNoticesList->deselectAllItems(TRUE); // TRUE == don't commit on chnage
  355. }
  356. void LLPanelGroupNotices::refreshNotices()
  357. {
  358. onClickRefreshNotices(this);
  359. /*
  360. lldebugs << "LLPanelGroupNotices::onClickGetPastNotices" << llendl;
  361. mNoticesList->deleteAllItems();
  362. LLMessageSystem* msg = gMessageSystem;
  363. msg->newMessage("GroupNoticesListRequest");
  364. msg->nextBlock("AgentData");
  365. msg->addUUID("AgentID",gAgent.getID());
  366. msg->addUUID("SessionID",gAgent.getSessionID());
  367. msg->nextBlock("Data");
  368. msg->addUUID("GroupID",self->mGroupID);
  369. gAgent.sendReliableMessage();
  370. */
  371. }
  372. void LLPanelGroupNotices::onClickRefreshNotices(void* data)
  373. {
  374. lldebugs << "LLPanelGroupNotices::onClickGetPastNotices" << llendl;
  375. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  376. self->mNoticesList->deleteAllItems();
  377. LLMessageSystem* msg = gMessageSystem;
  378. msg->newMessage("GroupNoticesListRequest");
  379. msg->nextBlock("AgentData");
  380. msg->addUUID("AgentID",gAgent.getID());
  381. msg->addUUID("SessionID",gAgent.getSessionID());
  382. msg->nextBlock("Data");
  383. msg->addUUID("GroupID",self->mGroupID);
  384. gAgent.sendReliableMessage();
  385. }
  386. //static
  387. std::map<LLUUID,LLPanelGroupNotices*> LLPanelGroupNotices::sInstances;
  388. // static
  389. void LLPanelGroupNotices::processGroupNoticesListReply(LLMessageSystem* msg, void** data)
  390. {
  391. LLUUID group_id;
  392. msg->getUUID("AgentData", "GroupID", group_id);
  393. std::map<LLUUID,LLPanelGroupNotices*>::iterator it = sInstances.find(group_id);
  394. if (it == sInstances.end())
  395. {
  396. llinfos << "Group Panel Notices " << group_id << " no longer in existence."
  397. << llendl;
  398. return;
  399. }
  400. LLPanelGroupNotices* selfp = it->second;
  401. if(!selfp)
  402. {
  403. llinfos << "Group Panel Notices " << group_id << " no longer in existence."
  404. << llendl;
  405. return;
  406. }
  407. selfp->processNotices(msg);
  408. }
  409. void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
  410. {
  411. LLUUID id;
  412. std::string subj;
  413. std::string name;
  414. U32 timestamp;
  415. BOOL has_attachment;
  416. U8 asset_type;
  417. S32 i=0;
  418. S32 count = msg->getNumberOfBlocks("Data");
  419. mNoticesList->setEnabled(TRUE);
  420. //save sort state and set unsorted state to prevent unnecessary
  421. //sorting while adding notices
  422. bool save_sort = mNoticesList->isSorted();
  423. mNoticesList->setNeedsSort(false);
  424. for (;i<count;++i)
  425. {
  426. msg->getUUID("Data","NoticeID",id,i);
  427. if (1 == count && id.isNull())
  428. {
  429. // Only one entry, the dummy entry.
  430. mNoticesList->setCommentText(mNoNoticesStr);
  431. mNoticesList->setEnabled(FALSE);
  432. return;
  433. }
  434. //with some network delays we can receive notice list more then once...
  435. //so add only unique notices
  436. S32 pos = mNoticesList->getItemIndex(id);
  437. if(pos!=-1)//if items with this ID already in the list - skip it
  438. continue;
  439. msg->getString("Data","Subject",subj,i);
  440. msg->getString("Data","FromName",name,i);
  441. msg->getBOOL("Data","HasAttachment",has_attachment,i);
  442. msg->getU8("Data","AssetType",asset_type,i);
  443. msg->getU32("Data","Timestamp",timestamp,i);
  444. // we only have the legacy name here, convert it to a username
  445. if (LLAvatarNameCache::useDisplayNames())
  446. {
  447. name = LLCacheName::buildUsername(name);
  448. }
  449. LLSD row;
  450. row["id"] = id;
  451. row["columns"][0]["column"] = "icon";
  452. if (has_attachment)
  453. {
  454. std::string icon_name = LLInventoryIcon::getIconName(
  455. (LLAssetType::EType)asset_type,
  456. LLInventoryType::IT_NONE);
  457. row["columns"][0]["type"] = "icon";
  458. row["columns"][0]["value"] = icon_name;
  459. }
  460. row["columns"][1]["column"] = "subject";
  461. row["columns"][1]["value"] = subj;
  462. row["columns"][2]["column"] = "from";
  463. row["columns"][2]["value"] = name;
  464. row["columns"][3]["column"] = "date";
  465. row["columns"][3]["value"] = build_notice_date(timestamp);
  466. row["columns"][4]["column"] = "sort";
  467. row["columns"][4]["value"] = llformat( "%u", timestamp);
  468. mNoticesList->addElement(row, ADD_BOTTOM);
  469. }
  470. mNoticesList->setNeedsSort(save_sort);
  471. mNoticesList->updateSort();
  472. }
  473. void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data)
  474. {
  475. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  476. if(!self) return;
  477. LLScrollListItem* item = self->mNoticesList->getFirstSelected();
  478. if (!item) return;
  479. LLMessageSystem* msg = gMessageSystem;
  480. msg->newMessage("GroupNoticeRequest");
  481. msg->nextBlock("AgentData");
  482. msg->addUUID("AgentID",gAgent.getID());
  483. msg->addUUID("SessionID",gAgent.getSessionID());
  484. msg->nextBlock("Data");
  485. msg->addUUID("GroupNoticeID",item->getUUID());
  486. gAgent.sendReliableMessage();
  487. lldebugs << "Item " << item->getUUID() << " selected." << llendl;
  488. }
  489. void LLPanelGroupNotices::showNotice(const std::string& subject,
  490. const std::string& message,
  491. const bool& has_inventory,
  492. const std::string& inventory_name,
  493. LLOfferInfo* inventory_offer)
  494. {
  495. arrangeNoticeView(VIEW_PAST_NOTICE);
  496. if(mViewSubject) mViewSubject->setText(subject);
  497. if(mViewMessage) mViewMessage->setText(message);
  498. if (mInventoryOffer)
  499. {
  500. // Cancel the inventory offer for the previously viewed notice
  501. mInventoryOffer->forceResponse(IOR_DECLINE);
  502. mInventoryOffer = NULL;
  503. }
  504. if (inventory_offer)
  505. {
  506. mInventoryOffer = inventory_offer;
  507. std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
  508. LLInventoryType::IT_TEXTURE);
  509. mViewInventoryIcon->setValue(icon_name);
  510. mViewInventoryIcon->setVisible(TRUE);
  511. std::stringstream ss;
  512. ss << " " << inventory_name;
  513. mViewInventoryName->setText(ss.str());
  514. mBtnOpenAttachment->setEnabled(TRUE);
  515. }
  516. else
  517. {
  518. mViewInventoryName->clear();
  519. mViewInventoryIcon->setVisible(FALSE);
  520. mBtnOpenAttachment->setEnabled(FALSE);
  521. }
  522. }
  523. void LLPanelGroupNotices::arrangeNoticeView(ENoticeView view_type)
  524. {
  525. if (CREATE_NEW_NOTICE == view_type)
  526. {
  527. mPanelCreateNotice->setVisible(TRUE);
  528. mPanelViewNotice->setVisible(FALSE);
  529. }
  530. else
  531. {
  532. mPanelCreateNotice->setVisible(FALSE);
  533. mPanelViewNotice->setVisible(TRUE);
  534. mBtnOpenAttachment->setEnabled(FALSE);
  535. }
  536. }
  537. void LLPanelGroupNotices::setGroupID(const LLUUID& id)
  538. {
  539. sInstances.erase(mGroupID);
  540. LLPanelGroupTab::setGroupID(id);
  541. sInstances[mGroupID] = this;
  542. mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
  543. LLGroupDropTarget* target = getChild<LLGroupDropTarget> ("drop_target");
  544. target->setPanel (this);
  545. target->setGroup (mGroupID);
  546. if(mViewMessage)
  547. mViewMessage->clear();
  548. if(mViewInventoryName)
  549. mViewInventoryName->clear();
  550. activate();
  551. }