if (value) {
if (!m_pNoContentItem) {
m_pNoContentItem = new NoContentListViewItem;
+ m_pNoContentItem->setText("WDS_MSG_NPBODY_NO_MESSAGES_ABB");
insertBeforeItem(*m_pNoContentItem, *m_pBottomPadItem);
}
} else if (m_pNoContentItem){
public:
NoContentListViewItem();
+ void setText(std::string text);
+
protected:
void onAttached(ViewItem &item) override;
private:
std::string getText(ListItem &item, const char *part) override;
+
+ private:
+ std::string m_Text;
};
inline NoContentListViewItem::NoContentListViewItem()
{
}
+ inline void NoContentListViewItem::setText(std::string text)
+ {
+ m_Text = std::move(text);
+ }
+
inline std::string NoContentListViewItem::getText(ListItem &item, const char *part)
{
if (!strcmp(part, "elm.text"))
- return (std::string)msg("WDS_MSG_NPBODY_NO_MESSAGES_ABB");
+ return (std::string)msg(m_Text.c_str());
return "";
}
--- /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 BlockedMsgListItem_h_
+#define BlockedMsgListItem_h_
+
+#include "ThreadListViewItem.h"
+
+namespace Msg {
+ class BlockedMsgListItem
+ : public ThreadListViewItem {
+
+ public:
+ BlockedMsgListItem();
+ virtual ~BlockedMsgListItem();
+
+ private:
+ std::string getName() override;
+ std::string getMessage() override;
+ std::string getTime() override;
+ std::string getUnreadCount() override;
+ };
+}
+
+#endif // BlockedMsgListItem_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 BlockedNumberListItem_h_
+#define BlockedNumberListItem_h_
+
+#include "BlockedNumberListViewItem.h"
+
+namespace Msg {
+ class BlockedNumberListItem
+ : public BlockedNumberListViewItem {
+
+ public:
+ BlockedNumberListItem();
+ virtual ~BlockedNumberListItem();
+
+ private:
+ std::string getAddress() override;
+ std::string getContactName() override;
+ };
+}
+
+#endif // BlockedNumberListItem_h_
#define SettingsBlockListFrame_h_
#include "FrameController.h"
+#include "ListView.h"
+
+namespace Msg {
-namespace Msg
-{
class ListView;
class ListItem;
+ class DefaultLayout;
+ class MoreOption;
+ class BottomButton;
+ class CtxPopupItem;
+ class SelectButton;
+ class PaddingListViewItem;
+ class NoContentListViewItem;
class SettingsBlockListFrame
- : public FrameController
- {
+ : public FrameController {
+
public:
- SettingsBlockListFrame(NaviFrameController &parent);
+ enum BlockListType {
+ BlockedNumType,
+ BlockedMsgType
+ };
+
+ SettingsBlockListFrame(NaviFrameController &parent, BlockListType type);
virtual ~SettingsBlockListFrame();
protected:
void onAttached(ViewItem &item) override;
private:
- void onBlockedNumberSelected(ListItem &listItem);
- void onBlockedMsgSelected(ListItem &listItem);
+ // Select mode cb:
+ void onDoneButtonClicked(Evas_Object *obj, void *event);
+ void onSelectButtonClicked(Evas_Object *obj, void *event);
+ void onSelectAllButtonClicked(CtxPopupItem &item);
+ void onDeselectAllButtonClicked(CtxPopupItem &item);
+
+ // More option:
+ void onRestoreClicked(MoreOption &obj);
+ void onDeleteClicked(MoreOption &obj);
+ void prepareMainLayout();
+ void prepareMoreOption();
+ void prepareSelectViews();
void preapareList();
+ void updateCheckViews();
void fillList();
+ void setSelectMode(bool value);
+ void showSelectPopup();
+ void updateNoContent();
+ void insertItem(ListItem *item);
private:
+ const BlockListType m_BlockListType;
+ bool m_IsSelectMode;
+ DefaultLayout *m_pLayout;
+ MoreOption *m_pMoreOption;
+ BottomButton *m_pDoneButton;
+ SelectButton *m_pSelectButton;
ListView *m_pList;
+ PaddingListViewItem *m_pBottomItem;
+ NoContentListViewItem *m_pNoContentItem;
};
}
#define SettingsFrame_h_
#include "FrameController.h"
-#include "SettingsBlockListFrame.h"
+#include "SettingsMenuBlockListFrame.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief A core-class responsible for a whole lifecycle of settings-module and for managing
* sub-components of message settings.
*/
class SettingsFrame
- : public SettingsBlockListFrame
- {
+ : public SettingsMenuBlockListFrame {
public:
/**
* @brief A constructor of Settings object based on outside parent object.
--- /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 SettingsMenuBlockListFrame_h_
+#define SettingsMenuBlockListFrame_h_
+
+#include "FrameController.h"
+
+namespace Msg {
+ class ListView;
+ class ListItem;
+
+ class SettingsMenuBlockListFrame
+ : public FrameController {
+ public:
+ SettingsMenuBlockListFrame(NaviFrameController &parent);
+ virtual ~SettingsMenuBlockListFrame();
+
+ protected:
+ // NaviFrameItem:
+ void onAttached(ViewItem &item) override;
+
+ private:
+ void onBlockedNumberSelected(ListItem &listItem);
+ void onBlockedMsgSelected(ListItem &listItem);
+
+ void preapareList();
+ void fillList();
+
+ private:
+ ListView *m_pList;
+ };
+}
+
+#endif /* SettingsMenuBlockListFrame_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.
+ */
+
+#include "BlockedMsgListItem.h"
+
+using namespace Msg;
+
+BlockedMsgListItem::BlockedMsgListItem()
+{
+
+}
+
+BlockedMsgListItem::~BlockedMsgListItem()
+{
+
+}
+
+std::string BlockedMsgListItem::getName()
+{
+ // TODO: impl.
+ return "Name";
+}
+
+std::string BlockedMsgListItem::getMessage()
+{
+ // TODO: impl.
+ return "Message";
+}
+
+std::string BlockedMsgListItem::getTime()
+{
+ // TODO: impl.
+ return "";
+}
+
+std::string BlockedMsgListItem::getUnreadCount()
+{
+ // TODO: impl.
+ return "";
+}
+
--- /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 "BlockedNumberListItem.h"
+
+using namespace Msg;
+
+BlockedNumberListItem::BlockedNumberListItem()
+{
+ // TODO: impl.
+}
+
+BlockedNumberListItem::~BlockedNumberListItem()
+{
+}
+
+std::string BlockedNumberListItem::getAddress()
+{
+ // TODO: impl.
+ return "Address";
+}
+
+std::string BlockedNumberListItem::getContactName()
+{
+ // TODO: impl.
+ return "Name";
+}
* limitations under the License.
*/
+
#include "SettingsBlockListFrame.h"
-#include "SettingsMenuListItem.h"
+#include "MoreOption.h"
+#include "BottomButton.h"
+#include "DefaultLayout.h"
+#include "TitleListItem.h"
#include "PaddingListViewItem.h"
-#include "App.h"
-#include "Window.h"
+#include "SelectButton.h"
+#include "SelectCtxPopup.h"
#include "Logger.h"
-#include "ListView.h"
-#include "TitleListItem.h"
-#include "ListView.h"
+#include "BlockedNumberListItem.h"
+#include "BlockedMsgListItem.h"
+#include "NoContentListViewItem.h"
using namespace Msg;
-SettingsBlockListFrame::SettingsBlockListFrame(NaviFrameController &parent)
+SettingsBlockListFrame::SettingsBlockListFrame(NaviFrameController &parent, BlockListType type)
: FrameController(parent)
+ , m_BlockListType(type)
+ , m_IsSelectMode(false)
+ , m_pLayout(nullptr)
+ , m_pMoreOption(nullptr)
+ , m_pDoneButton(nullptr)
+ , m_pSelectButton(nullptr)
, m_pList(nullptr)
+ , m_pBottomItem(nullptr)
+ , m_pNoContentItem(nullptr)
{
+ MSG_LOG("");
+ prepareMainLayout();
+ prepareMoreOption();
preapareList();
+ updateNoContent();
}
SettingsBlockListFrame::~SettingsBlockListFrame()
{
+}
+
+void SettingsBlockListFrame::setSelectMode(bool value)
+{
+ if (value == m_IsSelectMode)
+ return;
+
+ m_IsSelectMode = value;
+ m_pLayout->showBottomButton(value);
+ m_pLayout->showMoreOption(!value);
+ if (value) {
+ prepareSelectViews();
+ m_pSelectButton->setText("0");
+ m_pSelectButton->showButton(true);
+ m_pDoneButton->disabled(true);
+ } else {
+ if (m_pSelectButton)
+ m_pSelectButton->showButton(false);
+ }
}
-void SettingsBlockListFrame::onAttached(ViewItem &item)
+void SettingsBlockListFrame::prepareMainLayout()
{
- FrameController::onAttached(item);
- setContent(*m_pList);
+ if (!m_pLayout) {
+ m_pLayout = new DefaultLayout(getParent());
+ m_pLayout->showSelectButton(true);
+ m_pLayout->showMoreOption(true);
+ }
}
void SettingsBlockListFrame::preapareList()
m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface());
m_pList->setHomogeneous(false);
m_pList->setMultiSelection(false);
+ m_pLayout->setContent(*m_pList);
fillList();
}
}
void SettingsBlockListFrame::fillList()
{
- using namespace std::placeholders;
-
// Title:
auto *titleItem = new TitleListItem;
- titleItem->setTitle("WDS_MSG_MBODY_BLOCK_LIST", true);
+ const char *titleStr = m_BlockListType == BlockedMsgType ? "WDS_MSG_MBODY_BLOCKED_MESSAGES"
+ : "WDS_MSG_MBODY_BLOCKED_NUMBERS";
+ titleItem->setTitle(titleStr, true);
m_pList->appendItem(*titleItem);
- // Blocked number:
- auto *blockedNum = new SettingsMenuListItem(SettingsMenuListItem::oneTextStyle);
- blockedNum->setText("WDS_MSG_MBODY_BLOCKED_NUMBERS");
- std::bind(&SettingsBlockListFrame::onBlockedNumberSelected, this);
- blockedNum->setOnSelectedCb(std::bind(&SettingsBlockListFrame::onBlockedNumberSelected, this, _1));
- m_pList->appendItem(*blockedNum);
+ // Bottom padding:
+ m_pBottomItem = new PaddingListViewItem;
+ insertItem(m_pBottomItem);
+}
+
+void SettingsBlockListFrame::prepareMoreOption()
+{
+ if (!m_pMoreOption) {
+ m_pMoreOption = new MoreOption(*m_pLayout);
+ m_pMoreOption->setDirection(EEXT_MORE_OPTION_DIRECTION_RIGHT);
+ m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_NEW_MESSAGE_ABB"), NEW_MSG_MORE_ICON, makeCbLast(&SettingsBlockListFrame::onRestoreClicked), this);
+ m_pMoreOption->appendItem(msgt("WDS_MSG_OPT_DELETE_ABB"), DELETEG_MORE_ICON, makeCbLast(&SettingsBlockListFrame::onDeleteClicked), this);
+ m_pLayout->setMoreOption(*m_pMoreOption);
+ }
+}
- // Blocked messages:
- auto *blockedMsg = new SettingsMenuListItem(SettingsMenuListItem::oneTextStyle);
- blockedMsg->setText("WDS_MSG_MBODY_BLOCKED_NUMBERS");
- blockedMsg->setOnSelectedCb(std::bind(&SettingsBlockListFrame::onBlockedMsgSelected, this, _1));
- m_pList->appendItem(*blockedMsg);
+void SettingsBlockListFrame::prepareSelectViews()
+{
+ if (!m_pDoneButton) {
+ m_pDoneButton = new BottomButton(*m_pLayout);
+ m_pDoneButton->setText(msgt("IDS_MSG_ACBUTTON_DELETE_ABB"));
+ View::addSmartCb(m_pDoneButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockListFrame::onDoneButtonClicked), this);
+ m_pLayout->setBottomButton(*m_pDoneButton);
+ }
- // Bottom padding:
- m_pList->appendItem(*new PaddingListViewItem);
+ if (!m_pSelectButton) {
+ m_pSelectButton = new SelectButton(*m_pLayout);
+ View::addSmartCb(m_pSelectButton->getInnerButton(), "clicked", makeCbFirst(&SettingsBlockListFrame::onSelectButtonClicked), this);
+ m_pLayout->setSelectButton(*m_pSelectButton);
+ }
+}
+
+void SettingsBlockListFrame::updateCheckViews()
+{
+ if (m_IsSelectMode) {
+ int count = m_pList->getCheckedItemsCount();
+ m_pSelectButton->setText(std::to_string(count));
+ m_pDoneButton->disabled(count <= 0);
+ }
+}
+
+void SettingsBlockListFrame::showSelectPopup()
+{
+ auto *ctx = new SelectCtxPopup;
+ int checkedCount = m_pList->getCheckedItemsCount();
+ int checkableCount = m_pList->getCheckableItemsCount();
+
+ if (checkedCount < checkableCount)
+ ctx->appendTopItem(msg("WDS_MSG_OPT_SELECT_ALL_ABB"), makeCbLast(&SettingsBlockListFrame::onSelectAllButtonClicked), this);
+ if (checkedCount > 0)
+ ctx->appendBottomItem(msg("WDS_MSG_OPT_DESELECT_ALL_ABB"), makeCbLast(&SettingsBlockListFrame::onDeselectAllButtonClicked), this);
+
+ if (m_pSelectButton)
+ ctx->align(m_pSelectButton->getInnerButton());
+
+ ctx->go();
+}
+
+void SettingsBlockListFrame::updateNoContent()
+{
+ int count = m_BlockListType == BlockedNumType ? m_pList->getItemsCount<BlockedNumberListItem>()
+ : m_pList->getItemsCount<BlockedMsgListItem>();
+
+ if (count <= 0) {
+ if (!m_pNoContentItem) {
+ const char *noContentText = m_BlockListType == BlockedNumType ? "WDS_MSG_NPBODY_NO_BLOCKED_NUMBERS_ABB"
+ : "WDS_MSG_NPBODY_NO_BLOCKED_MESSAGES_ABB";
+ m_pNoContentItem = new NoContentListViewItem;
+ m_pNoContentItem->setText(noContentText);
+ insertItem(m_pNoContentItem);
+ }
+ } else if (m_pNoContentItem) {
+ m_pNoContentItem->destroy();
+ m_pNoContentItem = nullptr;
+ }
+}
+
+void SettingsBlockListFrame::insertItem(ListItem *item)
+{
+ if(m_pBottomItem && m_pBottomItem != item)
+ m_pList->insertBeforeItem(*item, *m_pBottomItem);
+ else
+ m_pList->appendItem(*item);
+}
+
+void SettingsBlockListFrame::onAttached(ViewItem &item)
+{
+ FrameController::onAttached(item);
+ setContent(*m_pLayout);
+}
+
+void SettingsBlockListFrame::onSelectAllButtonClicked(CtxPopupItem &item)
+{
+ MSG_LOG("");
+}
+
+void SettingsBlockListFrame::onDeselectAllButtonClicked(CtxPopupItem &item)
+{
+ MSG_LOG("");
+}
+
+void SettingsBlockListFrame::onRestoreClicked(MoreOption &obj)
+{
+ MSG_LOG("");
+}
+
+void SettingsBlockListFrame::onDeleteClicked(MoreOption &obj)
+{
+ MSG_LOG("");
+ setSelectMode(true);
}
-void SettingsBlockListFrame::onBlockedNumberSelected(ListItem &listItem)
+void SettingsBlockListFrame::onDoneButtonClicked(Evas_Object *obj, void *event)
{
MSG_LOG("");
+ setSelectMode(false);
}
-void SettingsBlockListFrame::onBlockedMsgSelected(ListItem &listItem)
+void SettingsBlockListFrame::onSelectButtonClicked(Evas_Object *obj, void *event)
{
MSG_LOG("");
}
+
+
using namespace Msg;
SettingsFrame::SettingsFrame(NaviFrameController &parent)
- : SettingsBlockListFrame(parent)
+ : SettingsMenuBlockListFrame(parent)
{
}
void SettingsFrame::onAttached(ViewItem &item)
{
MSG_LOG("");
- SettingsBlockListFrame::onAttached(item);
+ SettingsMenuBlockListFrame::onAttached(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 "SettingsMenuBlockListFrame.h"
+#include "SettingsMenuListItem.h"
+#include "PaddingListViewItem.h"
+#include "App.h"
+#include "Window.h"
+#include "Logger.h"
+#include "ListView.h"
+#include "TitleListItem.h"
+#include "ListView.h"
+#include "SettingsBlockListFrame.h"
+
+using namespace Msg;
+
+SettingsMenuBlockListFrame::SettingsMenuBlockListFrame(NaviFrameController &parent)
+ : FrameController(parent)
+ , m_pList(nullptr)
+{
+ preapareList();
+}
+
+SettingsMenuBlockListFrame::~SettingsMenuBlockListFrame()
+{
+
+}
+
+void SettingsMenuBlockListFrame::onAttached(ViewItem &item)
+{
+ FrameController::onAttached(item);
+ setContent(*m_pList);
+}
+
+void SettingsMenuBlockListFrame::preapareList()
+{
+ if (!m_pList) {
+ m_pList = new ListView(getParent(), App::getInst().getWindow().getCircleSurface());
+ m_pList->setHomogeneous(false);
+ m_pList->setMultiSelection(false);
+ fillList();
+ }
+}
+
+void SettingsMenuBlockListFrame::fillList()
+{
+ using namespace std::placeholders;
+
+ // Title:
+ auto *titleItem = new TitleListItem;
+ titleItem->setTitle("WDS_MSG_MBODY_BLOCK_LIST", true);
+ m_pList->appendItem(*titleItem);
+
+ // Blocked number:
+ auto *blockedNum = new SettingsMenuListItem(SettingsMenuListItem::oneTextStyle);
+ blockedNum->setText("WDS_MSG_MBODY_BLOCKED_NUMBERS");
+ blockedNum->setOnSelectedCb(std::bind(&SettingsMenuBlockListFrame::onBlockedNumberSelected, this, _1));
+ m_pList->appendItem(*blockedNum);
+
+ // Blocked messages:
+ auto *blockedMsg = new SettingsMenuListItem(SettingsMenuListItem::oneTextStyle);
+ blockedMsg->setText("WDS_MSG_MBODY_BLOCKED_MESSAGES");
+ blockedMsg->setOnSelectedCb(std::bind(&SettingsMenuBlockListFrame::onBlockedMsgSelected, this, _1));
+ m_pList->appendItem(*blockedMsg);
+
+ // Bottom padding:
+ m_pList->appendItem(*new PaddingListViewItem);
+}
+
+void SettingsMenuBlockListFrame::onBlockedNumberSelected(ListItem &listItem)
+{
+ MSG_LOG("");
+ auto *frame = new SettingsBlockListFrame(getParent(), SettingsBlockListFrame::BlockedNumType);
+ getParent().push(*frame);
+}
+
+void SettingsMenuBlockListFrame::onBlockedMsgSelected(ListItem &listItem)
+{
+ MSG_LOG("");
+ auto *frame = new SettingsBlockListFrame(getParent(), SettingsBlockListFrame::BlockedMsgType);
+ getParent().push(*frame);
+}
+
namespace Msg {
class BlockedNumberListViewItem
: public ListItem {
- public:
- BlockedNumberListViewItem();
- virtual ~BlockedNumberListViewItem();
public:
static ListItemStyleRef numberStyle;
static ListItemStyleRef contactNameStyle;
+ public:
+ BlockedNumberListViewItem();
+ virtual ~BlockedNumberListViewItem();
+
+
protected:
virtual std::string getAddress() = 0;
virtual std::string getContactName() = 0;