*/
void enabledAlign(bool enabled);
+ void setRealizationMode(bool mode);
+
template<typename T>
std::vector<T*> getItems() const;
elm_object_scroll_item_align_enabled_set(getEo(), enabled);
}
+void ListView::setRealizationMode(bool mode)
+{
+ elm_genlist_realization_mode_set(getEo(), mode);
+}
+
void ListView::setMultiSelection(bool value)
{
elm_genlist_multi_select_set(getEo(), value);
--- /dev/null
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BubbleCalEventEntity_h_
+#define BubbleCalEventEntity_h_
+
+#include "BubbleEntity.h"
+#include "BubbleIconTextLayoutItem.h"
+
+namespace Msg {
+ class BubbleCalEventEntity
+ : public BubbleEntity {
+ public:
+ BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
+ virtual ~BubbleCalEventEntity();
+
+ BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
+
+ private:
+ std::string m_Name;
+ };
+}
+
+#endif /* BubbleCalEventEntity_h_ */
+++ /dev/null
-/*
- * Copyright 2016 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef BubbleCalendarEntity_h_
-#define BubbleCalendarEntity_h_
-
-#include "BubbleEntity.h"
-#include "BubbleIconTextLayoutItem.h"
-
-namespace Msg {
- class BubbleCalendarEntity
- : public BubbleEntity {
- public:
- BubbleCalendarEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
- virtual ~BubbleCalendarEntity();
-
- virtual BubbleIconTextLayoutItem *createView(Evas_Object *parent);
-
- private:
- std::string m_Name;
- };
-}
-
-#endif /* BubbleCalendarEntity_h_ */
class BubbleContactEntity
: public BubbleEntity {
public:
- BubbleContactEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction);
+ BubbleContactEntity(const std::string &filePath, std::string fileName, Message::Direction direction);
virtual ~BubbleContactEntity();
- virtual BubbleIconTextLayoutItem *createView(Evas_Object *parent);
+ BubbleIconTextLayoutItem *createView(Evas_Object *parent) override;
private:
std::string m_Name;
#include "Message.h"
#include <string>
+#include <memory>
namespace Msg {
+ class BubbleEntity;
+ typedef std::shared_ptr<BubbleEntity> BubbleEntityRef;
+
class BubbleEntity {
public:
enum Type {
#define BubbleEntityFactory_h_
#include "MsgConvMedia.h"
+#include "MsgConversationItem.h"
#include "WorkingDir.h"
-
-// Bubble items:
-#include "BubbleTextEntity.h"
-/*
-#include "BubbleImageEntity.h"
-#include "BubbleVideoEntity.h"
-#include "BubbleAudioEntity.h"
-#include "BubbleDownloadButtonEntity.h"
-#include "BubbleUnknownFileEntity.h"
-#include "BubbleCalEventEntity.h"
-#include "BubbleContactEntity.h"
-*/
+#include "BubbleEntity.h"
#include <string>
+#include <list>
namespace Msg {
+
+ class BubbleTextEntity;
+ class BubbleImageEntity;
+ class BubbleVideoEntity;
+ class BubbleAudioEntity;
+ class BubbleRetrieveEntity;
+ class BubbleUnknownFileEntity;
+ class BubbleCalEventEntity;
+ class BubbleContactEntity;
+ class BubbleNoContentEntity;
+
class BubbleEntityFactory {
public:
BubbleEntityFactory(WorkingDirRef &workingDir);
~BubbleEntityFactory();
- BubbleEntity *createEntity(std::string filePath, Message::Direction direction);
- BubbleEntity *createEntity(const MsgConvMedia &msgMedia, Message::Direction direction);
- BubbleTextEntity *createTextEntity(std::string text, Message::Direction direction);
+ std::list<BubbleEntityRef> create(const MsgConversationItem &item);
private:
+ BubbleEntity *createEntity(const MsgConvMedia &msgMedia, Message::Direction direction);
+ BubbleTextEntity *createTextEntity(std::string text, Message::Direction direction);
+ BubbleRetrieveEntity *createRetrieveEntity(Message::Direction direction);
+ BubbleNoContentEntity *createNoContentEntity(Message::Direction direction);
BubbleEntity *createTextEntityFromFile(std::string filePath, Message::Direction direction);
- BubbleEntity *createEntity(std::string filePath, std::string fileName, std::string mime, Message::Direction direction);
BubbleEntity *createVideoEntity(std::string filePath, std::string fileName, Message::Direction direction);
BubbleEntity *createAudioEntity(std::string filePath, std::string fileName, Message::Direction direction);
BubbleEntityFactory(BubbleEntityFactory&) = delete;
BubbleImageEntity(const std::string &filePath, Message::Direction direction);
virtual ~BubbleImageEntity();
- virtual BubbleImageViewItem *createView(Evas_Object *parent);
+ BubbleImageViewItem *createView(Evas_Object *parent) override;
};
BubbleNoContentEntity(Message::Direction direction);
virtual ~BubbleNoContentEntity();
- virtual BubbleInfoTextViewItem *createView(Evas_Object *parent);
+ BubbleInfoTextViewItem *createView(Evas_Object *parent) override;
};
inline BubbleNoContentEntity::BubbleNoContentEntity(Message::Direction direction)
BubbleRetrieveEntity(Message::Direction direction);
virtual ~BubbleRetrieveEntity();
- virtual BubbleInfoTextViewItem *createView(Evas_Object *parent);
+ BubbleInfoTextViewItem *createView(Evas_Object *parent) override;
};
inline BubbleRetrieveEntity::BubbleRetrieveEntity(Message::Direction direction)
BubbleSubjectEntity(const std::string &subject, Message::Direction direction);
virtual ~BubbleSubjectEntity();
- virtual BubbleSubjectViewItem *createView(Evas_Object *parent);
+ BubbleSubjectViewItem *createView(Evas_Object *parent) override;
private:
std::string m_Subject;
BubbleTextEntity(Message::Direction direction, std::string text);
virtual ~BubbleTextEntity();
- virtual BubbleTextViewItem *createView(Evas_Object *parent);
+ BubbleTextViewItem *createView(Evas_Object *parent) override;
private:
std::string m_Text;
#include "BubbleVideoViewItem.h"
#include "BubbleEntity.h"
+#include "WorkingDir.h"
namespace Msg {
class BubbleVideoEntity
: public BubbleEntity {
public:
- BubbleVideoEntity(const std::string &filePath, Message::Direction direction);
+ BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction);
virtual ~BubbleVideoEntity();
- virtual BubbleVideoViewItem *createView(Evas_Object *parent);
+ BubbleVideoViewItem *createView(Evas_Object *parent) override;
private:
std::string m_ImgPath;
+ WorkingDirRef m_WorkingDir;
};
}
#include "MsgTypes.h"
#include "Message.h"
#include "WorkingDir.h"
+#include "BubbleEntity.h"
#include <list>
class MsgConversationItem;
class BubbleEntityFactory;
- class BubbleEntity;
class ConvListItem
: public ConvListViewItem
void updateViewStatus();
void prepareContent(const MsgConversationItem &item);
- void addEntity(BubbleEntity *entity);
private:
MsgId m_MsgId;
Message::NetworkStatus m_NetworkStatus;
Message::Type m_Type;
std::string m_TimeStr;
- std::list<BubbleEntity*> m_BubbleEntityList;
+ std::list<BubbleEntityRef> m_BubbleEntityList;
WorkingDirRef m_WorkingDir;
BubbleEntityFactory &m_BubbleEntityFactory;
};
--- /dev/null
+/*
+ * Copyright 2016 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "BubbleCalEventEntity.h"
+#include "Resource.h"
+
+using namespace Msg;
+
+BubbleCalEventEntity::BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
+ : BubbleEntity(CalendarEventItem, direction, filePath)
+{
+ m_Name = fileName;
+}
+
+BubbleCalEventEntity::~BubbleCalEventEntity()
+{
+}
+
+BubbleIconTextLayoutItem *BubbleCalEventEntity::createView(Evas_Object *parent)
+{
+ auto *item = new BubbleIconTextLayoutItem(parent, *this);
+ item->setIcon(item->createIcon(ATTACH_CALENDAR_ICON));
+ item->setMainText(m_Name);
+ return item;
+}
+++ /dev/null
-/*
- * Copyright 2016 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "BubbleCalendarEntity.h"
-#include "Resource.h"
-
-using namespace Msg;
-
-BubbleCalendarEntity::BubbleCalendarEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
- : BubbleEntity(CalendarEventItem, direction, filePath)
-{
- m_Name = fileName;
-}
-
-BubbleCalendarEntity::~BubbleCalendarEntity()
-{
-}
-
-BubbleIconTextLayoutItem *BubbleCalendarEntity::createView(Evas_Object *parent)
-{
- auto *item = new BubbleIconTextLayoutItem(parent, *this);
- item->setIcon(item->createIcon(ATTACH_CALENDAR_ICON));
- item->setMainText(m_Name);
- return item;
-}
using namespace Msg;
-BubbleContactEntity::BubbleContactEntity(const std::string &filePath, const std::string &fileName, Message::Direction direction)
+BubbleContactEntity::BubbleContactEntity(const std::string &filePath, std::string fileName, Message::Direction direction)
: BubbleEntity(ContactItem, direction, filePath)
{
- m_Name = fileName;
+ m_Name = std::move(fileName);
}
BubbleContactEntity::~BubbleContactEntity()
#include "FileUtils.h"
#include "MediaType.h"
#include "MediaUtils.h"
+#include "MsgUtils.h"
// Bubble items:
#include "BubbleTextEntity.h"
-/*
#include "BubbleImageEntity.h"
#include "BubbleVideoEntity.h"
-#include "BubbleAudioEntity.h"
-#include "BubbleDownloadButtonEntity.h"
-#include "BubbleUnknownFileEntity.h"
+#include "BubbleRetrieveEntity.h"
#include "BubbleCalEventEntity.h"
#include "BubbleContactEntity.h"
-*/
+#include "BubbleNoContentEntity.h"
+
+// TODO: impl
+// #include "BubbleAudioEntity.h"
+// #include "BubbleUnknownFileEntity.h"
#include <algorithm>
{
}
+std::list<BubbleEntityRef> BubbleEntityFactory::create(const MsgConversationItem &item)
+{
+ std::list<BubbleEntityRef> list;
+
+ Message::Type type = item.getType();
+ Message::Direction direct = item.getDirection();
+
+ if (MsgUtils::isSms(type)) {
+ // SMS:
+ auto *entity = createTextEntity(item.getText(), direct);
+ if (entity)
+ list.push_back(BubbleEntityRef(entity));
+ } else if (type == Message::MT_MMS_Noti) {
+ // MMS_Noti:
+ auto *entity = createRetrieveEntity(direct);
+ if (entity)
+ list.push_back(BubbleEntityRef(entity));
+ } else {
+ // MMS:
+ const MsgConvMediaList &convList = item.getMediaList();
+ int convListLen = convList.getLength();
+ for (int i = 0; i < convListLen; ++i) {
+ auto *entity = createEntity(convList[i], direct);
+ if (entity)
+ list.push_back(BubbleEntityRef(entity));
+ }
+ }
+
+ // No Content:
+ if (list.empty()) {
+ auto *entity = createNoContentEntity(direct);
+ if (entity)
+ list.push_back(BubbleEntityRef(entity));
+ }
+
+ return list;
+}
+
BubbleEntity *BubbleEntityFactory::createEntity(const MsgConvMedia &msgMedia, Message::Direction direction)
{
- std::string mime = msgMedia.getMime();
- std::string fileName = msgMedia.getName();
std::string filePath = msgMedia.getPath();
- if (mime.empty())
- mime = FileUtils::getMimeType(filePath);
+ if (FileUtils::isExists(filePath)) {
- if (fileName.empty())
- fileName = FileUtils::getFileName(filePath);
+ std::string mime = msgMedia.getMime();
+ std::string fileName = msgMedia.getName();
- return createEntity(filePath, fileName, mime, direction);
-}
+ if (mime.empty())
+ mime = FileUtils::getMimeType(filePath);
-BubbleEntity *BubbleEntityFactory::createEntity(std::string filePath, Message::Direction direction)
-{
- return createEntity(std::move(filePath), FileUtils::getFileName(filePath), FileUtils::getMimeType(filePath), direction);
+ if (fileName.empty())
+ fileName = FileUtils::getFileName(filePath);
+
+ std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
+ MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
+
+ switch (msgMediaType) {
+ case MsgMedia::TextType:
+ return createTextEntityFromFile(std::move(filePath), direction);
+ case MsgMedia::ImageType:
+ return new BubbleImageEntity(std::move(filePath), direction);
+ case MsgMedia::AudioType:
+ return createAudioEntity(std::move(filePath), std::move(fileName), direction);
+ case MsgMedia::VideoType:
+ return createVideoEntity(std::move(filePath), std::move(fileName), direction);
+ default:
+ if (mime == "text/x-vcalendar" || mime == "text/calendar")
+ return new BubbleCalEventEntity(std::move(filePath), std::move(fileName), direction);
+
+ // TDOO: impl.
+/* else if (mime == "text/x-vcard" ||
+ mime == "text/vcard" ||
+ mime == "text/x-vcalendar")
+ return new BubbleContactEntity(std::move(filePath), std::move(fileName), direction);
+ else if (mime != "application/smil")
+ return new BubbleUnknownFileEntity(std::move(filePath), std::move(fileName), direction);*/
+ }
+ }
+
+ return nullptr;
}
+
BubbleTextEntity *BubbleEntityFactory::createTextEntity(std::string text, Message::Direction direction)
{
return text.empty() ? nullptr : new BubbleTextEntity(direction, std::move(text));
}
+BubbleRetrieveEntity *BubbleEntityFactory::createRetrieveEntity(Message::Direction direction)
+{
+ return new BubbleRetrieveEntity(direction);
+}
+
+BubbleNoContentEntity *BubbleEntityFactory::createNoContentEntity(Message::Direction direction)
+{
+ return new BubbleNoContentEntity(direction);
+}
+
BubbleEntity *BubbleEntityFactory::createAudioEntity(std::string filePath, std::string fileName, Message::Direction direction)
{
// TDOO: impl.
BubbleEntity *BubbleEntityFactory::createVideoEntity(std::string filePath, std::string fileName, Message::Direction direction)
{
- // TDOO: impl.
- return nullptr;
+ if (MediaUtils::hasVideo(filePath))
+ return new BubbleVideoEntity(m_WorkingDir, std::move(filePath), direction);
-/* if (MediaUtils::hasVideo(filePath))
- return new BubbleVideoEntity(m_WorkingDir, filePath, direction);
+ return nullptr;
+ // TODO: impl.
// Try to create Audio entity.
- return createAudioEntity(filePath, fileName, bgType, direction);*/
+ // return createAudioEntity(std::move(filePath), std::move(fileName), bgType, direction);
}
BubbleEntity *BubbleEntityFactory::createTextEntityFromFile(std::string filePath, Message::Direction direction)
return entity;
}
-BubbleEntity *BubbleEntityFactory::createEntity(std::string filePath, std::string fileName, std::string mime, Message::Direction direction)
-{
- if (FileUtils::isExists(filePath)) {
- std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
- MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
-
- switch (msgMediaType) {
- case MsgMedia::TextType:
- return createTextEntityFromFile(std::move(filePath), direction);
-
- // TDOO: impl.
-
- /* case MsgMedia::ImageType:
- return new BubbleImageEntity(filePath, direction);
- case MsgMedia::AudioType:
- return createAudioEntity(filePath, fileName, direction);
- case MsgMedia::VideoType:
- return createVideoEntity(filePath, fileName, direction);
- default:
- if (mime == "text/x-vcalendar" || mime == "text/calendar")
- return new BubbleCalEventEntity(filePath, fileName, direction);
- else if (mime == "text/x-vcard" ||
- mime == "text/vcard" ||
- mime == "text/x-vcalendar")
- return new BubbleContactEntity(m_App, filePath, fileName, direction);
- else if (mime != "application/smil")
- return new BubbleUnknownFileEntity(filePath, fileName, direction);
- */
- }
- }
-
- return nullptr;
-}
-
using namespace Msg;
-
-BubbleVideoEntity::BubbleVideoEntity(const std::string &filePath, Message::Direction direction)
+BubbleVideoEntity::BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction)
: BubbleEntity(VideoItem, direction, filePath)
+ , m_WorkingDir(workingDir)
{
// TODO: when video player will be available
m_ImgPath = filePath;
*/
#include "ConvListItem.h"
+#include "BubbleItemContainer.h"
+#include "BubbleEntityFactory.h"
#include "MsgEngine.h"
#include "TimeUtils.h"
#include "MsgUtils.h"
#include <algorithm>
-// Bubble items:
-#include "BubbleItemContainer.h"
-#include "BubbleEntityFactory.h"
-#include "BubbleTextEntity.h"
-// #include "BubbleImageEntity.h"
-// #include "BubbleVideoEntity.h"
-// #include "BubbleAudioEntity.h"
-// #include "BubbleDownloadButtonEntity.h"
-// #include "BubbleUnknownFileEntity.h"
-// #include "BubbleCalEventEntity.h"
-// #include "BubbleContactEntity.h"
-
using namespace Msg;
ConvListItem::ConvListItem(const MsgConversationItem &item,
ConvListItem::~ConvListItem()
{
- for (auto *entity : m_BubbleEntityList)
- delete entity;
-
- m_BubbleEntityList.clear();
}
MsgId ConvListItem::getMsgId() const
void ConvListItem::prepareContent(const MsgConversationItem &item)
{
- if (MsgUtils::isSms(m_Type)) {
- addEntity(m_BubbleEntityFactory.createTextEntity(item.getText(), m_Direction));
- } else if (m_Type == Message::MT_MMS_Noti) {
- // TODO: impl.
- } else {
- const MsgConvMediaList &list = item.getMediaList();
- for (int i = 0; i < list.getLength(); ++i) {
- const MsgConvMedia &media = list.at(i);
- addEntity(m_BubbleEntityFactory.createEntity(media, m_Direction));
- }
- }
-}
-
-void ConvListItem::addEntity(BubbleEntity *entity)
-{
- if (entity)
- m_BubbleEntityList.push_back(entity);
+ m_BubbleEntityList = m_BubbleEntityFactory.create(item);
}
Evas_Object *ConvListItem::getBubbleContent()
return nullptr;
auto *bubble = new BubbleItemContainer(*getOwner());
- for (BubbleEntity *entity : m_BubbleEntityList) {
+ for (BubbleEntityRef entity : m_BubbleEntityList) {
BubbleViewItem *item = entity->createView(*bubble);
if (item) {
bubble->append(*item, entity->getDirection());