llpanelgroupnotices.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /**
  2. * @file llpanelgroupnotices.cpp
  3. * @brief A panel to display group notices.
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewergpl$
  6. *
  7. * Copyright (c) 2006-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #include "llviewerprecompiledheaders.h"
  33. #include "llpanelgroupnotices.h"
  34. #include "llbutton.h"
  35. #include "llfontgl.h"
  36. #include "lliconctrl.h"
  37. #include "llinventory.h"
  38. #include "lllineeditor.h"
  39. #include "llnotifications.h"
  40. #include "llscrolllistctrl.h"
  41. #include "lltexteditor.h"
  42. #include "llagent.h"
  43. #include "llinventorymodel.h"
  44. #include "llinventoryicon.h" // For getIconName()
  45. #include "lltooldraganddrop.h"
  46. #include "llviewercontrol.h"
  47. #include "llviewerinventory.h"
  48. #include "llviewermessage.h" // For LLOfferInfo
  49. #include "roles_constants.h"
  50. //-----------------------------------------------------------------------------
  51. // LLGroupDropTarget class
  52. //
  53. // This handy class is a simple way to drop something on another view. It
  54. // handles drop events, always setting itself to the size of its parent.
  55. //-----------------------------------------------------------------------------
  56. class LLGroupDropTarget final : public LLView
  57. {
  58. protected:
  59. LOG_CLASS(LLGroupDropTarget);
  60. public:
  61. LLGroupDropTarget(const std::string& name, const LLRect& rect,
  62. LLPanelGroupNotices* panel, const LLUUID& group_id);
  63. ~LLGroupDropTarget() override {}
  64. void doDrop(EDragAndDropType cargo_type, void* cargo_data);
  65. // LLView functionality
  66. bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
  67. EDragAndDropType cargo_type, void* cargo_data,
  68. EAcceptance* accept, std::string& tooltip) override;
  69. protected:
  70. LLPanelGroupNotices* mGroupNoticesPanel;
  71. LLUUID mGroupID;
  72. };
  73. LLGroupDropTarget::LLGroupDropTarget(const std::string& name,
  74. const LLRect& rect,
  75. LLPanelGroupNotices* panel,
  76. const LLUUID& group_id)
  77. : LLView(name, rect, false, FOLLOWS_ALL),
  78. mGroupNoticesPanel(panel),
  79. mGroupID(group_id)
  80. {
  81. }
  82. void LLGroupDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data)
  83. {
  84. llinfos << "No operation" << llendl;
  85. }
  86. bool LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
  87. EDragAndDropType cargo_type,
  88. void* cargo_data, EAcceptance* accept,
  89. std::string& tooltip_msg)
  90. {
  91. if (!gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND))
  92. {
  93. *accept = ACCEPT_NO;
  94. return true;
  95. }
  96. if (!getParent())
  97. {
  98. return false;
  99. }
  100. if ((cargo_type == DAD_SETTINGS && !gAgent.hasInventorySettings()) ||
  101. (cargo_type == DAD_MATERIAL && !gAgent.hasInventoryMaterial()))
  102. {
  103. return false;
  104. }
  105. // Check the type
  106. switch (cargo_type)
  107. {
  108. case DAD_TEXTURE:
  109. case DAD_SOUND:
  110. case DAD_LANDMARK:
  111. case DAD_SCRIPT:
  112. case DAD_OBJECT:
  113. case DAD_NOTECARD:
  114. case DAD_CLOTHING:
  115. case DAD_BODYPART:
  116. case DAD_ANIMATION:
  117. case DAD_GESTURE:
  118. #if LL_MESH_ASSET_SUPPORT
  119. case DAD_MESH:
  120. case DAD_GLTF:
  121. case DAD_GLTF_BIN:
  122. #endif
  123. case DAD_SETTINGS:
  124. case DAD_MATERIAL:
  125. {
  126. LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
  127. if (inv_item && gInventory.getItem(inv_item->getUUID()) &&
  128. LLToolDragAndDrop::isInventoryGroupGiveAcceptable(inv_item))
  129. {
  130. // *TODO: get multiple object transfers working
  131. *accept = ACCEPT_YES_COPY_SINGLE;
  132. if (drop)
  133. {
  134. mGroupNoticesPanel->setItem(inv_item);
  135. }
  136. }
  137. else
  138. {
  139. // It is not in the user's inventory (it is probably in an
  140. // object's contents), so disallow dragging it here; you cannot
  141. // give something you do not yet have.
  142. *accept = ACCEPT_NO;
  143. }
  144. break;
  145. }
  146. default:
  147. *accept = ACCEPT_NO;
  148. }
  149. return true;
  150. }
  151. //-----------------------------------------------------------------------------
  152. // LLPanelGroupNotices class
  153. //-----------------------------------------------------------------------------
  154. //static
  155. LLPanelGroupNotices::instances_map_t LLPanelGroupNotices::sInstances;
  156. LLPanelGroupNotices::LLPanelGroupNotices(const std::string& name,
  157. const LLUUID& group_id)
  158. : LLPanelGroupTab(name,group_id),
  159. mInventoryItem(NULL),
  160. mInventoryOffer(NULL),
  161. mInitOK(false)
  162. {
  163. sInstances[group_id] = this;
  164. }
  165. LLPanelGroupNotices::~LLPanelGroupNotices()
  166. {
  167. sInstances.erase(mGroupID);
  168. if (mInventoryOffer)
  169. {
  170. // Cancel the inventory offer.
  171. mInventoryOffer->forceResponse(IOR_DECLINE);
  172. mInventoryOffer = NULL;
  173. }
  174. }
  175. //static
  176. void* LLPanelGroupNotices::createTab(void* data)
  177. {
  178. LLUUID* group_id = static_cast<LLUUID*>(data);
  179. return new LLPanelGroupNotices("panel group notices", *group_id);
  180. }
  181. bool LLPanelGroupNotices::isVisibleByAgent()
  182. {
  183. return mAllowEdit && gAgent.hasPowerInGroup(mGroupID,
  184. GP_NOTICES_SEND |
  185. GP_NOTICES_RECEIVE);
  186. }
  187. bool LLPanelGroupNotices::postBuild()
  188. {
  189. mNoticesList = getChild<LLScrollListCtrl>("notice_list");
  190. mNoticesList->setCommitOnSelectionChange(true);
  191. mNoticesList->setCommitCallback(onSelectNotice);
  192. mNoticesList->setCallbackUserData(this);
  193. mBtnNewMessage = getChild<LLButton>("create_new_notice", true, false);
  194. if (mBtnNewMessage)
  195. {
  196. mBtnNewMessage->setClickedCallback(onClickNewMessage);
  197. mBtnNewMessage->setCallbackUserData(this);
  198. mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID,
  199. GP_NOTICES_SEND));
  200. }
  201. mBtnGetPastNotices = getChild<LLButton>("refresh_notices", true, false);
  202. if (mBtnGetPastNotices)
  203. {
  204. mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices);
  205. mBtnGetPastNotices->setCallbackUserData(this);
  206. }
  207. // Create
  208. mCreateSubject = getChild<LLLineEditor>("create_subject");
  209. mCreateMessage = getChild<LLTextEditor>("create_message");
  210. mCreateInventoryName = getChild<LLLineEditor>("create_inventory_name");
  211. mCreateInventoryName->setTabStop(false);
  212. mCreateInventoryName->setEnabled(false);
  213. mCreateInventoryIcon = getChild<LLIconCtrl>("create_inv_icon",
  214. true, false);
  215. if (mCreateInventoryIcon)
  216. {
  217. mCreateInventoryIcon->setVisible(false);
  218. }
  219. mBtnSendMessage = getChild<LLButton>("send_notice", true, false);
  220. if (mBtnSendMessage)
  221. {
  222. mBtnSendMessage->setClickedCallback(onClickSendMessage);
  223. mBtnSendMessage->setCallbackUserData(this);
  224. }
  225. mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",
  226. true, false);
  227. if (mBtnRemoveAttachment)
  228. {
  229. mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment);
  230. mBtnRemoveAttachment->setCallbackUserData(this);
  231. mBtnRemoveAttachment->setEnabled(false);
  232. }
  233. // View
  234. mViewSubject = getChild<LLLineEditor>("view_subject", true, false);
  235. mViewMessage = getChild<LLTextEditor>("view_message", true, false);
  236. if (mViewMessage)
  237. {
  238. mViewMessage->setParseHTML(true);
  239. }
  240. mViewInventoryName = getChild<LLLineEditor>("view_inventory_name",
  241. true, false);
  242. if (mViewInventoryName)
  243. {
  244. mViewInventoryName->setTabStop(false);
  245. mViewInventoryName->setEnabled(false);
  246. }
  247. mViewInventoryIcon = getChild<LLIconCtrl>("view_inv_icon", true, false);
  248. if (mViewInventoryIcon)
  249. {
  250. mViewInventoryIcon->setVisible(false);
  251. }
  252. mBtnOpenAttachment = getChild<LLButton>("open_attachment", true, false);
  253. if (mBtnOpenAttachment)
  254. {
  255. mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment);
  256. mBtnOpenAttachment->setCallbackUserData(this);
  257. }
  258. mNoNoticesStr = getString("no_notices_text");
  259. mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice");
  260. mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice");
  261. // Must be in front of all other UI elements.
  262. LLPanel* dtv = getChild<LLPanel>("drop_target");
  263. LLGroupDropTarget* target = new LLGroupDropTarget("drop_target",
  264. dtv->getRect(),
  265. this, mGroupID);
  266. target->setEnabled(true);
  267. target->setToolTip(dtv->getToolTip());
  268. mPanelCreateNotice->addChild(target);
  269. mPanelCreateNotice->removeChild(dtv, true);
  270. mInitOK = true;
  271. arrangeNoticeView(VIEW_PAST_NOTICE);
  272. mInitOK = LLPanelGroupTab::postBuild();
  273. return mInitOK;
  274. }
  275. void LLPanelGroupNotices::activate()
  276. {
  277. if (!mInitOK) return;
  278. bool can_send = gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND);
  279. bool can_receive = gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_RECEIVE);
  280. mPanelViewNotice->setEnabled(can_receive);
  281. mPanelCreateNotice->setEnabled(can_send);
  282. // Always disabled to stop direct editing of attachment names
  283. mCreateInventoryName->setEnabled(false);
  284. if (mViewInventoryName) mViewInventoryName->setEnabled(false);
  285. // If we can receive notices, grab them right away.
  286. if (can_receive)
  287. {
  288. onClickRefreshNotices(this);
  289. }
  290. }
  291. void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
  292. {
  293. if (!mInitOK) return;
  294. mInventoryItem = inv_item;
  295. bool item_is_multi = false;
  296. if (inv_item->getFlags() &
  297. LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
  298. {
  299. item_is_multi = true;
  300. }
  301. if (mCreateInventoryIcon)
  302. {
  303. std::string icon_name =
  304. LLInventoryIcon::getIconName(inv_item->getType(),
  305. inv_item->getInventoryType(),
  306. inv_item->getFlags(), item_is_multi);
  307. mCreateInventoryIcon->setImage(icon_name);
  308. mCreateInventoryIcon->setVisible(true);
  309. }
  310. std::stringstream ss;
  311. ss << " " << mInventoryItem->getName();
  312. mCreateInventoryName->setText(ss.str());
  313. if (mBtnRemoveAttachment)
  314. {
  315. mBtnRemoveAttachment->setEnabled(true);
  316. }
  317. }
  318. void LLPanelGroupNotices::onClickRemoveAttachment(void* data)
  319. {
  320. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  321. if (!self || !self->mInitOK) return;
  322. self->mInventoryItem = NULL;
  323. self->mCreateInventoryName->clear();
  324. if (self->mCreateInventoryIcon)
  325. {
  326. self->mCreateInventoryIcon->setVisible(false);
  327. }
  328. if (self->mBtnRemoveAttachment)
  329. {
  330. self->mBtnRemoveAttachment->setEnabled(false);
  331. }
  332. }
  333. //static
  334. void LLPanelGroupNotices::onClickOpenAttachment(void* data)
  335. {
  336. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  337. if (!self || !self->mInitOK) return;
  338. if (self->mInventoryOffer)
  339. {
  340. self->mInventoryOffer->forceResponse(IOR_ACCEPT);
  341. self->mInventoryOffer = NULL;
  342. }
  343. self->mBtnOpenAttachment->setEnabled(false);
  344. }
  345. void LLPanelGroupNotices::onClickSendMessage(void* data)
  346. {
  347. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  348. if (!self || !self->mInitOK) return;
  349. if (self->mCreateSubject->getText().empty())
  350. {
  351. // Must supply a subject
  352. gNotifications.add("MustSpecifyGroupNoticeSubject");
  353. return;
  354. }
  355. send_group_notice(self->mGroupID, self->mCreateSubject->getText(),
  356. self->mCreateMessage->getText(), self->mInventoryItem);
  357. self->mCreateMessage->clear();
  358. self->mCreateSubject->clear();
  359. onClickRemoveAttachment(data);
  360. self->arrangeNoticeView(VIEW_PAST_NOTICE);
  361. onClickRefreshNotices(self);
  362. }
  363. //static
  364. void LLPanelGroupNotices::onClickNewMessage(void* data)
  365. {
  366. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  367. if (!self || !self->mInitOK) return;
  368. self->arrangeNoticeView(CREATE_NEW_NOTICE);
  369. if (self->mInventoryOffer)
  370. {
  371. self->mInventoryOffer->forceResponse(IOR_DECLINE);
  372. self->mInventoryOffer = NULL;
  373. }
  374. self->mCreateSubject->clear();
  375. self->mCreateMessage->clear();
  376. if (self->mInventoryItem)
  377. {
  378. onClickRemoveAttachment(self);
  379. }
  380. // NOTE: true == do not commit on change
  381. self->mNoticesList->deselectAllItems(true);
  382. }
  383. void LLPanelGroupNotices::onClickRefreshNotices(void* data)
  384. {
  385. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  386. if (!self || !self->mInitOK) return;
  387. LL_DEBUGS("GroupPanel") << "Sending GroupNoticesListRequest" << LL_ENDL;
  388. self->mNoticesList->deleteAllItems();
  389. LLMessageSystem* msg = gMessageSystemp;
  390. msg->newMessage("GroupNoticesListRequest");
  391. msg->nextBlock("AgentData");
  392. msg->addUUID("AgentID", gAgentID);
  393. msg->addUUID("SessionID", gAgentSessionID);
  394. msg->nextBlock("Data");
  395. msg->addUUID("GroupID", self->mGroupID);
  396. gAgent.sendReliableMessage();
  397. }
  398. //static
  399. void LLPanelGroupNotices::processGroupNoticesListReply(LLMessageSystem* msg,
  400. void** data)
  401. {
  402. LLUUID group_id;
  403. msg->getUUID("AgentData", "GroupID", group_id);
  404. instances_map_t::iterator it = sInstances.find(group_id);
  405. if (it == sInstances.end())
  406. {
  407. llinfos << "Group Panel Notices " << group_id
  408. << " no longer in existence." << llendl;
  409. return;
  410. }
  411. LLPanelGroupNotices* selfp = it->second;
  412. if (!selfp)
  413. {
  414. llinfos << "Group Panel Notices " << group_id
  415. << " no longer in existence." << llendl;
  416. return;
  417. }
  418. selfp->processNotices(msg);
  419. }
  420. void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
  421. {
  422. if (!mInitOK) return;
  423. LLUUID id;
  424. std::string subj, name;
  425. U32 timestamp;
  426. bool has_attachment;
  427. U8 asset_type;
  428. std::string format = gSavedSettings.getString("ShortDateFormat");
  429. S32 count = msg->getNumberOfBlocks("Data");
  430. for (S32 i = 0; i < count; ++i)
  431. {
  432. msg->getUUID("Data","NoticeID",id,i);
  433. if (count == 1 && id.isNull())
  434. {
  435. // Only one entry, the dummy entry.
  436. mNoticesList->addCommentText(mNoNoticesStr);
  437. mNoticesList->setEnabled(false);
  438. return;
  439. }
  440. msg->getString("Data","Subject", subj, i);
  441. msg->getString("Data","FromName", name, i);
  442. msg->getBool("Data","HasAttachment", has_attachment, i);
  443. msg->getU8("Data","AssetType", asset_type, i);
  444. msg->getU32("Data","Timestamp", timestamp, i);
  445. LLSD row;
  446. row["id"] = id;
  447. row["columns"][0]["column"] = "icon";
  448. if (has_attachment)
  449. {
  450. std::string icon;
  451. icon = LLInventoryIcon::getIconName((LLAssetType::EType)asset_type,
  452. LLInventoryType::IT_NONE,
  453. false, false);
  454. row["columns"][0]["type"] = "icon";
  455. row["columns"][0]["value"] = icon;
  456. }
  457. row["columns"][1]["column"] = "subject";
  458. row["columns"][1]["value"] = subj;
  459. row["columns"][2]["column"] = "from";
  460. row["columns"][2]["value"] = name;
  461. std::string buffer;
  462. row["columns"][3]["column"] = "date";
  463. row["columns"][3]["type"] = "date";
  464. row["columns"][3]["format"] = format;
  465. row["columns"][3]["value"] = LLDate(timestamp);
  466. mNoticesList->addElement(row, ADD_BOTTOM);
  467. }
  468. mNoticesList->sortByColumnIndex(3, false);
  469. }
  470. void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data)
  471. {
  472. LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
  473. if (!self || !self->mInitOK) return;
  474. LLScrollListItem* item = self->mNoticesList->getFirstSelected();
  475. if (!item) return;
  476. LLMessageSystem* msg = gMessageSystemp;
  477. msg->newMessage("GroupNoticeRequest");
  478. msg->nextBlock("AgentData");
  479. msg->addUUID("AgentID", gAgentID);
  480. msg->addUUID("SessionID", gAgentSessionID);
  481. msg->nextBlock("Data");
  482. msg->addUUID("GroupNoticeID",item->getUUID());
  483. gAgent.sendReliableMessage();
  484. LL_DEBUGS("GroupPanel") << "Item " << item->getUUID() << " selected."
  485. << LL_ENDL;
  486. }
  487. void LLPanelGroupNotices::showNotice(const std::string& subject,
  488. const std::string& message, bool,
  489. const std::string& inventory_name,
  490. LLOfferInfo* inventory_offer)
  491. {
  492. arrangeNoticeView(VIEW_PAST_NOTICE);
  493. if (mViewSubject) mViewSubject->setText(subject);
  494. if (mViewMessage)
  495. {
  496. mViewMessage->clear();
  497. mViewMessage->setParseHTML(true);
  498. // Now we append the new text (setText() won't highlight URLs)
  499. mViewMessage->appendColoredText(message, false, false,
  500. mViewMessage->getReadOnlyFgColor());
  501. }
  502. if (mInventoryOffer)
  503. {
  504. // Cancel the inventory offer for the previously viewed notice
  505. mInventoryOffer->forceResponse(IOR_DECLINE);
  506. mInventoryOffer = NULL;
  507. }
  508. if (inventory_offer)
  509. {
  510. mInventoryOffer = inventory_offer;
  511. if (mViewInventoryIcon)
  512. {
  513. std::string icon_name =
  514. LLInventoryIcon::getIconName(mInventoryOffer->mType,
  515. LLInventoryType::IT_TEXTURE,
  516. 0, false);
  517. mViewInventoryIcon->setImage(icon_name);
  518. mViewInventoryIcon->setVisible(true);
  519. }
  520. if (mViewInventoryName)
  521. {
  522. std::stringstream ss;
  523. ss << " " << inventory_name;
  524. mViewInventoryName->setText(ss.str());
  525. }
  526. if (mBtnOpenAttachment)
  527. {
  528. mBtnOpenAttachment->setEnabled(true);
  529. }
  530. }
  531. else
  532. {
  533. if (mViewInventoryName)
  534. {
  535. mViewInventoryName->clear();
  536. }
  537. if (mViewInventoryIcon)
  538. {
  539. mViewInventoryIcon->setVisible(false);
  540. }
  541. if (mBtnOpenAttachment)
  542. {
  543. mBtnOpenAttachment->setEnabled(false);
  544. }
  545. }
  546. }
  547. void LLPanelGroupNotices::arrangeNoticeView(ENoticeView view_type)
  548. {
  549. if (!mInitOK) return;
  550. if (view_type == CREATE_NEW_NOTICE)
  551. {
  552. mPanelCreateNotice->setVisible(true);
  553. mPanelViewNotice->setVisible(false);
  554. }
  555. else
  556. {
  557. mPanelCreateNotice->setVisible(false);
  558. mPanelViewNotice->setVisible(true);
  559. if (mBtnOpenAttachment)
  560. {
  561. mBtnOpenAttachment->setEnabled(false);
  562. }
  563. }
  564. }