+#define BASE_SCALE 1.8
#define PADDING_LEFT(param_padding_name, param_padding_size) \
part \
color: 255 255 255 64; \
} \
}
-
+#define SIG(name_, state_, target_) \
+ program { name: name_; \
+ signal: name_; \
+ source: ""; \
+ action: STATE_SET state_ 0.0; \
+ target: target_; \
+ }
+#include "macros.inl"
+
collections {
- base_scale: 1.8;
+ base_scale: BASE_SCALE;
- group { name: "msg_thread";
+ group { name: "msg_thread_layout";
parts {
part { name: "swl.bg";
type: SWALLOW;
scale: 1;
description { state: "default" 0.0;
+ visible: 1;
+ }
+ description { state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
}
}
- part { name: "swl.searchbar";
+ part { name: "swl.search_list";
type: SWALLOW;
mouse_events: 1;
scale: 1;
description { state: "default" 0.0;
- min: 0 0;
- fixed: 0 1;
- align: 0.5 1.0;
- rel2 {
- relative: 1.0 0.0;
- }
+ align: 0.0 0.0;
+ visible: 1;
}
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- align: 0.5 0.0;
+ description { state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
}
}
part { name: "swl.list";
scale: 1;
description { state: "default" 0.0;
align: 0.0 0.0;
- rel1 {
- relative: 0.0 1.0;
- to: "swl.searchbar";
- }
+ visible: 1;
+ }
+ description { state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
}
}
}
programs {
- program { name: "show_searchbar";
- signal: "show_searchbar";
- source: "";
- action: STATE_SET "visible" 0.0;
- target: "swl.searchbar";
- }
- program { name: "hide_searchbar";
- signal: "hide_searchbar";
- source: "";
- action: STATE_SET "default" 0.0;
- target: "swl.searchbar";
- }
+ SIG("hide_bg", "hide", "swl.bg");
+ SIG("show_bg", "default", "swl.bg");
+ SIG("hide_list", "hide", "swl.list");
+ SIG("show_list", "default", "swl.list");
+ SIG("hide_search_list", "hide", "swl.search_list");
+ SIG("show_search_list", "default", "swl.search_list");
}
}
}
{
return at(i);
}
+
+ inline bool isEmpty() const
+ {
+ return getLength() <= 0;
+ }
};
}
public:
ListItem(Elm_Genlist_Item_Type type = ELM_GENLIST_ITEM_NONE, int userType = 0);
- ListItem(const ListItemStyleRef &itemStyle, Elm_Genlist_Item_Type type, int userType);
+ ListItem(const ListItemStyleRef &itemStyle, Elm_Genlist_Item_Type type, int userType = 0);
virtual ~ListItem();
// Base elm methods:
void setMultiSelection(bool value);
bool getMultiSelection() const;
void clear();
+ bool isEmpty() const;
void setMode(Elm_List_Mode mode);
void setHomogeneous(bool isHomogeneous);
ListItem *getSelectedItem() const;
{
T *listItem = dynamic_cast<T*>(static_cast<ListItem*>(data));
if(listItem)
- {
list.push_back(listItem);
- }
}
elmItem = elm_genlist_item_next_get(elmItem);
}
inline bool isVisible() const;
inline void show();
inline void hide();
+ inline void setVisibility(bool show);
inline void move(Evas_Coord x, Evas_Coord y);
inline void setSizeHintWeight(double x = EVAS_HINT_EXPAND, double y = EVAS_HINT_EXPAND);
inline void setSizeHintAlign(double x = EVAS_HINT_FILL, double y = EVAS_HINT_FILL);
evas_object_hide(m_pEo);
}
+ inline void View::setVisibility(bool show)
+ {
+ if(show)
+ View::show();
+ else
+ hide();
+ }
+
inline void View::setSizeHintWeight(double x, double y)
{
evas_object_size_hint_weight_set(m_pEo, x, y);
elm_genlist_clear(getEo());
}
+bool ListView::isEmpty() const
+{
+ return elm_genlist_first_item_get(getEo()) == nullptr;
+}
+
void ListView::setMode(Elm_List_Mode mode)
{
elm_genlist_mode_set(getEo(), mode);
#include "FrameController.h"
#include "HwButtonListener.h"
-#include "MsgStorage.h"
-#include "ListView.h"
#include "Popup.h"
#include "ContextPopup.h"
#include "MsgThreadLayout.h"
#include "MsgThreadSearchPanel.h"
#include "FloatingButton.h"
#include "NoContentLayout.h"
+#include "MsgTypes.h"
+#include "ThreadList.h"
+#include "ThreadSearchList.h"
#include <string>
#include <memory>
class SelectAllListItem;
class NaviFrameController;
class ThreadListItem;
- class ThreadListView;
class App;
class MsgThread
: public FrameController
, private IHwButtonListener
- , private IListViewListener
- , private IMsgStorageListener
, private IMsgThreadSearchPanelListener
, private IFloatingButtonListener
+ , private IThreadListListener
{
public:
MsgThread(NaviFrameController &parent);
virtual void onHwBackButtonClicked();
virtual void onHwMoreButtonClicked();
- // IMsgStorageListener:
- virtual void onMsgStorageChange(const MsgIdList &idList);
-
- // IListViewListener:
- virtual void onListItemSelected(ListItem &listItem, void *funcData);
- virtual void onListItemChecked(ListItem &listItem, void *funcData);
-
- // IPopupListener:
- virtual void onPopupButtonClicked(Popup &popup, int buttonId);
-
- // ContextPopup callbacks:
+ // Popup callbacks:
void onSettingsItemPressed(ContextPopupItem &item);
void onDeleteItemPressed(ContextPopupItem &item);
void onSearchItemPressed(ContextPopupItem &item);
// IFloatingButtonListener
virtual void onFloatingButtonPressed();
+ // IThreadListListener:
+ virtual void onListItemSelected(ThreadId id);
+ virtual void onThreadListChanged();
+
private:
enum Mode
{
InitMode,
- NormalMode,
DeleteMode,
+ NormalMode,
SearchMode
};
private:
// MsgThread:
- void updateThreadList();
void composeNewMessage();
void navigateToSettings();
void navigateToConversation(ThreadId threadId);
void setMode(Mode mode);
void setDeleteMode(bool value);
void setNormalMode();
- void deleteSelectedItems();
-
- void checkHandler(SelectAllListItem &item);
- void checkHandler(ThreadListItem &item);
- void selectHandler(ThreadListItem &item);
+ void update();
// Search:
Evas_Object *createSearchPanel(Evas_Object *parent);
private:
MsgThreadLayout *m_pLayout;
NoContentLayout *m_pNoContent;
- ThreadListView *m_pThreadListView;
+ ThreadList *m_pThreadList;
+ ThreadSearchList *m_pSearchList;
MsgThreadSearchPanel *m_pSearchPanel;
Mode m_Mode;
--- /dev/null
+/*
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef ThreadList_h_
+#define ThreadList_h_
+
+#include "ListView.h"
+#include "MsgStorage.h"
+
+namespace Msg
+{
+ class IThreadListListener;
+ class SelectAllListItem;
+ class ThreadListItem;
+ class App;
+
+ class ThreadList
+ : public ListView
+ , private IMsgStorageListener
+ , private IListViewListener
+ {
+ public:
+ ThreadList(Evas_Object *parent, App &app);
+ virtual ~ThreadList();
+
+ void setListener(IThreadListListener *l);
+ void setDeleteMode(bool value);
+ bool isDeleteModeEnabled() const;
+ void deleteSelectedItems();
+
+ private:
+ // IMsgStorageListener:
+ virtual void onMsgStorageChange(const MsgIdList &idList);
+
+ // IListViewListener:
+ virtual void onListItemSelected(ListItem &listItem, void *funcData);
+ virtual void onListItemChecked(ListItem &listItem, void *funcData);
+
+ private:
+ void showSelectAllItem(bool show, bool resetCheck = true);
+ void checkAllItems(bool check);
+ void checkHandler(SelectAllListItem &item);
+ void checkHandler(ThreadListItem &item);
+ void updateList();
+
+ private:
+ IThreadListListener *m_pListener;
+ App &m_App;
+ bool m_DeleteMode;
+ };
+
+ class IThreadListListener
+ {
+ public:
+ virtual ~IThreadListListener() {}
+ virtual void onListItemSelected(ThreadId id) {};
+ virtual void onThreadListChanged() {}
+ };
+}
+
+#endif // ThreadList_h_
*
*/
-#ifndef ThreadListView_h_
-#define ThreadListView_h_
+#ifndef ThreadSearchList_h_
+#define ThreadSearchList_h_
#include "ListView.h"
namespace Msg
{
- class ThreadListView
+ class ThreadSearchList
: public ListView
{
public:
- ThreadListView(Evas_Object *parent);
- virtual ~ThreadListView();
-
- void showSelectAllItem(bool show, bool resetCheck = true);
- void checkAllItems(bool check);
+ ThreadSearchList(Evas_Object *parent);
+ virtual ~ThreadSearchList();
};
}
-#endif // ThreadListView_h_
+#endif // ThreadSearchList_h_
#include "Settings.h"
#include "Conversation.h"
#include "Logger.h"
-#include "ThreadListView.h"
-#include "ThreadListItem.h"
-#include "PathUtils.h"
-#include "MsgEngine.h"
#include "App.h"
-#include "ThreadListItem.h"
-#include "ThreadListItemType.h"
-#include "SelectAllListItem.h"
#include "Popup.h"
-#include "ContactManager.h"
-#include <Elementary.h>
-#include <sstream>
using namespace Msg;
: FrameController(parent)
, m_pLayout(nullptr)
, m_pNoContent(nullptr)
- , m_pThreadListView(nullptr)
+ , m_pThreadList(nullptr)
+ , m_pSearchList(nullptr)
, m_pSearchPanel(nullptr)
, m_Mode(InitMode)
, m_pFloatingBtn(nullptr)
m_pLayout->setFloatingButton(*m_pFloatingBtn);
m_pNoContent = new NoContentLayout(*m_pLayout);
- m_pNoContent->setText(msgt("IDS_MSG_NPBODY_NO_MESSAGES"));
+ m_pNoContent->show();
+
+ m_pThreadList = new ThreadList(*m_pLayout, getApp());
+ m_pThreadList->setListener(this);
+ m_pThreadList->show();
- m_pThreadListView = new ThreadListView(*m_pLayout);
- m_pThreadListView->setListener(this);
- m_pThreadListView->setMultiSelection(false);
- m_pThreadListView->show();
+ m_pSearchList = new ThreadSearchList(*m_pLayout);
+ m_pSearchList->show();
- m_pLayout->setBg(*m_pNoContent);
- m_pLayout->setList(*m_pThreadListView);
- updateThreadList();
- getMsgEngine().getStorage().addListener(*this);
+ m_pLayout->setNoContent(*m_pNoContent);
+ m_pLayout->setList(*m_pThreadList);
+ m_pLayout->setSearchList(*m_pSearchList);
setMode(NormalMode);
}
MsgThread::~MsgThread()
{
- getMsgEngine().getStorage().removeListener(*this);
+}
+
+Evas_Object *MsgThread::createSearchPanel(Evas_Object *parent)
+{
+ m_pSearchPanel = new MsgThreadSearchPanel(*m_pLayout);
+ m_pSearchPanel->setListener(this);
+ m_pSearchPanel->setGuideText("Search");
+ m_pSearchPanel->show();
+ return *m_pSearchPanel;
}
void MsgThread::onAttached(ViewItem &item)
popupMngr.getCtxPopup().show();
}
-void MsgThread::onFloatingButtonPressed()
-{
- composeNewMessage();
-}
-
-void MsgThread::updateThreadList()
-{
- MsgThreadListRef list = getMsgEngine().getStorage().getThreadList();
-
- int length = list->getLength();
- for(int i = 0; i < length; ++i)
- {
- ThreadListItem *item = new ThreadListItem(list->at(i), getApp());
- m_pThreadListView->appendItem(*item);
- }
-
- if(length > 0)
- {
- m_pNoContent->hide();
- m_pThreadListView->show();
- }
- else
- {
- m_pThreadListView->hide();
- m_pNoContent->show();
- }
-}
-
void MsgThread::composeNewMessage()
{
Conversation *frame = new Conversation(getParent());
return;
setNormalMode();
-
switch(mode)
{
case NormalMode:
break;
- case DeleteMode:
- setDeleteMode(true);
- break;
-
case SearchMode:
setSearchMode(true);
break;
+ case DeleteMode:
+ setDeleteMode(true);
+ break;
+
case InitMode:
default:
MSG_ASSERT(false, "Not supported mode");
void MsgThread::setNormalMode()
{
+ MSG_LOG("");
+
// Reset previus mode:
switch(m_Mode)
{
break;
}
+ m_pNoContent->setText(msgt("IDS_MSG_NPBODY_NO_MESSAGES"));
m_Mode = NormalMode;
+ update();
}
void MsgThread::setDeleteMode(bool value)
{
+ MSG_LOG("");
+
if(value)
m_Mode = DeleteMode;
getNaviBar().showButton(NaviOkButtonId, value);
getNaviBar().showButton(NaviCancelButtonId, value);
-
- m_pThreadListView->setCheckMode(value);
- m_pThreadListView->checkAllItems(false);
- m_pThreadListView->showSelectAllItem(value);
+ m_pThreadList->setDeleteMode(value);
}
-void MsgThread::checkHandler(SelectAllListItem &item)
+void MsgThread::setSearchMode(bool value)
{
- bool checked = item.getCheckedState();
- m_pThreadListView->checkAllItems(checked);
-}
+ MSG_LOG("");
-void MsgThread::checkHandler(ThreadListItem &item)
-{
- ThreadId threadId = item.getThreadId();
- MSG_LOG("Checked (id : state) = ", threadId, ":", item.getCheckedState());
+ getNaviBar().showButton(NaviPrevButtonId, value);
+ if(value)
+ {
+ m_Mode = SearchMode;
+ m_pSearchPanel->clearEntry();
+ getNaviBar().showSearch();
+ m_pNoContent->setText(msgt("IDS_MSG_NPBODY_NO_RESULTS_FOUND_ABB"));
+ }
+ else
+ {
+ getNaviBar().hideSearch();
+ }
+
+ update();
+ m_pSearchPanel->setEntryFocus(value);
}
-void MsgThread::selectHandler(ThreadListItem &item)
+void MsgThread::update()
{
- ThreadId threadId = item.getThreadId();
- MSG_LOG("Selected MsgThreadItem id = ", threadId);
- navigateToConversation(threadId);
+ if(m_Mode == SearchMode)
+ {
+ bool showSearch = !m_pSearchList->isEmpty();
+ bool showThread = !showSearch && !m_pThreadList->isEmpty();
+ bool showNoContent = !showThread;
+
+ m_pLayout->showSearchList(showSearch);
+ m_pLayout->showThreadList(showThread);
+ m_pLayout->showNoContent(showNoContent);
+ }
+ else
+ {
+ bool showThread = !m_pThreadList->isEmpty();
+ m_pLayout->showThreadList(showThread);
+ m_pLayout->showNoContent(!showThread);
+ }
}
void MsgThread::onHwBackButtonClicked()
showMainCtxPopup();
}
-void MsgThread::onListItemSelected(ListItem &listItem, void *funcData)
+void MsgThread::onSettingsItemPressed(ContextPopupItem &item)
{
- listItem.setSelected(false);
- if(ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem))
- selectHandler(*it);
+ MSG_LOG("");
+ item.getParent().destroy();
+ navigateToSettings();
}
-void MsgThread::onListItemChecked(ListItem &listItem, void *funcData)
+void MsgThread::onDeleteItemPressed(ContextPopupItem &item)
{
- if(ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem))
- checkHandler(*it);
- else if(SelectAllListItem *it = dynamic_cast<SelectAllListItem*>(&listItem))
- checkHandler(*it);
+ MSG_LOG("");
+ item.getParent().destroy();
+ setMode(DeleteMode);
}
-void MsgThread::onPopupButtonClicked(Popup &popup, int buttonId)
+void MsgThread::onSearchItemPressed(ContextPopupItem &item)
{
- MSG_LOG("Popup button id: ", buttonId);
- popup.destroy();
+ MSG_LOG("");
+ item.getParent().destroy();
+ setMode(SearchMode);
}
-void MsgThread::onMsgStorageChange(const MsgIdList &idList)
+void MsgThread::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- m_pThreadListView->clear(); // FIXME: temporary solution for demo
- updateThreadList();
+ MSG_LOG("NaviButton id:", buttonId);
+ if(buttonId == NaviOkButtonId)
+ m_pThreadList->deleteSelectedItems();
+ setMode(NormalMode);
}
-void MsgThread::onSettingsItemPressed(ContextPopupItem &item)
+void MsgThread::onListItemSelected(ThreadId id)
{
- item.getParent().destroy();
- navigateToSettings();
+ navigateToConversation(id);
}
-void MsgThread::onDeleteItemPressed(ContextPopupItem &item)
+void MsgThread::onThreadListChanged()
{
- item.getParent().destroy();
- setMode(DeleteMode);
+ update();
}
-void MsgThread::onSearchItemPressed(ContextPopupItem &item)
+void MsgThread::onFloatingButtonPressed()
{
- item.getParent().destroy();
- setMode(SearchMode);
+ composeNewMessage();
}
-void MsgThread::deleteSelectedItems()
+void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj)
{
- auto collection = m_pThreadListView->getItems<ThreadListItem>();
- for(ThreadListItem *it : collection)
- {
- if(it->getCheckedState())
- getMsgEngine().getStorage().deleteThread(it->getThreadId());
- }
+ MSG_LOG("");
}
-void MsgThread::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
+void MsgThread::onEntryChanged(MsgThreadSearchPanel &obj)
{
- MSG_LOG("NaviButton id:", buttonId);
- if(buttonId == NaviOkButtonId)
- deleteSelectedItems();
- setMode(NormalMode);
+ MSG_LOG("");
}
+++ /dev/null
-/*
- * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "MsgThread.h"
-#include "App.h"
-#include "Logger.h"
-
-using namespace Msg;
-
-Evas_Object *MsgThread::createSearchPanel(Evas_Object *parent)
-{
- m_pSearchPanel = new MsgThreadSearchPanel(*m_pLayout);
- m_pSearchPanel->setListener(this);
- m_pSearchPanel->setGuideText("Search");
- m_pSearchPanel->show();
- return *m_pSearchPanel;
-}
-
-void MsgThread::setSearchMode(bool value)
-{
- getNaviBar().showButton(NaviPrevButtonId, value);
- if(value)
- {
- m_Mode = SearchMode;
- m_pSearchPanel->clearEntry();
- getNaviBar().showSearch();
- }
- else
- {
- getNaviBar().hideSearch();
- }
-
- m_pSearchPanel->setEntryFocus(value);
-}
-
-void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj)
-{
- MSG_LOG("");
-}
-
-void MsgThread::onEntryChanged(MsgThreadSearchPanel &obj)
-{
- MSG_LOG("");
-}
--- /dev/null
+/*
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include "ThreadList.h"
+#include "ThreadListItem.h"
+#include "ListItem.h"
+#include "SelectAllListItem.h"
+#include "App.h"
+
+using namespace Msg;
+
+namespace
+{
+ inline bool isSelectAll(ListItem *it)
+ {
+ return dynamic_cast<SelectAllListItem*>(it) != nullptr;
+ }
+}
+
+ThreadList::ThreadList(Evas_Object *parent, App &app)
+ : ListView(parent)
+ , m_pListener(nullptr)
+ , m_App(app)
+ , m_DeleteMode(false)
+{
+ ListView::setListener(this);
+ ListView::setMultiSelection(false);
+ ListView::setMode(ELM_LIST_COMPRESS);
+ m_App.getMsgEngine().getStorage().addListener(*this);
+ updateList();
+}
+
+ThreadList::~ThreadList()
+{
+ m_App.getMsgEngine().getStorage().removeListener(*this);
+}
+
+void ThreadList::setListener(IThreadListListener *l)
+{
+ m_pListener = l;
+}
+
+void ThreadList::setDeleteMode(bool value)
+{
+ m_DeleteMode = value;
+ setCheckMode(value);
+ checkAllItems(false);
+ showSelectAllItem(value);
+}
+
+bool ThreadList::isDeleteModeEnabled() const
+{
+ return m_DeleteMode;
+}
+
+
+void ThreadList::deleteSelectedItems()
+{
+ auto collection = getItems<ThreadListItem>();
+ for(ThreadListItem *it : collection)
+ {
+ if(it->getCheckedState())
+ m_App.getMsgEngine().getStorage().deleteThread(it->getThreadId());
+ }
+}
+
+void ThreadList::showSelectAllItem(bool show, bool resetCheck)
+{
+ SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(getFirstItem());
+
+ if(show)
+ {
+ if(!item)
+ {
+ item = new SelectAllListItem;
+ prependItem(*item);
+ }
+
+ if(item && resetCheck)
+ item->setCheckedState(false, true);
+ }
+ else
+ {
+ if(item)
+ item->destroy();
+ }
+}
+
+void ThreadList::checkAllItems(bool check)
+{
+ auto items = getItems();
+ for(ListItem *it : items)
+ {
+ if(it->isCheckable() && !isSelectAll(it))
+ it->setCheckedState(check, true);
+ }
+}
+
+void ThreadList::checkHandler(SelectAllListItem &item)
+{
+ bool checked = item.getCheckedState();
+ checkAllItems(checked);
+}
+
+void ThreadList::checkHandler(ThreadListItem &item)
+{
+ ThreadId threadId = item.getThreadId();
+ MSG_LOG("Checked (id : state) = ", threadId, ":", item.getCheckedState());
+}
+
+void ThreadList::updateList()
+{
+ MsgThreadListRef list = m_App.getMsgEngine().getStorage().getThreadList();
+ if(!list)
+ return;
+
+ int length = list->getLength();
+ for(int i = 0; i < length; ++i)
+ {
+ ThreadListItem *item = new ThreadListItem(list->at(i), m_App);
+ ListView::appendItem(*item);
+ }
+}
+
+void ThreadList::onMsgStorageChange(const MsgIdList &idList)
+{
+ ListView::clear(); // FIXME: temporary solution for demo
+ updateList();
+ if(m_pListener)
+ m_pListener->onThreadListChanged();
+}
+
+void ThreadList::onListItemSelected(ListItem &listItem, void *funcData)
+{
+ ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem);
+ if(it && m_pListener)
+ m_pListener->onListItemSelected(it->getThreadId());
+}
+
+void ThreadList::onListItemChecked(ListItem &listItem, void *funcData)
+{
+ if(ThreadListItem *it = dynamic_cast<ThreadListItem*>(&listItem))
+ checkHandler(*it);
+ else if(SelectAllListItem *it = dynamic_cast<SelectAllListItem*>(&listItem))
+ checkHandler(*it);
+}
* 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 __THREAD_LIST_ITEM_TYPE_H__
-#define __THREAD_LIST_ITEM_TYPE_H__
-namespace Msg
-{
- enum ItemType
- {
- IT_TREAD = 0,
- IT_SEPARATOR,
- IT_MAX
- };
-}
+#include "ThreadSearchList.h"
+using namespace Msg;
+ThreadSearchList::ThreadSearchList(Evas_Object *parent)
+ : ListView(parent)
+{
+ setMultiSelection(false);
+ setMode(ELM_LIST_COMPRESS);
+}
-#endif /* __THREAD_LIST_ITEM_TYPE_H__ */
+ThreadSearchList::~ThreadSearchList()
+{
+}
virtual ~MsgThreadLayout();
void setList(Evas_Object *list);
- void setBg(Evas_Object *bg);
-
+ void setSearchList(Evas_Object *searchList);
+ void setNoContent(Evas_Object *bg);
+ void showNoContent(bool show);
+ void showSearchList(bool show);
+ void showThreadList(bool show);
private:
void create(Evas_Object *parent);
void setContent(Evas_Object *obj);
void showClearButton(bool visible);
void setGuideText(const std::string &text);
void setEntryFocus(bool focus);
+ bool isEmpty() const;
private:
void create(Evas_Object *parent);
m_pLayout = elm_layout_add(parent);
evas_object_show(m_pLayout);
std::string path = PathUtils::getResourcePath(MSG_THREAD_EDJ_PATH);
- elm_layout_file_set(m_pLayout, path.c_str(), "msg_thread");
+ elm_layout_file_set(m_pLayout, path.c_str(), "msg_thread_layout");
DefaultLayout::setContent(m_pLayout);
}
elm_object_part_content_set(m_pLayout, "swl.list", list);
}
-void MsgThreadLayout::setBg(Evas_Object *bg)
+void MsgThreadLayout::setSearchList(Evas_Object *searchList)
+{
+ elm_object_part_content_set(m_pLayout, "swl.search_list", searchList);
+}
+
+void MsgThreadLayout::setNoContent(Evas_Object *bg)
{
elm_object_part_content_set(m_pLayout, "swl.bg", bg);
}
+
+void MsgThreadLayout::showNoContent(bool show)
+{
+ const char *sig = show ? "show_bg" : "hide_bg";
+ elm_layout_signal_emit(m_pLayout, sig, "");
+}
+
+void MsgThreadLayout::showSearchList(bool show)
+{
+ const char *sig = show ? "show_search_list" : "hide_search_list";
+ elm_layout_signal_emit(m_pLayout, sig, "");
+}
+
+void MsgThreadLayout::showThreadList(bool show)
+{
+ const char *sig = show ? "show_list" : "hide_list";
+ elm_layout_signal_emit(m_pLayout, sig, "");
+}
// setContent(backButton, "swl.back_button"); TODO:
}
+bool MsgThreadSearchPanel::isEmpty() const
+{
+ const char *text = elm_entry_entry_get(m_pEntry);
+ return text ? *text == 0 : true;
+}
+
void MsgThreadSearchPanel::setListener(IMsgThreadSearchPanelListener *listener)
{
m_pListener = listener;
+++ /dev/null
-/*
- * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-
-#include "ThreadListView.h"
-#include "ThreadListViewItem.h"
-#include "ListItem.h"
-#include "SelectAllListItem.h"
-
-using namespace Msg;
-
-namespace
-{
- inline bool isSelectAll(ListItem *it)
- {
- return dynamic_cast<SelectAllListItem*>(it) != nullptr;
- }
-}
-
-ThreadListView::ThreadListView(Evas_Object *parent)
- : ListView(parent)
-{
-
-}
-
-ThreadListView::~ThreadListView()
-{
-}
-
-void ThreadListView::showSelectAllItem(bool show, bool resetCheck)
-{
- SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(getFirstItem());
-
- if(show)
- {
- if(!item)
- {
- item = new SelectAllListItem;
- prependItem(*item);
- }
-
- if(item && resetCheck)
- {
- item->setCheckedState(false, true);
- }
- }
- else
- {
- if(item)
- {
- item->destroy();
- }
- }
-}
-
-void ThreadListView::checkAllItems(bool check)
-{
- auto items = getItems();
- for(ListItem *it : items)
- {
- if(it->isCheckable() && !isSelectAll(it))
- {
- it->setCheckedState(check, true);
- }
- }
-}
*/
#include "ThreadListViewItem.h"
-#include "ThreadListView.h"
-#include "ThreadListItemType.h"
#include "Logger.h"
#include "PathUtils.h"
#include "ThumbnailMaker.h"
}
ThreadListViewItem::ThreadListViewItem(Elm_Genlist_Item_Type type)
- : ListItem(threadItemStyle, type, IT_TREAD)
+ : ListItem(threadItemStyle, type)
, m_State(NormalState)
{
}
*/
#include "SimListViewItem.h"
-#include "ThreadListView.h"
-#include "ThreadListItemType.h"
#include "Logger.h"
#include "PathUtils.h"
#include "ThumbnailMaker.h"
}
SimListViewItem::SimListViewItem(Elm_Genlist_Item_Type type)
- : ListItem(SimItemStyle, type, IT_TREAD)
+ : ListItem(SimItemStyle, type)
{
}