#include "ViewItemController.h"
#include "NaviFrameItem.h"
#include "NaviFrameController.h"
+#include "MsgAddress.h"
namespace Msg
{
virtual NaviFrameController &getParent();
protected:
+ void setNaviBarTitle(const MsgAddressList &addressList);
+
// NaviFrameItem
virtual void onAttached(ViewItem &item);
};
#include "NaviFrameController.h"
#include "Logger.h"
#include "App.h"
+#include "ContactManager.h"
using namespace Msg;
NaviFrameItem::onAttached(item);
}
+void FrameController::setNaviBarTitle(const MsgAddressList &addressList)
+{
+ std::string title;
+ if(!addressList.isEmpty())
+ {
+ std::string firstAddress = addressList[0].getAddress();
+ ContactPersonAddressRef contactPersonAddress = getApp().getContactManager().getContactPersonAddress(firstAddress);
+ if(contactPersonAddress)
+ title = contactPersonAddress->getDispName();
+
+ if(title.empty())
+ {
+ title = firstAddress;
+ }
+ else
+ {
+ int hidenAddresses = addressList.getLength() - 1;
+ if(hidenAddresses > 0)
+ {
+ title += " + " + std::to_string(hidenAddresses);
+ getNaviBar().showButton(NaviDownButtonId, true);
+ }
+ }
+ }
+ getNaviBar().showButton(NaviCenterButtonId, true);
+ getNaviBar().setButtonText(NaviCenterButtonId, title);
+}
void Conversation::updateNavibar()
{
- getNaviBar().clear();
- getNaviBar().setColor(NaviBar::NaviWhiteColorId);
-
- // TODO: Update Navibar title(center) button in separated method ?
+ NaviBar &naviBar = getNaviBar();
+ naviBar.clear();
+ naviBar.setColor(NaviBar::NaviWhiteColorId);
+ naviBar.showButton(NaviPrevButtonId, true);
if(m_Mode == NewMessageMode)
{
- getNaviBar().setTitle(msgt("IDS_MSGF_POP_NEW_MESSAGE"));
- getNaviBar().showButton(NaviPrevButtonId, true);
+ naviBar.setTitle(msgt("IDS_MSGF_POP_NEW_MESSAGE"));
}
else if(m_Mode == ConversationMode)
{
if(m_pConvList->getMode() == ConvList::SelectMode)
{
- getNaviBar().setTitle(msgt("IDS_MSG_OPT_DELETE"));
- getNaviBar().showButton(NaviCancelButtonId, true);
- getNaviBar().showButton(NaviOkButtonId, true);
+ naviBar.setTitle(msgt("IDS_MSG_OPT_DELETE"));
+ naviBar.showButton(NaviCancelButtonId, true);
+ naviBar.showButton(NaviOkButtonId, true);
}
else
{
MsgAddressListRef addressList = getAddressList();
- if(addressList && !addressList->isEmpty())
+ if(addressList)
{
- std::string conversationName;
- std::string firstAddress = addressList->at(0).getAddress();
- ContactPersonAddressRef contactPersonNumber = getApp().getContactManager().getContactPersonAddress(firstAddress);
- if(contactPersonNumber)
- conversationName = contactPersonNumber->getDispName();
-
- if(conversationName.empty())
- conversationName = firstAddress;
-
- int hidenAddresses= addressList->getLength() - 1;
- if(hidenAddresses > 0)
- {
- conversationName += " + " + std::to_string(hidenAddresses);
- getNaviBar().showButton(NaviDownButtonId, true);
- }
-
- getNaviBar().showButton(NaviCenterButtonId, true);
- getNaviBar().showButton(NaviPrevButtonId, true);
- getNaviBar().setButtonText(NaviCenterButtonId, conversationName);
+ naviBar.showButton(NaviCenterButtonId, true);
+ FrameController::setNaviBarTitle(*addressList);
}
}
}
#include "ViewerLayout.h"
#include "PlayerControl.h"
#include "MsgTypes.h"
+#include "ContactManager.h"
namespace Msg
{
: public FrameController
, private IHwButtonListener
, private IPlayerControlListener
+ , private IContactManagerListener
{
public:
Viewer(NaviFrameController &parent, MsgId id);
virtual void onHwBackButtonClicked();
virtual void onHwMoreButtonClicked();
- /// IPlayerControlListener:
+ // IPlayerControlListener:
virtual void onPlayClicked();
virtual void onPauseClicked();
virtual void onNextClicked();
virtual void onPrevClicked();
+ // IContactManagerListener:
+ virtual void onContactChanged();
+
private:
void updateNavibar();
void create();
#include "Logger.h"
#include "PathUtils.h"
#include "Logger.h"
+#include "MsgEngine.h"
+#include "App.h"
#include <Elementary.h>
#include <sstream>
Viewer::~Viewer()
{
+ getApp().getContactManager().removeListener(*this);
}
void Viewer::onAttached(ViewItem &item)
void Viewer::updateNavibar()
{
- getNaviBar().setTitle("Viewer");
+ getNaviBar().clear();
getNaviBar().setColor(NaviBar::NaviBlueColorId);
getNaviBar().showButton(NaviPrevButtonId, true);
+ MessageRef msg = getMsgEngine().getStorage().getMessage(m_MsgId);
+ if(msg)
+ FrameController::setNaviBarTitle(msg->getAddressList());
}
void Viewer::create()
{
+ getApp().getContactManager().addListener(*this);
createLayout();
createPlayerControl();
setHwButtonListener(*m_pLayout, this);
void Viewer::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- if(buttonId == NaviPrevButtonId)
- getParent().pop();
+ MSG_LOG("");
+ switch(buttonId)
+ {
+ case NaviCenterButtonId:
+ break;
+
+ case NaviPrevButtonId:
+ getParent().pop();
+ break;
+
+ case NaviDownButtonId:
+ break;
+
+ default:
+ break;
+ };
}
void Viewer::onPlayClicked()
{
MSG_LOG("");
}
+
+void Viewer::onContactChanged()
+{
+ MSG_LOG("");
+ updateNavibar();
+}