From ddd669f11f9657fdf55dd826f14c9ef26de87a1d Mon Sep 17 00:00:00 2001 From: Denis Dolzhenko Date: Tue, 19 Jul 2016 17:36:47 +0300 Subject: [PATCH] TizenRefApp-6278 Calendar event attachment support Change-Id: I4e28efdb8600e0cceca70dd4c69e42c436e80477 Signed-off-by: Denis Dolzhenko --- CMakeLists.txt | 1 + edje/images/U01_icon_etc.png | Bin 1354 -> 466 bytes edje/images/U01_icon_vcs.png | Bin 1576 -> 736 bytes inc/Resource.h | 4 +- packaging/message.spec | 1 + project_def.prop | 4 +- src/Common/ContactManager/inc/Contact.h | 69 ++++++++++++ src/Common/ContactManager/inc/ContactManager.h | 14 ++- ...{VcfGenerator.cpp => ContactVCardGenerator.cpp} | 0 .../ContactManager/src/ContactVCardParser.cpp | 48 +++++++++ src/Common/Utils/inc/TimeUtils.h | 4 +- src/Common/Utils/inc/VCalendarParser.h | 53 +++++++++ src/Common/Utils/src/TimeUtils.cpp | 22 +++- src/Common/Utils/src/VCalendarParser.cpp | 119 +++++++++++++++++++++ .../ConvList/Controller/inc/ConvListItem.h | 1 + .../ConvList/Controller/src/ConvListItem.cpp | 23 +++- .../ConvList/View/inc/BubbleCalEventViewItem.h | 50 +++++++++ .../ConvList/View/inc/BubbleViewItem.h | 2 +- .../ConvList/View/src/BubbleAudioViewItem.cpp | 2 +- .../ConvList/View/src/BubbleCalEventViewItem.cpp | 58 ++++++++++ .../ConvList/View/src/BubbleItemContainer.cpp | 1 + .../View/src/BubbleUnknownFileViewItem.cpp | 1 + 22 files changed, 464 insertions(+), 13 deletions(-) create mode 100644 src/Common/ContactManager/inc/Contact.h rename src/Common/ContactManager/src/{VcfGenerator.cpp => ContactVCardGenerator.cpp} (100%) create mode 100644 src/Common/ContactManager/src/ContactVCardParser.cpp create mode 100644 src/Common/Utils/inc/VCalendarParser.h create mode 100644 src/Common/Utils/src/VCalendarParser.cpp create mode 100644 src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h create mode 100644 src/Conversation/ConvList/View/src/BubbleCalEventViewItem.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 10230ac..1594582 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ pkg_check_modules(pkgs REQUIRED storage attach-panel phonenumber-utils + calendar-service2 ) ADD_DEFINITIONS("-DAPP_DIR=\"${PKGDIR}\"") diff --git a/edje/images/U01_icon_etc.png b/edje/images/U01_icon_etc.png index 6ea35ead805c2b2edbfc6f367afc35d11eee83cc..ef2bc63979e381fcc30acfba25f371bd70644e8f 100755 GIT binary patch literal 466 zcmV;@0WJQCP)b(DdhkF0bfZ( zK~!ko?Uy}E13?gmpE(1f7Ah%(V4*||YQVzUAK(XqKTZ&u^;%cUx>KXt1un1gB`b^{X+HGqwr z54vJz5AG2c;zC@A3vnSX#CxsI908j-?(GG5!f_nOahwt48!&l3^w)^1&PVosU-?Y zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP zs8ErclUHn2VXFi-*9yo63F|81#=KlDb#X~hD#E>34K5C;EJ)Q4 zN-fSWElLJPT$(b-ssbzLqSVBa{GyQj{2W*)24v)y2=9ZF3nBND}m`vf$4QJFu=a)38O@25*c#EV@l0c5w!4hAd=h{k1!h(YF2ApNQb*u+d zE~>B@YDoNLYFhSH(qN7OclqYSuipHVuQ+A!{af?So6~m($s8B-oNmV9z#{0vq|~9% zdiFH?sUKB~7;Qq=U%B1((Y;h9`H274 zRr}hu%;9~|8TDU%^@iZJE#Kx=tkK)NaS3xwVtLv5iMviI_Eqy;HSH6=TfAUh@rJka zYD=4qrOpZ*aO)}fOQ(wee=8((bMDrj z>7UyyK3q;SzIy16*OQm#reLLlOd$0Q9Kf&<02%C?Q0eCB>gTe~DWM4f`*__~ diff --git a/edje/images/U01_icon_vcs.png b/edje/images/U01_icon_vcs.png index b40edf4ba8e8fd09892a16e6f1db93b73e3620de..7fac5c86a61062c7dc06cb2f2538f12ef1ad7e1e 100755 GIT binary patch literal 736 zcmV<60w4W}P)BL@7+A7CpsB3OupMnSBNm6Zw>f(Suv^dGR1AOQtI ztt>>r5VR32f`tm}M*}Mb8y!qX`?7VsJymucE6ciK` z6cp4sVwz-0Jpc{@r~|l7ay%BV0yqSq7rHgm_)j2aDfIh?gWyT6{dsyOla+YL!!r###W|0W2}JM$(>G zS`UD(zr-s5x~<)p5GR0|wO2~o24IY&=5tz&D1ZHwv|+xdR=J?XsJ5s)5<0SAS1qUe z0Gc^?V>5timK_-;c|FTsSOxG5!1~~klwa<+q)&E@IR4J@RmP4vcEQ*>$6n;^k@!yC zYwc=mhp)#9)9!@al4Em4c4P{`V{5;4{Hc4{A9ioL+}G~qBQ~AO9F#O_Wy21~x~!tD zOR6|tbDZsRCDE~(H@l?g_J12Q9}$vsNmGL4?7!q%G5EEpeZ-H_egOOIag5|?<2PKD zyO(53(hz_lV|PfNlGG0%I@f$Axw|Nj3;@__?N^R(ab~Y1rPB?bO*nneGg-tD6eHzw&eM}Q)9Bz;>l$lV`h+}cb;TO|>Tx(l;wA$LkQMH1li(Pb%(jIWZ-ko;`Z9%7H zew3gP7!2G{5(jLufpe3opg^4B7=y*2^CL1ghd?H%^ER0U-R=-@e~ex3?)}K~Jiq6C z-zRTg;>I^-&w6E+Kp>cHj7Q8|yNUmTgSdZf;W{PPEMVfSOcIgGxNH#=#%kIC+X<)G#$&{8C&{q|0?leSX|rdb43L7RVYn82(9{9~ zm_rM0R+ywF(txI8@!1rbl)cen&(5%`9pLI!fW{4T0#1~%0dD7ZoQB<6a9kJW`uwy6 z1jZpuh8BEo%4$jk3uOX9(IE0Ay;Ec^J!s)0<1q7w- z6h<-_fdjmvErrNrv>@m7`4XJulq^n9Y!kO(61R<%Kw>Gsq)DL3^#4$&a|%r}X7q*M z{}iSz9uk$9QJTo4?A*bnM)9Rc*g&B+hM+72v3+tE6VnNXpwkHwFeE8~Wt%bFLAdDX zalFX{8*!Sk;da!BXhBXvjA0H~4oUTL1tK%7i7`M>oLs*)Muq5+I6Y!e#VBHAlU#(b zXF5@wndCZNaOKl-`6xI^t}=pBSQhG7OA$_Be9162y%*`UdJ|m7^j@H8xf0Hdgg@AS z9rWZBmma=56dLB)%*4(M^-69<8`4WVY%8`X^g8jd z^{mQ}<#=$Tr-Qu^5-achepoxSGqy=(6q&jM?{)_V?+Hc#5C{i2&ie zz#VNB*+&Zo*{%NDd4sIQukj7CiGGcE`9*_y)xs+SdrBgNy9(Alu_Bf4EvW2ZmMjer zUh_Z9=#5ul?+o@IIkIibX`R$Qsy&4lw;G>4eRR5aY{RYHPDmZ2Qj4aNww-vZV36H)8$UzqR%Kb?nrMpth^!i)-ZSqKX>{J<12~Hx`0 +#include +#include + +namespace Msg +{ + class Contact; + typedef std::shared_ptr ContactRef; + + class Contact + : public ContactRecord + { + public: + Contact(bool release, contacts_record_h record = nullptr); + + std::string getDispName() const; + std::string getPhoneNumber() const; + std::string getEmail() const; + std::string getThumb() const; + }; + + inline Contact::Contact(bool release, contacts_record_h record) + : ContactRecord(release, record) + { + } + + inline std::string Contact::getDispName() const + { + return getStr(_contacts_contact.display_name); + } + + inline std::string Contact::getPhoneNumber() const + { + return getStr(_contacts_contact.number); + } + + inline std::string Contact::getEmail() const + { + return getStr(_contacts_contact.email); + } + + inline std::string Contact::getThumb() const + { + return getStr(_contacts_contact.image_thumbnail_path); + } +} + +#endif /* __Contact_h__ */ diff --git a/src/Common/ContactManager/inc/ContactManager.h b/src/Common/ContactManager/inc/ContactManager.h index a8c9d96..b59230e 100644 --- a/src/Common/ContactManager/inc/ContactManager.h +++ b/src/Common/ContactManager/inc/ContactManager.h @@ -31,6 +31,7 @@ #include "ContactMyProfile.h" #include "ContactMyProfileNumber.h" #include "ContactMyProfileEmail.h" +#include "Contact.h" namespace Msg { @@ -125,12 +126,19 @@ namespace Msg */ std::string makeVcard(const int personId, bool myProfile); - /** - *@brief Create content of contact by id list + /** +- *@brief Create content of contact by id list *@param[in] personId - contact id *@return Content with all info about contacts */ - std::string makeVcard(const std::list &idList); + std::string makeVcard(const std::list &idList); + + /** + *@brief Parse vCard file + *@param[in] filePath Path to file + *@return list of Contacts + */ + std::shared_ptr> parseVcard(const std::string &filePath); private: typedef std::unordered_map AddressMap; diff --git a/src/Common/ContactManager/src/VcfGenerator.cpp b/src/Common/ContactManager/src/ContactVCardGenerator.cpp similarity index 100% rename from src/Common/ContactManager/src/VcfGenerator.cpp rename to src/Common/ContactManager/src/ContactVCardGenerator.cpp diff --git a/src/Common/ContactManager/src/ContactVCardParser.cpp b/src/Common/ContactManager/src/ContactVCardParser.cpp new file mode 100644 index 0000000..6aa803d --- /dev/null +++ b/src/Common/ContactManager/src/ContactVCardParser.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "ContactManager.h" +#include "Logger.h" +#include "FileUtils.h" + +#include +#include +#include +#include + +using namespace Msg; + +std::shared_ptr> ContactManager::parseVcard(const std::string &filePath) +{ + std::shared_ptr> res; + + if(filePath.empty()) + return res; + + std::string vcardStream = FileUtils::readTextFile(filePath); + if(vcardStream.empty()) + return res; + + contacts_list_h list = {}; + int parseRes = contacts_vcard_parse_to_contacts(vcardStream.c_str(), &list); + if(list) + res = std::make_shared>(list); + + MSG_LOG("Parse result: ", parseRes); + + return res; +} diff --git a/src/Common/Utils/inc/TimeUtils.h b/src/Common/Utils/inc/TimeUtils.h index 6185f12..e2b3d44 100644 --- a/src/Common/Utils/inc/TimeUtils.h +++ b/src/Common/Utils/inc/TimeUtils.h @@ -39,12 +39,14 @@ namespace Msg static std::string makeDateTimeString(time_t msgTime); static std::string makeSmsReportTimeString(time_t msgTime); static std::string makeMmsReportTimeString(time_t msgTime); + static std::string makeCalEventString(time_t time); + static std::string makeCalEventString(int year, int month, int mday, int hour, int min, const char *timezone = nullptr); protected: //made protected to allow inheritance of this class in tests static const std::string &getDefaultLocale(); static std::string getDateBestPattern(const std::string &locale, const std::string &skeleton); - static std::string getFormattedDate(const std::string &locale, const std::string &bestPattern, time_t time); + static std::string getFormattedDate(const std::string &locale, const std::string &bestPattern, time_t time, const char *timezone = nullptr); private: static int getTimeFormat(); diff --git a/src/Common/Utils/inc/VCalendarParser.h b/src/Common/Utils/inc/VCalendarParser.h new file mode 100644 index 0000000..3ff3b96 --- /dev/null +++ b/src/Common/Utils/inc/VCalendarParser.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef VCardParser_h_ +#define VCardParser_h_ + +#include +#include +#include + +class CalendarEvent +{ + public: + CalendarEvent(calendar_record_h record); + + const std::string &getSummary() const; + const std::string &getStartDate() const; + + private: + std::string m_Summary; + std::string m_StartDate; +}; + +class VCalendarParser +{ + public: + static VCalendarParser &getInst(); + static std::list parse(const std::string &filePath); + + private: + VCalendarParser(); + ~VCalendarParser(); + VCalendarParser& operator=(VCalendarParser&) = delete; + VCalendarParser(VCalendarParser&) = delete; + +}; + + +#endif /* VCardParser_h_ */ diff --git a/src/Common/Utils/src/TimeUtils.cpp b/src/Common/Utils/src/TimeUtils.cpp index 6a77db8..6bfcc79 100644 --- a/src/Common/Utils/src/TimeUtils.cpp +++ b/src/Common/Utils/src/TimeUtils.cpp @@ -115,6 +115,24 @@ std::string TimeUtils::makeMmsReportTimeString(time_t msgTime) return getFormattedDate(locale, getDateBestPattern(locale, timeFormat), msgTime); } +std::string TimeUtils::makeCalEventString(time_t time) +{ + const std::string &locale = getDefaultLocale(); + return getFormattedDate(locale, getDateBestPattern(locale, dateYear), time); +} + +std::string TimeUtils::makeCalEventString(int year, int month, int mday, int hour, int min, const char *timezone) +{ + struct tm time = {}; + time.tm_year = year - 1900; + time.tm_mon = month - 1; + time.tm_mday = mday; + time.tm_hour = hour; + time.tm_min = min; + const std::string &locale = getDefaultLocale(); + return getFormattedDate(locale, getDateBestPattern(locale, dateYear), mktime(&time), timezone); +} + int TimeUtils::getTimeFormat() { bool timeFormat = false; @@ -207,7 +225,7 @@ std::string TimeUtils::getDateBestPattern(const std::string &locale, const std:: return bestPatternString; } -std::string TimeUtils::getFormattedDate(const std::string &locale, const std::string &bestPattern, time_t time) +std::string TimeUtils::getFormattedDate(const std::string &locale, const std::string &bestPattern, time_t time, const char *timezone) { int status = I18N_ERROR_NONE; i18n_udate date; @@ -227,7 +245,7 @@ std::string TimeUtils::getFormattedDate(const std::string &locale, const std::st i18n_ustring_copy_ua_n(uBestPattern, bestPattern.c_str(), maxUcharLen); /* get current timezone and set as default timezone */ - i18n_ustring_copy_ua(utimezoneId, getTimezone().c_str()); + i18n_ustring_copy_ua(utimezoneId, timezone ? timezone : getTimezone().c_str()); status = i18n_ucalendar_set_default_timezone(utimezoneId); if (status != I18N_ERROR_NONE) diff --git a/src/Common/Utils/src/VCalendarParser.cpp b/src/Common/Utils/src/VCalendarParser.cpp new file mode 100644 index 0000000..240fe28 --- /dev/null +++ b/src/Common/Utils/src/VCalendarParser.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "VCalendarParser.h" +#include "FileUtils.h" +#include "Logger.h" +#include "TimeUtils.h" + +#include + +using namespace Msg; + +CalendarEvent::CalendarEvent(calendar_record_h record) +{ + char *summary = nullptr; + calendar_record_get_str_p(record, _calendar_event.summary, &summary); + if(summary) + m_Summary = summary; + + calendar_time_s start = {}; + calendar_record_get_caltime(record, _calendar_event.start_time, &start); + if(start.type == CALENDAR_TIME_UTIME) // Unix time + { + m_StartDate = TimeUtils::makeCalEventString(start.time.utime); + } + else // Local time + { + // FIXME: timezone is null + char *timezone = nullptr; + calendar_record_get_str_p(record, _calendar_event.timezone, &timezone); + m_StartDate = TimeUtils::makeCalEventString + ( + start.time.date.year, + start.time.date.month, + start.time.date.mday, + start.time.date.hour, + start.time.date.minute, + timezone + ); + } + +} + +const std::string &CalendarEvent::getSummary() const +{ + return m_Summary; +} + +const std::string &CalendarEvent::getStartDate() const +{ + return m_StartDate; +} + +VCalendarParser::VCalendarParser() +{ + calendar_connect(); +} + +VCalendarParser::~VCalendarParser() +{ + calendar_disconnect(); +} + +VCalendarParser &VCalendarParser::getInst() +{ + static VCalendarParser inst; + return inst; +} + +std::list VCalendarParser::parse(const std::string &filePath) +{ + if(filePath.empty()) + return {}; + + std::list list; + std::string text = FileUtils::readTextFile(filePath); + + calendar_list_h records = nullptr; + int parseRes = calendar_vcalendar_parse_to_calendar(text.c_str(), &records); + MSG_LOG("Parse results: ", parseRes); + + int count = 0; + calendar_list_get_count(records, &count); + calendar_list_first(records); + + for(int i = 0; i < count; ++i) + { + calendar_record_h record = nullptr; + calendar_list_get_current_record_p(records, &record); + if(record) + { + char *viewUri = nullptr; + calendar_record_get_uri_p(record, &viewUri); + if(viewUri && !strcmp(viewUri, _calendar_event._uri)) + list.emplace_back(record); + } + } + + if(records) + calendar_list_destroy(records, true); + + return list; +} + + diff --git a/src/Conversation/ConvList/Controller/inc/ConvListItem.h b/src/Conversation/ConvList/Controller/inc/ConvListItem.h index 30c1e19..13f1baf 100644 --- a/src/Conversation/ConvList/Controller/inc/ConvListItem.h +++ b/src/Conversation/ConvList/Controller/inc/ConvListItem.h @@ -93,6 +93,7 @@ namespace Msg void addTextItem(std::string text, bool markup, const std::string &searchWord); void addImageItem(const MsgConvMedia &media); void addAttachedFileItem(const MsgConvMedia &media); + void addCalendarItem(const MsgConvMedia &media); // Create Popup when message is clicked void showMainListPopup(); diff --git a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp index 7a8cc35..434b458 100644 --- a/src/Conversation/ConvList/Controller/src/ConvListItem.cpp +++ b/src/Conversation/ConvList/Controller/src/ConvListItem.cpp @@ -21,6 +21,7 @@ #include "CallbackAssist.h" #include "FileUtils.h" #include "TimeUtils.h" +#include "VCalendarParser.h" #include "SaveAttachmentsPopup.h" #include "TextDecorator.h" #include "MediaType.h" @@ -28,16 +29,20 @@ #include "TimeUtils.h" #include "FileViewer.h" #include "BubbleItemContainer.h" + +// Bubble items: #include "BubbleTextViewItem.h" #include "BubbleImageViewItem.h" #include "BubbleVideoViewItem.h" #include "BubbleAudioViewItem.h" #include "BubbleDownloadButtonViewItem.h" #include "BubbleUnknownFileViewItem.h" +#include "BubbleCalEventViewItem.h" #include #include #include +#include using namespace Msg; @@ -181,6 +186,18 @@ void ConvListItem::addAttachedFileItem(const MsgConvMedia &media) m_BubbleEntityList.push_back(entity); } +void ConvListItem::addCalendarItem(const MsgConvMedia &media) +{ + auto list = VCalendarParser::getInst().parse(media.getPath()); + if(!list.empty()) + { + // TODO: if list.szie() > 1 ? + const CalendarEvent &event = list.front(); + auto *entity = new BubbleCalEventEntity(media.getPath(), event.getSummary(), event.getStartDate()); + m_BubbleEntityList.push_back(entity); + } +} + void ConvListItem::addDownloadButtonItem() { auto *entity = new BubbleDownloadButtonEntity; @@ -237,6 +254,7 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str std::string mime = media.getMime(); MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime); + std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower); switch(msgMediaType) { case MsgMedia::TextType: @@ -252,7 +270,9 @@ void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::str addVideoItem(media); break; default: - if(mime != "application/smil") + if(mime == "text/x-vcalendar" || mime == "text/calendar") + addCalendarItem(media); + else if(mime != "application/smil") addAttachedFileItem(media); break; } @@ -266,7 +286,6 @@ Evas_Object *ConvListItem::getBubbleContent() for(BubbleEntity *entity : m_BubbleEntityList) { BubbleViewItem *item = entity->createView(*bubble); - item->show(); bubble->append(*item); item->setListener(this); } diff --git a/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h b/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h new file mode 100644 index 0000000..aa1b76f --- /dev/null +++ b/src/Conversation/ConvList/View/inc/BubbleCalEventViewItem.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef BubbleCalEventViewItem_h_ +#define BubbleCalEventViewItem_h_ + +#include "BubbleIconTextLayoutItem.h" + +namespace Msg +{ + class BubbleCalEventViewItem + : public BubbleIconTextLayoutItem + { + public: + BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent); + virtual ~BubbleCalEventViewItem(); + }; + + class BubbleCalEventEntity + : public BubbleEntity + { + public: + BubbleCalEventEntity(const std::string &filePath, const std::string &name, const std::string &dateTime); + virtual ~BubbleCalEventEntity(); + + virtual BubbleCalEventViewItem *createView(Evas_Object *parent); + virtual const std::string &getFilePath() const; + + private: + const std::string m_FilePath; + const std::string m_Name; + const std::string m_DateTime; + }; +} + +#endif /* BubbleCalEventViewItem_h_ */ diff --git a/src/Conversation/ConvList/View/inc/BubbleViewItem.h b/src/Conversation/ConvList/View/inc/BubbleViewItem.h index 1532d3b..fac1bbf 100644 --- a/src/Conversation/ConvList/View/inc/BubbleViewItem.h +++ b/src/Conversation/ConvList/View/inc/BubbleViewItem.h @@ -59,7 +59,7 @@ namespace Msg AudioItem, VideoItem, ContactItem, - CalendarItem, + CalendarEventItem, UnknownFileItem, DownloadButtonItem }; diff --git a/src/Conversation/ConvList/View/src/BubbleAudioViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleAudioViewItem.cpp index b320f31..0b75f07 100644 --- a/src/Conversation/ConvList/View/src/BubbleAudioViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleAudioViewItem.cpp @@ -24,6 +24,7 @@ BubbleAudioViewItem::BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *pare : BubbleIconTextLayoutItem(entity, parent, Layout1Icon2Text) { attachGestureTapLayer(getEo(), getEo()); + setIcon(createIcon(getEo(), ATTACH_MUSIC_ICON)); } BubbleAudioViewItem::~BubbleAudioViewItem() @@ -48,7 +49,6 @@ BubbleAudioEntity::~BubbleAudioEntity() BubbleAudioViewItem *BubbleAudioEntity::createView(Evas_Object *parent) { auto *item = new BubbleAudioViewItem(*this, parent); - item->setIcon(BubbleAudioViewItem::createIcon(*item, ATTACH_MUSIC_ICON)); item->setMainText(m_FileName); item->setSubText(m_Duration); return item; diff --git a/src/Conversation/ConvList/View/src/BubbleCalEventViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleCalEventViewItem.cpp new file mode 100644 index 0000000..a2dc75f --- /dev/null +++ b/src/Conversation/ConvList/View/src/BubbleCalEventViewItem.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "BubbleCalEventViewItem.h" +#include "Resource.h" + +using namespace Msg; + +BubbleCalEventViewItem::BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent) + : BubbleIconTextLayoutItem(entity, parent, Layout1Icon2Text) +{ + attachGestureTapLayer(getEo(), getEo()); + setIcon(createIcon(getEo(), ATTACH_CAL_ICON)); +} + +BubbleCalEventViewItem::~BubbleCalEventViewItem() +{ +} + +BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string &name, const std::string &dateTime) + : BubbleEntity(CalendarEventItem) + , m_FilePath(filePath) + , m_Name(name) + , m_DateTime(dateTime) + +{ +} + +BubbleCalEventEntity::~BubbleCalEventEntity() +{ +} + +BubbleCalEventViewItem *BubbleCalEventEntity::createView(Evas_Object *parent) +{ + auto *item = new BubbleCalEventViewItem(*this, parent); + item->setMainText(m_Name); + item->setSubText(m_DateTime); + return item; +} + +const std::string &BubbleCalEventEntity::getFilePath() const +{ + return m_FilePath; +} diff --git a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp index 6de1fbf..e74b464 100644 --- a/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp +++ b/src/Conversation/ConvList/View/src/BubbleItemContainer.cpp @@ -41,6 +41,7 @@ BubbleItemContainer::~BubbleItemContainer() void BubbleItemContainer::append(Evas_Object *item) { + evas_object_size_hint_align_set(item, 0.0, EVAS_HINT_FILL); evas_object_smart_calculate(item); evas_object_show(item); elm_box_pack_end(getEo(), item); diff --git a/src/Conversation/ConvList/View/src/BubbleUnknownFileViewItem.cpp b/src/Conversation/ConvList/View/src/BubbleUnknownFileViewItem.cpp index e1abfe3..0d2971d 100644 --- a/src/Conversation/ConvList/View/src/BubbleUnknownFileViewItem.cpp +++ b/src/Conversation/ConvList/View/src/BubbleUnknownFileViewItem.cpp @@ -24,6 +24,7 @@ BubbleUnknownFileViewItem::BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_ : BubbleIconTextLayoutItem(entity, parent, Layout1Icon1Text) { attachGestureTapLayer(getEo(), getEo()); + setIcon(createIcon(getEo(), ATTACH_UNKNOWN_ICON)); } BubbleUnknownFileViewItem::~BubbleUnknownFileViewItem() -- 2.7.4