TizenRefApp-6897 Move attachments insertion from body to convlist 91/84791/2
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Mon, 22 Aug 2016 10:52:03 +0000 (13:52 +0300)
committerAndrey Klimenko <and.klimenko@samsung.com>
Mon, 22 Aug 2016 11:14:13 +0000 (04:14 -0700)
Change-Id: I9fcfa6589520fc0fa922f1667148e7f83f62654e
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
58 files changed:
src/Common/Utils/src/FileUtils.cpp
src/Common/View/inc/ListItem.h
src/Common/View/inc/ListView.h
src/Common/View/src/ListItem.cpp
src/Common/View/src/ListView.cpp
src/Conversation/Body/Controller/inc/Body.h
src/Conversation/Body/Controller/inc/Page.h [deleted file]
src/Conversation/Body/Controller/inc/PopupBodyAttachmentListItem.h [deleted file]
src/Conversation/Body/Controller/src/Body.cpp
src/Conversation/Body/Controller/src/Page.cpp [deleted file]
src/Conversation/Body/Controller/src/PopupBodyAttachmentListItem.cpp [deleted file]
src/Conversation/Body/View/inc/BodyAttachmentViewItem.h [deleted file]
src/Conversation/Body/View/inc/BodyView.h
src/Conversation/Body/View/inc/BodyViewItem.h [deleted file]
src/Conversation/Body/View/inc/ImagePageViewItem.h [deleted file]
src/Conversation/Body/View/inc/MediaPageViewItem.h [deleted file]
src/Conversation/Body/View/inc/PageSeparator.h [deleted file]
src/Conversation/Body/View/inc/PageView.h [deleted file]
src/Conversation/Body/View/inc/PageViewItem.h [deleted file]
src/Conversation/Body/View/inc/SoundPageViewItem.h [deleted file]
src/Conversation/Body/View/inc/TextPageViewItem.h [deleted file]
src/Conversation/Body/View/inc/VideoPageViewItem.h [deleted file]
src/Conversation/Body/View/src/BodyAttachmentViewItem.cpp [deleted file]
src/Conversation/Body/View/src/BodyView.cpp
src/Conversation/Body/View/src/BodyViewItem.cpp [deleted file]
src/Conversation/Body/View/src/ImagePageViewItem.cpp [deleted file]
src/Conversation/Body/View/src/MediaPageViewItem.cpp [deleted file]
src/Conversation/Body/View/src/PageSeparator.cpp [deleted file]
src/Conversation/Body/View/src/PageView.cpp [deleted file]
src/Conversation/Body/View/src/PageViewItem.cpp [deleted file]
src/Conversation/Body/View/src/SoundPageViewItem.cpp [deleted file]
src/Conversation/Body/View/src/TextPageViewItem.cpp [deleted file]
src/Conversation/Body/View/src/VideoPageViewItem.cpp [deleted file]
src/Conversation/ConvList/Controller/inc/BubbleAudioEntity.h
src/Conversation/ConvList/Controller/inc/BubbleBgEntity.h
src/Conversation/ConvList/Controller/inc/BubbleCalEventEntity.h
src/Conversation/ConvList/Controller/inc/BubbleContactEntity.h
src/Conversation/ConvList/Controller/inc/BubbleDownloadButtonEntity.h
src/Conversation/ConvList/Controller/inc/BubbleEntity.h
src/Conversation/ConvList/Controller/inc/BubbleEntityFactory.h
src/Conversation/ConvList/Controller/inc/BubbleImageEntity.h
src/Conversation/ConvList/Controller/inc/BubbleTextEntity.h
src/Conversation/ConvList/Controller/inc/BubbleUnknownFileEntity.h
src/Conversation/ConvList/Controller/inc/BubbleVideoEntity.h
src/Conversation/ConvList/Controller/inc/ComposeListItem.h
src/Conversation/ConvList/Controller/inc/ConvList.h
src/Conversation/ConvList/Controller/src/BubbleAudioEntity.cpp
src/Conversation/ConvList/Controller/src/BubbleCalEventEntity.cpp
src/Conversation/ConvList/Controller/src/BubbleContactEntity.cpp
src/Conversation/ConvList/Controller/src/BubbleEntityFactory.cpp
src/Conversation/ConvList/Controller/src/BubbleUnknownFileEntity.cpp
src/Conversation/ConvList/Controller/src/BubbleVideoEntity.cpp
src/Conversation/ConvList/Controller/src/ComposeListItem.cpp
src/Conversation/ConvList/Controller/src/ConvList.cpp
src/Conversation/ConvList/View/inc/ComposeListViewItem.h
src/Conversation/ConvList/View/src/BubbleViewItem.cpp
src/Conversation/ConvList/View/src/ComposeListViewItem.cpp
src/Conversation/Main/Controller/src/Conversation.cpp

index c0a41ce6ec968ec9db997b3a5f58ed7c476b153d..f2574dfac5116b341067ad4ca03d7883fe17f78d 100755 (executable)
@@ -29,6 +29,7 @@
 #include <fstream>
 #include <mime_type.h>
 #include <media_content.h>
+#include <algorithm>
 
 using namespace Msg;
 
@@ -241,6 +242,7 @@ std::string FileUtils::getMimeType(const std::string &filePath)
         if(mime)
         {
             res = mime;
+            std::transform(res.begin(), res.end(), res.begin(), ::tolower);
             free(mime);
         }
     }
index cacc3c6356fbe4af47dfaad9e5dcc29524b19881..685c205d713cc8d2c7b88bc7834d064cd3698602 100644 (file)
@@ -179,6 +179,7 @@ namespace Msg
             virtual bool getState(ListItem &item, const char *part);
             virtual void onDelete(ListItem &item);
             virtual const char *getCheckPart(ListItem &item);
+            virtual bool getFilter(ListItem &item, void *key);
 
             virtual void onRealized(ListItem &item) {};
             virtual void onUnrealized(ListItem &item) {};
@@ -192,6 +193,7 @@ namespace Msg
             static Evas_Object * elm_gen_item_content_get_cb(void * data, Evas_Object * obj, const char * part);
             static Eina_Bool elm_gen_item_state_get_cb(void * data, Evas_Object * obj, const char * part);
             static void elm_gen_item_del_cb(void *data, Evas_Object *obj);
+            static Eina_Bool elm_gen_item_filter_cb(void *data, Evas_Object *obj, void *key);
 
     private:
         ListView *m_pOwner;
index c607ed4addaa89beb9d29f3db9adfda19a032f37..1df100f0647f486d9b0a981923e25b4f788ab119 100644 (file)
@@ -189,6 +189,12 @@ namespace Msg
              */
             void demoteItem(ListItem &item);
 
+            /**
+             * @brief Set filter for items
+             * @param[in] key The filter key
+             */
+            void setFilter(void *key);
+
             /**
              * @brief Enables(disables selection mode). Makes all list-view items to show(hide) a check-box.
              * @param[in] check if true makes all items to show checkbox, otherwise make them to hide it.
index 1d38027ce7308e9a1948e56c21866a952a4fdb3b..67683416ce1ba59e88b70394e220a4376558e625 100644 (file)
@@ -68,6 +68,7 @@ void ListItemStyle::registerCallback()
     m_pGenlistItemClass->func.state_get = &ListItem::elm_gen_item_state_get_cb;
     m_pGenlistItemClass->func.del = &ListItem::elm_gen_item_del_cb;
     m_pGenlistItemClass->func.content_get = &ListItem::elm_gen_item_content_get_cb;
+    m_pGenlistItemClass->func.filter_get = &ListItem::elm_gen_item_filter_cb;
 }
 
 void ListItemStyle::unregisterCallback()
@@ -79,6 +80,7 @@ void ListItemStyle::unregisterCallback()
     m_pGenlistItemClass->func.state_get = nullptr;
     m_pGenlistItemClass->func.del = nullptr;
     m_pGenlistItemClass->func.content_get = nullptr;
+    m_pGenlistItemClass->func.filter_get = nullptr;
 }
 
 // ListItemClass:
@@ -142,9 +144,7 @@ Evas_Object *ListItem::elm_gen_item_content_get_cb(void * data, Evas_Object * ob
     ListItem *self = static_cast<ListItem*>(data);
 
     if(!self)
-    {
         return nullptr;
-    }
 
     if(self->getOwner()->getCheckMode())
     {
@@ -158,6 +158,12 @@ Evas_Object *ListItem::elm_gen_item_content_get_cb(void * data, Evas_Object * ob
     return self->getContent(*self, part);
 }
 
+Eina_Bool ListItem::elm_gen_item_filter_cb(void *data, Evas_Object *obj, void *key)
+{
+    ListItem *self = static_cast<ListItem*>(data);
+    return self ? self->getFilter(*self, key) : false;
+}
+
 Evas_Object *ListItem::addCheck()
 {
     Evas_Object *check = elm_check_add(*getOwner());
@@ -248,6 +254,11 @@ std::string ListItem::getText(ListItem &item, const char* part)
     return std::string();
 }
 
+bool ListItem::getFilter(ListItem &item, void *key)
+{
+    return true;
+}
+
 Evas_Object* ListItem::getContent(ListItem &item, const char* part)
 {
     return nullptr;
index 06ef51c59079aed6acd84ee5250db89ca7f621ea..4006d16873ea5e9ada347a79a7b0749667a39cfc 100644 (file)
@@ -213,6 +213,11 @@ void ListView::demoteItem(ListItem &item)
     elm_genlist_item_demote(item);
 }
 
+void ListView::setFilter(void *key)
+{
+    elm_genlist_filter_set(getEo(), key);
+}
+
 void ListView::notifyListener(void *data, Evas_Object *obj, void *event_info, ListenerMethod method)
 {
     ListItem *item = ListItem::staticCast<ListItem*>(event_info);
index 8cd299b40e04e069435400aa8c84747fd2fe6f32..a18b943ffcd40973a2e70ce35ce86aaf788de28f 100644 (file)
@@ -23,8 +23,8 @@
 #include "MessageMms.h"
 #include "WorkingDir.h"
 #include "AppControlCompose.h"
-#include "Page.h"
 #include "AttachmentHandler.h"
+#include "ComposeListItem.h"
 
 #include <list>
 #include <queue>
@@ -38,35 +38,36 @@ namespace Msg
     class PopupList;
     class ConvList;
 
-    // TODO: move page(controller) methods to Page class
 
     class Body
         : public BodyView
         , private IAttachmentHandlerListener
+        , private IComposeListItemListener
     {
         public:
-            Body(App &app, WorkingDirRef workingDir, ConvList &convList);
+            Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &convList);
             virtual ~Body();
 
-            void create(Evas_Object *parent);
             void setListener(IBodyListener *listener);
 
             void enableAutoFocusForAttachments(bool focus);
             void addMedia(const std::list<std::string> &fileList);
             void addMedia(const std::string &filePath);
-
+            void clear();
+            bool isEmpty() const;
             bool isMms();
             void setMmsRecipFlag(bool value);
             const MsgTextMetric &getTextMetric();
             long long getMsgSize();
-            int getAttachmentsCountTotal() const;
             void read(Message &msg);
             void write(const Message &msg);
             void execCmd(const AppControlComposeRef &cmd);
-            Page &getDefaultPage();
 
         private:
-            Page &createPage();
+            ComposeListItem &getComposeItem();
+            const ComposeListItem &getComposeItem() const;
+            void notifyContentChanged();
+            void updateTextMetricIfNeeded();
             void showTooLargePopup(const std::list <std::string> &tooBigFiles);
             void showTooMuchAttachedPopup(int willBeAttached);
             void showTooMuchAttachedPopup();
@@ -76,13 +77,17 @@ namespace Msg
             void read(MessageSMS &msg);
             void read(MessageMms &msg);
             void readAttachments(MessageMms &msg);
+            void readText(MessageMms &msg);
             void write(const MessageSMS &msg);
             void write(const MessageMms &msg);
+            void writeText(const Message &msg);
             void writeAttachments(const MessageMms &msg);
-            void writeTextToFile(TextPageViewItem &item);
+            void writeTextToFile();
             void addAttachment( const std::string &filePath, const std::string &fileName = "");
             void runFileProcessing();
 
+            PopupList &createPopupList(const std::string &title);
+
             void onTooLargePopupDel(Evas_Object *obj, void *eventInfo);
             void onTooMuchAttachedPopupDel(Evas_Object *obj, void *eventInfo);
             void onResizingPopupDel(Evas_Object *obj, void *eventInfo);
@@ -91,20 +96,12 @@ namespace Msg
 
             // BodyView:
             virtual void onContentChanged();
-            virtual void onItemDelete(PageViewItem &item);
-            virtual void onItemDelete(BodyAttachmentViewItem &item);
-            virtual void onMaxLengthReached(TextPageViewItem &item);
-            virtual void onCheckBoundaryText(TextPageViewItem &item, char **text);
+            virtual void onMaxLengthReached();
+            virtual void onCheckBoundaryText(char **text);
 
-            //IMediaPageViewItemListener
-            virtual void onClicked(MediaPageViewItem &item);
-
-            //IBodyAttachmentViewListener
-            virtual void onClicked(BodyAttachmentViewItem &item);
-
-            PopupList &createPopupList(const std::string &title);
-            void onRemoveMediaItemPressed(PopupListItem &item);
-            void onRemoveBodyItemPressed(PopupListItem &item);
+            // IComposeListItemListener:
+            virtual void onAttachmentAdded(const std::list<std::string> &files);
+            virtual void onAttachmentDeleted(const std::list<std::string> &files);
 
             //IAttachmentHandlerListener
             virtual long long onFreeSpaceRequest();
@@ -124,6 +121,10 @@ namespace Msg
             std::queue<std::string> m_SelectedFiles;
             bool m_AutoFocusForAttachments;
             ConvList &m_ConvList;
+            std::string m_MmsTextFilePath;
+            MsgTextMetric m_TextMetric;
+            bool m_TextMetricUpdated;
+            int m_Utf8TextSize;
     };
 
     class IBodyListener
diff --git a/src/Conversation/Body/Controller/inc/Page.h b/src/Conversation/Body/Controller/inc/Page.h
deleted file mode 100644 (file)
index b526b7a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 Page_h_
-#define Page_h_
-
-#include "PageView.h"
-#include "MsgEngine.h"
-#include "WorkingDir.h"
-#include "TextPageViewItem.h"
-
-namespace Msg
-{
-    class Body;
-    class Page
-        : public PageView
-    {
-        public:
-
-
-        public:
-            Page(Body &parent, WorkingDirRef workingDir);
-            virtual ~Page();
-
-            int getAttachmentsCount() const;
-            const MsgTextMetric &getTextMetric();
-            long long getSize();
-            bool isMms();
-            void read(MsgPage &msgPage);
-            void write(const MsgPage &msgPage);
-            bool addMedia(const std::string &filePath);
-
-        private:
-            void updateMsgMetricIfNeeded();
-
-            void readText(MsgPage &msgPage);
-            void readSound(MsgPage &msgPage);
-            void readImage(MsgPage &msgPage);
-            void readVideo(MsgPage &msgPage);
-
-            void writeText(const MsgMedia &msgMedia);
-            void writeImage(const MsgMedia &msgMedia);
-            void writeVideo(const MsgMedia &msgMedia);
-            void writeSound(const MsgMedia &msgMedia);
-            void writeTextToFile(TextPageViewItem &item);
-
-            void addVideo(const std::string &videoPath);
-            void addImage(const std::string &filePath);
-            void addSound(const std::string &filePath, const std::string &fileName = "");
-
-        private:
-            Body &m_Body;
-            MsgTextMetric m_MsgMetric;
-            WorkingDirRef m_WorkingDir;
-            int m_Utf8TextSize;
-    };
-}
-
-#endif /* Page_h_ */
diff --git a/src/Conversation/Body/Controller/inc/PopupBodyAttachmentListItem.h b/src/Conversation/Body/Controller/inc/PopupBodyAttachmentListItem.h
deleted file mode 100644 (file)
index a460d49..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- *
- */
-
-#ifndef PopupBodyAttachmentListItem_h_
-#define PopupBodyAttachmentListItem_h_
-
-#include "PopupListItem.h"
-
-namespace Msg
-{
-    class PageViewItem;
-    class BodyAttachmentViewItem;
-
-    class PopupBodyAttachmentListItem
-            : public PopupTextListItem
-    {
-    public:
-        PopupBodyAttachmentListItem(PopupList &parent, const std::string &text,
-                PageViewItem &pageItem, PopupListItemPressedCb cb, void *userData);
-
-        virtual ~PopupBodyAttachmentListItem();
-
-        PageViewItem &getPageItem();
-
-    private:
-        PageViewItem &m_PageItem;
-    };
-
-    //TODO: rename this class
-    class BodyAttachmentListItem
-        : public PopupTextListItem
-    {
-    public:
-        BodyAttachmentListItem(PopupList &parent, const std::string &text,
-                BodyAttachmentViewItem &bodyItem, PopupListItemPressedCb cb, void *userData);
-
-        virtual ~BodyAttachmentListItem();
-
-        BodyAttachmentViewItem &getBodyItem();
-
-    private:
-        BodyAttachmentViewItem &m_BodyItem;
-    };
-
-}
-
-#endif /* PopupBodyAttachmentListItem_h_ */
index 81be9298f7b48f641842324267564e07005a0080..adfafda3a106fb2cccc2c8c9cc1311efc2c7af84 100644 (file)
 
 #include "App.h"
 #include "Body.h"
-#include "PageView.h"
 #include "FileUtils.h"
-#include "TextPageViewItem.h"
-#include "ImagePageViewItem.h"
-#include "VideoPageViewItem.h"
 #include "MediaType.h"
 #include "MsgEngine.h"
 #include "Logger.h"
 #include "MediaUtils.h"
 #include "PopupList.h"
-#include "PopupBodyAttachmentListItem.h"
 #include "ComposeListItem.h"
 #include "ConvList.h"
 
@@ -41,32 +36,10 @@ namespace
 {
     const std::string contactFileName = "Contact.vcf";
     const std::string contactsFileName = "Contacts.vcf";
-
-    inline TextPageViewItem *getTextItem(const PageView &page)
-    {
-        return page ? static_cast<TextPageViewItem*>(page.getItem(PageViewItem::TextType)) : nullptr;
-    }
-
-    PageViewItem::Type msgMediaTypeToPageItemType(MsgMedia::Type type)
-    {
-        switch(type)
-        {
-            case MsgMedia::ImageType:
-                return PageViewItem::ImageType;
-            case MsgMedia::AudioType:
-                return PageViewItem::SoundType;
-            case MsgMedia::VideoType:
-                return PageViewItem::VideoType;
-            case MsgMedia::TextType:
-                return PageViewItem::TextType;
-            default:
-                return PageViewItem::UnknownType;
-        }
-    }
 }
 
-Body::Body(App &app, WorkingDirRef workingDir, ConvList &convList)
-    : BodyView()
+Body::Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &convList)
+    : BodyView(parent, app.getMsgEngine().getSettings().getMaxMsgTextLen())
     , m_pListener(nullptr)
     , m_App(app)
     , m_WorkingDir(workingDir)
@@ -78,21 +51,13 @@ Body::Body(App &app, WorkingDirRef workingDir, ConvList &convList)
     , m_AttachmentHandler(workingDir)
     , m_AutoFocusForAttachments(true)
     , m_ConvList(convList)
+    , m_TextMetric()
+    , m_TextMetricUpdated(false)
+    , m_Utf8TextSize(0)
 {
     m_AttachmentHandler.setListener(this);
 }
 
-void Body::create(Evas_Object *parent)
-{
-    BodyView::create(parent);
-
-}
-
-Page &Body::getDefaultPage()
-{
-    return static_cast<Page&>(BodyView::getDefaultPage());
-}
-
 Body::~Body()
 {
     if(m_pOnChangedIdler)
@@ -102,11 +67,15 @@ Body::~Body()
     }
 }
 
-Page &Body::createPage()
+bool Body::isEmpty() const
 {
-    Page *page = new Page(*this, m_WorkingDir);
-    BodyView::addText(*page, m_App.getMsgEngine().getSettings().getMaxMsgTextLen());
-    return *page;
+    return BodyView::isEmpty() && getComposeItem().isEmpty();
+}
+
+void Body::clear()
+{
+    BodyView::clear();
+    getComposeItem().clear();
 }
 
 void Body::setListener(IBodyListener *listener)
@@ -114,6 +83,19 @@ void Body::setListener(IBodyListener *listener)
     m_pListener = listener;
 }
 
+ComposeListItem &Body::getComposeItem()
+{
+    ComposeListItem &item = m_ConvList.getComposeItem();
+    if(item.getListener() != this)
+        item.setListener(this);
+    return item;
+}
+
+const ComposeListItem &Body::getComposeItem() const
+{
+    return const_cast<Body*>(this)->getComposeItem();
+}
+
 void Body::enableAutoFocusForAttachments(bool focus)
 {
     m_AutoFocusForAttachments = focus;
@@ -145,24 +127,11 @@ void Body::runFileProcessing()
 
 bool Body::isMms()
 {
-    if(m_MmsRecipFlag)
-        return true;
-
-    auto pages = getPages();
-
-    if(pages.size() > 1)
-        return true;
-
-    if(getAttachments().size() > 0)
+    if(m_MmsRecipFlag || !getComposeItem().isEmpty())
         return true;
 
-    for(PageView *page : pages)
-    {
-        if(static_cast<Page*>(page)->isMms())
-            return true;
-    }
-
-    return false;
+    updateTextMetricIfNeeded();
+    return m_TextMetric.isMms;
 }
 
 void Body::setMmsRecipFlag(bool value)
@@ -170,42 +139,39 @@ void Body::setMmsRecipFlag(bool value)
     m_MmsRecipFlag = value;
 }
 
+void Body::updateTextMetricIfNeeded()
+{
+    if(m_TextMetricUpdated)
+    {
+        std::string text = getPlainUtf8Text();
+        m_Utf8TextSize = text.length();
+        MsgEngine::calculateTextMetric(text, m_TextMetric);
+        m_TextMetricUpdated = false;
+    }
+}
+
 const MsgTextMetric &Body::getTextMetric()
 {
-    return static_cast<Page&>(getDefaultPage()).getTextMetric();
+    updateTextMetricIfNeeded();
+    return m_TextMetric;
 }
 
 long long Body::getMsgSize()
 {
-    // Attachments:
-    long long size = 0;
-    auto attachments = getAttachments();
-    for(BodyAttachmentViewItem *attachment : attachments)
-    {
-        long long fileSize = attachment->getFileSize();
-        if(fileSize > 0)
-            size += fileSize;
-    }
+    long long totalSize = 0;
 
-    // Pages:
-    auto pages = getPages();
-    for(PageView *pageView : pages)
+    // Attachments:
+    auto attachments = getComposeItem().getAttachments();
+    for(auto *attachment : attachments)
     {
-        size += static_cast<Page*>(pageView)->getSize();
+        totalSize += attachment->getFileSize();
     }
 
-    return size;
-}
-
-int Body::getAttachmentsCountTotal() const
-{
-    int count = getAttachments().size();
-
-    auto pages = getPages();
-    for(PageView *pageView : pages)
-        count += static_cast<Page*>(pageView)->getAttachmentsCount();
+    // Text:
+    updateTextMetricIfNeeded();
+    totalSize += isMms() ? m_Utf8TextSize : m_TextMetric.bytes;
 
-    return count;
+    return totalSize;
 }
 
 void Body::read(Message &msg)
@@ -227,88 +193,118 @@ void Body::write(const Message &msg)
 
 void Body::write(const MessageSMS &msg)
 {
-    TextPageViewItem *textItem = getTextItem(getDefaultPage());
-    assert(textItem);
-    if(textItem)
-        textItem->setText(msg.getText());
+    setText(msg.getText());
 }
 
 void Body::write(const MessageMms &msg)
 {
-    // Pages:
-    auto &pageList = msg.getPageList();
-    for(int i = 0; i < pageList.getLength(); ++i)
-    {
-        Page &page = i == 0 ? getDefaultPage() : static_cast<Page&>(*addPage());
-        page.write(pageList[i]);
-    }
-
-    // Attachments:
+    writeText(msg);
     writeAttachments(msg);
 }
 
+void Body::writeText(const Message &msg)
+{
+    setText(msg.getText());
+}
+
 void Body::writeAttachments(const MessageMms &msg)
 {
-    auto &attachmentList = msg.getAttachmentList();
-    for(int i = 0; i < attachmentList.getLength(); ++i)
+    // Pages:
+    const MsgPageList &pages = msg.getPageList();
+    int pageCount = pages.getLength();
+    for(int pageIndex = 0; pageIndex < pageCount; ++pageIndex)
     {
-        const MsgAttachment &attachment = attachmentList[i];
-        addAttachment(attachment.getFilePath(), attachment.getFileName());
+        const MsgPage &page = pages[pageIndex];
+
+        // Media:
+        const MsgMediaList &mediaList = page.getMediaList();
+        int mediaCount = mediaList.getLength();
+        for(int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex)
+        {
+            const MsgMedia &media = mediaList[mediaIndex];
+            std::string filePath = media.getFilePath();
+            if(!filePath.empty())
+            {
+                std::string mime = FileUtils::getMimeType(filePath);
+                if(mime != "text/plain") // Skip text on page
+                {
+                    std::string newFilePath = m_WorkingDir->addFile(filePath);
+                    getComposeItem().addAttachment(newFilePath);
+                }
+            }
+        }
+    }
+
+    // Attachments:
+    const MsgAttachmentList &attachments = msg.getAttachmentList();
+    int attachmentCount = attachments.getLength();
+    for(int i = 0; i < attachmentCount; ++i)
+    {
+        const MsgAttachment &attachment = attachments[i];
+        std::string filePath = attachment.getFilePath();
+        if(!filePath.empty())
+        {
+            std::string mime = FileUtils::getMimeType(filePath);
+            if(mime != "application/smil") // Skip SMIL layout
+            {
+                std::string newFilePath = m_WorkingDir->addFile(filePath);
+                getComposeItem().addAttachment(newFilePath);
+            }
+        }
     }
 }
 
-void Body::writeTextToFile(TextPageViewItem &item)
+void Body::writeTextToFile()
 {
-    if(item.getResourcePath().empty())
-        item.setResourcePath(m_WorkingDir->addTextFile(item.getPlainUtf8Text()));
+    if(m_MmsTextFilePath.empty())
+        m_MmsTextFilePath = m_WorkingDir->addTextFile(getPlainUtf8Text());
     else
-        FileUtils::writeTextFile(item.getResourcePath(), item.getPlainUtf8Text());
+        FileUtils::writeTextFile(m_MmsTextFilePath, getPlainUtf8Text());
 }
 
 void Body::read(MessageSMS &msg)
 {
-    TextPageViewItem *textItem = getTextItem(getDefaultPage());
-    assert(textItem);
-    if(textItem)
-        msg.setText(textItem->getPlainUtf8Text());
+    msg.setText(getPlainUtf8Text());
 }
 
 void Body::read(MessageMms &msg)
 {
-    // Pages:
-    auto pages = getPages();
-    for(PageView *page : pages)
-    {
-        MsgPage &msgPage = msg.addPage();
-        static_cast<Page*>(page)->read(msgPage);
-    }
-
-    // Attachments:
     readAttachments(msg);
+    readText(msg);
 }
 
 void Body::readAttachments(MessageMms &msg)
 {
-    auto attachments = getAttachments();
-    for(BodyAttachmentViewItem *attachView : attachments)
+    const int defaultPageDuration = 5; // sec
+    const auto &attachments = getComposeItem().getAttachments();
+    for(auto *attachment : attachments)
+    {
+        const std::string &filePath = attachment->getFilePath();
+        if(!filePath.empty())
+        {
+            MsgPage &msgPage = msg.addPage();
+            msgPage.setPageDuration(defaultPageDuration);
+            MsgMedia &media = msgPage.addMedia();
+            media.setFilePath(filePath);
+            media.setFileName(FileUtils::getFileName(filePath));
+        }
+    }
+}
+
+void Body::readText(MessageMms &msg)
+{
+    if(!isEmpty())
     {
-        std::string resPath= attachView->getResourcePath();
-        std::string mime = getMsgMediaTypeByFileExt(resPath).mime;
-        long long fileSize = FileUtils::getFileSize(resPath);
-
-        MsgAttachment &msgAttach = msg.addAttachment();
-        msgAttach.setFilePath(resPath);
-        msgAttach.setFileName(attachView->getFileName());
-        msgAttach.setFileSize((int)fileSize);
+        writeTextToFile();
+        MsgPage &msgPage = msg.addPage();
+        MsgMedia &media = msgPage.addMedia();
+        media.setFilePath(m_MmsTextFilePath);
     }
 }
 
 void Body::execCmd(const AppControlComposeRef &cmd)
 {
-    TextPageViewItem *textItem = getTextItem(getDefaultPage());
-    if(textItem)
-        textItem->setText(cmd->getMessageText());
-
+    setText(cmd->getMessageText());
     std::list<std::string> path = cmd->getFileList();
     if(!cmd->getVcfInfo().contactsIdList.empty())
         path.push_back(createVcfFile(cmd));
@@ -320,35 +316,16 @@ void Body::addAttachment(const std::string &filePath, const std::string &fileNam
 {
     std::string newFilePath = m_WorkingDir->addFile(filePath);
     if(!newFilePath.empty())
-    {
-        long long fileSize = FileUtils::getFileSize(newFilePath);
-        std::string newFileName = fileName.empty() ? FileUtils::getFileName(filePath) : fileName;
-        BodyView::addAttachment(newFilePath, fileSize, newFileName);
-        m_ConvList.getComposeItem()->addAttachment(newFilePath);
-    }
-}
-
-void Body::onItemDelete(PageViewItem &item)
-{
-    MSG_LOG("");
-    if(auto video = dynamic_cast<VideoPageViewItem*>(&item))
-        m_WorkingDir->removeFile(video->getImagePath());
-
-    m_WorkingDir->removeFile(item.getResourcePath());
-}
-
-void Body::onItemDelete(BodyAttachmentViewItem &item)
-{
-    m_WorkingDir->removeFile(item.getResourcePath());
+        getComposeItem().addAttachment(newFilePath);
 }
 
-void Body::onMaxLengthReached(TextPageViewItem &item)
+void Body::onMaxLengthReached()
 {
     MSG_LOG("");
     showMaxCharactersPopup();
 }
 
-void Body::onCheckBoundaryText(TextPageViewItem &item, char **text)
+void Body::onCheckBoundaryText(char **text)
 {
     MSG_LOG("");
     if(isMms())
@@ -364,25 +341,6 @@ void Body::onCheckBoundaryText(TextPageViewItem &item, char **text)
     }
 }
 
-void Body::onClicked(MediaPageViewItem &item)
-{
-    MSG_LOG("");
-    PopupList &popupList = createPopupList(item.getFileName());
-    popupList.appendItem(*new PopupBodyAttachmentListItem(popupList, msg("IDS_MSGF_OPT_REMOVE"), item,
-                POPUPLIST_ITEM_PRESSED_CB(Body, onRemoveMediaItemPressed), this));
-    popupList.show();
-}
-
-void Body::onClicked(BodyAttachmentViewItem &item)
-{
-    MSG_LOG("");
-    PopupList &popupList = createPopupList(item.getFileName());
-
-    popupList.appendItem(*new BodyAttachmentListItem(popupList, msg("IDS_MSGF_OPT_REMOVE"), item,
-                POPUPLIST_ITEM_PRESSED_CB(Body, onRemoveBodyItemPressed), this));
-    popupList.show();
-}
-
 PopupList &Body::createPopupList(const std::string &title)
 {
     PopupList &popupList = m_App.getPopupManager().getPopupList();
@@ -473,24 +431,6 @@ void Body::showMaxCharactersPopup()
     notification_status_message_post(notifText.c_str());
 }
 
-void Body::onRemoveMediaItemPressed(PopupListItem &item)
-{
-    MSG_LOG("");
-    PopupBodyAttachmentListItem &listItem = static_cast<PopupBodyAttachmentListItem&>(item);
-    PageViewItem &pageViewItem = listItem.getPageItem();
-    pageViewItem.destroy();
-    item.getParent().destroy();
-}
-
-void Body::onRemoveBodyItemPressed(PopupListItem &item)
-{
-    MSG_LOG("");
-    BodyAttachmentListItem &listItem = static_cast<BodyAttachmentListItem&>(item);
-    BodyAttachmentViewItem &bodyItem = listItem.getBodyItem();
-    bodyItem.destroy();
-    item.getParent().destroy();
-}
-
 void Body::onTooLargePopupDel(Evas_Object *obj, void *eventInfo)
 {
     MSG_LOG("");
@@ -531,7 +471,7 @@ std::string Body::createVcfFile(const AppControlComposeRef &cmd)
     return path;
 }
 
-void Body::onContentChanged()
+void Body::notifyContentChanged()
 {
     if(!m_pOnChangedIdler)
     {
@@ -550,9 +490,29 @@ void Body::onContentChanged()
     }
 }
 
+void Body::onContentChanged()
+{
+    m_TextMetricUpdated = true;
+    notifyContentChanged();
+}
+
+void Body::onAttachmentAdded(const std::list<std::string> &files)
+{
+    notifyContentChanged();
+}
+
+void Body::onAttachmentDeleted(const std::list<std::string> &files)
+{
+    for(const std::string &file : files)
+    {
+        m_WorkingDir->removeFile(file);
+    }
+    notifyContentChanged();
+}
+
 void Body::onFileReady(const std::string &filePath)
 {
-    int numAttached = getAttachmentsCountTotal();
+    int numAttached = getComposeItem().getAttachments().size();
     int numAttachMax = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount();
     if(numAttached == numAttachMax)
     {
@@ -564,26 +524,10 @@ void Body::onFileReady(const std::string &filePath)
     MediaTypeData mediaType = getMsgMediaTypeByFileExt(filePath);
     MSG_LOG("Media type: ", mediaType.mime);
 
-    m_ConvList.getComposeItem()->addAttachment(filePath);
-
-    Page *page = nullptr;
-    if(mediaType.type != MsgMedia::UnknownType && mediaType.type != MsgMedia::TextType)
-    {
-        page = static_cast<Page*>(getPageForMedia(msgMediaTypeToPageItemType(mediaType.type)));
-        if(!page)
-            return;
-
-        page->addMedia(filePath);
-
-    }
-    else
-    {
-        addAttachment(filePath);
-        page = &getDefaultPage();
-    }
+    getComposeItem().addAttachment(filePath);
 
-    if(page && m_AutoFocusForAttachments)
-        BodyView::setFocus(*page, true); // TODO: check for multi insertion
+    if(m_AutoFocusForAttachments)
+        BodyView::setFocus(true);
 
     m_SelectedFiles.pop();
     if(!m_SelectedFiles.empty())
diff --git a/src/Conversation/Body/Controller/src/Page.cpp b/src/Conversation/Body/Controller/src/Page.cpp
deleted file mode 100644 (file)
index 8d96e9d..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * 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 "Page.h"
-#include "PageView.h"
-#include "Body.h"
-#include "Logger.h"
-#include "MsgEngine.h"
-#include "TextPageViewItem.h"
-#include "MediaPageViewItem.h"
-#include "FileUtils.h"
-#include "MediaUtils.h"
-#include "MediaType.h"
-
-using namespace Msg;
-
-namespace
-{
-    const int defaultPageDuration = 5; // sec
-}
-
-Page::Page(Body &parent, WorkingDirRef workingDir)
-    : PageView(parent)
-    , m_Body(parent)
-    , m_MsgMetric()
-    , m_WorkingDir(workingDir)
-    , m_Utf8TextSize(0)
-{
-}
-
-Page::~Page()
-{
-}
-
-const MsgTextMetric &Page::getTextMetric()
-{
-    updateMsgMetricIfNeeded();
-    return m_MsgMetric;
-}
-
-void Page::updateMsgMetricIfNeeded()
-{
-    TextPageViewItem *item = static_cast<TextPageViewItem*>(getItem(PageViewItem::TextType));
-    if(item)
-    {
-        if(item->hasChanged())
-        {
-            std::string text = item->getPlainUtf8Text();
-            m_Utf8TextSize = text.length();
-            MsgEngine::calculateTextMetric(text, m_MsgMetric);
-            item->resetChangedFlag();
-        }
-    }
-    else
-    {
-        m_MsgMetric.reset();
-    }
-}
-
-long long Page::getSize()
-{
-    long long totalSize = 0;
-    auto items = getItems();
-    for(PageViewItem *item : items)
-    {
-        MediaPageViewItem *mediaItem = dynamic_cast<MediaPageViewItem*>(item);
-        if(mediaItem)
-        {
-            int size = mediaItem->getFileSize();
-            if(size > 0)
-                totalSize += size;
-        }
-    }
-    updateMsgMetricIfNeeded();
-    totalSize += m_Body.isMms() ? m_Utf8TextSize : m_MsgMetric.bytes;
-    return totalSize;
-}
-
-int Page::getAttachmentsCount() const
-{
-    int res = 0;
-    auto items = getItems();
-    for(PageViewItem *item : items)
-    {
-        MediaPageViewItem *mediaItem = dynamic_cast<MediaPageViewItem*>(item);
-        if(mediaItem)
-            ++res;
-    }
-    return res;
-}
-
-bool Page::isMms()
-{
-    auto pageItems = getItems();
-    for(PageViewItem *pageItem : pageItems)
-    {
-        PageViewItem::Type itemType = pageItem->getType();
-        if(itemType != PageViewItem::TextType)
-            return true;
-    }
-
-    updateMsgMetricIfNeeded();
-    return m_MsgMetric.isMms;
-}
-
-bool Page::addMedia(const std::string &filePath)
-{
-    MediaTypeData typeData = getMsgMediaTypeByFileExt(filePath);
-    MSG_LOG("Media type: ", typeData.mime);
-
-   switch(typeData.type)
-   {
-       case MsgMedia::ImageType:
-       {
-           addImage(filePath);
-           break;
-       }
-
-       case MsgMedia::AudioType:
-       {
-           addSound(filePath);
-           break;
-       }
-
-       case MsgMedia::VideoType:
-       {
-           addVideo(filePath);
-           break;
-       }
-
-       default:
-           MSG_LOG_WARN("Can't add type: ", typeData.mime);
-           return false;
-           break;
-   }
-
-   return true;
-}
-
-void Page::write(const MsgPage &msgPage)
-{
-    auto &mediaList = msgPage.getMediaList();
-    for(int i = 0; i < mediaList.getLength(); ++i)
-    {
-        const MsgMedia &msgMedia = mediaList[i];
-        switch(msgMedia.getType())
-        {
-            case MsgMedia::TextType:
-                writeText(msgMedia);
-                break;
-            case MsgMedia::ImageType:
-                writeImage(msgMedia);
-                break;
-            case MsgMedia::AudioType:
-                writeSound(msgMedia);
-                break;
-            case MsgMedia::VideoType:
-                writeVideo(msgMedia);
-                break;
-
-            default:
-                MSG_LOG_WARN("Skip unsupported Smil type");
-                break;
-        }
-    }
-}
-
-void Page::writeText(const MsgMedia &msgMedia)
-{
-    TextPageViewItem *textItem = static_cast<TextPageViewItem*>(getItem(PageViewItem::TextType));;
-    assert(textItem);
-    if(textItem)
-        textItem->setText(FileUtils::readTextFile(msgMedia.getFilePath()));
-}
-
-void Page::writeImage(const MsgMedia &msgMedia)
-{
-    addImage(msgMedia.getFilePath());
-}
-
-void Page::writeVideo(const MsgMedia &msgMedia)
-{
-    addVideo(msgMedia.getFilePath());
-}
-
-void Page::writeSound(const MsgMedia &msgMedia)
-{
-    addSound(msgMedia.getFilePath(), msgMedia.getFileName());
-}
-
-void Page::writeTextToFile(TextPageViewItem &item)
-{
-    if(item.getResourcePath().empty())
-        item.setResourcePath(m_WorkingDir->addTextFile(item.getPlainUtf8Text()));
-    else
-        FileUtils::writeTextFile(item.getResourcePath(), item.getPlainUtf8Text());
-}
-
-void Page::read(MsgPage &msgPage)
-{
-    readText(msgPage);
-    readImage(msgPage);
-    readVideo(msgPage);
-    readSound(msgPage);
-
-    if(msgPage.getPageDuration() < defaultPageDuration)
-        msgPage.setPageDuration(defaultPageDuration);
-}
-
-void Page::readText(MsgPage &msgPage)
-{
-    TextPageViewItem *textItem = static_cast<TextPageViewItem*>(getItem(PageViewItem::TextType));
-    if(textItem && !textItem->isEmpty())
-    {
-        writeTextToFile(*textItem);
-        MsgMedia &media = msgPage.addMedia();
-        media.setFilePath(textItem->getResourcePath());
-    }
-}
-
-void Page::readSound(MsgPage &msgPage)
-{
-    SoundPageViewItem *soundItem = static_cast<SoundPageViewItem*>(getItem(PageViewItem::SoundType));
-    if(soundItem)
-    {
-        MsgMedia &media = msgPage.addMedia();
-        media.setFilePath(soundItem->getResourcePath());
-        int sec = MediaUtils::getDurationSec(soundItem->getResourcePath());
-        if(msgPage.getPageDuration() < sec)
-            msgPage.setPageDuration(sec);
-    }
-}
-
-void Page::readImage(MsgPage &msgPage)
-{
-    ImagePageViewItem *imgItem = static_cast<ImagePageViewItem*>(getItem(PageViewItem::ImageType));
-    if(imgItem)
-    {
-        MsgMedia &media = msgPage.addMedia();
-        media.setFilePath(imgItem->getResourcePath());
-    }
-}
-
-void Page::readVideo(MsgPage &msgPage)
-{
-    VideoPageViewItem *videoItem = static_cast<VideoPageViewItem*>(getItem(PageViewItem::VideoType));
-    if(videoItem)
-    {
-        MsgMedia &media = msgPage.addMedia();
-        media.setFilePath(videoItem->getResourcePath());
-        int sec = MediaUtils::getDurationSec(videoItem->getResourcePath());
-        if(msgPage.getPageDuration() < sec)
-            msgPage.setPageDuration(sec);
-    }
-}
-
-void Page::addVideo(const std::string &videoFilePath)
-{
-    const std::string thumbFileName = "thumbnail.jpeg";
-    std::string thumbFilePath =  m_WorkingDir->genUniqueFilePath(thumbFileName);
-    std::string newVideoFilePath = m_WorkingDir->addFile(videoFilePath);
-
-    if(!newVideoFilePath.empty())
-    {
-        long long fileSize = FileUtils::getFileSize(newVideoFilePath);
-        // FIXME: if getVideoFrame returns false ?
-        MediaUtils::getVideoFrame(videoFilePath, thumbFilePath);
-        m_Body.addVideo(*this, newVideoFilePath, fileSize, thumbFilePath);
-    }
-}
-
-void Page::addImage(const std::string &filePath)
-{
-    std::string newFilePath = m_WorkingDir->addFile(filePath);
-    if(!newFilePath.empty())
-    {
-        long long fileSize = FileUtils::getFileSize(newFilePath);
-        m_Body.addImage(*this, newFilePath, fileSize);
-    }
-}
-
-void Page::addSound(const std::string &filePath, const std::string &fileName)
-{
-    std::string newFilePath = m_WorkingDir->addFile(filePath);
-    if(!newFilePath.empty())
-    {
-        long long fileSize = FileUtils::getFileSize(newFilePath);
-        std::string newFileName = fileName.empty() ? FileUtils::getFileName(filePath) : fileName;
-        m_Body.addSound(*this, newFilePath, fileSize, newFileName);
-    }
-}
-
diff --git a/src/Conversation/Body/Controller/src/PopupBodyAttachmentListItem.cpp b/src/Conversation/Body/Controller/src/PopupBodyAttachmentListItem.cpp
deleted file mode 100644 (file)
index c8b26a3..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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 "PopupBodyAttachmentListItem.h"
-#include "BodyAttachmentViewItem.h"
-
-using namespace Msg;
-
-PopupBodyAttachmentListItem::PopupBodyAttachmentListItem(PopupList &parent,
-        const std::string &text,
-        PageViewItem &pageItem,
-        PopupListItemPressedCb cb,
-        void *userData)
-    : PopupTextListItem(parent, text, cb, userData)
-    , m_PageItem(pageItem)
-{
-}
-
-PopupBodyAttachmentListItem::~PopupBodyAttachmentListItem()
-{
-}
-
-PageViewItem &PopupBodyAttachmentListItem::getPageItem()
-{
-    return m_PageItem;
-}
-
-BodyAttachmentListItem::BodyAttachmentListItem(PopupList &parent,
-        const std::string &text,
-        BodyAttachmentViewItem &bodyItem,
-        PopupListItemPressedCb cb,
-        void *userData)
-    : PopupTextListItem(parent, text, cb, userData)
-    , m_BodyItem(bodyItem)
-{
-}
-
-BodyAttachmentListItem::~BodyAttachmentListItem()
-{
-}
-
-BodyAttachmentViewItem &BodyAttachmentListItem::getBodyItem()
-{
-    return m_BodyItem;
-}
diff --git a/src/Conversation/Body/View/inc/BodyAttachmentViewItem.h b/src/Conversation/Body/View/inc/BodyAttachmentViewItem.h
deleted file mode 100644 (file)
index c51d649..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 BodyAttachmentViewItem_h_
-#define BodyAttachmentViewItem_h_
-
-#include "BodyViewItem.h"
-
-namespace Msg
-{
-    class BodyView;
-    class IBodyAttachmentViewListener;
-
-    class BodyAttachmentViewItem
-        : public BodyViewItem
-    {
-        public:
-            BodyAttachmentViewItem(BodyView &parent, const std::string &resourePath, long long fileSize, const std::string &dispName = "");
-            virtual ~BodyAttachmentViewItem();
-
-            void setListener(IBodyAttachmentViewListener *listener);
-            const std::string &getResourcePath() const;
-            const std::string &getFileName() const;
-            long long getFileSize() const;
-
-        private:
-            Evas_Object *createLayout(Evas_Object *parent);
-            Evas_Object *createButton(Evas_Object *parent);
-            Evas_Object *createLabel(Evas_Object *parent, const std::string &name);
-
-        private:
-            Evas_Object *m_pLayaout;
-            IBodyAttachmentViewListener *m_pListener;
-            const std::string m_ResourePath;
-            std::string m_FileName;
-            long long m_FileSize;
-    };
-
-    class IBodyAttachmentViewListener
-    {
-        public:
-            virtual ~IBodyAttachmentViewListener() {}
-            virtual void onClicked(BodyAttachmentViewItem &item) {};
-            virtual void onDelete(BodyAttachmentViewItem &item) {};
-    };
-}
-
-#endif /* BodyAttachmentViewItem_h_ */
index 9d0c811e59ab4817c3505cb6ee1a3999824b2a50..1d6ab7af8c5abcaff5fe14aff404ac614011349b 100644 (file)
 #define BodyView_h_
 
 #include "View.h"
-#include "BodyViewItem.h"
-#include "MediaPageViewItem.h"
-#include "TextPageViewItem.h"
-#include "ImagePageViewItem.h"
-#include "SoundPageViewItem.h"
-#include "VideoPageViewItem.h"
-#include "BodyAttachmentViewItem.h"
 
 #include <vector>
 
 namespace Msg
 {
-    class PageView;
-    class PageSeparator;
-
-    typedef std::vector<PageView*> PageViewCollection;
-    typedef std::vector<BodyAttachmentViewItem*> BodyAttachmentCollection;
-    typedef std::vector<BodyViewItem*> BodyViewItemCollection;
-
     class BodyView
         : public View
-        , private ITextPageViewItemListener
-        , private IMediaPageViewItemListener
-        , private IBodyAttachmentViewListener
     {
-        friend class PageView;
-
         public:
-            BodyView();
+            BodyView(Evas_Object *parent, int maxCharCount);
             virtual ~BodyView();
 
-            void create(Evas_Object *parent);
             bool isEmpty() const;
             void clear();
             void setFocus(bool focus);
-            const PageView &getDefaultPage() const;
-            PageView &getDefaultPage();
-            PageViewCollection getPages() const;
-            int getPageCount() const;
-            PageView *getNextPage(PageView &page) const;
-            PageView *getPrevPage(PageView &page) const;
-            PageView *addPage();
-            BodyAttachmentCollection getAttachments() const;
-
-            TextPageViewItem *addText(PageView &page, int maxCharCount);
-            ImagePageViewItem *addImage(PageView &page, const std::string &filePath, long long fileSize);
-            VideoPageViewItem *addVideo(PageView &page, const std::string &filePath, long long fileSize, const std::string &imagePath);
-            SoundPageViewItem *addSound(PageView &page, const std::string &filePath, long long fileSize, const std::string &dispName = "");
+            void setText(const std::string &text);
+            std::string getText() const;
+            std::string getPlainUtf8Text() const;
 
         protected:
-            virtual PageView &createPage() = 0;
-
-            BodyAttachmentViewItem *addAttachment(const std::string &filePath, long long fileSize, const std::string &dispName = "");
-            PageView *getPageForMedia(PageViewItem::Type type);
-            void setFocus(PageView &page, bool focus);
-
-        private:
-            /*====Input signals====*/
-
-            void onContentBoxGeometryChanged(Evas_Object *obj, void *event_info);
-
-            // ITextPageViewItemListener:
-            virtual void onCursorChanged(TextPageViewItem &item);
-            virtual void onFocused(TextPageViewItem &item);
-            virtual void onUnfocused(TextPageViewItem &item);
-            virtual void onPreeditChanged(TextPageViewItem &item);
-            virtual void onPress(TextPageViewItem &item);
-            virtual void onClicked(TextPageViewItem &item);
-            virtual void onKeyDown(TextPageViewItem &obj, Evas_Event_Key_Down &event);
-            virtual void onKeyUp(TextPageViewItem &obj, Evas_Event_Key_Up &event);
-            virtual void onChanged(TextPageViewItem &item);
-
-            // IMediaPageViewItemListener:
-            virtual void onDelete(PageViewItem &item);
-            virtual void onPressed(MediaPageViewItem &item);
-            virtual void onUnpressed(MediaPageViewItem &item);
-            virtual void onFocused(MediaPageViewItem &item);
-            virtual void onUnfocused(MediaPageViewItem &item);
-            virtual void onKeyDown(MediaPageViewItem &item, Evas_Event_Key_Down &event);
-            virtual void onKeyUp(MediaPageViewItem &item, Evas_Event_Key_Up &event);
-
-            // IBodyAttachmentViewListener:
-            virtual void onDelete(BodyAttachmentViewItem &item);
-
-            /*====Output signals====*/
             virtual void onContentChanged() {};
-            virtual void onItemDelete(PageViewItem &item) {};
-            virtual void onItemDelete(BodyAttachmentViewItem &item) {};
-            virtual void onClicked(BodyAttachmentViewItem &item) {};
-            virtual void onClicked(MediaPageViewItem &item) {};
+            virtual void onMaxLengthReached() {};
+            virtual void onCheckBoundaryText(char **text) {};
 
         private:
-            template<typename T>
-            std::vector<T*> getItems() const;
-            BodyViewItemCollection getAllItems() const;
-            int getItemCount(BodyViewItem::Type type) const;
-            void showInputPanel(PageView &page, bool show);
-            void showInputPanel(PageViewItem &pageItem, bool show);
-            void removePage(PageView &page, bool setNextFocus);
-            void removeAttachment(BodyAttachmentViewItem &attachment);
-            void updateLastFocusedPage(PageViewItem &pageItem);
-            void backKeyHandler(MediaPageViewItem &item);
-            void backKeyHandler(TextPageViewItem &item);
-            void clear(PageView &page);
-            void prepare(BodyViewItem &item);
-            void insertAfter(BodyViewItem &item, BodyViewItem &after);
-            void insertBefore(BodyViewItem &item, BodyViewItem &before);
-            void append(BodyViewItem &item);
-            void remove(BodyViewItem &item);
-            void rebuildSeparators();
-            void updateSeparators();
-            PageSeparator *createSep();
+            Evas_Object *createEntry(Evas_Object *parent, int maxCharCount);
             Evas_Object *createContentBox(Evas_Object *parent);
-            void updateSep(PageSeparator &sep, int number, int maxNumber);
+
+            void onContentBoxGeometryChanged(Evas_Object *obj, void *eventInfo);
 
         private:
             Evas_Object *m_pRootBox;
             Evas_Object *m_pContentBox;
             Evas_Object *m_pScroller;
-            BodyViewItemCollection m_Items;
-            PageView *m_pDefaultPage;
-            int m_LastTextCursorPos;
-            PageView *m_pLastFocusedPage;
+            Evas_Object *m_pEntry;
     };
 }
 
diff --git a/src/Conversation/Body/View/inc/BodyViewItem.h b/src/Conversation/Body/View/inc/BodyViewItem.h
deleted file mode 100644 (file)
index 7ec90ec..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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 BodyViewItem_h_
-#define BodyViewItem_h_
-
-#include "View.h"
-
-namespace Msg
-{
-    class BodyViewItem
-        : public View
-    {
-        public:
-            enum Type
-            {
-                SeparatorType,
-                PageType,
-                AttachmentType
-            };
-
-        public:
-            BodyViewItem(Type type);
-            virtual ~BodyViewItem();
-
-            Type getType() const;
-
-        protected:
-            std::string getEdjPath() const;
-
-        private:
-            Type m_Type;
-    };
-}
-
-#endif /* BodyViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/ImagePageViewItem.h b/src/Conversation/Body/View/inc/ImagePageViewItem.h
deleted file mode 100644 (file)
index ea752ca..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 ImagePageViewItem_h_
-#define ImagePageViewItem_h_
-
-#include "MediaPageViewItem.h"
-
-#include <vector>
-
-namespace Msg
-{
-    class ImagePageViewItem
-        : public MediaPageViewItem
-    {
-        public:
-            ImagePageViewItem(PageView &parent, const std::string &reourcePath, long long fileSize, const std::string &imagePath);
-            virtual ~ImagePageViewItem();
-
-            void showPlayIcon();
-            const std::string &getImagePath() const;
-            virtual Type getType() const;
-            virtual bool isEmpty() const;
-            virtual void highlight(bool value);
-            virtual std::string getFileName() const;
-
-        private:
-            Evas_Object *createImageLayout(Evas_Object *parent);
-            Evas_Object *createRect(Evas_Object *parent);
-            Evas_Object *createImage(Evas_Object *parent);
-
-        private:
-            Evas_Object *m_pImageLayout;
-            const std::string m_ImagePath;
-    };
-}
-
-#endif /* ImagePageViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/MediaPageViewItem.h b/src/Conversation/Body/View/inc/MediaPageViewItem.h
deleted file mode 100644 (file)
index 5a31818..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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 MediaPageViewItem_h_
-#define MediaPageViewItem_h_
-
-#include "PageViewItem.h"
-
-#include <vector>
-
-namespace Msg
-{
-    class IMediaPageViewItemListener;
-
-    class MediaPageViewItem
-        : public PageViewItem
-    {
-        public:
-            MediaPageViewItem(PageView &parent, const std::string &resourcePath, long long fileSize);
-            virtual ~MediaPageViewItem();
-
-            void setListener(IMediaPageViewItemListener *l);
-            long long getFileSize() const;
-            virtual void highlight(bool value) = 0;
-
-            virtual std::string getFileName() const = 0;
-        protected:
-            Evas_Object *getMediaLayout() const;
-            Evas_Object *getButtonLayout() const;
-            void setButtonContent(Evas_Object *layout);
-            void setRect(Evas_Object *layout);
-
-        private:
-
-            Evas_Object *createMainLayout(Evas_Object *parent);
-            Evas_Object *createButton(Evas_Object *parent);
-            Evas_Object *createRect(Evas_Object *parent);
-            Evas_Object *createGestureLayer(Evas_Object *parent);
-
-            template<class...Args>
-            static void notifyListener(void *data, void (IMediaPageViewItemListener::*method)(MediaPageViewItem &, Args...args), Args&&...args);
-
-        private:
-            IMediaPageViewItemListener *m_pListener;
-            Evas_Object *m_pButton;
-            long long m_FileSize;
-    };
-
-    class IMediaPageViewItemListener
-        : public IPageViewItemListener
-    {
-        public:
-            virtual ~IMediaPageViewItemListener() {}
-
-            virtual void onClicked(MediaPageViewItem &item) {};
-            virtual void onPressed(MediaPageViewItem &item) {};
-            virtual void onUnpressed(MediaPageViewItem &item) {};
-            virtual void onFocused(MediaPageViewItem &item) {};
-            virtual void onUnfocused(MediaPageViewItem &item) {};
-            virtual void onKeyDown(MediaPageViewItem &item, Evas_Event_Key_Down &event) {};
-            virtual void onKeyUp(MediaPageViewItem &item, Evas_Event_Key_Up &event) {};
-    };
-}
-
-#endif /* MediaPageViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/PageSeparator.h b/src/Conversation/Body/View/inc/PageSeparator.h
deleted file mode 100644 (file)
index 3b54bb4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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 PageSeparator_h_
-#define PageSeparator_h_
-
-#include "BodyViewItem.h"
-
-namespace Msg
-{
-    class BodyView;
-
-    class PageSeparator
-        : public BodyViewItem
-    {
-        public:
-            PageSeparator(BodyView &parent);
-            virtual ~PageSeparator();
-
-            void setText(const std::string &text);
-
-        private:
-            Evas_Object *m_pTextLayout;
-    };
-}
-
-#endif /* PageSeparator_h_ */
diff --git a/src/Conversation/Body/View/inc/PageView.h b/src/Conversation/Body/View/inc/PageView.h
deleted file mode 100644 (file)
index 42980ec..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 PageView_h_
-#define PageView_h_
-
-#include "BodyViewItem.h"
-#include "PageViewItem.h"
-
-#include <vector>
-#include <map>
-
-namespace Msg
-{
-    class BodyView;
-    class PageView
-        : public BodyViewItem
-    {
-        public:
-            typedef std::vector<PageViewItem*> ItemList;
-
-        public:
-            PageView(BodyView &parent);
-            virtual ~PageView();
-
-            bool hasMedia() const;
-            ItemList getItems() const;
-            bool canItemBeAdded(PageViewItem::Type type) const;
-            void addItem(PageViewItem &item);
-            void removeItem(PageViewItem &item);
-            PageViewItem *getItem(PageViewItem::Type type) const;
-            bool isEmpty() const;
-            Evas_Object *getItemParent() const;
-
-        private:
-            typedef std::map<PageViewItem::Type, PageViewItem*> PageItemMap;
-
-            Evas_Object *createMainLayout(Evas_Object *parent);
-            Evas_Object *createLayout(Evas_Object *parent);
-            Evas_Object *createBox(Evas_Object *parent);
-
-        private:
-            Evas_Object *m_pBox;
-            PageItemMap m_PageItemMap;
-    };
-}
-
-#endif /* PageView_h_ */
diff --git a/src/Conversation/Body/View/inc/PageViewItem.h b/src/Conversation/Body/View/inc/PageViewItem.h
deleted file mode 100644 (file)
index 07f6910..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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 PageViewItem_h_
-#define PageViewItem_h_
-
-#include "View.h"
-
-namespace Msg
-{
-    class PageView;
-    class IPageViewItemListener;
-
-    class PageViewItem
-        : public View
-    {
-        public:
-            enum Type
-            {
-                UnknownType,
-                TextType,
-                ImageType,
-                SoundType,
-                VideoType
-            };
-
-        public:
-            PageViewItem(PageView &parent, const std::string &resourcePath = "");
-            virtual ~PageViewItem();
-
-            virtual Type getType() const = 0;
-            virtual bool isEmpty() const = 0;
-
-            void setListener(IPageViewItemListener *l);
-            void setResourcePath(const std::string &resourcePath);
-            const std::string &getResourcePath() const;
-            const PageView &getParentPage() const;
-            PageView &getParentPage();
-            void destroy();
-
-        protected:
-            const std::string &getEdjPath() const;
-
-            virtual void onBeforeDelete(View &view);
-
-        private:
-            PageView &m_Parent;
-            std::string m_ResourcePath;
-            IPageViewItemListener *m_pListener;
-    };
-
-    class IPageViewItemListener
-    {
-        public:
-            virtual ~IPageViewItemListener() {}
-            virtual void onDelete(PageViewItem &item) {};
-    };
-}
-
-#endif /* PageViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/SoundPageViewItem.h b/src/Conversation/Body/View/inc/SoundPageViewItem.h
deleted file mode 100644 (file)
index d92e3b2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 SoundPageViewItem_h_
-#define SoundPageViewItem_h_
-
-#include "MediaPageViewItem.h"
-
-namespace Msg
-{
-    class SoundPageViewItem
-        : public MediaPageViewItem
-    {
-        public:
-            SoundPageViewItem(PageView &parent, const std::string &resourcePath, long long fileSize, const std::string &dispName = "");
-            virtual ~SoundPageViewItem();
-
-            virtual Type getType() const;
-            virtual bool isEmpty() const;
-            virtual void highlight(bool value);
-            virtual std::string getFileName() const;
-
-        private:
-            Evas_Object *createLabel(Evas_Object *parent, const std::string &fileName);
-
-        private:
-            std::string m_DispName;
-    };
-}
-
-#endif /* SoundPageViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/TextPageViewItem.h b/src/Conversation/Body/View/inc/TextPageViewItem.h
deleted file mode 100644 (file)
index 5829803..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 TextPageViewItem_h_
-#define TextPageViewItem_h_
-
-#include "PageViewItem.h"
-#include "LangUtils.h"
-
-namespace Msg
-{
-    class ITextPageViewItemListener;
-
-    class TextPageViewItem
-        : public PageViewItem
-    {
-        public:
-            TextPageViewItem(PageView &parent, int maxCharCount);
-            virtual ~TextPageViewItem();
-
-            virtual Type getType() const;
-            virtual bool isEmpty() const;
-            void resetChangedFlag();
-            bool hasChanged() const;
-
-            void showInputPanel(bool show);
-            int getCursorPos() const;
-            void setCursorPos(int pos);
-            void setEndCursorPos();
-            void setBeginCursorPos();
-            void setListener(ITextPageViewItemListener *l);
-            void setGuideText(const TText &text);
-            void clear();
-            std::string getText() const;
-            std::string getPlainUtf8Text() const;
-            void setText(const std::string &text);
-
-        private:
-            Evas_Object *createEntry(Evas_Object *parent, int maxCharCount);
-            static void entryFilterCheckBoundary(void *data, Evas_Object *entry, char **text);
-
-            template<class...Args>
-            static void notifyListener(void *data, void (ITextPageViewItemListener::*method)(TextPageViewItem &, Args...args), Args&&...args);
-
-        private:
-            Evas_Object *m_pEntry;
-            ITextPageViewItemListener *m_pListener;
-            bool m_Changed;
-    };
-
-    class ITextPageViewItemListener
-    {
-        public:
-            virtual ~ITextPageViewItemListener() {}
-            virtual void onCursorChanged(TextPageViewItem &obj) {};
-            virtual void onFocused(TextPageViewItem &obj) {};
-            virtual void onUnfocused(TextPageViewItem &obj) {};
-            virtual void onChanged(TextPageViewItem &obj) {};
-            virtual void onPreeditChanged(TextPageViewItem &obj) {};
-            virtual void onPress(TextPageViewItem &obj) {};
-            virtual void onClicked(TextPageViewItem &obj) {};
-            virtual void onMaxLengthReached(TextPageViewItem &obj) {};
-            virtual void onKeyDown(TextPageViewItem &obj, Evas_Event_Key_Down &event) {};
-            virtual void onKeyUp(TextPageViewItem &obj, Evas_Event_Key_Up &event) {};
-            virtual void onCheckBoundaryText(TextPageViewItem &obj, char **text) {};
-    };
-}
-
-#endif /* TextPageViewItem_h_ */
diff --git a/src/Conversation/Body/View/inc/VideoPageViewItem.h b/src/Conversation/Body/View/inc/VideoPageViewItem.h
deleted file mode 100644 (file)
index b1239e9..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 VideoPageViewItem_h_
-#define VideoPageViewItem_h_
-
-#include "ImagePageViewItem.h"
-
-#include <vector>
-
-namespace Msg
-{
-    class VideoPageViewItem
-        : public ImagePageViewItem
-    {
-        public:
-            VideoPageViewItem(PageView &parent, const std::string &reourcePath, long long fileSize, const std::string &imagePath);
-            virtual ~VideoPageViewItem();
-
-            virtual Type getType() const;
-            virtual std::string getFileName() const;
-    };
-}
-
-#endif /* VideoPageViewItem_h_ */
diff --git a/src/Conversation/Body/View/src/BodyAttachmentViewItem.cpp b/src/Conversation/Body/View/src/BodyAttachmentViewItem.cpp
deleted file mode 100644 (file)
index 2ab2c3d..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 "BodyAttachmentViewItem.h"
-#include "BodyView.h"
-#include "FileUtils.h"
-#include "Logger.h"
-
-using namespace Msg;
-
-namespace
-{
-    const char *mediaMainGroup = "conv/body/media_main";
-    const char *mediaMainSwlContent = "swl.content";
-    const char *buttonStyle = "focus";
-    const char *buttonSwlContent = "elm.swallow.content";
-    const char *labelLayout = "conv/body/media_label";
-    const char *fileNamePart = "text.filename";
-}
-
-BodyAttachmentViewItem::BodyAttachmentViewItem(BodyView &parent, const std::string &resourePath, long long fileSize, const std::string &dispName)
-    : BodyViewItem(AttachmentType)
-    , m_pLayaout(nullptr)
-    , m_pListener(nullptr)
-    , m_ResourePath(resourePath)
-    , m_FileName(dispName)
-    , m_FileSize(fileSize)
-{
-    setEo(createLayout(parent));
-    Evas_Object *button = createButton(getEo());
-    Evas_Object *label = createLabel(button, m_FileName);
-
-    elm_layout_content_set(button, buttonSwlContent, label);
-    setContent(button, mediaMainSwlContent);
-}
-
-BodyAttachmentViewItem::~BodyAttachmentViewItem()
-{
-    if(m_pListener)
-        m_pListener->onDelete(*this);
-}
-
-void BodyAttachmentViewItem::setListener(IBodyAttachmentViewListener *listener)
-{
-    m_pListener = listener;
-}
-
-const std::string &BodyAttachmentViewItem::getResourcePath() const
-{
-   return m_ResourePath;
-}
-
-const std::string &BodyAttachmentViewItem::getFileName() const
-{
-    return m_FileName;
-}
-
-long long BodyAttachmentViewItem::getFileSize() const
-{
-    return m_FileSize;
-}
-
-Evas_Object *BodyAttachmentViewItem::createLayout(Evas_Object *parent)
-{
-    m_pLayaout = elm_layout_add(parent);
-    elm_layout_file_set(m_pLayaout, getEdjPath().c_str(), mediaMainGroup);
-    expand(m_pLayaout);
-    evas_object_show(m_pLayaout);
-    return m_pLayaout;
-}
-
-Evas_Object *BodyAttachmentViewItem::createButton(Evas_Object *parent)
-{
-    Evas_Object *button = elm_button_add(parent);
-    elm_object_style_set(button, buttonStyle);
-    evas_object_show(button);
-
-    evas_object_smart_callback_add(button, "clicked", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        BodyAttachmentViewItem *self = (BodyAttachmentViewItem*)data;
-        if(self && self->m_pListener)
-            self->m_pListener->onClicked(*self);
-    }, this);
-
-    return button;
-}
-
-Evas_Object *BodyAttachmentViewItem::createLabel(Evas_Object *parent, const std::string &fileName)
-{
-    Evas_Object *layout = elm_layout_add(parent);
-    elm_layout_file_set(layout, getEdjPath().c_str(), labelLayout);
-    elm_object_part_text_set(layout, fileNamePart, fileName.c_str());
-    evas_object_show(layout);
-    return layout;
-}
index da76c180edc6bca54550be0dbe326d4b990f02f0..1366839bcbfba1759120f3f999635532731838e8 100644 (file)
  */
 
 #include "BodyView.h"
-#include "PageView.h"
-#include "PageSeparator.h"
 #include "Logger.h"
-#include "MediaType.h"
+#include "LangUtils.h"
 
 #include <assert.h>
 #include <algorithm>
+#include <efl_extension.h>
 
 using namespace Msg;
 
@@ -36,22 +35,11 @@ namespace
     }
 }
 
-BodyView::BodyView()
+BodyView::BodyView(Evas_Object *parent, int maxCharCount)
     : m_pRootBox(nullptr)
     , m_pContentBox(nullptr)
     , m_pScroller(nullptr)
-    , m_pDefaultPage(nullptr)
-    , m_LastTextCursorPos(0)
-    , m_pLastFocusedPage(nullptr)
-{
-}
-
-BodyView::~BodyView()
-{
-
-}
-
-void BodyView::create(Evas_Object *parent)
+    , m_pEntry(nullptr)
 {
     // Root box:
     m_pRootBox = elm_box_add(parent);
@@ -69,7 +57,11 @@ void BodyView::create(Evas_Object *parent)
     elm_box_pack_end(m_pRootBox, m_pScroller);
     elm_object_content_set(m_pScroller, contentBox);
 
-    m_pDefaultPage = addPage();
+    elm_box_pack_end(contentBox, createEntry(contentBox, maxCharCount));
+}
+
+BodyView::~BodyView()
+{
 }
 
 Evas_Object *BodyView::createContentBox(Evas_Object *parent)
@@ -85,526 +77,117 @@ Evas_Object *BodyView::createContentBox(Evas_Object *parent)
     return m_pContentBox;
 }
 
-void BodyView::onContentBoxGeometryChanged(Evas_Object *obj, void *event_info)
-{
-    int w = 0;
-    int h = 0;
-
-    evas_object_geometry_get(m_pContentBox, nullptr, nullptr, &w, &h);
-    MSG_LOG(h);
-
-    if(h > maxBodyHeight)
-        h = maxBodyHeight;
-
-    evas_object_size_hint_min_set(m_pRootBox, w, h);
-    evas_object_size_hint_max_set(m_pRootBox, w, h);
-}
-
-const PageView &BodyView::getDefaultPage() const
-{
-    assert(m_pDefaultPage);
-    return *m_pDefaultPage;
-}
-
-PageView &BodyView::getDefaultPage()
-{
-    assert(m_pDefaultPage);
-    return *m_pDefaultPage;
-}
-
 bool BodyView::isEmpty() const
 {
-    const auto pages = getPages();
-
-    if(pages.size() > 1)
-        return false;
-
-    for(PageView *page : pages)
-    {
-        if(!page->isEmpty())
-            return false;
-    }
-
-    return getAttachments().empty();
-}
-
-PageView *BodyView::getNextPage(PageView &page) const
-{
-    auto pages = getPages();
-    auto itEnd = pages.end();
-    auto it = std::find(pages.begin(), pages.end(), &page);
-
-    if(it != itEnd)
-        ++it;
-
-    return it != itEnd ? *it : nullptr;
+    const char *text = elm_entry_entry_get(m_pEntry);
+    return text ? text[0] == '\0' : true;
 }
 
-PageView *BodyView::getPrevPage(PageView &page) const
-{
-    auto pages = getPages();
-
-    auto itBegin = pages.begin();
-    auto itEnd = pages.end();
-    auto it = std::find(pages.begin(), pages.end(), &page);
-
-    if(it != itEnd && it != itBegin)
-        --it;
-
-    return it != itEnd ? *it : nullptr;
-}
-
-int BodyView::getItemCount(BodyViewItem::Type type) const
-{
-    int count = 0;
-    auto list = getAllItems();
-    for(BodyViewItem *item : list)
-    {
-        if(item->getType() == type)
-            ++count;
-    }
-    return count;
-}
-
-PageSeparator *BodyView::createSep()
-{
-    PageSeparator *sep = new PageSeparator(*this);
-    return sep;
-}
-
-void BodyView::updateSep(PageSeparator &sep, int number, int maxNumber)
+void BodyView::clear()
 {
-    std::ostringstream ss;
-    ss << number << '/' << maxNumber;
-    sep.setText(ss.str());
+    elm_object_text_set(m_pEntry, "");
 }
 
-void BodyView::rebuildSeparators()
+void BodyView::setText(const std::string &text)
 {
-    auto separators = getItems<PageSeparator>();
-    for(PageSeparator *sep : separators)
-        remove(*sep);
-
-    auto pages = getPages();
-    PageView *prevPage = nullptr;
-    int number = 0;
-
-    for(PageView *page : pages)
+    if(!text.empty())
     {
-        if(prevPage)
+        char *markupText = elm_entry_utf8_to_markup(text.c_str());
+        if(markupText)
         {
-            ++number;
-            PageSeparator *sep = createSep();
-            updateSep(*sep, number, pages.size());
-            insertAfter(*sep, *prevPage);
+            elm_object_text_set(m_pEntry, markupText);
+            free(markupText);
         }
-        prevPage = page;
-    }
-}
-
-void BodyView::updateSeparators()
-{
-    auto separators = getItems<PageSeparator>();
-    if(separators.empty())
-        return;
-
-    int index = 1;
-    for(PageSeparator *sep : separators)
-    {
-        updateSep(*sep, index, separators.size() + 1);
-        ++index;
     }
 }
 
-void BodyView::prepare(BodyViewItem &item)
-{
-    expand(item);
-    item.show();
-}
-
-void BodyView::append(BodyViewItem &item)
-{
-    prepare(item);
-    elm_box_pack_end(m_pContentBox, item);
-    item.show();
-    onContentChanged();
-}
-
-void BodyView::insertAfter(BodyViewItem &item, BodyViewItem &after)
-{
-    prepare(item);
-    elm_box_pack_after(m_pContentBox, item, after);
-    onContentChanged();
-}
-
-void BodyView::insertBefore(BodyViewItem &item, BodyViewItem &before)
-{
-    prepare(item);
-    elm_box_pack_before(m_pContentBox, item, before);
-    onContentChanged();
-}
-
-void BodyView::remove(BodyViewItem &item)
-{
-    elm_box_unpack(m_pContentBox, item);
-    item.destroy();
-    onContentChanged();
-}
-
-int BodyView::getPageCount() const
-{
-    return getPages().size();
-}
-
-PageViewCollection BodyView::getPages() const
+void BodyView::setFocus(bool focus)
 {
-    return getItems<PageView>();
+    elm_object_focus_set(m_pEntry, focus);
+    if(focus)
+        elm_entry_cursor_end_set(m_pEntry);
 }
 
-BodyAttachmentCollection BodyView::getAttachments() const
+std::string BodyView::getText() const
 {
-    return getItems<BodyAttachmentViewItem>();
+    return m_pEntry ? elm_object_text_get(m_pEntry) : "";
 }
 
-template<typename T>
-std::vector<T*> BodyView::getItems() const
+std::string BodyView::getPlainUtf8Text() const
 {
-    std::vector<T*> res;
-    BodyViewItemCollection all = getAllItems();
-    for(BodyViewItem *item : all)
-    {
-        if(T *itemT = dynamic_cast<T*>(item))
-            res.push_back(itemT);
-    }
-    return res;
-}
+    std::string res;
+    const char *plainText = elm_entry_entry_get(m_pEntry);
 
-BodyViewItemCollection BodyView::getAllItems() const
-{
-    BodyViewItemCollection res;
-    Eina_List *list = elm_box_children_get(m_pContentBox);
-    if(list)
+    if(plainText)
     {
-        Eina_List *l = nullptr;
-        void *obj = nullptr;
-
-        EINA_LIST_FOREACH(list, l, obj)
+        char *text = elm_entry_markup_to_utf8(plainText);
+        if(text)
         {
-            BodyViewItem *item = reinterpretCast<BodyViewItem*>(obj);
-            if(item)
-                res.push_back(item);
+            res.assign(text);
+            free(text);
         }
-        eina_list_free(list);
     }
-
     return res;
 }
 
-PageView *BodyView::addPage()
+Evas_Object *BodyView::createEntry(Evas_Object *parent, int maxCharCount)
 {
-    PageView &page = createPage();
+    m_pEntry = elm_entry_add(parent);
+    elm_entry_prediction_allow_set(m_pEntry, true);
+    elm_entry_autocapital_type_set(m_pEntry, ELM_AUTOCAPITAL_TYPE_SENTENCE);
+    elm_entry_input_panel_return_key_type_set(m_pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
+    elm_object_focus_allow_set(m_pEntry, true);
+   // elm_entry_input_panel_enabled_set(m_pEntry, false);  // Keypad is manually controlled
+    eext_entry_selection_back_event_allow_set(m_pEntry, true);
+    evas_object_show(m_pEntry);
+    expand(m_pEntry);
 
-    int pageCount = getItemCount(BodyViewItem::PageType);
-    if(pageCount > 0)
-    {
-        append(*createSep());
-        updateSeparators();
-    }
-
-    append(page);
-
-    //scroll to the end
-    Evas_Coord_Point pt{0, 0};
-    Evas_Coord_Size sz{0, 0};
-    elm_scroller_region_get(m_pScroller, &pt.x, &pt.y, &sz.w, &sz.h);
-    elm_scroller_region_show(m_pScroller, 0, sz.h + pt.y, 0, sz.h + pt.y);
-    return &page;
-}
+    View::setText(m_pEntry, msgt("IDS_MSG_TMBODY_TEXT_MESSAGES"), "elm.guide");
 
-BodyAttachmentViewItem *BodyView::addAttachment(const std::string &filePath, long long fileSize, const std::string &dispName)
-{
-    BodyAttachmentViewItem *attachment = new BodyAttachmentViewItem(*this, filePath, fileSize, dispName);
-    insertBefore(*attachment, *m_pDefaultPage);
-    attachment->setListener(this);
-    onContentChanged();
-    return attachment;
-}
-
-void BodyView::setFocus(PageView &page, bool focus)
-{
-    TextPageViewItem *textItem = static_cast<TextPageViewItem*>(page.getItem(PageViewItem::TextType));
-    if(textItem)
-    {
-        textItem->setFocus(focus);
-        textItem->setEndCursorPos();
-    }
-}
-
-void BodyView::setFocus(bool focus)
-{
-    setFocus(*m_pDefaultPage, focus);
-}
-
-void BodyView::clear(PageView &page)
-{
-    auto pageItems = page.getItems();
-    for(PageViewItem *pageItem : pageItems)
-    {
-        if(pageItem->getType() == PageViewItem::TextType)
-            static_cast<TextPageViewItem*>(pageItem)->clear();
-        else
-            page.removeItem(*pageItem);
-    }
-}
-
-void BodyView::clear()
-{
-    auto items = getAllItems();
-    for(BodyViewItem *item : items)
-    {
-        if(item->getType() == BodyViewItem::PageType)
+    Elm_Entry_Filter_Limit_Size limitFilter = {};
+    limitFilter.max_char_count = maxCharCount;
+    elm_entry_markup_filter_append(m_pEntry, elm_entry_filter_limit_size, &limitFilter);
+    elm_entry_markup_filter_append
+    (
+        m_pEntry,
+        [](void *data, Evas_Object *entry, char **text)
         {
-            PageView *page = static_cast<PageView*>(item);
-            if(page == m_pDefaultPage)
-                clear(*page);
-            else
-                removePage(*page, false);
-        }
-        else if(item->getType() == BodyViewItem::AttachmentType)
-        {
-            BodyAttachmentViewItem *attachment = static_cast<BodyAttachmentViewItem*>(item);
-            removeAttachment(*attachment);
-        }
-    }
-}
-
-void BodyView::showInputPanel(PageView &page, bool show)
-{
-    TextPageViewItem *item = static_cast<TextPageViewItem*>(page.getItem(PageViewItem::TextType));
-    if(item)
-        item->showInputPanel(show);
-}
-
-void BodyView::showInputPanel(PageViewItem &pageItem, bool show)
-{
-    if(pageItem.getType() == PageViewItem::TextType)
-        static_cast<TextPageViewItem&>(pageItem).showInputPanel(show);
-    else
-        showInputPanel(pageItem.getParentPage(), show);
-}
-
-ImagePageViewItem *BodyView::addImage(PageView &page, const std::string &filePath, long long fileSize)
-{
-    ImagePageViewItem *item = new ImagePageViewItem(page, filePath, fileSize, filePath);
-    item->setListener(this);
-    item->show();
-    page.addItem(*item);
-    onContentChanged();
-    return item;
-}
-
-SoundPageViewItem *BodyView::addSound(PageView &page, const std::string &filePath, long long fileSize, const std::string &dispName)
-{
-    SoundPageViewItem *item = new SoundPageViewItem(page, filePath, fileSize, dispName);
-    item->setListener(this);
-    item->show();
-    page.addItem(*item);
-    onContentChanged();
-    return item;
-}
-
-VideoPageViewItem *BodyView::addVideo(PageView &page, const std::string &filePath, long long fileSize, const std::string &imagePath)
-{
-    VideoPageViewItem *item = new VideoPageViewItem(page, filePath, fileSize, imagePath);
-    item->setListener(this);
-    item->show();
-    page.addItem(*item);
-    onContentChanged();
-    return item;
-}
+            ((BodyView*)data)->onCheckBoundaryText(text);
+        }, this );
 
-TextPageViewItem *BodyView::addText(PageView &page, int maxCharCount)
-{
-    TextPageViewItem *item = new TextPageViewItem(page, maxCharCount);
-    item->setListener(this);
-    item->show();
-    item->setGuideText(msgt("IDS_MSG_TMBODY_TEXT_MESSAGES"));
-    page.addItem(*item);
-    onContentChanged();
-    return item;
-}
+    // Preset max width to avoid blink
+    const int maxWidth = ELM_SCALE_SIZE(720);
+    evas_object_resize(m_pEntry, maxWidth, 0);
 
-void BodyView::updateLastFocusedPage(PageViewItem &pageItem)
-{
-    m_pLastFocusedPage = &pageItem.getParentPage();
-}
-
-PageView *BodyView::getPageForMedia(PageViewItem::Type type)
-{
-    if(m_pLastFocusedPage && m_pLastFocusedPage->canItemBeAdded(type))
-    {
-        return m_pLastFocusedPage;
-    }
-    else
+    evas_object_smart_callback_add(m_pEntry, "changed", [](void *data, Evas_Object *obj, void *event_info)
     {
-        auto pages = getPages();
-        for(PageView *page : pages)
-        {
-            if(page->canItemBeAdded(type))
-                return page;
-        }
-    }
+        ((BodyView*)data)->onContentChanged();
+    }, this);
 
-    return addPage();
-}
-
-void BodyView::removePage(PageView &page, bool setNextFocus)
-{
-    if(m_pDefaultPage != &page && getPageCount() > 1)
+    evas_object_smart_callback_add(m_pEntry, "preedit,changed", [](void *data, Evas_Object *obj, void *event_info)
     {
-        if(setNextFocus)
-        {
-            PageView *prevPage = getPrevPage(page);
-            if(prevPage)
-                setFocus(*prevPage, true);
-        }
+       // TODO: check
+    }, this);
 
-        page.View::destroy();
-        rebuildSeparators();
-
-        if(m_pLastFocusedPage == &page)
-            m_pLastFocusedPage = nullptr;
-    }
-}
-
-void BodyView::removeAttachment(BodyAttachmentViewItem &attachment)
-{
-    remove(attachment);
-}
-
-void BodyView::backKeyHandler(MediaPageViewItem &item)
-{
-    item.destroy();
-}
-
-void BodyView::backKeyHandler(TextPageViewItem &item)
-{
-    if(m_LastTextCursorPos == 0)
+    evas_object_smart_callback_add(m_pEntry, "maxlength,reached", [](void *data, Evas_Object *obj, void *event_info)
     {
-        MSG_LOG("Last text cursor position");
-        PageView &page = item.getParentPage();
+        ((BodyView*)data)->onMaxLengthReached();
+    }, this);
 
-        PageViewItem *topItem = page.getItem(PageViewItem::ImageType);
-        if(!topItem)
-            topItem = page.getItem(PageViewItem::VideoType);
 
-        if(topItem)
-            topItem->setFocus(true);
-        else
-            removePage(page, true);
-    }
-}
-
-void BodyView::onCursorChanged(TextPageViewItem &item)
-{
-    m_LastTextCursorPos = item.getCursorPos();
-    MSG_LOG("Cursor pos: ", item.getCursorPos());
-}
-
-void BodyView::onFocused(TextPageViewItem &item)
-{
-    MSG_LOG("");
-    updateLastFocusedPage(item);
-    item.showInputPanel(true);
-}
-
-void BodyView::onUnfocused(TextPageViewItem &item)
-{
-    MSG_LOG("");
-    item.showInputPanel(false);
-}
-
-void BodyView::onPreeditChanged(TextPageViewItem &item)
-{
-    MSG_LOG("");
-}
-
-void BodyView::onPress(TextPageViewItem &item)
-{
-    MSG_LOG("");
-}
-
-void BodyView::onClicked(TextPageViewItem &item)
-{
-    MSG_LOG("");
-    showInputPanel(item, true);
-}
-
-void BodyView::onKeyDown(TextPageViewItem &item, Evas_Event_Key_Down &event)
-{
-    MSG_LOG("");
-    if(isBackKey(event.keyname))
-        backKeyHandler(item);
-}
-
-void BodyView::onKeyUp(TextPageViewItem &item, Evas_Event_Key_Up &event)
-{
-    MSG_LOG("");
-}
-
-void BodyView::onChanged(TextPageViewItem &item)
-{
-    MSG_LOG("");
-    onContentChanged();
-}
-
-void BodyView::onPressed(MediaPageViewItem &item)
-{
-    MSG_LOG("");
-}
-
-void BodyView::onUnpressed(MediaPageViewItem &item)
-{
-    MSG_LOG("");
+    return m_pEntry;
 }
 
-void BodyView::onFocused(MediaPageViewItem &item)
-{
-    MSG_LOG("");
-    updateLastFocusedPage(item);
-    item.highlight(true);
-    showInputPanel(item, true);
-}
-
-void BodyView::onUnfocused(MediaPageViewItem &item)
-{
-    MSG_LOG("");
-    item.highlight(false);
-    showInputPanel(item, false);
-}
-
-void BodyView::onKeyDown(MediaPageViewItem &item, Evas_Event_Key_Down &event)
+void BodyView::onContentBoxGeometryChanged(Evas_Object *obj, void *event_info)
 {
-    MSG_LOG("");
-    if(isBackKey(event.keyname))
-        backKeyHandler(item);
-}
+    int w = 0;
+    int h = 0;
 
-void BodyView::onKeyUp(MediaPageViewItem &item, Evas_Event_Key_Up &event)
-{
-    MSG_LOG("");
-}
+    evas_object_geometry_get(m_pContentBox, nullptr, nullptr, &w, &h);
 
-void BodyView::onDelete(BodyAttachmentViewItem &item)
-{
-    MSG_LOG("");
-    onItemDelete(item);
-    onContentChanged();
-}
+    if(h > maxBodyHeight)
+        h = maxBodyHeight;
 
-void BodyView::onDelete(PageViewItem &item)
-{
-    MSG_LOG("");
-    onItemDelete(item);
-    onContentChanged();
+    evas_object_size_hint_min_set(m_pRootBox, w, h);
+    evas_object_size_hint_max_set(m_pRootBox, w, h);
 }
diff --git a/src/Conversation/Body/View/src/BodyViewItem.cpp b/src/Conversation/Body/View/src/BodyViewItem.cpp
deleted file mode 100644 (file)
index afc7d72..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 "BodyViewItem.h"
-
-#include <assert.h>
-
-using namespace Msg;
-
-
-BodyViewItem::BodyViewItem(Type type)
-    : m_Type(type)
-{
-}
-
-BodyViewItem::~BodyViewItem()
-{
-}
-
-std::string BodyViewItem::getEdjPath() const
-{
-    return PathUtils::getResourcePath(MSG_BODY_EDJ_PATH);
-}
-
-BodyViewItem::Type BodyViewItem::getType() const
-{
-    return m_Type;
-}
diff --git a/src/Conversation/Body/View/src/ImagePageViewItem.cpp b/src/Conversation/Body/View/src/ImagePageViewItem.cpp
deleted file mode 100644 (file)
index 73f073a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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 "ImagePageViewItem.h"
-#include "PageView.h"
-#include "Logger.h"
-#include "FileUtils.h"
-#include <assert.h>
-
-using namespace Msg;
-
-namespace
-{
-    const char *mediaImagePortraitSig = "media.image.portrait";
-    const char *mediaImageLandscapeSig = "media.image.landscape";
-    const char *mediaImageEqualSig = "media.image.equal";
-    const char *imageLayout = "conv/body/media_image";
-    const char *imageContentPart = "swl.thumbnail";
-    const char *showPlayIconSig = "play_icon_show";
-
-    const int thumbOriginHeight = 75;
-    const int thumbLandscapeHeight = 102;
-    const int thumbPortraitHeight = 128;
-    const int thumbEqual = 106;
-}
-
-ImagePageViewItem::ImagePageViewItem(PageView &parent, const std::string &reourcePath, long long fileSize, const std::string &imagePath)
-    : MediaPageViewItem(parent, reourcePath, fileSize)
-    , m_pImageLayout(nullptr)
-    , m_ImagePath(imagePath)
-{
-    Evas_Object *imageLayout = createImageLayout(getMediaLayout());
-    Evas_Object *rect = createRect(getMediaLayout());
-    Evas_Object *icon = createImage(imageLayout);
-    elm_object_part_content_set(m_pImageLayout, imageContentPart, icon);
-    setRect(rect);
-    setButtonContent(imageLayout);
-}
-
-ImagePageViewItem::~ImagePageViewItem()
-{
-
-}
-
-void ImagePageViewItem::showPlayIcon()
-{
-    emitSignal(m_pImageLayout, showPlayIconSig, "");
-}
-
-const std::string &ImagePageViewItem::getImagePath() const
-{
-    return m_ImagePath;
-}
-
-ImagePageViewItem::Type ImagePageViewItem::getType() const
-{
-    return ImageType;
-}
-
-bool ImagePageViewItem::isEmpty() const
-{
-    return getResourcePath().empty();
-}
-
-void ImagePageViewItem::highlight(bool value)
-{
-    const char *sig = value ? "focused" : "unfocused";
-    emitSignal(m_pImageLayout, sig, "*");
-}
-
-std::string ImagePageViewItem::getFileName() const
-{
-    return FileUtils::getFileName(m_ImagePath);
-}
-
-Evas_Object *ImagePageViewItem::createImageLayout(Evas_Object *parent)
-{
-    m_pImageLayout = elm_layout_add(parent);
-    elm_layout_file_set(m_pImageLayout, getEdjPath().c_str(), imageLayout);
-    evas_object_show(m_pImageLayout);
-    return m_pImageLayout;
-}
-
-Evas_Object *ImagePageViewItem::createRect(Evas_Object *parent)
-{
-    Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(parent));
-    evas_object_color_set(rect, 0, 0, 0, 0);
-    evas_object_size_hint_min_set(rect, 0, ELM_SCALE_SIZE(thumbOriginHeight));
-    evas_object_show(rect);
-    return rect;
-}
-
-Evas_Object *ImagePageViewItem::createImage(Evas_Object *parent)
-{
-    // Get image dimension:
-    Evas *evas = evas_object_evas_get(parent);
-    Evas_Object *img = evas_object_image_add(evas);
-    evas_object_image_load_orientation_set(img, true);
-    evas_object_image_file_set(img, m_ImagePath.c_str(), nullptr);
-
-    int err = evas_object_image_load_error_get(img);
-    if (err != EVAS_LOAD_ERROR_NONE)
-    {
-        evas_object_del(img);
-        MSG_LOG_ERROR("Image loading is failed: ", m_ImagePath);
-        return nullptr;
-    }
-
-    int width = 0;
-    int height = 0;
-    float ratio = 0.0;
-    evas_object_image_size_get(img, &width, &height);
-    evas_object_del(img);
-
-    MSG_LOG("Image: width = ", width, " height = ", height);
-    if(height > 0)
-        ratio = width / (float)height;
-    // Set orientation  of media layout and icon dimension:
-    int iconWidth = 0;
-    int iconHeight = 0;
-    const char *sig = nullptr;
-
-    if(width > height) // Landscape
-    {
-        iconWidth = (int)ELM_SCALE_SIZE(ratio * thumbLandscapeHeight);
-        iconHeight = (int)ELM_SCALE_SIZE(thumbLandscapeHeight);
-        sig = mediaImageLandscapeSig;
-    }
-    else if(height > width) // Portrait
-    {
-        iconWidth = (int)ELM_SCALE_SIZE(ratio * thumbPortraitHeight);
-        iconHeight = (int)ELM_SCALE_SIZE(thumbPortraitHeight);
-        sig = mediaImagePortraitSig;
-    }
-    else // Equal
-    {
-        iconWidth = (int)ELM_SCALE_SIZE(thumbEqual);
-        iconHeight = (int)ELM_SCALE_SIZE(thumbEqual);
-        sig = mediaImageEqualSig;
-    }
-    emitSignal(getMediaLayout(), sig, "*");
-
-    // Create and load icon image:
-    Evas_Object *icon = elm_icon_add(parent);
-    elm_image_file_set(icon, m_ImagePath.c_str(), NULL);
-    evas_object_size_hint_align_set(icon, 0.0, EVAS_HINT_FILL);
-    evas_object_size_hint_min_set(icon, iconWidth, iconHeight);
-    elm_image_aspect_fixed_set(icon, EINA_TRUE);
-    evas_object_show(icon);
-
-    return icon;
-}
diff --git a/src/Conversation/Body/View/src/MediaPageViewItem.cpp b/src/Conversation/Body/View/src/MediaPageViewItem.cpp
deleted file mode 100644 (file)
index 3b4c5ea..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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 "MediaPageViewItem.h"
-#include "PageView.h"
-
-#include <assert.h>
-
-using namespace Msg;
-
-namespace
-{
-    const char *mediaMainGroup = "conv/body/media_main";
-    const char *buttonSwlContent = "elm.swallow.content";
-}
-
-MediaPageViewItem::MediaPageViewItem(PageView &parent, const std::string &resourcePath, long long fileSize)
-    : PageViewItem(parent, resourcePath)
-    , m_pListener(nullptr)
-    , m_pButton(nullptr)
-    , m_FileSize(fileSize)
-{
-    View::setEo(createMainLayout(parent.getItemParent()));
-    Evas_Object *button = createButton(getEo());
-    setContent(button, "swl.content");
-}
-
-MediaPageViewItem::~MediaPageViewItem()
-{
-
-}
-
-template<class...Args>
-void MediaPageViewItem::notifyListener(void *data, void (IMediaPageViewItemListener::*method)(MediaPageViewItem &, Args...args), Args&&...args)
-{
-    MediaPageViewItem *self = static_cast<MediaPageViewItem*>(data);
-    if(self && self->m_pListener)
-        (self->m_pListener->*method)(*self, args...);
-}
-
-Evas_Object *MediaPageViewItem::getMediaLayout() const
-{
-    return getEo();
-}
-
-Evas_Object *MediaPageViewItem::getButtonLayout() const
-{
-    return m_pButton;
-}
-
-void MediaPageViewItem::setButtonContent(Evas_Object *layout)
-{
-    elm_object_part_content_set(m_pButton, buttonSwlContent, layout);
-}
-
-void MediaPageViewItem::setRect(Evas_Object *layout)
-{
-    setContent(layout, "swl.rect");
-}
-
-void MediaPageViewItem::setListener(IMediaPageViewItemListener *l)
-{
-    PageViewItem::setListener(l);
-    m_pListener = l;
-}
-
-long long MediaPageViewItem::getFileSize() const
-{
-    return m_FileSize;
-}
-
-Evas_Object *MediaPageViewItem::createMainLayout(Evas_Object *parent)
-{
-    Evas_Object *layout = elm_layout_add(parent);
-    elm_layout_file_set(layout, getEdjPath().c_str(), mediaMainGroup);
-    evas_object_show(layout);
-    return layout;
-}
-
-Evas_Object *MediaPageViewItem::createGestureLayer(Evas_Object *parent)
-{
-    // TODO: impl if needed
-    return nullptr;
-}
-
-Evas_Object *MediaPageViewItem::createButton(Evas_Object *parent)
-{
-    Evas_Object *button = elm_button_add(parent);
-    m_pButton = button;
-    elm_object_style_set(button, "focus");
-    evas_object_show(button);
-
-    evas_object_smart_callback_add(button, "clicked", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onClicked);
-    }, this);
-
-    evas_object_smart_callback_add(button, "pressed", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onPressed);
-    }, this);
-
-    evas_object_smart_callback_add(button, "focused", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onFocused);
-    }, this);
-
-    evas_object_smart_callback_add(button, "unfocused", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onUnfocused);
-    }, this);
-
-    evas_object_smart_callback_add(button, "unpressed", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onUnpressed);
-    }, this);
-
-    evas_object_event_callback_add(button, EVAS_CALLBACK_KEY_DOWN, [](void *data, Evas *e, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onKeyDown, *(Evas_Event_Key_Down*)event_info);
-    }, this);
-
-    evas_object_event_callback_add(button, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &IMediaPageViewItemListener::onKeyUp, *(Evas_Event_Key_Up*)event_info);
-    }, this);
-
-    return button;
-}
-
diff --git a/src/Conversation/Body/View/src/PageSeparator.cpp b/src/Conversation/Body/View/src/PageSeparator.cpp
deleted file mode 100644 (file)
index ca9c90a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 "PageSeparator.h"
-#include "BodyView.h"
-
-using namespace Msg;
-
-namespace
-{
-    const char *pageSeparatorGroup = "conv/body/page_divider";
-    const char *itemLayoutGroup = "conv/body/item_layout";
-}
-
-PageSeparator::PageSeparator(BodyView &parent)
-    : BodyViewItem(SeparatorType)
-{
-    setEo(elm_layout_add(parent));
-    elm_layout_file_set(getEo(), getEdjPath().c_str(), itemLayoutGroup);
-    emitSignal("show.normal.mode", "*");
-    expand();
-    show();
-
-    m_pTextLayout = elm_layout_add(getEo());
-    evas_object_show(m_pTextLayout);
-    elm_layout_file_set(m_pTextLayout, getEdjPath().c_str(), pageSeparatorGroup);
-
-    setContent(m_pTextLayout, "swl.content");
-}
-
-PageSeparator::~PageSeparator()
-{
-
-}
-
-void PageSeparator::setText(const std::string &text)
-{
-    elm_object_part_text_set(m_pTextLayout, "text.page_info", text.c_str());
-}
diff --git a/src/Conversation/Body/View/src/PageView.cpp b/src/Conversation/Body/View/src/PageView.cpp
deleted file mode 100644 (file)
index f4addfd..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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 "PageView.h"
-#include "BodyView.h"
-#include "TextPageViewItem.h"
-#include "ImagePageViewItem.h"
-#include "Logger.h"
-
-#include <efl_extension.h>
-#include <assert.h>
-
-using namespace Msg;
-
-namespace
-{
-    const char *pageGroup = "conv/body/page";
-    const char *itemLayoutGroup = "conv/body/item_layout";
-}
-
-PageView::PageView(BodyView &parent)
-    : BodyViewItem(PageType)
-    , m_pBox(nullptr)
-{
-    setEo(createMainLayout(parent));
-    Evas_Object *layout = createLayout(getEo());
-    Evas_Object *box = createBox(layout);
-
-    elm_object_part_content_set(layout, "swl.page", box);
-    setContent(layout, "swl.content");
-}
-
-PageView::~PageView()
-{
-
-}
-
-bool PageView::isEmpty() const
-{
-    for(auto it : m_PageItemMap)
-    {
-        if(!it.second->isEmpty())
-            return false;
-    }
-    return true;
-}
-
-Evas_Object *PageView::getItemParent() const
-{
-    return m_pBox;
-}
-
-bool PageView::hasMedia() const
-{
-    for(auto item : m_PageItemMap)
-    {
-        if(item.first != PageViewItem::TextType)
-            return true;
-    }
-    return false;
-}
-
-bool PageView::canItemBeAdded(PageViewItem::Type type) const
-{
-    auto it = m_PageItemMap.find(type);
-    if(it != m_PageItemMap.end())
-        return false;
-
-    if(type == PageViewItem::VideoType && hasMedia())
-        return false;
-
-    if(getItem(PageViewItem::VideoType) && type != PageViewItem::TextType)
-        return false;
-
-    return true;
-}
-
-void PageView::addItem(PageViewItem &item)
-{
-    /* Page items order:
-     * Image/Video
-     * Text
-     * Audio
-     */
-    switch(item.getType())
-    {
-        case PageViewItem::TextType:
-        {
-            // Middle:
-            auto itEnd = m_PageItemMap.end();
-            auto it = m_PageItemMap.find(PageViewItem::ImageType);
-            if(it != itEnd)
-                elm_box_pack_after(m_pBox, item, *it->second);
-            else if((it = m_PageItemMap.find(PageViewItem::SoundType)) != itEnd)
-                elm_box_pack_before(m_pBox, item, *it->second);
-            else
-                elm_box_pack_start(m_pBox, item);
-            break;
-        }
-
-        case PageViewItem::VideoType:
-        case PageViewItem::ImageType:
-        {
-            // Top:
-            elm_box_pack_start(m_pBox, item);
-            break;
-        }
-
-        case PageViewItem::SoundType:
-        {
-            // Bottom:
-            elm_box_pack_end(m_pBox, item);
-            break;
-        }
-
-        default:
-            assert(false);
-            return;
-            break;
-    }
-
-    item.expand();
-    item.show();
-
-    m_PageItemMap[item.getType()] = &item;
-}
-
-void PageView::removeItem(PageViewItem &item)
-{
-    auto it = m_PageItemMap.find(item.getType());
-    if(it != m_PageItemMap.end())
-        m_PageItemMap.erase(it);
-    item.View::destroy();
-}
-
-PageViewItem *PageView::getItem(PageViewItem::Type type) const
-{
-    auto it = m_PageItemMap.find(type);
-    return it == m_PageItemMap.end() ? nullptr : it->second;
-}
-
-PageView::ItemList PageView::getItems() const
-{
-    ItemList res;
-    Eina_List *list = elm_box_children_get(m_pBox);
-    Eina_List *l = nullptr;
-    void *data = nullptr;
-
-    EINA_LIST_FOREACH(list, l, data)
-    {
-        PageViewItem *item = reinterpretCast<PageViewItem*>(data);
-        res.push_back(item);
-    }
-    eina_list_free(list);
-
-    return res;
-}
-
-Evas_Object *PageView::createLayout(Evas_Object *parent)
-{
-    Evas_Object *layout = elm_layout_add(parent);
-    evas_object_show(layout);
-    elm_layout_file_set(layout, getEdjPath().c_str(), pageGroup);
-    expand(layout);
-    return layout;
-}
-
-Evas_Object *PageView::createMainLayout(Evas_Object *parent)
-{
-    Evas_Object *layout = elm_layout_add(parent);
-    elm_layout_file_set(layout, getEdjPath().c_str(), itemLayoutGroup);
-    emitSignal(layout, "show.normal.mode", "*");
-    expand(layout);
-    evas_object_show(layout);
-    return layout;
-}
-
-Evas_Object *PageView::createBox(Evas_Object *parent)
-{
-    m_pBox = elm_box_add(parent);
-    elm_box_homogeneous_set(m_pBox, false);
-    evas_object_show(m_pBox);
-    return m_pBox;
-}
-
-
diff --git a/src/Conversation/Body/View/src/PageViewItem.cpp b/src/Conversation/Body/View/src/PageViewItem.cpp
deleted file mode 100644 (file)
index 2e5f117..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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 "PageViewItem.h"
-#include "Resource.h"
-#include "PageView.h"
-
-using namespace Msg;
-
-PageViewItem::PageViewItem(PageView &parent, const std::string &resourcePath)
-    : m_Parent(parent)
-    , m_ResourcePath(resourcePath)
-    , m_pListener(nullptr)
-{
-
-}
-
-PageViewItem::~PageViewItem()
-{
-
-}
-
-void PageViewItem::destroy()
-{
-    m_Parent.removeItem(*this);
-}
-
-const std::string &PageViewItem::getEdjPath() const
-{
-    static std::string path = PathUtils::getResourcePath(MSG_BODY_EDJ_PATH);
-    return path;
-}
-
-const std::string &PageViewItem::getResourcePath() const
-{
-    return m_ResourcePath;
-}
-
-void PageViewItem::setResourcePath(const std::string &resourcePath)
-{
-    m_ResourcePath = resourcePath;
-}
-
-void PageViewItem::setListener(IPageViewItemListener *l)
-{
-    m_pListener = l;
-}
-
-const PageView &PageViewItem::getParentPage() const
-{
-    return m_Parent;
-}
-
-PageView &PageViewItem::getParentPage()
-{
-    return m_Parent;
-}
-
-void PageViewItem::onBeforeDelete(View &view)
-{
-    if(m_pListener)
-        m_pListener->onDelete(*this);
-}
-
diff --git a/src/Conversation/Body/View/src/SoundPageViewItem.cpp b/src/Conversation/Body/View/src/SoundPageViewItem.cpp
deleted file mode 100644 (file)
index a7dc1e8..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 "SoundPageViewItem.h"
-#include "FileUtils.h"
-
-using namespace Msg;
-
-namespace
-{
-    const char *labelLayout = "conv/body/media_label";
-    const char *fileNamePart = "text.filename";
-}
-
-SoundPageViewItem::SoundPageViewItem(PageView &parent, const std::string &resourcePath, long long fileSize, const std::string &dispName)
-    : MediaPageViewItem(parent, resourcePath, fileSize)
-{
-    m_DispName = dispName.empty() ? FileUtils::getFileName(resourcePath) : dispName;
-    Evas_Object *label = createLabel(getButtonLayout(), m_DispName);
-
-    setButtonContent(label);
-}
-
-SoundPageViewItem::~SoundPageViewItem()
-{
-
-}
-
-SoundPageViewItem::Type SoundPageViewItem::getType() const
-{
-    return SoundType;
-}
-
-bool SoundPageViewItem::isEmpty() const
-{
-    return false;
-}
-
-void SoundPageViewItem::highlight(bool value)
-{
-}
-
-std::string SoundPageViewItem::getFileName() const
-{
-    return m_DispName;
-}
-
-Evas_Object *SoundPageViewItem::createLabel(Evas_Object *parent, const std::string &fileName)
-{
-    Evas_Object *layout = elm_layout_add(parent);
-    elm_layout_file_set(layout, getEdjPath().c_str(), labelLayout);
-    elm_object_part_text_set(layout, fileNamePart, fileName.c_str());
-    evas_object_show(layout);
-    return layout;
-}
-
diff --git a/src/Conversation/Body/View/src/TextPageViewItem.cpp b/src/Conversation/Body/View/src/TextPageViewItem.cpp
deleted file mode 100644 (file)
index 116a74b..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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 "TextPageViewItem.h"
-#include "PageView.h"
-#include "BaseController.h"
-
-#include <efl_extension.h>
-
-using namespace Msg;
-
-
-TextPageViewItem::TextPageViewItem(PageView &parent, int maxCharCount)
-    : PageViewItem(parent)
-    , m_pEntry(nullptr)
-    , m_pListener(nullptr)
-    , m_Changed(true)
-{
-    setEo(createEntry(parent.getItemParent(), maxCharCount));
-}
-
-TextPageViewItem::~TextPageViewItem()
-{
-
-}
-
-template<class...Args>
-void TextPageViewItem::notifyListener(void *data, void (ITextPageViewItemListener::*method)(TextPageViewItem &, Args...args), Args&&...args)
-{
-    TextPageViewItem *self = static_cast<TextPageViewItem*>(data);
-    if(self && self->m_pListener)
-        (self->m_pListener->*method)(*self, args...);
-}
-
-TextPageViewItem::Type TextPageViewItem::getType() const
-{
-    return TextType;
-}
-
-bool TextPageViewItem::isEmpty() const
-{
-    const char *text = elm_entry_entry_get(m_pEntry);
-    return text ? text[0] == '\0' : true;
-}
-
-void TextPageViewItem::setListener(ITextPageViewItemListener *l)
-{
-    m_pListener = l;
-}
-
-void TextPageViewItem::resetChangedFlag()
-{
-    m_Changed = false;
-}
-
-bool TextPageViewItem::hasChanged() const
-{
-    return m_Changed;
-}
-
-int TextPageViewItem::getCursorPos() const
-{
-    return elm_entry_cursor_pos_get(getEo());
-}
-
-void TextPageViewItem::showInputPanel(bool show)
-{
-    if(show)
-        elm_entry_input_panel_show(m_pEntry);
-    else
-        elm_entry_input_panel_hide(m_pEntry);
-}
-
-void TextPageViewItem::setCursorPos(int pos)
-{
-
-    elm_entry_cursor_pos_set(getEo(), pos);
-}
-
-void TextPageViewItem::setEndCursorPos()
-{
-    elm_entry_cursor_end_set(getEo());
-}
-
-void TextPageViewItem::setBeginCursorPos()
-{
-    elm_entry_cursor_begin_set(getEo());
-}
-
-void TextPageViewItem::setGuideText(const TText &text)
-{
-    View::setText(m_pEntry, text, "elm.guide");
-    int cur = elm_entry_cursor_pos_get(m_pEntry);
-    if(!cur)
-        elm_entry_cursor_line_end_set(m_pEntry);
-}
-
-void TextPageViewItem::clear()
-{
-    elm_object_text_set(m_pEntry, "");
-}
-
-std::string TextPageViewItem::getText() const
-{
-    return m_pEntry ? elm_object_text_get(m_pEntry) : "";
-}
-
-std::string TextPageViewItem::getPlainUtf8Text() const
-{
-    std::string res;
-    const char *plainText = elm_entry_entry_get(m_pEntry);
-
-    if(plainText)
-    {
-        char *text = elm_entry_markup_to_utf8(plainText);
-        if(text)
-        {
-            res.assign(text);
-            free(text);
-        }
-    }
-    return res;
-}
-
-void TextPageViewItem::setText(const std::string &text)
-{
-    if(!text.empty())
-    {
-        char *markupText = elm_entry_utf8_to_markup(text.c_str());
-        if(markupText)
-        {
-            elm_object_text_set(m_pEntry, markupText);
-            free(markupText);
-        }
-    }
-}
-
-Evas_Object *TextPageViewItem::createEntry(Evas_Object *parent, int maxCharCount)
-{
-    m_pEntry = elm_entry_add(parent);
-    elm_entry_prediction_allow_set(m_pEntry, EINA_TRUE);
-    elm_entry_autocapital_type_set(m_pEntry, ELM_AUTOCAPITAL_TYPE_SENTENCE);
-    elm_entry_input_panel_return_key_type_set(m_pEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT);
-    elm_object_focus_allow_set(m_pEntry, true);
-    elm_entry_input_panel_enabled_set(m_pEntry, EINA_FALSE);  // Keypad is manually controlled
-    eext_entry_selection_back_event_allow_set(m_pEntry, EINA_TRUE);
-    expand(m_pEntry);
-
-    Elm_Entry_Filter_Limit_Size limitFilter = {};
-    limitFilter.max_char_count = maxCharCount;
-    elm_entry_markup_filter_append(m_pEntry, elm_entry_filter_limit_size, &limitFilter);
-    elm_entry_markup_filter_append(m_pEntry, entryFilterCheckBoundary, this);
-
-    // Preset max width to avoid blink
-    const int maxWidth = ELM_SCALE_SIZE(720);
-    evas_object_resize(m_pEntry, maxWidth, 0);
-
-    evas_object_smart_callback_add(m_pEntry, "changed", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        TextPageViewItem *self = (TextPageViewItem*)data;
-        self->m_Changed = true;
-        notifyListener(data, &ITextPageViewItemListener::onChanged);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "cursor,changed", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onCursorChanged);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "focused", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onFocused);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "unfocused", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onUnfocused);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "preedit,changed", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onPreeditChanged);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "press", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onPress);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "clicked", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onClicked);
-    }, this);
-
-    evas_object_smart_callback_add(m_pEntry, "maxlength,reached", [](void *data, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onMaxLengthReached);
-    }, this);
-
-    evas_object_event_callback_add(m_pEntry, EVAS_CALLBACK_KEY_DOWN, [](void *data, Evas *e, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onKeyDown, *(Evas_Event_Key_Down*)event_info);
-    }, this);
-
-    evas_object_event_callback_add(m_pEntry, EVAS_CALLBACK_KEY_UP, [](void *data, Evas *e, Evas_Object *obj, void *event_info)
-    {
-        notifyListener(data, &ITextPageViewItemListener::onKeyUp, *(Evas_Event_Key_Up*)event_info);
-    }, this);
-
-    return m_pEntry;
-}
-
-void TextPageViewItem::entryFilterCheckBoundary(void *data, Evas_Object *entry, char **text)
-{
-    notifyListener(data, &ITextPageViewItemListener::onCheckBoundaryText, &*text);
-}
-
diff --git a/src/Conversation/Body/View/src/VideoPageViewItem.cpp b/src/Conversation/Body/View/src/VideoPageViewItem.cpp
deleted file mode 100644 (file)
index 82fda1c..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 "VideoPageViewItem.h"
-#include "FileUtils.h"
-
-using namespace Msg;
-
-VideoPageViewItem::VideoPageViewItem(PageView &parent, const std::string &reourcePath, long long fileSize, const std::string &imagePath)
-    : ImagePageViewItem(parent, reourcePath, fileSize, imagePath)
-{
-    showPlayIcon();
-}
-
-VideoPageViewItem::~VideoPageViewItem()
-{
-}
-
-std::string VideoPageViewItem::getFileName() const
-{
-    return FileUtils::getFileName(getResourcePath());
-}
-
-VideoPageViewItem::Type VideoPageViewItem::getType() const
-{
-    return VideoType;
-}
-
index 86c8af75e3ed068180fcd3361dc4f629fd817f68..bf52b05d22586334a06d07256db409a0359f6890 100644 (file)
@@ -31,10 +31,8 @@ namespace Msg
             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;
     };
index 1ba01c2c4190b549d4483c7529623eac04599805..2a6cdbd48a1c3625b90ad76ef9f6372293781380 100644 (file)
@@ -27,7 +27,7 @@ namespace Msg
         : public BubbleEntity
     {
         public:
-            BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction);
+            BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction, const std::string &filePath = "");
             virtual ~BubbleBgEntity();
 
             void setBgType(BubbleBgViewItem::BgType type);
@@ -36,8 +36,8 @@ namespace Msg
             BubbleBgViewItem::BgType m_BgType;
     };
 
-    inline BubbleBgEntity::BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction)
-        : BubbleEntity(type, direction)
+    inline BubbleBgEntity::BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction, const std::string &filePath)
+        : BubbleEntity(type, direction, filePath)
         , m_BgType(bgType)
     {
     }
index 7984fc8d153290ed5192a107b5a8d874b4769c67..31041f13418f100fddd7f9e7d5cd17f5c6e0082e 100644 (file)
@@ -31,10 +31,8 @@ namespace Msg
             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;
     };
index 8bdd00aee8142597ce605f77d4c607b3854c0058..6c746aaeaeda0bb47155e93a354e124cc6062904 100644 (file)
@@ -33,11 +33,9 @@ namespace Msg
             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;
index db75a70b38f8aa0e18ab61f1db41a3026bf8a562..a796d7979d0cc6a40b90f6e75b7689065d7f6763 100644 (file)
@@ -31,7 +31,6 @@ namespace Msg
             virtual ~BubbleDownloadButtonEntity();
 
             virtual BubbleDownloadButtonViewItem *createView(Evas_Object *parent);
-            virtual std::string getFilePath() const;
     };
 
     inline BubbleDownloadButtonEntity::BubbleDownloadButtonEntity(Message::Direction direction)
@@ -48,11 +47,6 @@ namespace Msg
         auto *item = new BubbleDownloadButtonViewItem(*this, parent);
         return item;
     }
-
-    inline std::string BubbleDownloadButtonEntity::getFilePath() const
-    {
-        return {};
-    }
 }
 
 #endif /* BubbleDownloadButtonEntity_h_ */
index b8dbd59c7a5645dd36434e46bbfdfdda53d15284..3305e42b8f175d005e3fd816736f1d0d050f3777 100644 (file)
@@ -44,22 +44,27 @@ namespace Msg
             };
 
         public:
-            BubbleEntity(Type type, Message::Direction direction);
+            BubbleEntity(Type type, Message::Direction direction, const std::string &filePath = "");
             virtual ~BubbleEntity();
 
             Type getType() const;
             Message::Direction getDirection() const;
-            virtual std::string getFilePath() const = 0;
+            const std::string &getFilePath() const;
+            long long getFileSize() const;
             virtual BubbleViewItem *createView(Evas_Object *parent) = 0;
 
         private:
             Type m_Type;
             Message::Direction m_Direction;
+            std::string m_FilePath;
+            long long m_FileSize;
     };
 
-    inline BubbleEntity::BubbleEntity(Type type, Message::Direction direction)
+    inline BubbleEntity::BubbleEntity(Type type, Message::Direction direction, const std::string &filePath)
         : m_Type(type)
         , m_Direction(direction)
+        , m_FilePath(filePath)
+        , m_FileSize(!filePath.empty() ? FileUtils::getFileSize(filePath) : 0)
     {
     }
 
@@ -77,6 +82,16 @@ namespace Msg
         return m_Direction;
     }
 
+    inline const std::string &BubbleEntity::getFilePath() const
+    {
+        return m_FilePath;
+    }
+
+    inline long long BubbleEntity::getFileSize() const
+    {
+        return m_FileSize;
+    }
+
 }
 
 #endif /* BubbleEntity_h_ */
index 9a3bd557eef22c29f1a3b11995b368bb32b972f9..fe2b33e2e27c6d220a115a4e20f7cd6fe561f8f2 100644 (file)
@@ -49,7 +49,7 @@ namespace Msg
             BubbleDownloadButtonEntity *createDownloadButtonEntity(Message::Direction direction);
 
         private:
-            BubbleEntity *createEntity(const std::string &filePath, const std::string &fileName, std::string mime, BubbleBgViewItem::BgType bgType, Message::Direction direction);
+            BubbleEntity *createEntity(const std::string &filePath, const std::string &fileName, const std::string &mime, BubbleBgViewItem::BgType bgType, Message::Direction direction);
 
             BubbleEntityFactory(BubbleEntityFactory&) = delete;
             BubbleEntityFactory& operator=(const BubbleEntityFactory&) = delete;
index 417b0e1f8cd78f3248a067a679a69bbff03e181f..2aa9ab82fcbe7569e330f9792a967a01660608ed 100644 (file)
@@ -31,16 +31,11 @@ namespace Msg
             virtual ~BubbleImageEntity();
 
             virtual BubbleImageViewItem *createView(Evas_Object *parent);
-            virtual std::string getFilePath() const;
-
-        private:
-            const std::string m_ImgPath;
     };
 
 
     inline BubbleImageEntity::BubbleImageEntity(const std::string &filePath, Message::Direction direction)
-        : BubbleEntity(ImageItem, direction)
-        , m_ImgPath(filePath)
+        : BubbleEntity(ImageItem, direction, filePath)
     {
     }
 
@@ -50,15 +45,9 @@ namespace Msg
 
     inline BubbleImageViewItem *BubbleImageEntity::createView(Evas_Object *parent)
     {
-        auto *item = new BubbleImageViewItem(*this, parent, m_ImgPath);
+        auto *item = new BubbleImageViewItem(*this, parent, getFilePath());
         return item;
     }
-
-    inline std::string BubbleImageEntity::getFilePath() const
-    {
-        return m_ImgPath;
-    }
-
 }
 
 #endif /* BubbleImageEntity_h_ */
index 351d5580d346444bd3d78839a8d68471be1eff8f..4f1a54047b722fe676076d339e33e365faad1d80 100644 (file)
@@ -30,7 +30,6 @@ namespace Msg
             BubbleTextEntity(BubbleBgViewItem::BgType type, Message::Direction direction, const std::string &text);
             virtual ~BubbleTextEntity();
 
-            virtual std::string getFilePath() const;
             virtual BubbleTextViewItem *createView(Evas_Object *parent);
 
         private:
@@ -47,12 +46,6 @@ namespace Msg
     {
     }
 
-    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_BgType, m_Text);
index 36812df4d7d613567b748ef83212b83de24a24f7..f71355ba073c5533c763bd6a3cb58126535ed04d 100644 (file)
@@ -31,10 +31,8 @@ namespace Msg
             virtual ~BubbleUnknownFileEntity();
 
             virtual BubbleUnknownFileViewItem *createView(Evas_Object *parent);
-            virtual std::string getFilePath() const;
 
         private:
-            const std::string m_FilePath;
             const std::string m_FileName;
     };
 }
index 5c207652cc3f7d9370e6920ec84f3c571df38861..b5a02d6f29dd0bd6533c62ca5494377be5fea8ef 100644 (file)
@@ -32,10 +32,8 @@ namespace Msg
             virtual ~BubbleVideoEntity();
 
             virtual BubbleVideoViewItem *createView(Evas_Object *parent);
-            virtual std::string getFilePath() const;
 
         private:
-            std::string m_VideoPath;
             std::string m_ImgPath;
             WorkingDirRef m_WorkingDir;
     };
index 5d99bbe46a6b7ae91b8987ec771eaf580b364f9f..34fa84918fc56864b2ed4e843b09431d3b0ca1a5 100644 (file)
@@ -19,7 +19,6 @@
 #define ComposeListItem_H_
 
 #include "ComposeListViewItem.h"
-#include "BubbleEntity.h"
 #include "BubbleEntityFactory.h"
 
 #include <list>
@@ -27,6 +26,7 @@
 namespace Msg
 {
     class IComposeListItemListener;
+    typedef std::list<BubbleEntity*> BubbleEntityList;
 
     class ComposeListItem
         : public ComposeListViewItem
@@ -36,9 +36,12 @@ namespace Msg
             ComposeListItem(BubbleEntityFactory &entityFactory);
             virtual ~ComposeListItem();
 
-            std::list<std::string> getAttachments() const;
+            void clear(bool updateUi = true);
             void addAttachment(const std::string &filePath);
+            const BubbleEntityList &getAttachments() const;
+            bool isEmpty() const;
             void setListener(IComposeListItemListener *l);
+            IComposeListItemListener *getListener() const;
 
         protected:
             virtual Evas_Object *getBubbleContent();
@@ -62,7 +65,8 @@ namespace Msg
     {
         public:
             virtual ~IComposeListItemListener() {}
-            virtual void onAttachmentDeleted(const std::string &filePath) {};
+            virtual void onAttachmentAdded(const std::list<std::string> &files) {};
+            virtual void onAttachmentDeleted(const std::list<std::string> &files) {};
     };
 }
 
index 0ce799d33f3a4cd4bb98c2e219ffbf8e8eadb49f..6cfc5883f9f598f97370c64f7a32dcc7f2b75c2b 100644 (file)
@@ -124,7 +124,7 @@ namespace Msg
              * @brief Get compose item
              * @return compose item
              */
-            ComposeListItem *getComposeItem();
+            ComposeListItem &getComposeItem();
 
         private:
             typedef std::unordered_map<MsgId::Type, ConvListItem*> ConvListItemMap;
index 7520b3800b94b5549b24a16879b1a5d0291f3ee0..22792108eec53edb63843a6153332298a9f75ca3 100644 (file)
@@ -37,8 +37,7 @@ std::string makeDurationStr(const std::string &filePath)
 }
 
 BubbleAudioEntity::BubbleAudioEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction)
-    : BubbleBgEntity(AudioItem, bgType, direction)
-    , m_FilePath(filePath)
+    : BubbleBgEntity(AudioItem, bgType, direction, filePath)
     , m_FileName(fileName)
     , m_Duration(makeDurationStr(filePath))
 {
@@ -56,9 +55,4 @@ BubbleAudioViewItem *BubbleAudioEntity::createView(Evas_Object *parent)
     return item;
 }
 
-std::string BubbleAudioEntity::getFilePath() const
-{
-    return m_FilePath;
-}
-
 
index 1671b0f0388a52c535fe7e1f3b6c5368fa2cc7c6..a29c855ffe6ac77e5f66988c7c2c444722af72fa 100644 (file)
@@ -22,8 +22,7 @@
 using namespace Msg;
 
 BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction)
-    : BubbleBgEntity(CalendarEventItem, bgType, direction)
-    , m_FilePath(filePath)
+    : BubbleBgEntity(CalendarEventItem, bgType, direction, filePath)
 {
     auto list = VCalendarParser::getInst().parse(filePath);
     if(list.size() == 1)
@@ -52,8 +51,3 @@ BubbleCalEventViewItem *BubbleCalEventEntity::createView(Evas_Object *parent)
         item->setSubText(m_DateTime);
     return item;
 }
-
-std::string BubbleCalEventEntity::getFilePath() const
-{
-    return m_FilePath;
-}
index 427a1c64724bf793c547351c7ba014e5b39dd0f2..ce21c33de6d933ad5e3ec76160069730e5525467 100644 (file)
 using namespace Msg;
 
 BubbleContactEntity::BubbleContactEntity(App &app, const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction)
-    : BubbleBgEntity(ContactItem, bgType, direction)
+    : BubbleBgEntity(ContactItem, bgType, direction, filePath)
     , m_ThumbMaker(app.getThumbnailMaker())
-    , m_FilePath(filePath)
 {
-    auto list = app.getContactManager().parseVcard(m_FilePath);
+    auto list = app.getContactManager().parseVcard(getFilePath());
     if(!list.empty())
     {
         if(list.size() == 1)
@@ -65,8 +64,3 @@ BubbleContactViewItem *BubbleContactEntity::createView(Evas_Object *parent)
         item->setSubText(m_Address);
     return item;
 }
-
-std::string BubbleContactEntity::getFilePath() const
-{
-    return m_FilePath;
-}
index 7aacd9f42f0f8e8a2e44ea363120a445309876b9..31d98f2e0ab44c0fa2bb9ac390a427100bf1a594 100644 (file)
@@ -67,7 +67,7 @@ BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, Bub
 
 BubbleTextEntity *BubbleEntityFactory::createTextEntity(const std::string &text, BubbleBgViewItem::BgType bgType, Message::Direction direction)
 {
-    return new BubbleTextEntity(bgType, direction, text);
+    return text.empty() ? nullptr : new BubbleTextEntity(bgType, direction, text);
 }
 
 BubbleDownloadButtonEntity *BubbleEntityFactory::createDownloadButtonEntity(Message::Direction direction)
@@ -75,27 +75,28 @@ BubbleDownloadButtonEntity *BubbleEntityFactory::createDownloadButtonEntity(Mess
     return new BubbleDownloadButtonEntity(direction);
 }
 
-BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, const std::string &fileName, std::string mime, BubbleBgViewItem::BgType bgType, Message::Direction direction)
+BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, const std::string &fileName, const std::string &mime, BubbleBgViewItem::BgType bgType, Message::Direction direction)
 {
-    std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
-    MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
-
-    switch(msgMediaType)
+    if(FileUtils::isExists(filePath))
     {
-        case MsgMedia::ImageType:
-            // TODO: msg service corrupts thumbnail's metadata, so it lost rotation. Use getPath instead getThumbPath until fix
-            return new BubbleImageEntity(filePath, direction);
-        case MsgMedia::AudioType:
-            return new BubbleAudioEntity(filePath, fileName, bgType, direction);
-        case MsgMedia::VideoType:
-            return new BubbleVideoEntity(m_WorkingDir, filePath, direction);
-        default:
-          if(mime == "text/x-vcalendar" || mime == "text/calendar")
-              return new BubbleCalEventEntity(filePath, fileName, bgType, direction);
-          else if(mime == "text/x-vcard" || mime == "text/vcard")
-              return new BubbleContactEntity(m_App, filePath, fileName , bgType, direction);
-          else if(mime != "application/smil")
-              return new BubbleUnknownFileEntity(filePath, fileName, bgType, direction);
+        MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
+        switch(msgMediaType)
+        {
+            case MsgMedia::ImageType:
+                // TODO: msg service corrupts thumbnail's metadata, so it lost rotation. Use getPath instead getThumbPath until fix
+                return new BubbleImageEntity(filePath, direction);
+            case MsgMedia::AudioType:
+                return new BubbleAudioEntity(filePath, fileName, bgType, direction);
+            case MsgMedia::VideoType:
+                return new BubbleVideoEntity(m_WorkingDir, filePath, direction);
+            default:
+              if(mime == "text/x-vcalendar" || mime == "text/calendar")
+                  return new BubbleCalEventEntity(filePath, fileName, bgType, direction);
+              else if(mime == "text/x-vcard" || mime == "text/vcard")
+                  return new BubbleContactEntity(m_App, filePath, fileName , bgType, direction);
+              else if(mime != "application/smil")
+                  return new BubbleUnknownFileEntity(filePath, fileName, bgType, direction);
+        }
     }
 
     return nullptr;
index f322a73668a040c9bfa8dd0215a724b39e1bcadd..4fa3d122e7812cdc446f86e2313e6102243a8114 100644 (file)
@@ -23,8 +23,7 @@
 using namespace Msg;
 
 BubbleUnknownFileEntity::BubbleUnknownFileEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction)
-    : BubbleBgEntity(UnknownFileItem, bgType, direction)
-    , m_FilePath(filePath)
+    : BubbleBgEntity(UnknownFileItem, bgType, direction, filePath)
     , m_FileName(fileName)
 {
 
@@ -40,8 +39,3 @@ BubbleUnknownFileViewItem *BubbleUnknownFileEntity::createView(Evas_Object *pare
     item->setMainText(m_FileName);
     return item;
 }
-
-std::string BubbleUnknownFileEntity::getFilePath() const
-{
-    return m_FilePath;
-}
index 36e583fe1ca9166d3f66269a5be150e1d6bab600..e66e1dfa7b11a6dbca8367e195c9d20d73f4977b 100644 (file)
@@ -23,14 +23,13 @@ using namespace Msg;
 
 
 BubbleVideoEntity::BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction)
-    : BubbleEntity(VideoItem, direction)
-    , m_VideoPath(filePath)
+    : BubbleEntity(VideoItem, direction, filePath)
     , m_WorkingDir(workingDir)
 {
     static const std::string thumbFileName = "thumbnail.jpeg";
     m_ImgPath =  m_WorkingDir->genUniqueFilePath(thumbFileName);
     if(!m_ImgPath.empty())
-        MediaUtils::getVideoFrame(m_VideoPath, m_ImgPath);
+        MediaUtils::getVideoFrame(getFilePath(), m_ImgPath);
 }
 
 BubbleVideoEntity::~BubbleVideoEntity()
@@ -44,8 +43,3 @@ BubbleVideoViewItem *BubbleVideoEntity::createView(Evas_Object *parent)
     return item;
 }
 
-std::string BubbleVideoEntity::getFilePath() const
-{
-    return m_VideoPath;
-}
-
index 50210c74e2da0f03d28b72c9b19da772400646fb..4e08106605a8b923690ac34b888b8da47ac1c321 100644 (file)
@@ -43,44 +43,67 @@ ComposeListItem::ComposeListItem(BubbleEntityFactory &entityFactory)
 
 ComposeListItem::~ComposeListItem()
 {
-    for(BubbleEntity *entity : m_BubbleEntityList)
-    {
-        delete entity;
-    }
-    m_BubbleEntityList.clear();
+    m_pListener = nullptr;
+    clear(false);
 }
 
 void ComposeListItem::addAttachment(const std::string &filePath)
 {
-    if(!filePath.empty())
+    auto *entity = m_BubbleEntityFactory.createEntity(filePath, BubbleBgViewItem::DraftStyle, Message::MD_Sent);
+    if(entity)
     {
-        auto *entity = m_BubbleEntityFactory.createEntity(filePath, BubbleBgViewItem::SentStyle, Message::MD_Sent);
-        if(entity)
-        {
-            m_BubbleEntityList.push_back(entity);
-            updateBubblePart();
-            getOwner()->showItem(*this, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM);
-        }
+        m_BubbleEntityList.push_back(entity);
+        updateBubblePart();
+        getOwner()->showItem(*this, ELM_GENLIST_ITEM_SCROLLTO_BOTTOM);
+        show(true);
+        if(m_pListener)
+            m_pListener->onAttachmentAdded({filePath});
     }
 }
 
-std::list<std::string> ComposeListItem::getAttachments() const
+void ComposeListItem::setListener(IComposeListItemListener *l)
 {
-    std::list<std::string> res;
-    for(BubbleEntity *entity : m_BubbleEntityList)
-    {
-        res.push_back(entity->getFilePath());
-    }
-    return res;
+    m_pListener = l;
 }
 
-void ComposeListItem::setListener(IComposeListItemListener *l)
+IComposeListItemListener *ComposeListItem::getListener() const
 {
-    m_pListener = l;
+    return m_pListener;
+}
+
+const BubbleEntityList &ComposeListItem::getAttachments() const
+{
+    return m_BubbleEntityList;
+}
+
+bool ComposeListItem::isEmpty() const
+{
+    return m_BubbleEntityList.empty();
+}
+
+void ComposeListItem::clear(bool updateUi)
+{
+    std::list<std::string> fileList;
+    for(BubbleEntity *entity : m_BubbleEntityList)
+    {
+        fileList.push_back(entity->getFilePath());
+        delete entity;
+    }
+    m_BubbleEntityList.clear();
+    if(updateUi)
+    {
+        show(false);
+        ComposeListItem::updateBubblePart();
+    }
+    if(m_pListener)
+        m_pListener->onAttachmentDeleted(fileList);
 }
 
 Evas_Object *ComposeListItem::getBubbleContent()
 {
+    if(m_BubbleEntityList.empty())
+        return nullptr;
+
     auto *bubble = new BubbleItemContainer(*getOwner());
     for(BubbleEntity *entity : m_BubbleEntityList)
     {
@@ -88,8 +111,8 @@ Evas_Object *ComposeListItem::getBubbleContent()
         if(item)
         {
             item->showDelButton(true);
-            bubble->append(*item, entity->getDirection());
             item->setListener(this);
+            bubble->append(*item, entity->getDirection());
         }
     }
     bubble->go();
@@ -115,9 +138,11 @@ void ComposeListItem::deleteEntity(BubbleEntity &entity)
         std::string filePath = entity.getFilePath();
         delete *it;
         m_BubbleEntityList.erase(it);
+        if(isEmpty())
+            show(false);
         updateBubblePart();
         if(m_pListener)
-            m_pListener->onAttachmentDeleted(filePath);
+            m_pListener->onAttachmentDeleted({filePath});
     }
 }
 
index 61080cb29192e36d868b32bfc201b5b66efe83b4..e4aedc5583a3aaa0f0390be7ccc84a994e2d21c6 100644 (file)
@@ -333,20 +333,22 @@ void ConvList::selectListItems(bool state)
         m_pListener->onConvListItemChecked();
 }
 
-ComposeListItem *ConvList::getComposeItem()
+ComposeListItem &ConvList::getComposeItem()
 {
     if(!m_pComposeItem)
     {
         m_pComposeItem = new ComposeListItem(m_BubbleEntityFactory);
         m_pList->appendItem(*m_pComposeItem);
+        m_pComposeItem->show(false);
     }
-    return m_pComposeItem;
+    return *m_pComposeItem;
 }
 
 void ConvList::onListItemLongPressed(ListItem &listItem)
 {
-    ConvListItem &item = static_cast<ConvListItem&>(listItem);
-    item.showPopup();
+    ConvListItem *item = dynamic_cast<ConvListItem*>(&listItem);
+    if(item)
+        item->showPopup();
 }
 
 void ConvList::onSelectAllChanged(Evas_Object *obj, void *eventInfo)
index 0cc1c48afc7b35516ec9a63d9a33027c8d19ff84..9e758e7cf636f3096811ed67a4231be3b5384907 100644 (file)
@@ -29,6 +29,8 @@ namespace Msg
             ComposeListViewItem();
             virtual ~ComposeListViewItem();
 
+            void show(bool show);
+
         protected:
             virtual Evas_Object *getBubbleContent() = 0;
             virtual std::string getTime() = 0;
@@ -39,8 +41,10 @@ namespace Msg
         private:
             virtual std::string getText(ListItem &item, const char *part);
             virtual Evas_Object *getContent(ListItem &item, const char *part);
+            virtual bool getFilter(ListItem &item, void *key);
 
         private:
+            bool m_Visibility;
     };
 }
 
index eb44b1a6d14fe6fcb6b658a9c9558d647261be78..12499084e8192d1fe2e0c698656ac764c127b637 100644 (file)
@@ -70,7 +70,7 @@ void BubbleViewItem::attachGestureTapLayer(Evas_Object *parent, Evas_Object *obj
 
 void BubbleViewItem::showDelButton(bool show)
 {
-    if(!m_pDelButton)
+    if(show && !m_pDelButton)
     {
         m_pDelButton = elm_button_add(getEo());
         elm_object_style_set(m_pDelButton, "transparent");
index c0301ec6da301fe9bbf56600949a81a5221e52ea..0672cb516f2ddb161d8345205eda30213b42894d 100644 (file)
@@ -33,6 +33,7 @@ namespace
 
 ComposeListViewItem::ComposeListViewItem()
     : ListItem(sentStyle)
+    , m_Visibility(false)
 {
 }
 
@@ -63,3 +64,15 @@ void ComposeListViewItem::updateBubblePart()
 {
     updateFields(bubbleContentPart, ELM_GENLIST_ITEM_FIELD_CONTENT);
 }
+
+bool ComposeListViewItem::getFilter(ListItem &item, void *key)
+{
+    return m_Visibility;
+}
+
+void ComposeListViewItem::show(bool show)
+{
+ // FIXME: setFilter() do not works properly
+ // m_Visibility = show;
+ // getOwner()->setFilter(&m_Visibility);
+}
index 5dbef26a04ebe1382a46f4b2e762e3d2b73f4b0d..994546f4062e0586d1034433f67502da23054abc 100644 (file)
@@ -425,8 +425,7 @@ void Conversation::createBody(Evas_Object *parent, ConvList &convList)
     assert(m_pMsgInputPanel);
     if(!m_pBody && m_pMsgInputPanel)
     {
-        m_pBody = new Body(getApp(), m_WorkingDir, convList);
-        m_pBody->create(*m_pMsgInputPanel);
+        m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, convList);
         m_pBody->setListener(this);
         m_pBody->show();
         m_pMsgInputPanel->setEntry(*m_pBody);
@@ -1168,7 +1167,6 @@ void Conversation::onConvListItemChecked()
 void Conversation::onFileSelected(AttachPanel &panel, const AttachPanel::FileList &files)
 {
     MSG_LOG("");
-    m_pBody->enableAutoFocusForAttachments(true);
     m_pBody->addMedia(files);
 }