TizenRefApp-8267 Integrate multimedia bubble items to ConvListItem 61/121861/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 29 Mar 2017 08:19:47 +0000 (11:19 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Wed, 29 Mar 2017 08:19:47 +0000 (11:19 +0300)
Change-Id: If076cd272278d43ef01a17941150f484f2ac3bf0
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
20 files changed:
src/Common/View/inc/ListView.h
src/Common/View/src/ListView.cpp
src/Conversation/Controller/inc/BubbleCalEventEntity.h [new file with mode: 0644]
src/Conversation/Controller/inc/BubbleCalendarEntity.h [deleted file]
src/Conversation/Controller/inc/BubbleContactEntity.h
src/Conversation/Controller/inc/BubbleEntity.h
src/Conversation/Controller/inc/BubbleEntityFactory.h
src/Conversation/Controller/inc/BubbleImageEntity.h
src/Conversation/Controller/inc/BubbleNoContentEntity.h
src/Conversation/Controller/inc/BubbleRetrieveEntity.h
src/Conversation/Controller/inc/BubbleSubjectEntity.h
src/Conversation/Controller/inc/BubbleTextEntity.h
src/Conversation/Controller/inc/BubbleVideoEntity.h
src/Conversation/Controller/inc/ConvListItem.h
src/Conversation/Controller/src/BubbleCalEventEntity.cpp [new file with mode: 0644]
src/Conversation/Controller/src/BubbleCalendarEntity.cpp [deleted file]
src/Conversation/Controller/src/BubbleContactEntity.cpp
src/Conversation/Controller/src/BubbleEntityFactory.cpp
src/Conversation/Controller/src/BubbleVideoEntity.cpp
src/Conversation/Controller/src/ConvListItem.cpp

index 5483da0265583660b6f27d93dff628f4ffed5a1b..77a68e884fd956bf455572a167f8f3c5a9e1ba07 100644 (file)
@@ -243,6 +243,8 @@ namespace Msg
              */
             void enabledAlign(bool enabled);
 
+            void setRealizationMode(bool mode);
+
             template<typename T>
             std::vector<T*> getItems() const;
 
index bd01246e9845d11d9f1a25c0dc0dab06d34b40cd..7d2e85d0b10f5ba91380617db5c6f400e759a180 100644 (file)
@@ -306,6 +306,11 @@ void ListView::enabledAlign(bool enabled)
     elm_object_scroll_item_align_enabled_set(getEo(), enabled);
 }
 
+void ListView::setRealizationMode(bool mode)
+{
+    elm_genlist_realization_mode_set(getEo(), mode);
+}
+
 void ListView::setMultiSelection(bool value)
 {
     elm_genlist_multi_select_set(getEo(), value);
diff --git a/src/Conversation/Controller/inc/BubbleCalEventEntity.h b/src/Conversation/Controller/inc/BubbleCalEventEntity.h
new file mode 100644 (file)
index 0000000..664075c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "BubbleEntity.h"
+#include "BubbleIconTextLayoutItem.h"
+
+namespace Msg {
+    class BubbleCalEventEntity
+        : public BubbleEntity {
+        public:
+            BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
+            virtual ~BubbleCalEventEntity();
+
+            BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
+
+        private:
+            std::string m_Name;
+    };
+}
+
+#endif /* BubbleCalEventEntity_h_ */
diff --git a/src/Conversation/Controller/inc/BubbleCalendarEntity.h b/src/Conversation/Controller/inc/BubbleCalendarEntity.h
deleted file mode 100644 (file)
index 3eabf60..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2016 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 BubbleCalendarEntity_h_
-#define BubbleCalendarEntity_h_
-
-#include "BubbleEntity.h"
-#include "BubbleIconTextLayoutItem.h"
-
-namespace Msg {
-    class BubbleCalendarEntity
-        : public BubbleEntity {
-        public:
-            BubbleCalendarEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
-            virtual ~BubbleCalendarEntity();
-
-            virtual BubbleIconTextLayoutItem *createView(Evas_Object *parent);
-
-        private:
-            std::string m_Name;
-    };
-}
-
-#endif /* BubbleCalendarEntity_h_ */
index 50ca95e515ce0cf73c6e3e31c00b2302cc15e489..f2d0b0709c87beebee324852e93b1688e1105430 100644 (file)
@@ -24,10 +24,10 @@ namespace Msg {
     class BubbleContactEntity
         : public BubbleEntity {
         public:
-            BubbleContactEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
+            BubbleContactEntity(const std::string &filePath, std::string fileName, Message::Direction direction);
             virtual ~BubbleContactEntity();
 
-            virtual BubbleIconTextLayoutItem *createView(Evas_Object *parent);
+            BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
 
         private:
             std::string m_Name;
index c6dab5fd20ac4a674d5a9010706ee224d9cbf975..566dab2cdc1e77c690a448d7542e3d3132c2869b 100644 (file)
 #include "Message.h"
 
 #include <string>
+#include <memory>
 
 namespace Msg {
+    class BubbleEntity;
+    typedef std::shared_ptr<BubbleEntity> BubbleEntityRef;
+
     class BubbleEntity {
         public:
             enum Type {
index 4b56f5f75cfef0eba645af0999ac8ceb834ad318..2ccd70093e0dc6271c08ed2cb300b9b4b4658d7c 100644 (file)
 #define BubbleEntityFactory_h_
 
 #include "MsgConvMedia.h"
+#include "MsgConversationItem.h"
 #include "WorkingDir.h"
-
-// Bubble items:
-#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 "BubbleEntity.h"
 
 #include <string>
+#include <list>
 
 namespace Msg {
+
+    class BubbleTextEntity;
+    class BubbleImageEntity;
+    class BubbleVideoEntity;
+    class BubbleAudioEntity;
+    class BubbleRetrieveEntity;
+    class BubbleUnknownFileEntity;
+    class BubbleCalEventEntity;
+    class BubbleContactEntity;
+    class BubbleNoContentEntity;
+
     class BubbleEntityFactory {
         public:
             BubbleEntityFactory(WorkingDirRef &workingDir);
             ~BubbleEntityFactory();
 
-            BubbleEntity *createEntity(std::string filePath, Message::Direction direction);
-            BubbleEntity *createEntity(const MsgConvMedia &msgMedia, Message::Direction direction);
-            BubbleTextEntity *createTextEntity(std::string text, Message::Direction direction);
+            std::list<BubbleEntityRef> create(const MsgConversationItem &item);
 
         private:
+            BubbleEntity *createEntity(const MsgConvMedia &msgMedia, Message::Direction direction);
+            BubbleTextEntity *createTextEntity(std::string text, Message::Direction direction);
+            BubbleRetrieveEntity *createRetrieveEntity(Message::Direction direction);
+            BubbleNoContentEntity *createNoContentEntity(Message::Direction direction);
             BubbleEntity *createTextEntityFromFile(std::string filePath, Message::Direction direction);
-            BubbleEntity *createEntity(std::string filePath, std::string fileName, std::string mime, Message::Direction direction);
             BubbleEntity *createVideoEntity(std::string filePath, std::string fileName, Message::Direction direction);
             BubbleEntity *createAudioEntity(std::string filePath, std::string fileName, Message::Direction direction);
             BubbleEntityFactory(BubbleEntityFactory&) = delete;
index 9bcfacd2a379709e54f13e81f787287510107d22..5d7676543eb8abb0f2afa05a5e4bfbf2ca851b02 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg {
             BubbleImageEntity(const std::string &filePath, Message::Direction direction);
             virtual ~BubbleImageEntity();
 
-            virtual BubbleImageViewItem *createView(Evas_Object *parent);
+            BubbleImageViewItem *createView(Evas_Object *parent) override;
     };
 
 
index 6f454320dfd25dcae138008030f2ff8e06bf578f..60b47077480767c799cfb9e2eafe15b270dee639 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg {
             BubbleNoContentEntity(Message::Direction direction);
             virtual ~BubbleNoContentEntity();
 
-            virtual BubbleInfoTextViewItem *createView(Evas_Object *parent);
+            BubbleInfoTextViewItem *createView(Evas_Object *parent) override;
     };
 
     inline BubbleNoContentEntity::BubbleNoContentEntity(Message::Direction direction)
index 42cbc799a6509806f7c4cabc06f94e569965e48f..10bc965db315b26566b6b9c9038c418539a5a6ee 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg {
             BubbleRetrieveEntity(Message::Direction direction);
             virtual ~BubbleRetrieveEntity();
 
-            virtual BubbleInfoTextViewItem *createView(Evas_Object *parent);
+            BubbleInfoTextViewItem *createView(Evas_Object *parent) override;
     };
 
     inline BubbleRetrieveEntity::BubbleRetrieveEntity(Message::Direction direction)
index d950418a108a706a0bbd350c182aefe741fbf02f..bc684ce492c2a1814a1513a8789c1da636e1721a 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg {
             BubbleSubjectEntity(const std::string &subject, Message::Direction direction);
             virtual ~BubbleSubjectEntity();
 
-            virtual BubbleSubjectViewItem *createView(Evas_Object *parent);
+            BubbleSubjectViewItem *createView(Evas_Object *parent) override;
 
         private:
             std::string m_Subject;
index 2cdbe93bf9d8fc1bfc81f99937573b95977cc7ae..19dd7bd8850b51037e5b1dc0ab90714ca211d77b 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg {
             BubbleTextEntity(Message::Direction direction, std::string text);
             virtual ~BubbleTextEntity();
 
-            virtual BubbleTextViewItem *createView(Evas_Object *parent);
+            BubbleTextViewItem *createView(Evas_Object *parent) override;
 
         private:
             std::string m_Text;
index 0de9a748fc9d788b71a0796cde1da0c56f8a6195..f7731caabba36dbe7bd768b987544f1e8d0a92bc 100644 (file)
 
 #include "BubbleVideoViewItem.h"
 #include "BubbleEntity.h"
+#include "WorkingDir.h"
 
 namespace Msg {
     class BubbleVideoEntity
         : public BubbleEntity {
         public:
-            BubbleVideoEntity(const std::string &filePath, Message::Direction direction);
+            BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction);
             virtual ~BubbleVideoEntity();
 
-            virtual BubbleVideoViewItem *createView(Evas_Object *parent);
+            BubbleVideoViewItem *createView(Evas_Object *parent) override;
 
         private:
             std::string m_ImgPath;
+            WorkingDirRef m_WorkingDir;
     };
 }
 
index 4c13020bc3ab89e920253b667b02d4a49c6013e4..c2376e87fa9327e60381acd8c97ea2f6866d25da 100644 (file)
@@ -22,6 +22,7 @@
 #include "MsgTypes.h"
 #include "Message.h"
 #include "WorkingDir.h"
+#include "BubbleEntity.h"
 
 #include <list>
 
@@ -29,7 +30,6 @@ namespace Msg {
 
     class MsgConversationItem;
     class BubbleEntityFactory;
-    class BubbleEntity;
 
     class ConvListItem
         : public ConvListViewItem
@@ -57,7 +57,6 @@ namespace Msg {
 
             void updateViewStatus();
             void prepareContent(const MsgConversationItem &item);
-            void addEntity(BubbleEntity *entity);
 
         private:
             MsgId m_MsgId;
@@ -66,7 +65,7 @@ namespace Msg {
             Message::NetworkStatus m_NetworkStatus;
             Message::Type m_Type;
             std::string m_TimeStr;
-            std::list<BubbleEntity*> m_BubbleEntityList;
+            std::list<BubbleEntityRef> m_BubbleEntityList;
             WorkingDirRef m_WorkingDir;
             BubbleEntityFactory &m_BubbleEntityFactory;
     };
diff --git a/src/Conversation/Controller/src/BubbleCalEventEntity.cpp b/src/Conversation/Controller/src/BubbleCalEventEntity.cpp
new file mode 100644 (file)
index 0000000..fa0d2ac
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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 "BubbleCalEventEntity.h"
+#include "Resource.h"
+
+using namespace Msg;
+
+BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
+    : BubbleEntity(CalendarEventItem, direction, filePath)
+{
+    m_Name = fileName;
+}
+
+BubbleCalEventEntity::~BubbleCalEventEntity()
+{
+}
+
+BubbleIconTextLayoutItem *BubbleCalEventEntity::createView(Evas_Object *parent)
+{
+    auto *item = new BubbleIconTextLayoutItem(parent, *this);
+    item->setIcon(item->createIcon(ATTACH_CALENDAR_ICON));
+    item->setMainText(m_Name);
+    return item;
+}
diff --git a/src/Conversation/Controller/src/BubbleCalendarEntity.cpp b/src/Conversation/Controller/src/BubbleCalendarEntity.cpp
deleted file mode 100644 (file)
index 643271d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2016 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * 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 "BubbleCalendarEntity.h"
-#include "Resource.h"
-
-using namespace Msg;
-
-BubbleCalendarEntity::BubbleCalendarEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
-    : BubbleEntity(CalendarEventItem, direction, filePath)
-{
-    m_Name = fileName;
-}
-
-BubbleCalendarEntity::~BubbleCalendarEntity()
-{
-}
-
-BubbleIconTextLayoutItem *BubbleCalendarEntity::createView(Evas_Object *parent)
-{
-    auto *item = new BubbleIconTextLayoutItem(parent, *this);
-    item->setIcon(item->createIcon(ATTACH_CALENDAR_ICON));
-    item->setMainText(m_Name);
-    return item;
-}
index ff735577310ea8e3ae8a9538dbd4c79d246cd6bd..999e9088e86fd9010ce276b216c7638669bff222 100644 (file)
 
 using namespace Msg;
 
-BubbleContactEntity::BubbleContactEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
+BubbleContactEntity::BubbleContactEntity(const std::string &filePath, std::string fileName, Message::Direction direction)
     : BubbleEntity(ContactItem, direction, filePath)
 {
-    m_Name = fileName;
+    m_Name = std::move(fileName);
 }
 
 BubbleContactEntity::~BubbleContactEntity()
index 742c628b8314dd5dab2598c544ba0ef52883dd32..5ee2a0264fa2b3a9b154ec4aa0c6306075bd065e 100644 (file)
 #include "FileUtils.h"
 #include "MediaType.h"
 #include "MediaUtils.h"
+#include "MsgUtils.h"
 
 // Bubble items:
 #include "BubbleTextEntity.h"
-/*
 #include "BubbleImageEntity.h"
 #include "BubbleVideoEntity.h"
-#include "BubbleAudioEntity.h"
-#include "BubbleDownloadButtonEntity.h"
-#include "BubbleUnknownFileEntity.h"
+#include "BubbleRetrieveEntity.h"
 #include "BubbleCalEventEntity.h"
 #include "BubbleContactEntity.h"
-*/
+#include "BubbleNoContentEntity.h"
+
+// TODO: impl
+// #include "BubbleAudioEntity.h"
+// #include "BubbleUnknownFileEntity.h"
 
 #include <algorithm>
 
@@ -44,31 +46,104 @@ BubbleEntityFactory::~BubbleEntityFactory()
 {
 }
 
+std::list<BubbleEntityRef> BubbleEntityFactory::create(const MsgConversationItem &item)
+{
+    std::list<BubbleEntityRef> list;
+
+    Message::Type type = item.getType();
+    Message::Direction direct = item.getDirection();
+
+    if (MsgUtils::isSms(type)) {
+        // SMS:
+        auto *entity = createTextEntity(item.getText(), direct);
+        if (entity)
+            list.push_back(BubbleEntityRef(entity));
+    } else if (type == Message::MT_MMS_Noti) {
+        // MMS_Noti:
+        auto *entity = createRetrieveEntity(direct);
+        if (entity)
+            list.push_back(BubbleEntityRef(entity));
+    } else {
+        // MMS:
+        const MsgConvMediaList &convList = item.getMediaList();
+        int convListLen = convList.getLength();
+        for (int i = 0; i < convListLen; ++i) {
+            auto *entity = createEntity(convList[i], direct);
+            if (entity)
+                list.push_back(BubbleEntityRef(entity));
+        }
+    }
+
+    // No Content:
+    if (list.empty()) {
+        auto *entity = createNoContentEntity(direct);
+        if (entity)
+            list.push_back(BubbleEntityRef(entity));
+    }
+
+    return list;
+}
+
 BubbleEntity *BubbleEntityFactory::createEntity(const MsgConvMedia &msgMedia, Message::Direction direction)
 {
-    std::string mime = msgMedia.getMime();
-    std::string fileName = msgMedia.getName();
     std::string filePath = msgMedia.getPath();
 
-    if (mime.empty())
-        mime = FileUtils::getMimeType(filePath);
+    if (FileUtils::isExists(filePath)) {
 
-    if (fileName.empty())
-        fileName = FileUtils::getFileName(filePath);
+        std::string mime = msgMedia.getMime();
+        std::string fileName = msgMedia.getName();
 
-    return createEntity(filePath, fileName, mime, direction);
-}
+        if (mime.empty())
+            mime = FileUtils::getMimeType(filePath);
 
-BubbleEntity *BubbleEntityFactory::createEntity(std::string filePath, Message::Direction direction)
-{
-    return createEntity(std::move(filePath), FileUtils::getFileName(filePath), FileUtils::getMimeType(filePath), direction);
+        if (fileName.empty())
+            fileName = FileUtils::getFileName(filePath);
+
+        std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
+        MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
+
+        switch (msgMediaType) {
+        case MsgMedia::TextType:
+            return createTextEntityFromFile(std::move(filePath), direction);
+        case MsgMedia::ImageType:
+            return new BubbleImageEntity(std::move(filePath), direction);
+        case MsgMedia::AudioType:
+            return createAudioEntity(std::move(filePath), std::move(fileName), direction);
+        case MsgMedia::VideoType:
+            return createVideoEntity(std::move(filePath), std::move(fileName), direction);
+        default:
+          if (mime == "text/x-vcalendar" || mime == "text/calendar")
+              return new BubbleCalEventEntity(std::move(filePath), std::move(fileName), direction);
+
+          // TDOO: impl.
+/*          else if (mime == "text/x-vcard" ||
+                   mime == "text/vcard" ||
+                   mime == "text/x-vcalendar")
+              return new BubbleContactEntity(std::move(filePath), std::move(fileName), direction);
+          else if (mime != "application/smil")
+              return new BubbleUnknownFileEntity(std::move(filePath), std::move(fileName), direction);*/
+        }
+    }
+
+    return nullptr;
 }
 
+
 BubbleTextEntity *BubbleEntityFactory::createTextEntity(std::string text, Message::Direction direction)
 {
     return text.empty() ? nullptr : new BubbleTextEntity(direction, std::move(text));
 }
 
+BubbleRetrieveEntity *BubbleEntityFactory::createRetrieveEntity(Message::Direction direction)
+{
+    return new BubbleRetrieveEntity(direction);
+}
+
+BubbleNoContentEntity *BubbleEntityFactory::createNoContentEntity(Message::Direction direction)
+{
+    return new BubbleNoContentEntity(direction);
+}
+
 BubbleEntity *BubbleEntityFactory::createAudioEntity(std::string filePath, std::string fileName, Message::Direction direction)
 {
     // TDOO: impl.
@@ -83,14 +158,14 @@ BubbleEntity *BubbleEntityFactory::createAudioEntity(std::string filePath, std::
 
 BubbleEntity *BubbleEntityFactory::createVideoEntity(std::string filePath, std::string fileName, Message::Direction direction)
 {
-    // TDOO: impl.
-    return nullptr;
+    if (MediaUtils::hasVideo(filePath))
+           return new BubbleVideoEntity(m_WorkingDir, std::move(filePath), direction);
 
-/*    if (MediaUtils::hasVideo(filePath))
-           return new BubbleVideoEntity(m_WorkingDir, filePath, direction);
+    return nullptr;
 
+    // TODO: impl.
     // Try to create Audio entity.
-    return createAudioEntity(filePath, fileName, bgType, direction);*/
+   // return createAudioEntity(std::move(filePath), std::move(fileName), bgType, direction);
 }
 
 BubbleEntity *BubbleEntityFactory::createTextEntityFromFile(std::string filePath, Message::Direction direction)
@@ -102,37 +177,3 @@ BubbleEntity *BubbleEntityFactory::createTextEntityFromFile(std::string filePath
     return entity;
 }
 
-BubbleEntity *BubbleEntityFactory::createEntity(std::string filePath, std::string fileName, std::string mime, Message::Direction direction)
-{
-    if (FileUtils::isExists(filePath)) {
-        std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
-        MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
-
-        switch (msgMediaType) {
-        case MsgMedia::TextType:
-            return createTextEntityFromFile(std::move(filePath), direction);
-
-        // TDOO: impl.
-
-       /* case MsgMedia::ImageType:
-            return new BubbleImageEntity(filePath, direction);
-        case MsgMedia::AudioType:
-            return createAudioEntity(filePath, fileName, direction);
-        case MsgMedia::VideoType:
-            return createVideoEntity(filePath, fileName, direction);
-        default:
-          if (mime == "text/x-vcalendar" || mime == "text/calendar")
-              return new BubbleCalEventEntity(filePath, fileName, direction);
-          else if (mime == "text/x-vcard" ||
-                  mime == "text/vcard" ||
-                  mime == "text/x-vcalendar")
-              return new BubbleContactEntity(m_App, filePath, fileName, direction);
-          else if (mime != "application/smil")
-              return new BubbleUnknownFileEntity(filePath, fileName, direction);
-              */
-        }
-    }
-
-    return nullptr;
-}
-
index b3340419200496465d26b329f9f26cb306cc2e60..770aa774315bd3edf43763847f4f8c676b7abf78 100644 (file)
@@ -20,9 +20,9 @@
 
 using namespace Msg;
 
-
-BubbleVideoEntity::BubbleVideoEntity(const std::string &filePath, Message::Direction direction)
+BubbleVideoEntity::BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction)
     : BubbleEntity(VideoItem, direction, filePath)
+    , m_WorkingDir(workingDir)
 {
     // TODO: when video player will be available
     m_ImgPath =  filePath;
index e240dc5f3cca621dfd9965f98432990ec7ad7695..e2281505f7fefe2717e49e7cec6158d7930a97ee 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 #include "ConvListItem.h"
+#include "BubbleItemContainer.h"
+#include "BubbleEntityFactory.h"
 #include "MsgEngine.h"
 #include "TimeUtils.h"
 #include "MsgUtils.h"
 
 #include <algorithm>
 
-// Bubble items:
-#include "BubbleItemContainer.h"
-#include "BubbleEntityFactory.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"
-
 using namespace Msg;
 
 ConvListItem::ConvListItem(const MsgConversationItem &item,
@@ -59,10 +49,6 @@ ConvListItem::ConvListItem(const MsgConversationItem &item,
 
 ConvListItem::~ConvListItem()
 {
-    for (auto *entity : m_BubbleEntityList)
-        delete entity;
-
-    m_BubbleEntityList.clear();
 }
 
 MsgId ConvListItem::getMsgId() const
@@ -116,23 +102,7 @@ void ConvListItem::updateTime()
 
 void ConvListItem::prepareContent(const MsgConversationItem &item)
 {
-    if (MsgUtils::isSms(m_Type)) {
-        addEntity(m_BubbleEntityFactory.createTextEntity(item.getText(), m_Direction));
-    } else if (m_Type == Message::MT_MMS_Noti) {
-        // TODO: impl.
-    } else {
-        const MsgConvMediaList &list = item.getMediaList();
-        for (int i = 0; i < list.getLength(); ++i) {
-            const MsgConvMedia &media = list.at(i);
-            addEntity(m_BubbleEntityFactory.createEntity(media, m_Direction));
-        }
-    }
-}
-
-void ConvListItem::addEntity(BubbleEntity *entity)
-{
-    if (entity)
-        m_BubbleEntityList.push_back(entity);
+    m_BubbleEntityList = m_BubbleEntityFactory.create(item);
 }
 
 Evas_Object *ConvListItem::getBubbleContent()
@@ -141,7 +111,7 @@ Evas_Object *ConvListItem::getBubbleContent()
         return nullptr;
 
     auto *bubble = new BubbleItemContainer(*getOwner());
-    for (BubbleEntity *entity : m_BubbleEntityList) {
+    for (BubbleEntityRef entity : m_BubbleEntityList) {
         BubbleViewItem *item = entity->createView(*bubble);
         if (item) {
             bubble->append(*item, entity->getDirection());