Fixed: contact attachment.
Change-Id: Id5a59aeca8d3db51c921369e98bd0f09185d0366
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
profile = mobile-3.0
# C Sources
-USER_SRCS = src/MainApp/MainApp.cpp src/Common/AppControl/src/ContactViewer.cpp src/Common/View/src/PopupManager.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Conversation/ConvList/View/src/BubbleAudioViewItem.cpp src/Common/View/src/ViewItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Common/MsgEngine/src/MsgThreadItem.cpp src/Conversation/Body/View/src/TextPageViewItem.cpp src/Viewer/View/src/SmilImageItemView.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Viewer/View/src/SubjectLayout.cpp src/Settings/Controller/src/SimListViewItem.cpp src/Conversation/ContactList/View/src/ContactListViewItem.cpp src/Viewer/Controller/src/SmilPage.cpp src/Common/View/src/SelectAllListItem.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Common/View/src/Box.cpp src/Conversation/ConvList/View/src/DateLineViewItem.cpp src/Conversation/ConvList/View/src/ConvListViewItem.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Viewer/View/src/ViewerLayout.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Conversation/ConvList/View/src/BubbleUnknownFileViewItem.cpp src/Common/AppControl/src/AppControlCompose.cpp src/MsgThread/Controller/src/ThreadSearchListItem.cpp src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp src/Common/Utils/src/HwButtonListener.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/Controller/src/MbeRecipients.cpp src/Common/View/src/ContextPopup.cpp src/MsgThread/Controller/src/MsgSearchListItem.cpp src/Conversation/Body/View/src/BodyView.cpp src/Common/View/src/NoContentLayout.cpp src/Conversation/Body/View/src/PageSeparator.cpp src/Conversation/Main/Controller/src/PopupRecipientListItem.cpp src/Settings/Controller/src/MsgOnSimCard.cpp src/Common/View/src/MbeRecipientsView.cpp src/Conversation/Body/Controller/src/Page.cpp src/Conversation/AppControl/src/LaunchSettings.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Viewer/View/src/SmilAttachmentItemView.cpp src/Viewer/View/src/PlayerControl.cpp src/MsgThread/Controller/src/MsgThread.cpp src/Conversation/Body/View/src/ImagePageViewItem.cpp src/Conversation/ConvList/Controller/src/ConvListItem.cpp src/Conversation/Main/View/src/ConversationLayout.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Conversation/Main/View/src/MessageInputPanel.cpp src/Conversation/ContactList/Controller/src/ConvContactList.cpp src/Viewer/Controller/src/Viewer.cpp src/Conversation/Body/View/src/MediaPageViewItem.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Settings/Controller/src/Settings.cpp src/Common/View/src/PopupList.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Common/View/src/ListView.cpp src/Conversation/Utils/src/WorkingDir.cpp src/Conversation/Body/View/src/SoundPageViewItem.cpp src/Conversation/Body/View/src/BodyAttachmentViewItem.cpp src/Conversation/AppControl/src/AttachPanel.cpp src/Conversation/Body/View/src/PageView.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Settings/View/src/SettingsGroupListViewItem.cpp src/Conversation/Utils/src/AttachmentHandler.cpp src/Common/AppControl/src/FileViewer.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/MsgThread/Controller/src/ThreadSearchList.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/Controller/src/SaveAttachmentsPopup.cpp src/Viewer/View/src/SmilAudioItemView.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Common/Utils/src/VCalendarParser.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Viewer/Controller/src/SmilPlayer.cpp src/Common/Controller/src/ViewItemController.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/MsgThread/Controller/src/BaseThreadListItem.cpp src/Conversation/Body/View/src/VideoPageViewItem.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Conversation/Body/Controller/src/PopupBodyAttachmentListItem.cpp src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/Conversation/ConvList/View/src/BubbleViewItem.cpp src/Viewer/View/src/SmilPageLayout.cpp src/Common/View/src/Scroller.cpp src/Common/Controller/src/FrameController.cpp src/Common/AppControl/src/AppControlUtils.cpp src/Common/Controller/src/NaviFrameController.cpp src/Common/View/src/DefaultLayout.cpp src/Conversation/ContactList/Controller/src/ContactListItem.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Common/Utils/src/FileUtils.cpp src/Common/Utils/src/LoggerImpl.cpp src/Conversation/ConvList/View/src/BubbleItemContainer.cpp src/Conversation/ConvList/Controller/src/DateLineItem.cpp src/Common/View/src/PopupListItem.cpp src/Common/View/src/View.cpp src/Common/Utils/src/TextDecorator.cpp src/MainApp/main.cpp src/Common/Utils/src/PathUtils.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/Conversation/Body/View/src/BodyViewItem.cpp src/Common/Controller/src/BaseController.cpp src/Common/Controller/src/App.cpp src/Viewer/View/src/SmilVideoItemView.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/AppControl/src/ContactEditor.cpp src/Conversation/ConvList/View/src/ConvListLayout.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/Utils/src/MediaUtils.cpp src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp src/Conversation/ConvList/View/src/ConvSelectAll.cpp src/Common/MsgEngine/src/Message.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Common/View/src/Popup.cpp src/Common/View/src/ListItem.cpp src/Viewer/Utils/src/MediaPlayer.cpp src/Common/Utils/src/TimeUtils.cpp src/Settings/View/src/SettingsListViewItem.cpp src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp src/Conversation/Body/Controller/src/Body.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Conversation/ContactList/View/src/ConvContactListView.cpp src/Conversation/AppControl/src/ContactPicker.cpp src/MsgThread/View/src/MsgThreadSearchPanel.cpp src/MsgThread/View/src/FloatingButton.cpp src/Settings/Controller/src/SettingsSound.cpp src/Settings/View/src/SimMsgLayout.cpp src/Common/AppControl/src/FileShare.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Viewer/View/src/SmilTextItemView.cpp src/Conversation/ConvList/View/src/BubbleCalEventViewItem.cpp src/Common/ContactManager/src/ContactManager.cpp src/Common/View/src/NaviFrameView.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Conversation/ConvList/Controller/src/ConvList.cpp src/Conversation/Body/View/src/PageViewItem.cpp src/Common/Controller/src/ViewController.cpp src/Conversation/Main/Controller/src/Conversation.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/ContactManager/src/ContactRecord.cpp src/MsgThread/View/src/MsgThreadLayout.cpp src/Common/View/src/NaviFrameItem.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Conversation/Utils/src/MessageDetailContent.cpp src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp src/Viewer/View/src/SmilPlayerView.cpp src/Common/ContactManager/src/ContactVCardParser.cpp
+USER_SRCS = src/MainApp/MainApp.cpp src/Common/AppControl/src/ContactViewer.cpp src/Common/View/src/PopupManager.cpp src/Common/MsgEngine/src/MsgPage.cpp src/Common/View/src/ViewItem.cpp src/Common/MsgEngine/src/private/MsgComposerPrivate.cpp src/Common/MsgEngine/src/MsgThreadItem.cpp src/Conversation/Body/View/src/TextPageViewItem.cpp src/Viewer/View/src/SmilImageItemView.cpp src/Common/MsgEngine/src/private/MsgAttachmentPrivate.cpp src/Viewer/View/src/SubjectLayout.cpp src/Settings/Controller/src/SimListViewItem.cpp src/Conversation/ContactList/View/src/ContactListViewItem.cpp src/Viewer/Controller/src/SmilPage.cpp src/Common/View/src/SelectAllListItem.cpp src/Common/AppControl/src/AppControlCommand.cpp src/Conversation/ConvList/View/src/BubbleTextViewItem.cpp src/Common/View/src/Box.cpp src/Conversation/ConvList/View/src/DateLineViewItem.cpp src/Conversation/ConvList/View/src/ConvListViewItem.cpp src/Common/MsgEngine/src/private/MessageSMSPrivate.cpp src/Viewer/View/src/ViewerLayout.cpp src/Common/MsgEngine/src/private/MessagePrivate.cpp src/Common/AppControl/src/AppControlCompose.cpp src/MsgThread/Controller/src/ThreadSearchListItem.cpp src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp src/Common/Utils/src/HwButtonListener.cpp src/Common/View/src/PopupAttachmentListItem.cpp src/Common/Controller/src/MbeRecipients.cpp src/Common/View/src/ContextPopup.cpp src/MsgThread/Controller/src/MsgSearchListItem.cpp src/Conversation/Body/View/src/BodyView.cpp src/Common/View/src/NoContentLayout.cpp src/Conversation/Body/View/src/PageSeparator.cpp src/Conversation/Main/Controller/src/PopupRecipientListItem.cpp src/Settings/Controller/src/MsgOnSimCard.cpp src/Common/View/src/MbeRecipientsView.cpp src/Conversation/Body/Controller/src/Page.cpp src/Conversation/AppControl/src/LaunchSettings.cpp src/Common/MsgEngine/src/MsgTransport.cpp src/Viewer/View/src/SmilAttachmentItemView.cpp src/Viewer/View/src/PlayerControl.cpp src/MsgThread/Controller/src/MsgThread.cpp src/Conversation/Body/View/src/ImagePageViewItem.cpp src/Conversation/ConvList/Controller/src/ConvListItem.cpp src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp src/Conversation/Main/View/src/ConversationLayout.cpp src/Common/View/src/StandardWindow.cpp src/Common/MsgEngine/src/private/MsgConversationItemPrivate.cpp src/Conversation/Main/View/src/MessageInputPanel.cpp src/Conversation/ContactList/Controller/src/ConvContactList.cpp src/Viewer/Controller/src/Viewer.cpp src/Conversation/Body/View/src/MediaPageViewItem.cpp src/Common/Utils/src/PhoneNumberUtils.cpp src/Settings/Controller/src/Settings.cpp src/Common/ContactManager/src/ContactVCardGenerator.cpp src/Common/View/src/PopupList.cpp src/Common/MsgEngine/src/private/MsgReportPrivate.cpp src/Common/View/src/ListView.cpp src/Conversation/Utils/src/WorkingDir.cpp src/Conversation/Body/View/src/SoundPageViewItem.cpp src/Conversation/Body/View/src/BodyAttachmentViewItem.cpp src/Conversation/AppControl/src/AttachPanel.cpp src/Conversation/Body/View/src/PageView.cpp src/Common/Utils/src/ThumbnailMaker.cpp src/Settings/View/src/SettingsGroupListViewItem.cpp src/Conversation/Utils/src/AttachmentHandler.cpp src/Common/AppControl/src/FileViewer.cpp src/Common/MsgEngine/src/private/MsgUtilsPrivate.cpp src/MsgThread/Controller/src/ThreadSearchList.cpp src/Common/MsgEngine/src/private/MsgPagePrivate.cpp src/Common/MsgEngine/src/private/MsgThreadItemPrivate.cpp src/Common/Controller/src/SaveAttachmentsPopup.cpp src/Viewer/View/src/SmilAudioItemView.cpp src/Common/AppControl/src/AppControlParser.cpp src/Common/MsgEngine/src/MsgSettings.cpp src/Common/MsgEngine/src/MsgUtils.cpp src/Viewer/Controller/src/SmilPlayer.cpp src/Conversation/ConvList/Controller/src/BubbleAudioEntity.cpp src/Common/Controller/src/ViewItemController.cpp src/MsgThread/Controller/src/ThreadList.cpp src/Conversation/ConvList/View/src/BubbleDownloadButtonViewItem.cpp src/Common/MsgEngine/src/MsgConversationItem.cpp src/MsgThread/Controller/src/BaseThreadListItem.cpp src/Conversation/Body/View/src/VideoPageViewItem.cpp src/Common/MsgEngine/src/MessageSMS.cpp src/Conversation/Body/Controller/src/PopupBodyAttachmentListItem.cpp src/Conversation/ConvList/View/src/BubbleIconTextLayoutItem.cpp src/MsgThread/Controller/src/ThreadListItem.cpp src/Common/MsgEngine/src/private/MsgAddressPrivate.cpp src/Conversation/ConvList/View/src/BubbleViewItem.cpp src/Viewer/View/src/SmilPageLayout.cpp src/Common/View/src/Scroller.cpp src/Common/Controller/src/FrameController.cpp src/Common/AppControl/src/AppControlUtils.cpp src/Common/Controller/src/NaviFrameController.cpp src/Common/View/src/DefaultLayout.cpp src/Conversation/ContactList/Controller/src/ContactListItem.cpp src/Common/MsgEngine/src/private/MsgSettingsPrivate.cpp src/Common/MsgEngine/src/MsgStorage.cpp src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp src/Common/Utils/src/FileUtils.cpp src/Common/Utils/src/LoggerImpl.cpp src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp src/Conversation/ConvList/View/src/BubbleItemContainer.cpp src/Common/Utils/src/VCalendarParser.cpp src/Conversation/ConvList/Controller/src/DateLineItem.cpp src/Common/View/src/PopupListItem.cpp src/Common/View/src/View.cpp src/Common/Utils/src/TextDecorator.cpp src/MainApp/main.cpp src/Common/Utils/src/PathUtils.cpp src/Common/ContactManager/src/ContactVCardParser.cpp src/Common/MsgEngine/src/private/MsgTransportPrivate.cpp src/Conversation/Body/View/src/BodyViewItem.cpp src/Common/Controller/src/BaseController.cpp src/Common/Controller/src/App.cpp src/Viewer/View/src/SmilVideoItemView.cpp src/MsgThread/View/src/ThreadListViewItem.cpp src/Common/AppControl/src/ContactEditor.cpp src/Conversation/ConvList/View/src/ConvListLayout.cpp src/Common/MsgEngine/src/private/MsgConvMediaPrivate.cpp src/Common/Utils/src/MediaUtils.cpp src/Conversation/Recipients/Controller/src/ConvRecipientsPanel.cpp src/Conversation/ConvList/View/src/ConvSelectAll.cpp src/Common/MsgEngine/src/Message.cpp src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp src/Common/View/src/Popup.cpp src/Common/View/src/ListItem.cpp src/Viewer/Utils/src/MediaPlayer.cpp src/Common/Utils/src/TimeUtils.cpp src/Settings/View/src/SettingsListViewItem.cpp src/Conversation/ConvList/View/src/BubbleImageViewItem.cpp src/Conversation/Body/Controller/src/Body.cpp src/Common/MsgEngine/src/MsgEngine.cpp src/Conversation/ContactList/View/src/ConvContactListView.cpp src/Conversation/AppControl/src/ContactPicker.cpp src/MsgThread/View/src/MsgThreadSearchPanel.cpp src/MsgThread/View/src/FloatingButton.cpp src/Settings/Controller/src/SettingsSound.cpp src/Settings/View/src/SimMsgLayout.cpp src/Common/AppControl/src/FileShare.cpp src/Common/MsgEngine/src/private/MsgMediaPrivate.cpp src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp src/Common/AppControl/src/AppControlDefault.cpp src/Viewer/View/src/SmilTextItemView.cpp src/Common/ContactManager/src/ContactManager.cpp src/Common/View/src/NaviFrameView.cpp src/Common/MsgEngine/src/private/MessageMmsPrivate.cpp src/Conversation/ConvList/Controller/src/ConvList.cpp src/Conversation/Body/View/src/PageViewItem.cpp src/Common/Controller/src/ViewController.cpp src/Conversation/Main/Controller/src/Conversation.cpp src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp src/Common/ContactManager/src/ContactRecord.cpp src/MsgThread/View/src/MsgThreadLayout.cpp src/Common/View/src/NaviFrameItem.cpp src/Common/AppControl/src/VoiceCall.cpp src/Common/MsgEngine/src/MessageMms.cpp src/Conversation/Utils/src/MessageDetailContent.cpp src/Conversation/ConvList/View/src/BubbleVideoViewItem.cpp src/Viewer/View/src/SmilPlayerView.cpp
USER_SRCS_ABS =
# EDC Sources
*@param[in] filePath Path to file
*@return list of Contacts
*/
- std::shared_ptr<ContactList<Contact>> parseVcard(const std::string &filePath);
+ std::list<ContactRef> parseVcard(const std::string &filePath);
private:
typedef std::unordered_map<std::string, ContactAddressRef> AddressMap;
using namespace Msg;
-std::shared_ptr<ContactList<Contact>> ContactManager::parseVcard(const std::string &filePath)
+std::list<ContactRef> ContactManager::parseVcard(const std::string &filePath)
{
- std::shared_ptr<ContactList<Contact>> res;
+ std::list<ContactRef> 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<ContactList<Contact>>(list);
+ int parseRes = contacts_vcard_parse_to_contact_foreach
+ (
+ filePath.c_str(),
+ [](contacts_record_h record, void *user_data)->bool
+ {
+ contacts_record_h recordClone = {};
+ contacts_record_clone(record, &recordClone);
+ auto *list = (std::list<ContactRef>*)user_data;
+ auto recRef = std::make_shared<Contact>(true, recordClone);
+ list->emplace_back(recRef);
+ return true;
+ },
+ &res
+ );
MSG_LOG("Parse result: ", parseRes);
-
return res;
}
ThumbId getThumbId(const MsgAddress &address);
ThumbId getThumbId(const std::string &address);
ThumbId getThumbId(DefaultThumbs thumb);
- Evas_Object *getThumbById(Evas_Object *parent, ThumbId id, int thumbSize);
+ Evas_Object *getThumb(Evas_Object *parent, ThumbId id, int thumbSize);
+ Evas_Object *getThumb(Evas_Object *parent, const std::string &path, int thumbSize);
private:
typedef std::unordered_map<std::string, ThumbId> ContactsMap;
}
}
-Evas_Object *ThumbnailMaker::getThumbById(Evas_Object *parent, ThumbId id, int thumbSize)
+Evas_Object *ThumbnailMaker::getThumb(Evas_Object *parent, ThumbId id, int thumbSize)
{
auto it = m_OriginsMap.find(id);
if(it == m_OriginsMap.end())
return ic;
}
+Evas_Object *ThumbnailMaker::getThumb(Evas_Object *parent, const std::string &path, int thumbSize)
+{
+ Evas_Object *ic = elm_layout_add(parent);
+ std::string edjePath = PathUtils::getResourcePath(THUMBNAIL_EDJ_PATH);
+ elm_layout_file_set(ic, edjePath.c_str(), MSG_THUMB_STYLE_LIST);
+
+ Evas_Object *img = makeFace(ic, path);
+ elm_object_part_content_set(ic, "content", img);
+ int scaledThumbSize = ELM_SCALE_SIZE(thumbSize);
+ evas_object_resize(ic, scaledThumbSize, scaledThumbSize);
+ evas_object_show(ic);
+ return ic;
+}
+
Evas_Object *ThumbnailMaker::makeOriginThumb(Evas_Object *parent, const std::string &path)
{
Evas_Object *ic = elm_layout_add(parent);
Evas_Object *ContactListItem::getThumbnail() const
{
static const int thumbSize = 80;
- return m_App.getThumbnailMaker().getThumbById(*getOwner(), m_ThumbId, thumbSize);
+ return m_App.getThumbnailMaker().getThumb(*getOwner(), m_ThumbId, thumbSize);
}
--- /dev/null
+/*
+ * 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 BubbleAudioEntity_h_
+#define BubbleAudioEntity_h_
+
+#include "BubbleAudioViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleAudioEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleAudioEntity(const MsgConvMedia &media);
+ virtual ~BubbleAudioEntity();
+
+ virtual BubbleAudioViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ const std::string m_FilePath;
+ const std::string m_FileName;
+ const std::string m_Duration;
+ };
+}
+
+#endif /* BubbleAudioEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleCalEventEntity_h_
+#define BubbleCalEventEntity_h_
+
+#include "BubbleCalEventViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleCalEventEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleCalEventEntity(const MsgConvMedia &convMedia);
+ virtual ~BubbleCalEventEntity();
+
+ virtual BubbleCalEventViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ std::string m_FilePath;
+ std::string m_Name;
+ std::string m_DateTime;
+ };
+}
+
+#endif /* BubbleCalEventEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleContactEntity_h_
+#define BubbleContactEntity_h_
+
+#include "BubbleContactViewItem.h"
+#include "BubbleEntity.h"
+#include "App.h"
+#include "Contact.h"
+
+namespace Msg
+{
+ class BubbleContactEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleContactEntity(App &app, const MsgConvMedia &media);
+ virtual ~BubbleContactEntity();
+
+ virtual BubbleContactViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ ThumbnailMaker &m_ThumbMaker;
+ std::string m_FilePath;
+ std::string m_Name;
+ std::string m_Address;
+ std::string m_ThumbPath;
+ ContactRef m_Contact; // Thumbnail file holder
+ };
+}
+
+#endif /* BubbleContactEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleDownloadButtonEntity_h_
+#define BubbleDownloadButtonEntity_h_
+
+#include "BubbleDownloadButtonViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleDownloadButtonEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleDownloadButtonEntity();
+ virtual ~BubbleDownloadButtonEntity();
+
+ virtual BubbleDownloadButtonViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+ };
+
+ inline BubbleDownloadButtonEntity::BubbleDownloadButtonEntity()
+ : BubbleEntity(DownloadButtonItem)
+ {
+ }
+
+ inline BubbleDownloadButtonEntity::~BubbleDownloadButtonEntity()
+ {
+ }
+
+ inline BubbleDownloadButtonViewItem *BubbleDownloadButtonEntity::createView(Evas_Object *parent)
+ {
+ auto *item = new BubbleDownloadButtonViewItem(*this, parent);
+ return item;
+ }
+
+ inline std::string BubbleDownloadButtonEntity::getFilePath() const
+ {
+ return {};
+ }
+}
+
+#endif /* BubbleDownloadButtonEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleEntity_h_
+#define BubbleEntity_h_
+
+#include "View.h"
+#include "BubbleViewItem.h"
+#include "MsgConvMedia.h"
+#include "FileUtils.h"
+
+#include <string>
+
+namespace Msg
+{
+ class BubbleEntity
+ {
+ public:
+ enum Type
+ {
+ TextItem,
+ ImageItem,
+ AudioItem,
+ VideoItem,
+ ContactItem,
+ CalendarEventItem,
+ UnknownFileItem,
+ DownloadButtonItem
+ };
+
+ public:
+ BubbleEntity(Type type);
+ virtual ~BubbleEntity();
+
+ Type getType() const;
+ virtual std::string getFilePath() const = 0;
+ virtual BubbleViewItem *createView(Evas_Object *parent) = 0;
+
+ static std::string getFileName(const MsgConvMedia &media);
+
+ private:
+ Type m_Type;
+ };
+
+ inline BubbleEntity::BubbleEntity(Type type)
+ : m_Type(type)
+ {
+ }
+
+ inline BubbleEntity::~BubbleEntity()
+ {
+ }
+
+ inline BubbleEntity::Type BubbleEntity::getType() const
+ {
+ return m_Type;
+ }
+
+ inline std::string BubbleEntity::getFileName(const MsgConvMedia &media)
+ {
+ std::string res = media.getName();
+ if(res.empty())
+ res = FileUtils::getFileName(media.getPath());
+ return res;
+ }
+}
+
+#endif /* BubbleEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleImageEntity_h_
+#define BubbleImageEntity_h_
+
+#include "BubbleImageViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleImageEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleImageEntity(const MsgConvMedia &media);
+ virtual ~BubbleImageEntity();
+
+ virtual BubbleImageViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ const std::string m_ImgPath;
+ };
+
+ inline BubbleImageEntity::BubbleImageEntity(const MsgConvMedia &media)
+ : BubbleEntity(ImageItem)
+ , m_ImgPath(media.getPath())
+ {
+ }
+
+ inline BubbleImageEntity::~BubbleImageEntity()
+ {
+ }
+
+ inline BubbleImageViewItem *BubbleImageEntity::createView(Evas_Object *parent)
+ {
+ auto *item = new BubbleImageViewItem(*this, parent, m_ImgPath);
+ return item;
+ }
+
+ inline std::string BubbleImageEntity::getFilePath() const
+ {
+ return m_ImgPath;
+ }
+
+}
+
+#endif /* BubbleImageEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleTextEntity_h_
+#define BubbleTextEntity_h_
+
+#include "BubbleTextViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleTextEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleTextEntity(const std::string &text);
+ virtual ~BubbleTextEntity();
+
+ virtual std::string getFilePath() const;
+ virtual BubbleTextViewItem *createView(Evas_Object *parent);
+
+ private:
+ std::string m_Text;
+ };
+
+ inline BubbleTextEntity::BubbleTextEntity(const std::string &text)
+ : BubbleEntity(ImageItem)
+ , m_Text(text)
+ {
+ }
+
+ inline BubbleTextEntity::~BubbleTextEntity()
+ {
+ }
+
+ inline std::string BubbleTextEntity::getFilePath() const
+ {
+ static std::string empty;
+ return empty;
+ }
+
+ inline BubbleTextViewItem *BubbleTextEntity::createView(Evas_Object *parent)
+ {
+ auto *item = new BubbleTextViewItem(*this ,parent, m_Text);
+ return item;
+ }
+}
+
+#endif /* BubbleTextEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleUnknownFileEntity_h_
+#define BubbleUnknownFileEntity_h_
+
+#include "BubbleUnknownFileViewItem.h"
+#include "BubbleEntity.h"
+
+namespace Msg
+{
+ class BubbleUnknownFileEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleUnknownFileEntity(const MsgConvMedia &convMedia);
+ virtual ~BubbleUnknownFileEntity();
+
+ virtual BubbleUnknownFileViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ const std::string m_FilePath;
+ const std::string m_FileName;
+ };
+}
+
+#endif /* BubbleUnknownFileEntity_h_ */
--- /dev/null
+/*
+ * 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 BubbleVideoEntity_h_
+#define BubbleVideoEntity_h_
+
+#include "BubbleVideoViewItem.h"
+#include "BubbleEntity.h"
+#include "WorkingDir.h"
+
+namespace Msg
+{
+ class BubbleVideoEntity
+ : public BubbleEntity
+ {
+ public:
+ BubbleVideoEntity(WorkingDir &workingDir, const MsgConvMedia &media);
+ virtual ~BubbleVideoEntity();
+
+ virtual BubbleVideoViewItem *createView(Evas_Object *parent);
+ virtual std::string getFilePath() const;
+
+ private:
+ std::string m_VideoPath;
+ std::string m_ImgPath;
+ };
+}
+
+#endif /* BubbleVideoEntity_h_ */
#include "MsgUtils.h"
#include "WorkingDir.h"
#include "BubbleViewItem.h"
+#include "BubbleEntity.h"
namespace Msg
{
private:
ConvListViewItem::ConvItemType getConvItemType(const MsgConversationItem &item);
void prepareBubble(const MsgConversationItem &item, const std::string &searchWord);
- void addVideoItem(const MsgConvMedia &media);
- void addAudioItem(const MsgConvMedia &media);
- void addDownloadButtonItem();
- void addTextItem(const MsgConvMedia &media, const std::string &searchWord);
- void addTextItem(std::string text, bool markup, const std::string &searchWord);
- void addImageItem(const MsgConvMedia &media);
- void addUnknownFileItem(const MsgConvMedia &media);
- void addCalendarItem(const MsgConvMedia &media);
- void addContactItem(const MsgConvMedia &media);
+ BubbleEntity *createVideoEntity(const MsgConvMedia &media);
+ BubbleEntity *createAudioEntity(const MsgConvMedia &media);
+ BubbleEntity *createDownloadButtonEntity();
+ BubbleEntity *createTextEntity(const MsgConvMedia &media, const std::string &searchWord);
+ BubbleEntity *createTextEntity(std::string text, bool markup, const std::string &searchWord);
+ BubbleEntity *createImageEntity(const MsgConvMedia &media);
+ BubbleEntity *createUnknownFileEntity(const MsgConvMedia &media);
+ BubbleEntity *createCalendarEntity(const MsgConvMedia &media);
+ BubbleEntity *createContactEntity(const MsgConvMedia &media);
+ void addEntity(BubbleEntity *entity);
// Create Popup when message is clicked
void showMainListPopup();
*
*/
-#include "BubbleAudioViewItem.h"
+#include "BubbleAudioEntity.h"
+#include "MediaUtils.h"
#include "Resource.h"
-using namespace Msg;
+#include <sstream>
+#include <iomanip>
-BubbleAudioViewItem::BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *parent)
- : BubbleIconTextLayoutItem(entity, parent, Layout1Icon2Text)
-{
- attachGestureTapLayer(getEo(), getEo());
- setIcon(createIcon(getEo(), ATTACH_MUSIC_ICON));
-}
+using namespace Msg;
-BubbleAudioViewItem::~BubbleAudioViewItem()
+std::string makeDurationStr(const std::string &filePath)
{
+ int duration = MediaUtils::getDurationSec(filePath);
+ std::stringstream ss;
+ int h = duration / 60;
+ int m = duration % 60;
+ ss << std::setfill('0') << std::setw(2) << h << ':'
+ << std::setfill('0') << std::setw(2) << m;
+ return ss.str();
}
-
-BubbleAudioEntity::BubbleAudioEntity(const std::string &filePath, const std::string &fileName, const std::string &duration)
+BubbleAudioEntity::BubbleAudioEntity(const MsgConvMedia &media)
: BubbleEntity(AudioItem)
- , m_FilePath(filePath)
- , m_FileName(fileName)
- , m_Duration(duration)
+ , m_FilePath(media.getPath())
+ , m_FileName(getFileName(media))
+ , m_Duration(makeDurationStr(media.getPath()))
{
-
}
BubbleAudioEntity::~BubbleAudioEntity()
{
-
}
BubbleAudioViewItem *BubbleAudioEntity::createView(Evas_Object *parent)
return item;
}
-const std::string &BubbleAudioEntity::getFilePath() const
+std::string BubbleAudioEntity::getFilePath() const
{
return m_FilePath;
}
*
*/
-#include "BubbleCalEventViewItem.h"
+#include "BubbleCalEventEntity.h"
+#include "VCalendarParser.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)
+BubbleCalEventEntity::BubbleCalEventEntity(const MsgConvMedia &convMedia)
: BubbleEntity(CalendarEventItem)
- , m_FilePath(filePath)
- , m_Name(name)
- , m_DateTime(dateTime)
-
+ , m_FilePath(convMedia.getPath())
{
+ auto list = VCalendarParser::getInst().parse(convMedia.getPath());
+ if(list.size() == 1)
+ {
+ const CalendarEvent &event = list.front();
+ m_Name = event.getSummary();
+ m_DateTime = event.getStartDate();
+ }
+ else
+ {
+ m_Name = getFileName(convMedia);
+ }
}
BubbleCalEventEntity::~BubbleCalEventEntity()
BubbleCalEventViewItem *BubbleCalEventEntity::createView(Evas_Object *parent)
{
- auto *item = new BubbleCalEventViewItem(*this, parent);
+ BubbleCalEventViewItem::LayoutType type = m_DateTime.empty() ? BubbleCalEventViewItem::Layout1Icon1Text :
+ BubbleCalEventViewItem::Layout1Icon2Text;
+ auto *item = new BubbleCalEventViewItem(*this, parent, type);
item->setMainText(m_Name);
- item->setSubText(m_DateTime);
+ if(!m_DateTime.empty())
+ item->setSubText(m_DateTime);
return item;
}
-const std::string &BubbleCalEventEntity::getFilePath() const
+std::string BubbleCalEventEntity::getFilePath() const
{
return m_FilePath;
}
--- /dev/null
+/*
+ * 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 "BubbleContactEntity.h"
+#include "ContactManager.h"
+#include "Contact.h"
+#include "Resource.h"
+#include "FileUtils.h"
+
+using namespace Msg;
+
+
+BubbleContactEntity::BubbleContactEntity(App &app, const MsgConvMedia &media)
+ : BubbleEntity(ContactItem)
+ , m_ThumbMaker(app.getThumbnailMaker())
+ , m_FilePath(media.getPath())
+{
+ auto list = app.getContactManager().parseVcard(m_FilePath);
+ if(!list.empty())
+ {
+ if(list.size() == 1)
+ {
+ m_Contact = list.front();
+ if(m_Contact)
+ {
+ m_Name = m_Contact->getDispName();
+ m_Address = m_Contact->getAddress();
+ m_ThumbPath = m_Contact->getThumb();
+ }
+ }
+ }
+ if(!m_Contact)
+ m_Name = getFileName(media);
+}
+
+BubbleContactEntity::~BubbleContactEntity()
+{
+}
+
+BubbleContactViewItem *BubbleContactEntity::createView(Evas_Object *parent)
+{
+ BubbleContactViewItem::LayoutType type = m_Address.empty() ? BubbleContactViewItem::Layout1Icon1Text :
+ BubbleContactViewItem::Layout1Icon2Text;
+ auto *item = new BubbleContactViewItem(*this, parent, type);
+ item->setMainText(m_Name);
+
+ Evas_Object *thumb = nullptr;
+ if(m_ThumbPath.empty())
+ {
+ ThumbId id = m_ThumbMaker.getThumbId(ThumbnailMaker::SingleThumb);
+ thumb = m_ThumbMaker.getThumb(*item, id, BubbleContactViewItem::iconSize);
+ }
+ else
+ {
+ thumb = m_ThumbMaker.getThumb(*item, m_ThumbPath, BubbleContactViewItem::iconSize);
+ }
+
+ if(thumb)
+ item->setIcon(thumb);
+ if(!m_Address.empty())
+ item->setSubText(m_Address);
+ return item;
+}
+
+std::string BubbleContactEntity::getFilePath() const
+{
+ return m_FilePath;
+}
*
*/
-#include "BubbleUnknownFileViewItem.h"
+#include "BubbleUnknownFileEntity.h"
#include "Resource.h"
-using namespace Msg;
-
-BubbleUnknownFileViewItem::BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_Object *parent)
- : BubbleIconTextLayoutItem(entity, parent, Layout1Icon1Text)
-{
- attachGestureTapLayer(getEo(), getEo());
- setIcon(createIcon(getEo(), ATTACH_UNKNOWN_ICON));
-}
+#include "Logger.h"
-BubbleUnknownFileViewItem::~BubbleUnknownFileViewItem()
-{
-}
+using namespace Msg;
-BubbleUnknownFileEntity::BubbleUnknownFileEntity(const std::string &filePath, const std::string &fileName)
+BubbleUnknownFileEntity::BubbleUnknownFileEntity(const MsgConvMedia &convMedia)
: BubbleEntity(UnknownFileItem)
- , m_FilePath(filePath)
- , m_FileName(fileName)
+ , m_FilePath(convMedia.getPath())
+ , m_FileName(getFileName(convMedia))
{
}
BubbleUnknownFileEntity::~BubbleUnknownFileEntity()
{
-
}
BubbleUnknownFileViewItem *BubbleUnknownFileEntity::createView(Evas_Object *parent)
return item;
}
-const std::string &BubbleUnknownFileEntity::getFilePath() const
+std::string BubbleUnknownFileEntity::getFilePath() const
{
return m_FilePath;
}
--- /dev/null
+/*
+ * 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 "BubbleVideoEntity.h"
+#include "MediaUtils.h"
+
+using namespace Msg;
+
+BubbleVideoEntity::BubbleVideoEntity(WorkingDir &workingDir, const MsgConvMedia &media)
+ : BubbleEntity(VideoItem)
+ , m_VideoPath(media.getPath())
+{
+ static const std::string thumbFileName = "thumbnail.jpeg";
+ m_ImgPath = workingDir.genUniqueFilePath(thumbFileName);
+ if(!m_ImgPath.empty())
+ MediaUtils::getVideoFrame(m_VideoPath, m_ImgPath);
+}
+
+BubbleVideoEntity::~BubbleVideoEntity()
+{
+}
+
+BubbleVideoViewItem *BubbleVideoEntity::createView(Evas_Object *parent)
+{
+ auto *item = new BubbleVideoViewItem(*this, parent, m_ImgPath);
+ return item;
+}
+
+std::string BubbleVideoEntity::getFilePath() const
+{
+ return m_VideoPath;
+}
+
#include "CallbackAssist.h"
#include "FileUtils.h"
#include "TimeUtils.h"
-#include "VCalendarParser.h"
#include "SaveAttachmentsPopup.h"
#include "TextDecorator.h"
#include "MediaType.h"
#include "MediaUtils.h"
-#include "TimeUtils.h"
#include "FileViewer.h"
#include "BubbleItemContainer.h"
-#include "ContactManager.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 "BubbleContactViewItem.h"
+#include "BubbleTextEntity.h"
+#include "BubbleImageEntity.h"
+#include "BubbleVideoEntity.h"
+#include "BubbleAudioEntity.h"
+#include "BubbleDownloadButtonEntity.h"
+#include "BubbleUnknownFileEntity.h"
+#include "BubbleCalEventEntity.h"
+#include "BubbleContactEntity.h"
#include <notification_status.h>
-#include <sstream>
-#include <iomanip>
#include <algorithm>
using namespace Msg;
size_t size = s.find(sw);
return size != std::string::npos;
}
-
- std::string makeDurationStr(const std::string &filePath)
- {
- int duration = MediaUtils::getDurationSec(filePath);
- std::stringstream ss;
- int h = duration / 60;
- int m = duration % 60;
- ss << std::setfill('0') << std::setw(2) << h << ':'
- << std::setfill('0') << std::setw(2) << m;
- return ss.str();
- }
-
- std::string getFileName(const MsgConvMedia &media)
- {
- std::string res = media.getName();
- if(res.empty())
- res = FileUtils::getFileName(media.getPath());
- return res;
- }
}
ConvListItem::ConvListItem(const MsgConversationItem &item,
return type;
}
-void ConvListItem::addVideoItem(const MsgConvMedia &media)
+BubbleEntity *ConvListItem::createVideoEntity(const MsgConvMedia &media)
{
- const std::string thumbFileName = "thumbnail.jpeg";
- std::string thumbFilePath = m_WorkingDir->genUniqueFilePath(thumbFileName);
-
- if(!thumbFilePath.empty())
- {
- std::string path = media.getPath();
- if(MediaUtils::getVideoFrame(path, thumbFilePath))
- {
- auto *entity = new BubbleVideoEntity(path, thumbFilePath);
- m_BubbleEntityList.push_back(entity);
- }
- }
+ return new BubbleVideoEntity(*m_WorkingDir, media);
}
-void ConvListItem::addAudioItem(const MsgConvMedia &media)
+BubbleEntity * ConvListItem::createAudioEntity(const MsgConvMedia &media)
{
- std::string path = media.getPath();
- if(path.empty())
- return;
-
- std::string dsipName = media.getName();
- if(dsipName.empty())
- dsipName = FileUtils::getFileName(path);
-
- auto *entity = new BubbleAudioEntity(path, dsipName, makeDurationStr(path));
- m_BubbleEntityList.push_back(entity);
+ return new BubbleAudioEntity(media);
}
-void ConvListItem::addUnknownFileItem(const MsgConvMedia &media)
+BubbleEntity *ConvListItem::createUnknownFileEntity(const MsgConvMedia &media)
{
- std::string dsipName = getFileName(media);
- auto *entity = new BubbleUnknownFileEntity(media.getPath(), dsipName);
- m_BubbleEntityList.push_back(entity);
+ return new BubbleUnknownFileEntity(media);
}
-void ConvListItem::addCalendarItem(const MsgConvMedia &media)
+BubbleEntity *ConvListItem::createCalendarEntity(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);
- }
+ return new BubbleCalEventEntity(media);
}
-void ConvListItem::addContactItem(const MsgConvMedia &media)
+BubbleEntity *ConvListItem::createContactEntity(const MsgConvMedia &media)
{
- auto list = m_App.getContactManager().parseVcard(media.getPath());
- if(list && !list->isEmpty())
- {
- BubbleContactEntity *entity = nullptr;
-
- if(list->getCount() > 1)
- {
- std::string fileName = getFileName(media);
- entity = new BubbleContactEntity(m_App.getThumbnailMaker(), media.getPath(), fileName);
- }
- else
- {
- const Contact &rec = list->get();
- entity = new BubbleContactEntity(m_App.getThumbnailMaker(), media.getPath(), rec.getDispName(), rec.getAddress());
- }
- if(entity)
- m_BubbleEntityList.push_back(entity);
- }
+ return new BubbleContactEntity(m_App, media);
}
-void ConvListItem::addDownloadButtonItem()
+BubbleEntity *ConvListItem::createDownloadButtonEntity()
{
- auto *entity = new BubbleDownloadButtonEntity;
- m_BubbleEntityList.push_back(entity);
+ return new BubbleDownloadButtonEntity;
}
-void ConvListItem::addTextItem(const MsgConvMedia &media, const std::string &searchWord)
+BubbleEntity *ConvListItem::createTextEntity(const MsgConvMedia &media, const std::string &searchWord)
{
std::string text = FileUtils::readTextFile(media.getPath());
if(findText(text, searchWord))
showSearch();
- auto *entity = new BubbleTextEntity(utf8ToMarkup(text));
- m_BubbleEntityList.push_back(entity);
+ return new BubbleTextEntity(utf8ToMarkup(text));
}
-void ConvListItem::addTextItem(std::string text, bool markup, const std::string &searchWord)
+BubbleEntity *ConvListItem::createTextEntity(std::string text, bool markup, const std::string &searchWord)
{
if(findText(text, searchWord))
showSearch();
std::string resText = markup ? utf8ToMarkup(text) : std::move(text);
- auto *entity = new BubbleTextEntity(resText);
- m_BubbleEntityList.push_back(entity);
+ return new BubbleTextEntity(resText);
}
-void ConvListItem::addImageItem(const MsgConvMedia &media)
+BubbleEntity *ConvListItem::createImageEntity(const MsgConvMedia &media)
{
// TODO: msg service corrupts thumbnail's metadata, so it lost rotation. Use getPath instead getThumbPath until fix
- auto *entity = new BubbleImageEntity(media.getPath());
- m_BubbleEntityList.push_back(entity);
+ return new BubbleImageEntity(media);
+}
+
+void ConvListItem::addEntity(BubbleEntity *entity)
+{
+ if(entity)
+ m_BubbleEntityList.push_back(entity);
}
void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::string &searchWord)
{
if(!MsgUtils::isMms(m_Type))
{
- addTextItem(item.getText(), true, searchWord);
+ addEntity(createTextEntity(item.getText(), true, searchWord));
}
else if(m_Type == Message::MT_MMS_Noti)
{
std::string text = MessageDetailContent::getMmsNotiConvListItemContent(m_App, m_MsgId);
- addTextItem(text, false, searchWord);
- addDownloadButtonItem();
+ addEntity(createTextEntity(text, false, searchWord));
+ addEntity(createDownloadButtonEntity());
}
else
{
std::string mime = media.getMime();
MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
+ BubbleEntity *entity = nullptr;
switch(msgMediaType)
{
case MsgMedia::TextType:
- addTextItem(media, searchWord);
+ entity = createTextEntity(media, searchWord);
break;
case MsgMedia::ImageType:
- addImageItem(media);
+ entity = createImageEntity(media);
break;
case MsgMedia::AudioType:
- addAudioItem(media);
+ entity = createAudioEntity(media);
break;
case MsgMedia::VideoType:
- addVideoItem(media);
+ entity = createVideoEntity(media);
break;
default:
if(mime == "text/x-vcalendar" || mime == "text/calendar")
- addCalendarItem(media);
- if(mime == "text/x-vcard" || mime == "text/vcard")
- addContactItem(media);
+ entity = createCalendarEntity(media);
+ else if(mime == "text/x-vcard" || mime == "text/vcard")
+ entity = createContactEntity(media);
else if(mime != "application/smil")
- addUnknownFileItem(media);
+ entity = createUnknownFileEntity(media);
break;
}
+ addEntity(entity);
}
}
}
Evas_Object *ConvListItem::getThumbnail()
{
static const int thumbSize = 80;
- return m_App.getThumbnailMaker().getThumbById(*getOwner(), m_ThumbId, thumbSize);
+ return m_App.getThumbnailMaker().getThumb(*getOwner(), m_ThumbId, thumbSize);
}
Evas_Object *ConvListItem::getProgress()
void ConvListItem::showPopup()
{
- if(m_IsDraft)
- showDraftListPopup();
- else
- showMainListPopup();
+ m_IsDraft ? showDraftListPopup() : showMainListPopup();
}
void ConvListItem::showMainListPopup()
#define BubbleAudioViewItem_h_
#include "BubbleIconTextLayoutItem.h"
+#include "Resource.h"
namespace Msg
{
virtual ~BubbleAudioViewItem();
};
- class BubbleAudioEntity
- : public BubbleEntity
+ inline BubbleAudioViewItem::BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *parent)
+ : BubbleIconTextLayoutItem(entity, parent, Layout1Icon2Text)
{
- public:
- BubbleAudioEntity(const std::string &filePath, const std::string &fileName, const std::string &duration);
- virtual ~BubbleAudioEntity();
-
- virtual BubbleAudioViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
+ attachGestureTapLayer(getEo(), getEo());
+ setIcon(createIcon(getEo(), ATTACH_MUSIC_ICON));
+ }
- private:
- const std::string m_FilePath;
- const std::string m_FileName;
- const std::string m_Duration;
- };
+ inline BubbleAudioViewItem::~BubbleAudioViewItem()
+ {
+ }
}
#endif /* BubbleAudioViewItem_h_ */
#define BubbleCalEventViewItem_h_
#include "BubbleIconTextLayoutItem.h"
+#include "Resource.h"
namespace Msg
{
: public BubbleIconTextLayoutItem
{
public:
- BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent);
+ BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent, LayoutType layoutType);
virtual ~BubbleCalEventViewItem();
};
- class BubbleCalEventEntity
- : public BubbleEntity
+ inline BubbleCalEventViewItem::BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent, LayoutType layoutType)
+ : BubbleIconTextLayoutItem(entity, parent, layoutType)
{
- 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;
+ attachGestureTapLayer(getEo(), getEo());
+ setIcon(createIcon(getEo(), ATTACH_CAL_ICON));
+ }
- private:
- const std::string m_FilePath;
- const std::string m_Name;
- const std::string m_DateTime;
- };
+ inline BubbleCalEventViewItem::~BubbleCalEventViewItem()
+ {
+ }
}
#endif /* BubbleCalEventViewItem_h_ */
#define BubbleContactViewItem_h_
#include "BubbleIconTextLayoutItem.h"
-#include "ThumbnailMaker.h"
+#include "Resource.h"
namespace Msg
{
virtual ~BubbleContactViewItem();
};
- class BubbleContactEntity
- : public BubbleEntity
+ inline BubbleContactViewItem::BubbleContactViewItem(BubbleEntity &entity, Evas_Object *parent, LayoutType type)
+ : BubbleIconTextLayoutItem(entity, parent, type)
{
- public:
- BubbleContactEntity(ThumbnailMaker &thumbMaker, const std::string &filePath, const std::string &fileName);
- BubbleContactEntity(ThumbnailMaker &thumbMaker, const std::string &filePath, const std::string &dispName, const std::string &address);
- virtual ~BubbleContactEntity();
-
- void setThumbId(ThumbId id);
- virtual BubbleContactViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
+ attachGestureTapLayer(getEo(), getEo());
+ }
- private:
- ThumbnailMaker &m_ThumbMaker;
- const std::string m_FilePath;
- const std::string m_Name;
- const std::string m_Address;
- ThumbId m_ThumbId;
- };
+ inline BubbleContactViewItem::~BubbleContactViewItem()
+ {
+ }
}
#endif /* BubbleContactViewItem_h_ */
private:
void onPressed(Evas_Object *obj, void *eventInfo);
};
-
- class BubbleDownloadButtonEntity
- : public BubbleEntity
- {
- public:
- BubbleDownloadButtonEntity();
- virtual ~BubbleDownloadButtonEntity();
-
- virtual BubbleDownloadButtonViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
- };
}
#endif /* BubbleDownloadButtonViewItem_h_ */
private:
Evas_Object *createImage(Evas_Object *parent, const std::string &path);
};
-
- class BubbleImageEntity
- : public BubbleEntity
- {
- public:
- BubbleImageEntity(const std::string &imgPath);
- virtual ~BubbleImageEntity();
-
- virtual BubbleImageViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
-
- private:
- const std::string m_ImgPath;
- };
}
#endif /* BubbleImageViewItem_h_ */
private:
Evas_Object *createText(Evas_Object *parent, const std::string &text);
};
-
- class BubbleTextEntity
- : public BubbleEntity
- {
- public:
- BubbleTextEntity(const std::string &text);
- virtual ~BubbleTextEntity();
-
- virtual const std::string &getFilePath() const;
- virtual BubbleTextViewItem *createView(Evas_Object *parent);
-
- private:
- std::string m_Text;
- };
}
#endif /* BubbleTextViewItem_h_ */
#define BubbleUnknownFileViewItem_h_
#include "BubbleIconTextLayoutItem.h"
+#include "Resource.h"
namespace Msg
{
virtual ~BubbleUnknownFileViewItem();
};
- class BubbleUnknownFileEntity
- : public BubbleEntity
+ inline BubbleUnknownFileViewItem::BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_Object *parent)
+ : BubbleIconTextLayoutItem(entity, parent, Layout1Icon1Text)
{
- public:
- BubbleUnknownFileEntity(const std::string &filePath, const std::string &fileName);
- virtual ~BubbleUnknownFileEntity();
-
- virtual BubbleUnknownFileViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
+ attachGestureTapLayer(getEo(), getEo());
+ setIcon(createIcon(getEo(), ATTACH_UNKNOWN_ICON));
+ }
- private:
- const std::string m_FilePath;
- const std::string m_FileName;
- };
+ inline BubbleUnknownFileViewItem::~BubbleUnknownFileViewItem()
+ {
+ }
}
#endif /* BubbleUnknownFileViewItem_h_ */
private:
Evas_Object *createImage(Evas_Object *parent, const std::string &path);
};
-
- class BubbleVideoEntity
- : public BubbleEntity
- {
- public:
- BubbleVideoEntity(const std::string &videoPath, const std::string &imgPath);
- virtual ~BubbleVideoEntity();
-
- virtual BubbleVideoViewItem *createView(Evas_Object *parent);
- virtual const std::string &getFilePath() const;
-
- private:
- const std::string m_VideoPath;
- const std::string m_ImgPath;
- };
}
#endif /* BubbleVideoViewItem_h_ */
#define BubbleViewItem_h_
#include "View.h"
-#include "MsgTypes.h"
-
#include <string>
namespace Msg
IBubbleViewItemListener *m_pListener;
};
- class BubbleEntity
- {
- public:
- enum Type
- {
- TextItem,
- ImageItem,
- AudioItem,
- VideoItem,
- ContactItem,
- CalendarEventItem,
- UnknownFileItem,
- DownloadButtonItem
- };
-
- public:
- BubbleEntity(Type type);
- virtual ~BubbleEntity();
-
- Type getType() const;
- virtual const std::string &getFilePath() const = 0;
- virtual BubbleViewItem *createView(Evas_Object *parent) = 0;
-
- private:
- Type m_Type;
- };
-
class IBubbleViewItemListener
{
public:
+++ /dev/null
-/*
- * 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 "BubbleContactViewItem.h"
-#include "Resource.h"
-
-using namespace Msg;
-
-BubbleContactViewItem::BubbleContactViewItem(BubbleEntity &entity, Evas_Object *parent, LayoutType type)
- : BubbleIconTextLayoutItem(entity, parent, type)
-{
- attachGestureTapLayer(getEo(), getEo());
-}
-
-BubbleContactViewItem::~BubbleContactViewItem()
-{
-}
-
-BubbleContactEntity::BubbleContactEntity(ThumbnailMaker &thumbMaker, const std::string &filePath, const std::string &fileName)
- : BubbleContactEntity(thumbMaker, filePath, fileName, {})
-{
-
-}
-
-BubbleContactEntity::BubbleContactEntity(ThumbnailMaker &thumbMaker, const std::string &filePath, const std::string &dispName, const std::string &address)
- : BubbleEntity(ContactItem)
- , m_FilePath(filePath)
- , m_Name(dispName)
- , m_Address(address)
- , m_ThumbId(ThumbnailMaker::SingleThumb)
- , m_ThumbMaker(thumbMaker)
-{
-}
-
-BubbleContactEntity::~BubbleContactEntity()
-{
-}
-
-BubbleContactViewItem *BubbleContactEntity::createView(Evas_Object *parent)
-{
- BubbleContactViewItem::LayoutType type = m_Address.empty() ? BubbleContactViewItem::Layout1Icon1Text : BubbleContactViewItem::Layout1Icon2Text;
- auto *item = new BubbleContactViewItem(*this, parent, type);
- item->setIcon(m_ThumbMaker.getThumbById(*item, m_ThumbId, BubbleContactViewItem::iconSize));
- item->setMainText(m_Name);
- if(!m_Address.empty())
- item->setSubText(m_Address);
- return item;
-}
-
-const std::string &BubbleContactEntity::getFilePath() const
-{
- return m_FilePath;
-}
-
-void BubbleContactEntity::setThumbId(ThumbId id)
-{
- m_ThumbId = id;
-}
expand();
setText(msgt("IDS_MSG_BUTTON_DOWNLOAD_ABB3"));
evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(BubbleDownloadButtonViewItem, onPressed), this);
- evas_object_smart_calculate(button);
evas_object_show(button);
}
{
emitActionEvent();
}
-
-BubbleDownloadButtonEntity::BubbleDownloadButtonEntity()
- : BubbleEntity(DownloadButtonItem)
-{
-}
-
-BubbleDownloadButtonEntity::~BubbleDownloadButtonEntity()
-{
-}
-
-BubbleDownloadButtonViewItem *BubbleDownloadButtonEntity::createView(Evas_Object *parent)
-{
- auto *item = new BubbleDownloadButtonViewItem(*this, parent);
- return item;
-}
-
-const std::string &BubbleDownloadButtonEntity::getFilePath() const
-{
- static std::string empty;
- return empty;
-}
}
Evas_Object *layout = addLayout(parent, CONV_LIST_ATTACHMENTS_EDJ_PATH, group);
+ evas_object_size_hint_align_set(layout, 0.0, EVAS_HINT_FILL);
setEo(layout);
}
imageHeight *= scale;
}
evas_object_size_hint_min_set(image, imageWidth, imageHeight);
+ evas_object_size_hint_align_set(image, 0.0, EVAS_HINT_FILL);
evas_object_show(image);
return image;
}
-
-BubbleImageEntity::BubbleImageEntity(const std::string &imgPath)
- : BubbleEntity(ImageItem)
- , m_ImgPath(imgPath)
-{
-}
-
-BubbleImageEntity::~BubbleImageEntity()
-{
-}
-
-BubbleImageViewItem *BubbleImageEntity::createView(Evas_Object *parent)
-{
- auto *item = new BubbleImageViewItem(*this, parent, m_ImgPath);
- return item;
-}
-
-const std::string &BubbleImageEntity::getFilePath() const
-{
- return m_ImgPath;
-}
-
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);
evas_object_size_hint_align_set(label, 0.0, EVAS_HINT_FILL);
return label;
}
-
-BubbleTextEntity::BubbleTextEntity(const std::string &text)
- : BubbleEntity(ImageItem)
- , m_Text(text)
-{
-}
-
-BubbleTextEntity::~BubbleTextEntity()
-{
-}
-
-const std::string &BubbleTextEntity::getFilePath() const
-{
- static std::string empty;
- return empty;
-}
-
-BubbleTextViewItem *BubbleTextEntity::createView(Evas_Object *parent)
-{
- auto *item = new BubbleTextViewItem(*this ,parent, m_Text);
- return item;
-}
}
evas_object_size_hint_min_set(image, imageWidth, imageHeight);
evas_object_show(image);
+ evas_object_size_hint_align_set(image, 0.0, EVAS_HINT_FILL);
return image;
}
-
-BubbleVideoEntity::BubbleVideoEntity(const std::string &videoPath, const std::string &imgPath)
- : BubbleEntity(VideoItem)
- , m_VideoPath(videoPath)
- , m_ImgPath(imgPath)
-{
-}
-
-BubbleVideoEntity::~BubbleVideoEntity()
-{
-}
-
-BubbleVideoViewItem *BubbleVideoEntity::createView(Evas_Object *parent)
-{
- auto *item = new BubbleVideoViewItem(*this, parent, m_ImgPath);
- return item;
-}
-
-const std::string &BubbleVideoEntity::getFilePath() const
-{
- return m_VideoPath;
-}
-
if(m_pListener)
m_pListener->onAction(*this);
}
-
-BubbleEntity::BubbleEntity(Type type)
- : m_Type(type)
-{
-}
-
-BubbleEntity::~BubbleEntity()
-{
-}
-
-BubbleEntity::Type BubbleEntity::getType() const
-{
- return m_Type;
-}
-
Evas_Object *BaseThreadListItem::getThumbnail()
{
static const int thumbSize = 98;
- return m_App.getThumbnailMaker().getThumbById(*getOwner(), m_ThumbId, thumbSize);
+ return m_App.getThumbnailMaker().getThumb(*getOwner(), m_ThumbId, thumbSize);
}
time_t BaseThreadListItem::getRawTime() const