#include <string>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class AppControlCommand;
typedef std::shared_ptr<AppControlCommand> AppControlCommandRef;
- class AppControlCommand
- {
+ class AppControlCommand {
public:
- enum OperationType
- {
+ enum OperationType {
OpUnknown,
OpDefault,
OpComposeFamily /** For operations Compose, Share, MultiShare and ShareText */
#include <string>
#include <list>
-namespace Msg
-{
+namespace Msg {
class AppControlCompose;
typedef std::shared_ptr<AppControlCompose> AppControlComposeRef;
- struct VcfInfo
- {
+ struct VcfInfo {
std::list<int> contactsIdList;
bool isMyProfile;
};
class AppControlCompose
- : public AppControlCommand
- {
+ : public AppControlCommand {
public:
typedef std::list<std::string> RecipientList;
typedef std::list<std::string> FileList;
- enum OpComposeType
- {
+ enum OpComposeType {
OpUnknown,
OpCompose, /** APP_CONTROL_OPERATION_COMPOSE */
OpShare, /** APP_CONTROL_OPERATION_SHARE */
#include "Logger.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class AppControlDefault;
typedef std::shared_ptr<AppControlDefault> AppControlDefaultRef;
class AppControlDefault
- : public AppControlCommand
- {
+ : public AppControlCommand {
public:
- enum DefaultType
- {
+ enum DefaultType {
UnknownType,
MainType, //Type from home screen
ReplyType, //Type for reply message button clicked from Active Notification
#include <Ecore.h>
-namespace Msg
-{
+namespace Msg {
class AppControlLauncher;
- class AppControlHandle
- {
+ class AppControlHandle {
friend class AppControlLauncher;
public:
app_control_h m_Handle;
};
- class AppControlLauncher
- {
+ class AppControlLauncher {
friend class AppControlHandle;
public:
#include "AppControlCommand.h"
#include <app_control.h>
-namespace Msg
-{
- class AppControlParser
- {
+namespace Msg {
+ class AppControlParser {
public:
static AppControlCommandRef parse(app_control_h handle);
};
return static_cast<ClassName*>(data)->method(request, reply, result);\
}
-namespace Msg
-{
- struct AppControlUtils
- {
+namespace Msg {
+ struct AppControlUtils {
/**
*@brief Gets a single string from given app-control handle by a key specified
*/
#include <string>
-namespace Msg
-{
+namespace Msg {
class IContactEditorListener;
/**
*@brief An utility-class aimed to launch contacts-application with add-operation and edit-operation passed via app-control.
*/
class ContactEditor
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
- enum Operation
- {
+ enum Operation {
EditOp,
CreateOp
};
#include "AppControlLauncher.h"
#include "ContactAddress.h"
-namespace Msg
-{
+namespace Msg {
/**
*@brief An utility-class aimed to launch contacts-application with view-operation passed via app-control.
*/
class ContactViewer
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
ContactViewer();
virtual ~ContactViewer();
#include "AppControlLauncher.h"
-namespace Msg
-{
+namespace Msg {
class FileViewer
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
FileViewer();
virtual ~FileViewer();
#include <list>
#include <string>
-namespace Msg
-{
+namespace Msg {
class Share
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
Share();
virtual ~Share();
#include "AppControlUtils.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
/**
* @brief An utility-class aimed to make voice call passed via app-control.
*/
- class VoiceCall
- {
+ class VoiceCall {
public:
VoiceCall();
using namespace Msg;
-namespace
-{
+namespace {
const std::string mimeContact = "application/vnd.tizen.contact";
const std::string myProfileDataType = "my_profile";
{
MSG_LOG("ComposeType: ", m_ComposeType);
- if (handle)
- {
- switch (m_ComposeType)
- {
+ if (handle) {
+ switch (m_ComposeType) {
case OpCompose:
createComposeOp(handle);
break;
{
parseUriCompose(handle);
if (m_RecipientList.empty())
- {
AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_TO, m_RecipientList);
- }
+
m_MessageText = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_TEXT);
m_Subject = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_SUBJECT);
AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_PATH, m_FileList);
{
parseUriShare(handle);
- if (mimeContact == AppControlUtils::getMimeType(handle))
- {
+ if (mimeContact == AppControlUtils::getMimeType(handle)) {
std::string idStr = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_ID);
- if (!idStr.empty())
- {
+ if (!idStr.empty()) {
std::string dataType = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_TYPE);
m_VcfInfo.isMyProfile = (dataType == myProfileDataType);
m_VcfInfo.contactsIdList.push_back(atoi(idStr.c_str()));
}
}
- if (m_FileList.empty())
- {
+ if (m_FileList.empty()) {
std::string path = AppControlUtils::getExtraData(handle, APP_CONTROL_DATA_PATH);
if (!path.empty())
m_FileList.push_back(std::move(path));
void AppControlCompose::createMultiShareOp(app_control_h handle)
{
- if (mimeContact == AppControlUtils::getMimeType(handle))
- {
+ if (mimeContact == AppControlUtils::getMimeType(handle)) {
std::list<std::string> contactsList;
AppControlUtils::getExtraDataArray(handle, APP_CONTROL_DATA_ID, contactsList);
for (auto it : contactsList)
bool res = false;
char *uri = nullptr;
- if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri))
- {
- if (uri)
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) {
+ if (uri) {
MSG_LOG("uri = ", uri);
std::string uriToParse(uri);
std::istringstream is(uriToParse);
std::getline(is, cur, ':');
MSG_LOG("cur = ", cur.c_str());
- if (cur == "sms" || cur == "mmsto")
- {
+ if (cur == "sms" || cur == "mmsto") {
m_isMms = (cur == "mmsto");
- for (; std::getline(is, cur, ',');)
- {
+ for (; std::getline(is, cur, ',');) {
m_RecipientList.push_back(cur);
}
res = true;
bool res = false;
char *uri = nullptr;
- if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri))
- {
- if (uri)
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_get_uri(handle, &uri)) {
+ if (uri) {
MSG_LOG("uri = ", uri);
std::string uriToParse(uri);
std::istringstream is(uriToParse);
std::getline(is, cur, ':');
MSG_LOG("cur = ", cur.c_str());
- if (cur == "sms" || cur == "mmsto" || cur == "file")
- {
+ if (cur == "sms" || cur == "mmsto" || cur == "file") {
m_isMms = (cur == "mmsto" || cur == "file");
- if (cur == "file" && m_FileList.empty())
- {
+ if (cur == "file" && m_FileList.empty()) {
std::string prefix("file://");
m_FileList.push_back(uriToParse.erase(0, prefix.length()));
}
using namespace Msg;
-namespace
-{
+namespace {
const char *notificationPanel = "http://tizen.org/appcontrol/data/notification";
const char *keyType = "type";
const char *valueNewMsg = "new_msg";
{
char *key = nullptr;
app_control_get_extra_data(handle, keyType, &key);
- if (!key)
- {
+ if (!key) {
m_DefaultType = MainType;
return;
}
{
char *keyVal = nullptr;
app_control_get_extra_data(handle, notificationPanel, &keyVal);
- if (keyVal)
- {
+ if (keyVal) {
free(keyVal);
return true;
}
AppControlHandle::~AppControlHandle()
{
- if (m_Handle)
- {
+ if (m_Handle) {
terminate();
app_control_destroy(m_Handle);
}
if (m_pHandle)
m_pHandle->onReply(request, reply, result);
- if (m_LaunchInProgress)
- {
+ if (m_LaunchInProgress) {
m_pTimer = ecore_timer_add(1.2, // Extra time for application startup.
[](void *data)->Eina_Bool
{
using namespace Msg;
-namespace
-{
+namespace {
typedef std::unordered_map<std::string, AppControlCommand::OperationType> OperationMap;
const OperationMap operationMap =
app_control_get_operation(handle, &opStr);
- if (!opStr)
- {
+ if (!opStr) {
MSG_LOG_WARN("app_control operation is null");
return cmd;
}
AppControlCommand::OperationType opType = getOperation(opStr);
- switch (opType)
- {
+ switch (opType) {
case AppControlCommand::OpDefault:
cmd = std::make_shared<AppControlDefault>(opStr, handle);
break;
{
std::string res;
char *val = nullptr;
- if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val))
- {
- if (val)
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val)) {
+ if (val) {
res = val;
free(val);
}
{
int arrayLength = 0;
char **pArrayVal = nullptr;
- if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength))
- {
- for (int i = 0; i < arrayLength; ++i)
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength)) {
+ for (int i = 0; i < arrayLength; ++i) {
outArray.push_back(pArrayVal[i]);
free(pArrayVal[i]);
}
{
char *val = nullptr;
int parsed = 0;
- if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val) && val)
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data(handle, key.c_str(), &val) && val) {
parsed = atoi(val);
free(val);
}
int arrayLength = 0;
char **pArrayVal = nullptr;
if (APP_CONTROL_ERROR_NONE == app_control_get_extra_data_array(handle, key.c_str(), &pArrayVal, &arrayLength)
- && pArrayVal)
- {
+ && pArrayVal) {
std::string::size_type sz;
- for (int i = 0; i < arrayLength; ++i)
- {
- if (pArrayVal[i])
- {
+ for (int i = 0; i < arrayLength; ++i) {
+ if (pArrayVal[i]) {
std::string s(pArrayVal[i] ? pArrayVal[i] : "");
free(pArrayVal[i]);
int parsed = std::stoi(s, &sz);
if (sz == s.length())
- {
outArray.push_back(parsed);
- }
}
}
free(pArrayVal);
char *mime = nullptr;
std::string result;
app_control_get_mime(handle, &mime);
- if (mime)
- {
+ if (mime) {
result = mime;
free(mime);
}
using namespace Msg;
-namespace
-{
+namespace {
const char* mimeContact = "application/vnd.tizen.contact";
}
bool ContactEditor::launch(const std::string &address, Operation operation)
{
bool res = false;
- if (!address.empty())
- {
+ if (!address.empty()) {
const char *op = nullptr;
if (operation == EditOp)
op = APP_CONTROL_OPERATION_EDIT;
else if (operation == CreateOp)
op = APP_CONTROL_OPERATION_ADD;
- if (op)
- {
+ if (op) {
if (MsgUtils::isValidNumber(address))
res = launch(address, op, APP_CONTROL_DATA_PHONE);
else if (MsgUtils::isValidEmail(address))
using namespace Msg;
-namespace
-{
+namespace {
const char *mimeContact = "application/vnd.tizen.contact";
const char *personContactTypeStr = "person";
const char *myProfileTypeStr = "my_profile";
const char *ContactViewer::toStr(ContactAddress::OwnerType type)
{
- switch (type)
- {
+ switch (type) {
case ContactAddress::PersonType:
return personContactTypeStr;
case ContactAddress::MyProfileType:
if (mime.empty() || file.empty())
return false;
- if (m_Handle)
- {
+ if (m_Handle) {
app_control_set_mime(m_Handle, mime.c_str());
std::string uri = "file://" + file;
app_control_set_uri(m_Handle, uri.c_str());
{
bool res = false;
- if (!AppControlLauncher::getInst().isLaunchInProgress())
- {
+ if (!AppControlLauncher::getInst().isLaunchInProgress()) {
// Remove previous file (correct only for APP_CONTROL_LAUNCH_MODE_GROUP)
if (!m_FilePath.empty())
FileUtils::remove(m_FilePath);
m_FilePath = FileUtils::addFileToDataDir(file);
- if (!m_FilePath.empty())
- {
+ if (!m_FilePath.empty()) {
FileUtils::saveFileToStorage(m_FilePath);
res = launch(m_FilePath);
}
void Share::removeFiles()
{
for (auto &&file : m_FileList)
- {
FileUtils::remove(file);
- }
+
m_FileList.clear();
}
{
removeFiles();
for (auto &&file : files)
- {
m_FileList.push_back(FileUtils::addFileToDataDir(file));
- }
}
bool Share::launch(const std::list<std::string> &files)
addFiles(files);
std::vector<const char*> nativePaths;
- for (const std::string &file : m_FileList)
- {
+ for (const std::string &file : m_FileList) {
if (!file.empty())
nativePaths.push_back(file.c_str());
}
using namespace Msg;
-namespace
-{
+namespace {
const std::string tel = "tel:";
}
bool res = false;
app_control_h svcHandle = nullptr;
- if (APP_CONTROL_ERROR_NONE == app_control_create(&svcHandle))
- {
+ if (APP_CONTROL_ERROR_NONE == app_control_create(&svcHandle)) {
app_control_set_operation(svcHandle, APP_CONTROL_OPERATION_CALL);
std::string phoneNumber = tel + number;
#include <string>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class Contact;
typedef std::shared_ptr<Contact> ContactRef;
class Contact
- : public ContactRecord
- {
+ : public ContactRecord {
public:
Contact(bool release, contacts_record_h record = nullptr);
#include "MsgUtils.h"
-namespace Msg
-{
+namespace Msg {
class ContactAddress;
typedef std::shared_ptr<ContactAddress> ContactAddressRef;
- class ContactAddress
- {
+ class ContactAddress {
public:
- enum AddressType
- {
+ enum AddressType {
EmailType,
NumberType
};
- enum OwnerType
- {
+ enum OwnerType {
PersonType,
MyProfileType
};
#include <contacts.h>
-namespace Msg
-{
+namespace Msg {
class ContactManager;
template <typename T>
- class ContactList
- {
+ class ContactList {
friend class ContactManager;
public:
#include "ContactMyProfileEmail.h"
#include "Contact.h"
-namespace Msg
-{
+namespace Msg {
/*
*@brief A listener to be notified after contact-information will be changed in contacts-db
*/
*@brief Class that work with contacts database.
*@brief Search contacts, add listeners, register callback on changes in database.
*/
- class ContactManager
- {
+ class ContactManager {
public:
ContactManager();
~ContactManager();
ContactMyProfileRef m_OwnerProfile;
};
- class IContactManagerListener
- {
+ class IContactManagerListener {
public:
virtual ~IContactManagerListener() {}
/*
#include "ContactRecord.h"
-namespace Msg
-{
+namespace Msg {
class ContactMyProfile;
typedef std::shared_ptr<ContactMyProfile> ContactMyProfileRef;
class ContactMyProfile
- : public ContactRecord
- {
+ : public ContactRecord {
public:
ContactMyProfile(bool release, contacts_record_h record = nullptr);
int getId() const;
#include "ContactRecord.h"
#include "ContactMyProfile.h"
-namespace Msg
-{
+namespace Msg {
class ContactMyProfileEmail;
typedef std::shared_ptr<ContactMyProfileEmail> ContactMyProfileEmailRef;
class ContactMyProfileEmail
: public ContactAddress
- , public ContactRecord
- {
+ , public ContactRecord {
public:
ContactMyProfileEmail(bool release, const ContactMyProfile &myProfile, contacts_record_h record = nullptr);
static const char *getUri();
#include "ContactRecord.h"
#include "ContactMyProfile.h"
-namespace Msg
-{
+namespace Msg {
class ContactMyProfileNumber;
typedef std::shared_ptr<ContactMyProfileNumber> ContactMyProfileNumberRef;
class ContactMyProfileNumber
: public ContactAddress
- , public ContactRecord
- {
+ , public ContactRecord {
public:
ContactMyProfileNumber(bool release, const ContactMyProfile &myProfile, contacts_record_h record = nullptr);
static const char *getUri();
#include "ContactAddress.h"
#include "ContactRecord.h"
-namespace Msg
-{
+namespace Msg {
class ContactPersonEmail;
typedef std::shared_ptr<ContactPersonEmail> ContactPersonEmailRef;
class ContactPersonEmail
: public ContactAddress
- , public ContactRecord
- {
+ , public ContactRecord {
public:
ContactPersonEmail(bool release, contacts_record_h record = nullptr);
static const char *getUri();
#include "ContactAddress.h"
#include "ContactRecord.h"
-namespace Msg
-{
+namespace Msg {
class ContactPersonNumber;
typedef std::shared_ptr<ContactPersonNumber> ContactPersonNumberRef;
class ContactPersonNumber
: public ContactAddress
- , public ContactRecord
- {
+ , public ContactRecord {
public:
ContactPersonNumber(bool release, contacts_record_h record = nullptr);
static const char *getUri();
#include "ContactRecord.h"
-namespace Msg
-{
+namespace Msg {
class ContactPersonPhoneLog;
typedef std::shared_ptr<ContactPersonPhoneLog> ContactPersonPhoneLogRef;
class ContactPersonPhoneLog
- : public ContactRecord
- {
+ : public ContactRecord {
public:
ContactPersonPhoneLog(bool release, contacts_record_h record = nullptr);
static const char *getUri();
#include <string>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class ContactRecord;
typedef std::shared_ptr<ContactRecord> ContactRecordRef;
- class ContactRecord
- {
+ class ContactRecord {
public:
ContactRecord(bool release, contacts_record_h record = nullptr);
virtual ~ContactRecord();
#include <algorithm>
#include <string.h>
- namespace Msg
- {
+ namespace Msg {
const int mapReservSize = 512;
ContactManager::ContactManager()
MSG_LOG("");
m_AddressMap.reserve(mapReservSize);
int error = contacts_connect();
- if (error != 0)
- {
+ if (error != 0) {
MSG_LOG_ERROR(whatError(error));
}
std::string ContactManager::whatError(int error)
{
- switch (error)
- {
+ switch (error) {
case CONTACTS_ERROR_NONE:
return "CONTACTS_ERROR_NONE";
case CONTACTS_ERROR_OUT_OF_MEMORY:
contacts_query_set_filter(query, filter);
/* set projection */
- unsigned int numberProjection[] =
- {
+ unsigned int numberProjection[] = {
_contacts_person_phone_log.person_id,
_contacts_person_phone_log.address,
_contacts_person_phone_log.display_name
contacts_record_get_child_record_count(rec, _contacts_my_profile.number, &count);
std::string normalizedNumber = PhoneNumberUtils::getInst().getNormalizedNumber(number);
- for (int i =0; i < count; ++i)
- {
+ for (int i =0; i < count; ++i) {
contacts_record_h child = nullptr;
contacts_record_get_child_record_at_p(rec, _contacts_my_profile.number, i, &child);
- if (child)
- {
+ if (child) {
char *num = nullptr;
contacts_record_get_str_p(child, _contacts_number.number, &num);
- if (num)
- {
+ if (num) {
std::string curNum = PhoneNumberUtils::getInst().getNormalizedNumber(num);
- if (normalizedNumber == curNum)
- {
+ if (normalizedNumber == curNum) {
contacts_record_h clonedRec = nullptr;
contacts_record_clone(child, &clonedRec);
if (clonedRec)
int count = 0;
contacts_record_get_child_record_count(rec, _contacts_my_profile.email, &count);
- for (int i =0; i < count; ++i)
- {
+ for (int i =0; i < count; ++i) {
contacts_record_h child = nullptr;
contacts_record_get_child_record_at_p(rec, _contacts_my_profile.email, i, &child);
- if (child)
- {
+ if (child) {
char *curEmail = nullptr;
contacts_record_get_str_p(child, _contacts_email.email, &curEmail);
- if (curEmail)
- {
- if (strcasecmp(email.c_str(), curEmail) == 0)
- {
+ if (curEmail) {
+ if (strcasecmp(email.c_str(), curEmail) == 0) {
contacts_record_h clonedRec = nullptr;
contacts_record_clone(child, &clonedRec);
if (clonedRec)
ContactManager *self = static_cast<ContactManager *>(user_data);
self->invalidateCache();
for (auto listener : self->m_Listeners)
- {
listener->onContactChanged();
- }
}
void ContactManager::contactDisplayOrderChangedCb(contacts_name_display_order_e name_display_order, void *user_data)
ContactManager *self = static_cast<ContactManager *>(user_data);
self->invalidateCache();
for (auto listener : self->m_Listeners)
- {
listener->onContactChanged();
- }
}
void ContactManager::addListener(IContactManagerListener &listener)
{
auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (found == m_Listeners.end())
- {
m_Listeners.push_back(&listener);
- }
}
void ContactManager::removeListener(IContactManagerListener &listener)
{
auto found = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (found != m_Listeners.end())
- {
m_Listeners.erase(found);
- }
}
ContactPersonNumberRef ContactManager::getContactPersonNumber(contacts_filter_h filter)
contacts_filter_destroy(filter);
contacts_query_destroy(query);
- while (ctRrr == CONTACTS_ERROR_NONE)
- {
+ while (ctRrr == CONTACTS_ERROR_NONE) {
int contactId = 0;
contacts_list_get_current_record_p(list, &crValue);
- if (crValue)
- {
+ if (crValue) {
contacts_record_get_int(crValue, _contacts_person_number.person_id, &contactId);
if (contactId > 0)
cResValue = crValue;
contacts_filter_destroy(filter);
contacts_query_destroy(query);
- while (ctRrr == CONTACTS_ERROR_NONE)
- {
+ while (ctRrr == CONTACTS_ERROR_NONE) {
int contactId = 0;
contacts_list_get_current_record_p(list, &crValue);
- if (crValue)
- {
+ if (crValue) {
contacts_record_get_int(crValue, _contacts_person_email.person_id, &contactId);
if (contactId > 0)
cResValue = crValue;
ContactAddressRef ContactManager::getAddress(const std::string &address)
{
auto it = m_AddressMap.find(address);
- if (m_AddressMap.end() == it)
- {
+ if (m_AddressMap.end() == it) {
bool isNumber = MsgUtils::isValidNumber(address);
// ContactPerson:
// MyProfile:
#if (0)
- if (!contactAddress)
- {
+ if (!contactAddress) {
if (isNumber)
contactAddress = getContactMyProfileNumber(address);
else
ContactRecord::~ContactRecord()
{
- if (m_Record && m_Release)
- {
+ if (m_Record && m_Release) {
contacts_record_destroy(m_Record, true);
m_Record = nullptr;
}
using namespace Msg;
-namespace
-{
+namespace {
const int avgLengthOfContent = 2048;
}
contacts_record_h record = nullptr;
std::string vcardContent;
- if (contacts_db_get_record((myProfile ? _contacts_my_profile._uri : _contacts_person._uri), personId, &record) != CONTACTS_ERROR_NONE)
- {
+ if (contacts_db_get_record((myProfile ? _contacts_my_profile._uri : _contacts_person._uri), personId, &record) != CONTACTS_ERROR_NONE) {
MSG_LOG_ERROR("contacts_db_get_record() failed");
record = nullptr;
return std::string();
myProfile ? contacts_vcard_make_from_my_profile(record, &vcardBuff) : contacts_vcard_make_from_person(record, &vcardBuff);
- if (!vcardBuff)
- {
+ if (!vcardBuff) {
MSG_LOG_ERROR("vcardBuff is NULL");
return std::string();
}
std::string ContactManager::createContentForContactList(int personId)
{
contacts_record_h record = nullptr;
- if (contacts_db_get_record(_contacts_person._uri, personId, &record) != CONTACTS_ERROR_NONE)
- {
+ if (contacts_db_get_record(_contacts_person._uri, personId, &record) != CONTACTS_ERROR_NONE) {
MSG_LOG_ERROR("contacts_db_get_record() failed!");
record = nullptr;
return std::string();
#include "SystemSettingsManager.h"
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MsgEngine;
class ContactManager;
class IAppListener;
- class App
- {
+ class App {
public:
App();
virtual ~App();
bool m_IsPause;
};
- class IAppListener
- {
+ class IAppListener {
public:
virtual ~IAppListener() {}
virtual void onAppPause() {};
#include "BaseView.h"
-namespace Msg
-{
+namespace Msg {
class App;
class MsgEngine;
- class BaseController
- {
+ class BaseController {
public:
BaseController(App &app);
BaseController(BaseController *parent);
#include "NaviFrameController.h"
#include "MsgAddress.h"
-namespace Msg
-{
+namespace Msg {
class NaviFrameController;
class FrameController
: public ViewItemController
- , public NaviFrameItem
- {
+ , public NaviFrameItem {
public:
FrameController(NaviFrameController &parent);
virtual ~FrameController();
#include "MsgTypes.h"
#include "App.h"
-namespace Msg
-{
+namespace Msg {
class MbeRecipients
: public MbeRecipientsView
- , private IContactManagerListener
- {
+ , private IContactManagerListener {
public:
- enum AppendItemStatus
- {
+ enum AppendItemStatus {
SuccessStatus,
DuplicatedStatus,
InvalidRecipStatus,
#include "AppControlDefault.h"
#include "App.h"
-namespace Msg
-{
+namespace Msg {
class FrameController;
class NaviFrameController
: public ViewController
, public NaviFrameView
, private IHwButtonListener
- , private IAppListener
- {
+ , private IAppListener {
public:
NaviFrameController(App &app);
virtual ~NaviFrameController();
#include "SelectAllListItem.h"
#include "MsgStorage.h"
-namespace Msg
-{
+namespace Msg {
class SaveAttachments
: public FrameController
, private IHwButtonListener
- , private IListViewListener
- {
+ , private IListViewListener {
public:
SaveAttachments(NaviFrameController &parent, MsgId id);
virtual ~SaveAttachments();
#include "ListItem.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class SaveAttachmentsListItem
- : public ListItem
- {
+ : public ListItem {
public:
SaveAttachmentsListItem(const std::string &text, const std::string &path);
virtual ~SaveAttachmentsListItem();
#include "BaseController.h"
#include <Evas.h>
-namespace Msg
-{
+namespace Msg {
class App;
class ViewController
- : public BaseController
- {
+ : public BaseController {
public:
ViewController(App &app);
ViewController(BaseController *parent);
#include "BaseController.h"
#include "ViewItem.h"
-namespace Msg
-{
+namespace Msg {
class App;
class ViewItemController
- : public BaseController
- {
+ : public BaseController {
public:
ViewItemController(App &app);
ViewItemController(BaseController *parent);
, m_IsPause(true)
{
int serviceResult = m_Engine.openService();
- if (serviceResult != MESSAGES_ERROR_NONE)
- {
+ if (serviceResult != MESSAGES_ERROR_NONE) {
MSG_ENGINE_WHAT_ERROR(serviceResult);
MSG_LOG_ERROR("Service handle open error = ", serviceResult);
}
void App::pause()
{
- if (!m_IsPause)
- {
+ if (!m_IsPause) {
m_IsPause = true;
for (IAppListener *l : m_Listeners)
l->onAppPause();
void App::resume()
{
- if (m_IsPause)
- {
+ if (m_IsPause) {
m_IsPause = false;
updateActiveNotifPolicy();
for (IAppListener *l : m_Listeners)
void FrameController::setNaviBarTitle(const MsgAddressList &addressList)
{
std::string title;
- if (!addressList.isEmpty())
- {
+ if (!addressList.isEmpty()) {
std::string firstAddress = addressList[0].getAddress();
ContactAddressRef contactPersonAddress = getApp().getContactManager().getContactAddress(firstAddress);
if (contactPersonAddress)
title = firstAddress;
int hidenAddresses = addressList.getLength() - 1;
- if (hidenAddresses > 0)
- {
+ if (hidenAddresses > 0) {
title += " + " + std::to_string(hidenAddresses);
getNaviBar().showButton(NaviExpandButtonId, true);
}
void FrameController::pause()
{
- if (!m_IsPause)
- {
+ if (!m_IsPause) {
m_IsPause = true;
onPause();
}
void FrameController::resume()
{
- if (m_IsPause && !getApp().isPause())
- {
+ if (m_IsPause && !getApp().isPause()) {
m_IsPause = false;
onResume();
}
{
auto items = getItems();
for (MbeRecipientItem *item: items)
- {
item->setDispName(getDispName(item->getAddress()));
- }
}
void MbeRecipients::update(const MsgAddressList &addressList)
{
clear();
int addrListLen = addressList.getLength();
- for (int i = 0; i < addrListLen; i++)
- {
+ for (int i = 0; i < addrListLen; i++) {
const MsgAddress &addr = addressList.at(i);
appendItem(addr.getAddress(), addr.getAddressType());
}
void MbeRecipients::update(ThreadId threadId)
{
clear();
- if (threadId.isValid())
- {
+ if (threadId.isValid()) {
MsgAddressListRef addrList = m_App.getMsgEngine().getStorage().getAddressList(threadId);
if (addrList)
update(*addrList);
return TooManyRecipStatus;
AppendItemStatus result = SuccessStatus;
- if (!isRecipientExists(address))
- {
+ if (!isRecipientExists(address)) {
if (addressType == MsgAddress::UnknownAddressType)
addressType = MsgUtils::getAddressType(address);
- if (addressType == MsgAddress::Phone || addressType == MsgAddress::Email)
- {
+ if (addressType == MsgAddress::Phone || addressType == MsgAddress::Email) {
result = SuccessStatus;
MbeRecipientItem *item = new MbeRecipientItem(address, dispName, addressType);
MbeRecipientsView::appendItem(*item);
bool MbeRecipients::isRecipientExists(const std::string& address) const
{
auto recipientList = getItems();
- for (auto pViewItem : recipientList)
- {
+ for (auto pViewItem : recipientList) {
MbeRecipientItem *pItem = dynamic_cast<MbeRecipientItem*>(pViewItem);
if (pItem && pItem->getAddress() == address)
return true;
void NaviFrameController::pop(FrameController &frame)
{
- if (isLastFrame())
+ if (isLastFrame()) {
getApp().exit();
- else
- {
+ } else {
getApp().getPopupManager().reset();
NaviFrameView::pop(frame);
}
{
MSG_LOG("Execute app. control command: ", cmd.getOperationMsg());
std::string errorMsg;
- if (!getMsgEngine().isReady(errorMsg))
- {
+ if (!getMsgEngine().isReady(errorMsg)) {
notification_status_message_post(errorMsg.c_str());
return false;
}
void NaviFrameController::execCmd(const AppControlDefaultRef &cmd)
{
- if (prepare(*cmd))
- {
+ if (prepare(*cmd)) {
AppControlLauncher::getInst().terminate();
AppControlDefault::DefaultType type = cmd->getDefaultType();
MsgThread *thread = getTopFrame<MsgThread>(); // Check if thread is open
auto *conv = getTopFrame<Conversation>(); // Check if conversation is open
MessageRef msg = getMsgEngine().getStorage().getMessage(cmd->getMessageId()); //To avoid opening conversation if MsgId is invalid
- if (type != AppControlDefault::MainType && msg != nullptr)
- {
- if (conv)
- {
+ if (type != AppControlDefault::MainType && msg != nullptr) {
+ if (conv) {
promote(*conv);
conv->execCmd(cmd);
} else if (!conv) {
- if (type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type))
- {
+ if (type == AppControlDefault::ViewType || type == AppControlDefault::ReplyType || isUnreadNotificationSingle(type)) {
auto *conversation = new Conversation(*this);
push(*conversation);
conversation->execCmd(cmd);
void NaviFrameController::execCmd(const AppControlComposeRef &cmd)
{
- if (prepare(*cmd))
- {
+ if (prepare(*cmd)) {
AppControlLauncher::getInst().terminate();
auto *conv = getTopFrame<Conversation>();
- if (conv)
- {
+ if (conv) {
promote(*conv);
} else {
conv = new Conversation(*this);
T *NaviFrameController::getTopFrame() const
{
auto items = getItems();
- for (auto item = items.rbegin(); item != items.rend(); ++item)
- {
+ for (auto item = items.rbegin(); item != items.rend(); ++item) {
T *frame = dynamic_cast<T*>(*item);
if (frame)
return frame;
{
MessageMmsRef mms = std::dynamic_pointer_cast<MessageMms>(getMsgEngine().getStorage().getMessage(m_Id));
const MsgPageList &pageList = mms->getPageList();
- for (int i = 0; i < pageList.getLength(); ++i)
- {
+ for (int i = 0; i < pageList.getLength(); ++i) {
const MsgMediaList &mediaList = pageList.at(i).getMediaList();
- for (int j = 0; j < mediaList.getLength(); ++j)
- {
+ for (int j = 0; j < mediaList.getLength(); ++j) {
MsgMedia::Type type = mediaList.at(j).getType();
if (type != MsgMedia::TextType && type != MsgMedia::UnknownType)
- {
appendItem(mediaList.at(j).getFileName(), mediaList.at(j).getFilePath(), nullptr, this);
- }
}
}
const MsgAttachmentList &attachmentList = mms->getAttachmentList();
for (int i = 0; i < attachmentList.getLength(); ++i)
- {
appendItem(attachmentList.at(i).getFileName(), attachmentList.at(i).getFilePath(), nullptr, this);
- }
}
void SaveAttachments::appendItem(const std::string &text, const std::string &path, PopupListItemPressedCb cb, void *userData)
{
auto items = m_pList->getItems<SaveAttachmentsListItem>();
int count = 0;
- for (SaveAttachmentsListItem *item : items)
- {
+ for (SaveAttachmentsListItem *item : items) {
if (item->isCheckable() && item->getCheckedState())
++count;
}
{
SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(m_pList->getFirstItem());
if (!item)
- {
item = new SelectAllListItem;
m_pList->prependItem(*item);
- }
}
void SaveAttachments::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- switch (buttonId)
- {
+ switch (buttonId) {
case NaviCancelButtonId:
onHwBackButtonClicked();
break;
void SaveAttachments::updateSelectAllItem()
{
- if (m_pList->getItems().size() > 1)
- {
+ if (m_pList->getItems().size() > 1) {
bool allChecked = areAllItemsChecked();
SelectAllListItem *selectAllItem = dynamic_cast<SelectAllListItem*>(m_pList->getFirstItem());
ListItemCollection items = m_pList->getItems();
auto item = items.empty() ? items.begin() : ++items.begin();
- for (; item != items.end(); ++item)
- {
+ for (; item != items.end(); ++item) {
if ((*item)->isCheckable() && !(*item)->getCheckedState())
return false;
}
bool SaveAttachments::shouldEnableSaveBtn() const
{
ListItemCollection items = m_pList->getItems();
- for (auto *item : items)
- {
+ for (auto *item : items) {
if (item->isCheckable() && item->getCheckedState())
return true;
}
auto items = m_pList->getItems<SaveAttachmentsListItem>();
std::list<std::string> files;
- for (auto *item : items)
- {
+ for (auto *item : items) {
if (item->isCheckable() && item->getCheckedState())
files.push_back(item->getFilePath());
}
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef ItemStyle = ListItemStyle::create("type1");
Elm_Genlist_Item_Type type = ELM_GENLIST_ITEM_NONE;
const char *namePart = "elm.text";
#include <string.h>
#include <algorithm>
-namespace Msg
-{
- struct MediaTypeData
- {
+namespace Msg {
+ struct MediaTypeData {
MediaTypeData(const char *aMime, MsgMedia::Type aType)
: mime(aMime)
, type(aType)
#include "MsgAddress.h"
#include "MsgList.h"
-namespace Msg
-{
+namespace Msg {
class Message;
typedef std::shared_ptr<Message> MessageRef;
typedef MsgList<Message> MessageList;
/**
* @brief An abstraction that represents message-entity stored in message-service.
*/
- class Message
- {
+ class Message {
public:
/**
* @brief Each message can be sent or received, and this enum is used to distinguish the kind of every message.
*/
- enum Direction
- {
+ enum Direction {
MD_Sent = 0, /**< Outgoing message.*/
MD_Received /**< Incoming message.*/
};
/**
* @brief A type of every message.
*/
- enum Type
- {
+ enum Type {
MT_Unknown, /**< Unknown type of message. If you got it something bad has happened.*/
MT_SMS, /**< Text message - sms.*/
MT_MMS, /**< Multimedia message - mms.*/
/**
* @brief Status of every message.
*/
- enum NetworkStatus
- {
+ enum NetworkStatus {
NS_Unknown = -1, /**< Attempt to get message status has failed.*/
NS_Not_Send, /**< Message is a draft for now.*/
NS_Sending, /**< message is in progress of sending.*/
/**
* @brief Defines a storage for messages.
*/
- enum MessageStorageType
- {
+ enum MessageStorageType {
MS_Unknown, /**< Unknown storage.*/
MS_Phone, /**< Phone's internal storage used for regular messages.*/
MS_Sim /**< Sim-card storage used for messages on SIM.*/
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MessageMms;
typedef std::shared_ptr<MessageMms> MessageMmsRef;
typedef MsgList<MessageMms> MessageMmsList;
typedef std::shared_ptr<MsgList<MessageMms>> MessageMmsListRef;
class MessageMms:
- public virtual Message
- {
+ public virtual Message {
public:
virtual ~MessageMms();
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MessageSMS;
typedef std::shared_ptr<MessageSMS> MessageSMSRef;
typedef MsgList<MessageSMS> MessageSMSList;
typedef std::shared_ptr<MsgList<MessageSMS>> MessageSMSListRef;
class MessageSMS:
- public virtual Message
- {
+ public virtual Message {
public:
MessageSMS();
virtual ~MessageSMS();
#include <memory>
#include <string>
-namespace Msg
-{
+namespace Msg {
class MsgAddress;
typedef MsgList<MsgAddress> MsgAddressList;
typedef std::shared_ptr<MsgList<MsgAddress>> MsgAddressListRef;
/**
* @brief Basic abstraction that represents a recipient's address message should be delivered to.
*/
- class MsgAddress
- {
+ class MsgAddress {
public:
/**
* @brief Type of address.
*/
- enum AddressType
- {
+ enum AddressType {
Phone, /**< Phone number*/
Email, /**< Email address*/
UnknownAddressType /**< Unknown address, you get it if phone number format or email-format validations has failed to parce address.*/
/**
* @brief A kind of recipient that defines a way how message should be delivered to this address.
*/
- enum RecipientType
- {
+ enum RecipientType {
To, /**< Primary recipient, messages are sent directly to this address.*/
Cc, /**< "Carbon copy", secondary recipient. This address gets a message as a copy of original message sent to other "TO"-recipient.*/
Bcc, /**< "Blind carbon copy" to tertiary recipients who receive the message. The primary and secondary recipients cannot see the tertiary recipients.*/
#include "MsgList.h"
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MsgAttachment;
typedef std::shared_ptr<MsgAttachment> MsgAttachmentRef;
typedef MsgList<MsgAttachment> MsgAttachmentList;
typedef std::shared_ptr<MsgList<MsgAttachment>> MsgAttachmentListRef;
- class MsgAttachment
- {
+ class MsgAttachment {
public:
virtual ~MsgAttachment() {};
virtual std::string getFilePath() const = 0;
#include "MsgUtils.h"
#include "Logger.h"
-namespace Msg
-{
- class MsgComposer
- {
+namespace Msg {
+ class MsgComposer {
public:
virtual ~MsgComposer() {};
#include <memory>
#include <string>
-namespace Msg
-{
+namespace Msg {
class MsgConvMedia;
typedef MsgList<MsgConvMedia> MsgConvMediaList;
typedef std::shared_ptr<MsgList<MsgConvMedia>> MsgConvMediaListRef;
- class MsgConvMedia
- {
+ class MsgConvMedia {
public:
virtual ~MsgConvMedia() {};
#include <time.h>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MsgConversationItem;
typedef std::shared_ptr<MsgConversationItem> MsgConversationItemRef;
typedef std::shared_ptr<MsgList<MsgConversationItem>> MsgConversationListRef;
/**
* @brief An interface that provides basic information about conversation-list item.
*/
- class MsgConversationItem
- {
+ class MsgConversationItem {
public:
virtual ~MsgConversationItem();
#include "Logger.h"
#include "MsgTypes.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Core-instance of whole mechanism that interacts with message-service.
*/
- class MsgEngine
- {
+ class MsgEngine {
public:
MsgEngine();
~MsgEngine();
#define MsgList_H_
-namespace Msg
-{
+namespace Msg {
/**
* @brief Generic container for message-objects.
*/
template<typename T>
- class MsgList
- {
+ class MsgList {
public:
typedef T Type;
#include "MsgList.h"
#include <memory>
-namespace Msg
-{
+namespace Msg {
class MsgMedia;
typedef std::shared_ptr<MsgMedia> MsgMediaRef;
typedef MsgList<MsgMedia> MsgMediaList;
/**
* @brief represents a file to be attached to message.
*/
- class MsgMedia
- {
+ class MsgMedia {
public:
/**
* @brief Attacment-type.
*/
- enum Type
- {
+ enum Type {
UnknownType = 0, /**< File type unsupported by smil-player, can't be played by smil-player. Attached as unknown filetype.*/
ImageType, /**< Image file. Can be played with smil-player.*/
AudioType, /**< Audio file. Can be played with smil-player.*/
#include "MsgMedia.h"
-namespace Msg
-{
+namespace Msg {
class MsgPage;
typedef std::shared_ptr<MsgPage> MsgPageRef;
typedef MsgList<MsgPage> MsgPageList;
* @brief An abstraction that represents a concept of "page".
* This is a part of MMS that contains one previewable attachment(video or image) and a number of attachments that have no preview(documents, audio-files etc).
*/
- class MsgPage
- {
+ class MsgPage {
public:
virtual ~MsgPage();
#include <memory>
#include <string>
-namespace Msg
-{
+namespace Msg {
class MsgReport;
typedef MsgList<MsgReport> MsgReportList;
typedef std::shared_ptr<MsgList<MsgReport>> MsgReportListRef;
- class MsgReport
- {
+ class MsgReport {
public:
- enum DeliveryStatus
- {
+ enum DeliveryStatus {
StatusNone,
StatusExpired,
StatusSuccess,
StatusRejected
};
- enum ReadStatus
- {
+ enum ReadStatus {
ReadStatusNone,
ReadStatusIsRead,
ReadStatusIsDeleted,
ReadStatusRejectByUser
};
- enum Type
- {
+ enum Type {
TypeDelivery,
TypeRead,
TypeReadReportSent
#include <string>
#include <vector>
-namespace Msg
-{
+namespace Msg {
class IMsgSettingsListener;
- class MsgSettings
- {
+ class MsgSettings {
public:
- enum ActiveNotifPolicy
- {
+ enum ActiveNotifPolicy {
AppBackgroundPolicy, // App is not running or on background.
AppForegroundPolicy // App is running and on foreground, but not in conversation.
};
- enum RingtoneType
- {
+ enum RingtoneType {
DefaultRingtone,
SilentRingtone,
UserRingtone
#include "MsgConversationItem.h"
#include "MsgReport.h"
-namespace Msg
-{
+namespace Msg {
class IMsgStorageListener;
class MsgDataContainer;
/**
* @brief Instance responsible for interaction with message-service internal message-storage.
*/
- class MsgStorage
- {
+ class MsgStorage {
public:
/**
* @brief Possible results message storage could cause to.
*/
- enum StorageResult
- {
+ enum StorageResult {
StorageSuccess = 0, /**< Storage successful.*/
StorageFail = -1, /**< Storage failure.*/
StorageSimFull = -2, /**< SIM storage is full.*/
#include <memory>
#include <time.h>
-namespace Msg
-{
+namespace Msg {
class MsgThreadItem;
typedef std::shared_ptr<MsgThreadItem> MsgThreadItemRef;
typedef std::shared_ptr<MsgList<MsgThreadItem>> MsgThreadListRef;
/**
* @brief An interface that should be implemented by data-structure responsible for accessing basic thread information.
*/
- class MsgThreadItem
- {
+ class MsgThreadItem {
public:
virtual ~MsgThreadItem();
#include "MessageSMS.h"
#include "MsgReport.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Manages sending(receiving) messages activity.
*/
- class MsgTransport
- {
+ class MsgTransport {
public:
/**
* @brief Possible results message sending could cause to.
*/
- enum SendResult
- {
+ enum SendResult {
SendSuccess = 0, /**< Sending successful.*/
SendFail = -1, /**< Sending failure.*/
SendNoSIM = -2, /**< No SIM was found.*/
#include <vector>
-namespace Msg
-{
- class BaseMsgId
- {
+namespace Msg {
+ class BaseMsgId {
public:
typedef unsigned Type;
static const Type invalidId = 0;
};
class ThreadId
- : public BaseMsgId
- {
+ : public BaseMsgId {
using BaseMsgId::BaseMsgId;
};
class MsgId
- : public BaseMsgId
- {
+ : public BaseMsgId {
using BaseMsgId::BaseMsgId;
};
typedef std::vector<MsgId> MsgIdList;
- struct MsgTextMetric
- {
+ struct MsgTextMetric {
MsgTextMetric();
void reset();
#include <list>
#include <vector>
-namespace Msg
-{
- struct TokenizedRecipients
- {
+namespace Msg {
+ struct TokenizedRecipients {
std::list<std::pair<std::string, MsgAddress::AddressType>> validResults;
std::string invalidResult;
};
- class MsgUtils
- {
+ class MsgUtils {
public:
static TokenizedRecipients tokenizeRecipients(const std::string &inputText);
static bool isValidNumber(const std::string &address);
int MsgEngine::openService()
{
TRACE;
- if (m_MsgHandle)
- {
+ if (m_MsgHandle) {
MSG_LOG_ERROR("Handle already has been opened");
}
int result = 0;
int MsgEngine::closeService()
{
int result = 0;
- if (m_MsgHandle)
- {
+ if (m_MsgHandle) {
#ifdef TIZEN_PRIVATE_API
result = msg_close_msg_handle(&m_MsgHandle);
#else
bool MsgEngine::isReady(std::string &errorMsg) const
{
#ifdef TIZEN_PRIVATE_API
- if (!m_MsgHandle)
- {
+ if (!m_MsgHandle) {
errorMsg = handleIsNullStr;
return false;
}
std::string MsgEngine::whatError(int error)
{
#ifdef TIZEN_PRIVATE_API
- switch (error)
- {
+ switch (error) {
case MSG_SUCCESS:
return "MSG_SUCCESS";
break;
}
#else
- switch (error)
- {
+ switch (error) {
case MESSAGES_ERROR_NONE:
return "MESSAGES_ERROR_NONE";
break;
int bytesInChar = 1;
textMetric.reset();
- if (!text.empty())
- {
- if (msg_util_calculate_text_length(text.c_str(), MSG_ENCODE_AUTO, &textLen, &segmentLen, &encode) != 0)
- {
+ if (!text.empty()) {
+ if (msg_util_calculate_text_length(text.c_str(), MSG_ENCODE_AUTO, &textLen, &segmentLen, &encode) != 0) {
MSG_LOG_ERROR("msg_util_calculate_text_length returns error");
}
textMetric.bytes = textLen;
- switch (encode)
- {
+ switch (encode) {
case MSG_ENCODE_UCS2:
bytesInChar = 2;
break;
{
auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (itr == m_Listeners.end())
- {
m_Listeners.push_back(&listener);
- }
}
void MsgSettings::removeListener(IMsgSettingsListener &listener)
{
auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (itr != m_Listeners.end())
- {
m_Listeners.erase(itr);
- }
}
{
auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (itr == m_Listeners.end())
- {
m_Listeners.push_back(&listener);
- }
}
void MsgStorage::removeListener(IMsgStorageListener &listener)
{
auto itr = std::find(m_Listeners.begin(), m_Listeners.end(), &listener);
if (itr != m_Listeners.end())
- {
m_Listeners.erase(itr);
- }
}
bool MsgStorage::hasEmail(ThreadId id)
return false;
const MsgAddressListRef addressList = getAddressList(id);
- if (addressList)
- {
- for (int i = 0; i < addressList->getLength(); ++i)
- {
+ if (addressList) {
+ for (int i = 0; i < addressList->getLength(); ++i) {
const MsgAddress &msgAddr = addressList->at(i);
if (msgAddr.getAddressType() == MsgAddress::Email)
return true;
using namespace Msg;
-namespace
-{
+namespace {
unsigned emailAddrLenMax = 256;
const char *delimiters = ",;";
const char *numberRegex = "\\+?([[:digit:]][ *\\(\\)-]*){2,14}[[:digit:]]$";
std::string token;
MsgAddress::AddressType addressType = MsgAddress::UnknownAddressType;
- while (begin != end)
- {
- if (begin != std::string::npos)
- {
+ while (begin != end) {
+ if (begin != std::string::npos) {
token = inputText.substr(begin, end != std::string::npos ? end-begin : std::string::npos);
begin = inputText.find_first_not_of(delimiters, end);
result.invalidResult.append(token);
addressType = getAddressType(result.invalidResult);
- if (addressType != MsgAddress::UnknownAddressType)
- {
+ if (addressType != MsgAddress::UnknownAddressType) {
result.validResults.push_back(std::make_pair(result.invalidResult, addressType));
result.invalidResult.clear();
} else if (end != std::string::npos) {
MsgAddress::AddressType MsgUtils::getAddressType(const std::string &address)
{
if (isValidNumber(address))
- {
return MsgAddress::Phone;
- }
if (isValidEmail(address))
- {
return MsgAddress::Email;
- }
return MsgAddress::UnknownAddressType;
}
std::string MsgUtils::makeNormalizedNumber(const std::string &number)
{
std::string normalizedNumber;
- for (auto symbol : number)
- {
+ for (auto symbol : number) {
if (isdigit(symbol) || symbol == '*' || symbol == '#' || symbol == '+')
- {
normalizedNumber += symbol;
- }
}
return normalizedNumber;
}
std::string MsgUtils::makeCleanedNumber(const std::string &number)
{
std::string cleanedNumber;
- for (auto symbol : number)
- {
+ for (auto symbol : number) {
if (isdigit(symbol))
cleanedNumber += symbol;
}
bool MsgUtils::isMms(Message::Type type)
{
- switch (type)
- {
+ switch (type) {
case Message::MT_MMS:
case Message::MT_MMS_Noti:
return true;
{
const long long kb = 1024; // Bytes in kb
long long sizeKb = 0;
- if (bytes <= kb)
- {
+ if (bytes <= kb) {
sizeKb = 1;
} else {
sizeKb = bytes / kb;
, m_Page(false)
, m_Attachment(false)
{
- if (!m_MmsStruct)
- {
+ if (!m_MmsStruct) {
m_MmsStruct = msg_create_struct(MSG_STRUCT_MMS);
if (msgStruct)
- {
msg_get_mms_struct(m_MsgStruct, m_MmsStruct);
- }
}
}
MessageMmsPrivate::~MessageMmsPrivate()
{
if (m_MmsStruct)
- {
msg_release_struct(&m_MmsStruct);
- }
}
MessageMmsPrivate::Type MessageMmsPrivate::getType() const
std::string result;
int size = pageList.getLength();
- for (int i = 0; i < size; ++i)
- {
+ for (int i = 0; i < size; ++i) {
const MsgMediaList &mediaList = pageList.at(i).getMediaList();
int sizeList = mediaList.getLength();
- for (int j = 0; j < sizeList; ++j)
- {
- if (mediaList[j].getType() == MsgMedia::TextType)
- {
+ for (int j = 0; j < sizeList; ++j) {
+ if (mediaList[j].getType() == MsgMedia::TextType) {
std::string str = FileUtils::readTextFile(mediaList[j].getFilePath());
- if (!str.empty())
- {
+ if (!str.empty()) {
if (i > 0 && !result.empty())
result.append("\n");
int result = 0;
int size = pageList.getLength();
- for (int i = 0; i < size; ++i)
- {
+ for (int i = 0; i < size; ++i) {
const MsgMediaList &mediaList = pageList.at(i).getMediaList();
int sizeList = mediaList.getLength();
- for (int j = 0; j < sizeList; ++j)
- {
+ for (int j = 0; j < sizeList; ++j) {
if (mediaList[j].getType() != MsgMedia::TextType && mediaList[j].getType() != MsgMedia::UnknownType)
++result;
}
#include "MsgPagePrivate.h"
#include "MsgAttachmentPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MessageMmsPrivate
: public MessagePrivate
- , public MessageMms
- {
+ , public MessageMms {
public:
MessageMmsPrivate(bool release, msg_struct_t msgStruct = nullptr, msg_struct_t mmsStruct = nullptr);
virtual ~MessageMmsPrivate();
void MessagePrivate::addAddresses(const MsgAddressList &list)
{
int len = list.getLength();
- for (int i = 0; i < len; ++i)
- {
+ for (int i = 0; i < len; ++i) {
MsgAddressPrivate &newAddr = MessagePrivate::addAddress();
newAddr.setFields(list[i]);
}
void MessagePrivate::setMessageStorageType(Message::MessageStorageType msgStorage)
{
- switch (msgStorage)
- {
+ switch (msgStorage) {
case Message::MS_Phone:
msg_set_int_value(m_MsgStruct, MSG_MESSAGE_STORAGE_ID_INT, MSG_STORAGE_PHONE);
break;
#include <msg_types.h>
-namespace Msg
-{
+namespace Msg {
class MessagePrivate
: public virtual Message
- , public MsgStructPrivate
- {
+ , public MsgStructPrivate {
public:
MessagePrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MessagePrivate();
#include "MsgListHandlePrivate.h"
#include "MsgStructListPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MessageSMSPrivate
: public MessagePrivate
- , public MessageSMS
- {
+ , public MessageSMS {
public:
MessageSMSPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MessageSMSPrivate();
#include "MsgStructListPrivate.h"
#include "MsgStructPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgAddressPrivate
: public MsgStructPrivate
- , public MsgAddress
- {
+ , public MsgAddress {
public:
MsgAddressPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgAddressPrivate();
int size = 0;
msg_get_int_value(m_MsgStruct, MSG_MMS_ATTACH_FILESIZE_INT, &size);
- if (size == 0)
- {
+ if (size == 0) {
MSG_LOG_WARN("File ", getFilePath(), " size = 0, trying to get real file size");
size = (int)FileUtils::getFileSize(getFilePath());
MSG_LOG("Real file size = ", size);
#include "MsgListHandlePrivate.h"
#include "MsgStructListPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgAttachmentPrivate
: public MsgStructPrivate
- , public MsgAttachment
- {
+ , public MsgAttachment {
public:
MsgAttachmentPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgAttachmentPrivate();
{
MessageSMSRef smsRef;
msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- if (msgInfo)
- {
+ if (msgInfo) {
msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS);
MessageSMSPrivate *sms = new MessageSMSPrivate(true, msgInfo);
{
MessageMmsRef mmsRef;
msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- if (msgInfo)
- {
+ if (msgInfo) {
msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_MMS);
msg_struct_t mmsStruct = msg_create_struct(MSG_STRUCT_MMS);
#include "MsgComposer.h"
#include <msg_types.h>
-namespace Msg
-{
+namespace Msg {
class MsgComposerPrivate
- : public MsgComposer
- {
+ : public MsgComposer {
public:
MsgComposerPrivate();
MsgComposerPrivate(MsgComposerPrivate&) = delete;
#include "MsgListHandlePrivate.h"
#include "MsgStructPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgConvMediaPrivate
: public MsgStructPrivate
- , public MsgConvMedia
- {
+ , public MsgConvMedia {
public:
MsgConvMediaPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgConvMediaPrivate();
#include "MsgStructListPrivate.h"
#include "MsgConvMediaPrivate.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Implementation of MsgConversationItem with msg-service private API usage.
*/
class MsgConversationItemPrivate
: public MsgStructPrivate
- , public MsgConversationItem
- {
+ , public MsgConversationItem {
public:
MsgConversationItemPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgConversationItemPrivate();
#include <string>
-namespace Msg
-{
+namespace Msg {
// SMIL layout:
const int smilScreenWidthP = 100;
const int smilScreenHeightP = 100;
#include <msg.h>
-namespace Msg
-{
+namespace Msg {
// class T : public BaseT {}
template<typename T, typename BaseT>
class MsgListHandlePrivate
- : public MsgList<BaseT> // implement interface
- {
+ : public MsgList<BaseT> { // implement interface
public:
MsgListHandlePrivate(bool release, msg_list_handle_t list = nullptr)
: m_List(list)
virtual ~MsgListHandlePrivate()
{
if (m_Release && m_List)
- {
msg_list_free(m_List);
- }
}
virtual BaseT &at(int i)
{
msg_set_int_value(m_MsgStruct, MSG_MMS_MEDIA_TYPE_INT, MsgUtilsPrivate::smilTypeToNative(type));
- switch (type)
- {
+ switch (type) {
case ImageType:
case VideoType:
- {
MsgUtilsPrivate::setStr(m_MsgStruct, MSG_MMS_MEDIA_REGION_ID_STR, imageRegionId);
break;
- }
-
case AudioType:
- {
break;
- }
-
case TextType:
- {
MsgUtilsPrivate::setStr(m_MsgStruct, MSG_MMS_MEDIA_REGION_ID_STR, textRegionId);
break;
- }
-
default:
MSG_ASSERT(false, "Wrong SMIL type:", type);
}
#include "MsgListHandlePrivate.h"
#include "MsgStructListPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgMediaPrivate
: public MsgStructPrivate
- , public MsgMedia
- {
+ , public MsgMedia {
public:
MsgMediaPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgMediaPrivate();
#include "MsgPage.h"
#include "MsgMediaPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgPagePrivate
: public MsgStructPrivate
- , public MsgPage
- {
+ , public MsgPage {
public:
MsgPagePrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgPagePrivate();
#include "MsgStructListPrivate.h"
#include "MsgStructPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgReportPrivate
: public MsgStructPrivate
- , public MsgReport
- {
+ , public MsgReport {
public:
MsgReportPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgReportPrivate();
void MsgSettingsPrivate::finit()
{
- if (m_pActiveNotifJob)
- {
+ if (m_pActiveNotifJob) {
ecore_job_del(m_pActiveNotifJob);
m_pActiveNotifJob = nullptr;
vconf_set_int(VCONFKEY_MESSAGE_ACTIVATED_CONVERSATION_ID, m_ActiveNotifValue);
// Standard MMS has size 307200 bytes
const int kb = 1024;
- if (res > 0)
- {
+ if (res > 0) {
res *= kb;
res -= 5 * kb; // header size
} else {
msg_set_int_value(m_GeneralOpt, MSG_GENERAL_RINGTONE_TYPE_INT, MsgUtilsPrivate::ringtoneTypeToNative(type));
msg_set_general_opt(m_ServiceHandle, m_GeneralOpt);
for (auto listener: m_Listeners)
- {
listener->onRingtoneChanged(*this);
- }
}
MsgSettingsPrivate::RingtoneType MsgSettingsPrivate::getRingtoneType() const
MsgUtilsPrivate::setStr(m_GeneralOpt, MSG_GENERAL_RINGTONE_PATH_STR, soundPath);
msg_set_general_opt(m_ServiceHandle, m_GeneralOpt);
for (auto listener: m_Listeners)
- {
listener->onRingtoneChanged(*this);
- }
}
std::string MsgSettingsPrivate::getRingtone() const
void MsgSettingsPrivate::addJobSetActiveNotifPolicy(int value)
{
m_ActiveNotifValue = value;
- if (!m_pActiveNotifJob)
- {
+ if (!m_pActiveNotifJob) {
m_pActiveNotifJob = ecore_job_add
(
[](void *data)
#include <Ecore.h>
#include <msg_types.h>
-namespace Msg
-{
+namespace Msg {
class MsgSettingsPrivate
- : public MsgSettings
- {
+ : public MsgSettings {
public:
MsgSettingsPrivate(msg_handle_t serviceHandle);
MsgSettingsPrivate(MsgSettingsPrivate&) = delete;
void MsgStoragePrivate::notifyListeners(const T& delta, ListenerMethod<T> method)
{
for (auto listener: m_Listeners)
- {
(listener->*method)(delta);
- }
}
void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList, void *user_param)
msgIdList.reserve(count);
for (int i = 0; i < count; ++i)
- {
msgIdList.push_back(pMsgIdList->msgIdList[i]);
- }
- switch (storageChangeType)
- {
+ switch (storageChangeType) {
case MSG_STORAGE_CHANGE_UPDATE:
self->notifyListeners(msgIdList, &IMsgStorageListener::onMsgStorageUpdate);
break;
MsgStoragePrivate *self = static_cast<MsgStoragePrivate *>(user_param);
ThreadId tId = static_cast<ThreadId>(threadId);
- switch (storageChangeType)
- {
+ switch (storageChangeType) {
case MSG_STORAGE_CHANGE_UPDATE:
self->notifyListeners(tId, &IMsgStorageListener::onMsgStorageThreadUpdate);
break;
msg_release_struct(&sortRule);
if (error == 0)
- {
res.reset(new MsgThreadStructListPrivate(true, msgList));
- }
return res;
}
msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM);
if (msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0)
- {
res.reset(new SmsStructListPrivate(true, msgList));
- }
+
msg_release_struct(&listCond);
return res;
}
{
msg_thread_id_t id = ThreadId::invalidId;
- if (const MsgAddressListHandlePrivate *privateList = dynamic_cast<const MsgAddressListHandlePrivate*>(&addressList))
- {
+ if (const MsgAddressListHandlePrivate *privateList = dynamic_cast<const MsgAddressListHandlePrivate*>(&addressList)) {
msg_list_handle_t handleList = *privateList;
msg_get_thread_id_by_address2(m_ServiceHandle, handleList, &id);
} else if (const MsgAddressStructListPrivate *privateList = dynamic_cast<const MsgAddressStructListPrivate*>(&addressList)) {
msg_thread_id_t tid = ThreadId::invalidId;
msg_struct_t msgInfo = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
- if (msgInfo)
- {
- for (auto &addr : addressList)
- {
+ if (msgInfo) {
+ for (auto &addr : addressList) {
MsgAddress::AddressType type = MsgUtils::getAddressType(addr);
msg_struct_t tmpAddr = nullptr;
- if (msg_list_add_item(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr) == MSG_SUCCESS)
- {
+ if (msg_list_add_item(msgInfo, MSG_MESSAGE_ADDR_LIST_HND, &tmpAddr) == MSG_SUCCESS) {
msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_TYPE_INT, MsgUtilsPrivate::addressTypeToNative(type));
msg_set_int_value(tmpAddr, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO);
MsgUtilsPrivate::setStr(tmpAddr, MSG_ADDRESS_INFO_ADDRESS_VALUE_STR, addr);
msg_struct_list_s searchList = {};
msg_error_t error = msg_search_message_for_thread_view(m_ServiceHandle, word.c_str(), &searchList);
- if (error != 0)
- {
+ if (error != 0) {
MSG_LOG_ERROR("msg_search_message_for_thread_view error ", error);
}
msg_get_thread_view_list(m_ServiceHandle, sortRule, &peerList);
msg_release_struct(&sortRule);
- for (int i = 0; i < peerList.nCount; i++)
- {
+ for (int i = 0; i < peerList.nCount; i++) {
int unreadCnt = 0;
msg_get_int_value(peerList.msg_struct_info[i], MSG_THREAD_UNREAD_COUNT_INT, &unreadCnt);
MsgThreadItemRef res;
msg_struct_t thread = msg_create_struct(MSG_STRUCT_THREAD_INFO);
if (msg_get_thread(m_ServiceHandle, id, thread) == 0)
- {
res.reset(new MsgThreadItemPrivate(true, thread));
- }
+
return res;
}
int error = msg_get_conversation_view_list(m_ServiceHandle, id, &convList);
if (error == 0)
- {
res.reset(new MsgConversationStructListPrivate(true, convList));
- }
+
return res;
}
{
MsgConversationItemRef res;
msg_struct_t convItem = msg_create_struct(MSG_STRUCT_CONV_INFO);
- if (msg_get_conversation(m_ServiceHandle, id, convItem) == 0)
- {
+ if (msg_get_conversation(m_ServiceHandle, id, convItem) == 0) {
res.reset(new MsgConversationItemPrivate(true, convItem));
} else {
msg_release_struct(&convItem);
msg_struct_t msg = msg_create_struct(MSG_STRUCT_MESSAGE_INFO);
msg_struct_t sendOpt = msg_create_struct(MSG_STRUCT_SENDOPT);
- if (msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0)
- {
+ if (msg_get_message(m_ServiceHandle, id, msg, sendOpt) == 0) {
int nativeType = MSG_TYPE_INVALID;
msg_get_int_value(msg, MSG_MESSAGE_TYPE_INT, &nativeType);
Message::Type type = MsgUtilsPrivate::nativeToMessageType(nativeType);
msg_set_bool_value(sendOpt, MSG_SEND_OPT_SETTING_BOOL, false);
msgPriv.commit();
- if (msgPriv.getId().isValid() && updateExisting)
- {
+ if (msgPriv.getId().isValid() && updateExisting) {
int err = msg_update_message(m_ServiceHandle, msgPriv, sendOpt);
if (result)
*result = MsgUtilsPrivate::nativeToStorageResult(err);
newMsgId = msg.getId();
} else {
newMsgId = msg_add_message(m_ServiceHandle, msgPriv, sendOpt);
- if (newMsgId > 0)
- {
+ if (newMsgId > 0) {
int err = msg_move_msg_to_storage(m_ServiceHandle, newMsgId, msg.getMessageStorageType());
if (result)
*result = MsgUtilsPrivate::nativeToStorageResult(err);
- if (err != MSG_SUCCESS)
- {
+ if (err != MSG_SUCCESS) {
MSG_LOG_WARN("Can't move msg to storage, error = ", MsgEngine::whatError(err));
deleteMessage(newMsgId);
newMsgId.reset();
#include <msg.h>
#include <msg_storage_types.h>
-namespace Msg
-{
+namespace Msg {
class MsgStoragePrivate
- : public MsgStorage
- {
+ : public MsgStorage {
public:
MsgStoragePrivate(msg_handle_t serviceHandle);
MsgStoragePrivate(MsgStoragePrivate&) = delete;
#include <msg.h>
-namespace Msg
-{
+namespace Msg {
static msg_struct_list_s emptyStructList;
// class T : public BaseT {}
template<typename T, typename BaseT>
class MsgStructListPrivate
- : public MsgList<BaseT> // implement interface
- {
+ : public MsgList<BaseT> { // implement interface
public:
MsgStructListPrivate(bool release, const msg_struct_list_s &list = emptyStructList)
: m_List(list)
virtual ~MsgStructListPrivate()
{
if (m_Release && m_List.nCount)
- {
msg_release_list_struct(&m_List);
- }
}
virtual BaseT &at(int i)
#include <msg.h>
-namespace Msg
-{
- class MsgStructPrivate
- {
+namespace Msg {
+ class MsgStructPrivate {
public:
inline MsgStructPrivate(bool release, msg_struct_t msgStruct = nullptr);
inline virtual ~MsgStructPrivate();
inline MsgStructPrivate::~MsgStructPrivate()
{
if (m_Release && m_MsgStruct)
- {
msg_release_struct(&m_MsgStruct);
- }
}
inline void MsgStructPrivate::set(msg_struct_t msgStruct)
#include "MsgStructListPrivate.h"
#include "MsgStructPrivate.h"
-namespace Msg
-{
+namespace Msg {
class MsgThreadItemPrivate
: public MsgStructPrivate
- , public MsgThreadItem
- {
+ , public MsgThreadItem {
public:
MsgThreadItemPrivate(bool release, msg_struct_t msgStruct = nullptr);
virtual ~MsgThreadItemPrivate();
msg_set_struct_handle(req, MSG_REQUEST_MESSAGE_HND, privMsg);
- if (privMsg.isMms())
- {
+ if (privMsg.isMms()) {
MSG_LOG("Sending MMS");
err = msg_mms_send_message(m_ServiceHandle, req);
} else {
#include <msg_storage.h>
#include <msg_transport.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Private msg-service API specific implementation of sending messages routine.
*/
class MsgTransportPrivate
- : public MsgTransport
- {
+ : public MsgTransport {
public:
MsgTransportPrivate(msg_handle_t serviceHandle);
virtual ~MsgTransportPrivate();
int MsgUtilsPrivate::directionToNative(Message::Direction direction)
{
- switch (direction)
- {
+ switch (direction) {
case Message::MD_Sent:
return MSG_DIRECTION_TYPE_MO;
-
case Message::MD_Received:
return MSG_DIRECTION_TYPE_MT;
}
Message::Direction MsgUtilsPrivate::nativeToDirection(int direction)
{
- switch (direction)
- {
+ switch (direction) {
case MSG_DIRECTION_TYPE_MO:
return Message::MD_Sent;
-
case MSG_DIRECTION_TYPE_MT:
return Message::MD_Received;
}
Message::MessageStorageType MsgUtilsPrivate::nativeToMessageStorage(int id)
{
- switch (id)
- {
+ switch (id) {
case MSG_STORAGE_PHONE:
return Message::MS_Phone;
-
case MSG_STORAGE_SIM:
return Message::MS_Sim;
}
int MsgUtilsPrivate::addressTypeToNative(MsgAddress::AddressType type)
{
- switch (type)
- {
+ switch (type) {
case MsgAddress::Phone:
return MSG_ADDRESS_TYPE_PLMN;
-
case MsgAddress::Email:
return MSG_ADDRESS_TYPE_EMAIL;
-
default:
case MsgAddress::UnknownAddressType:
return MSG_ADDRESS_TYPE_UNKNOWN;
MsgAddress::AddressType MsgUtilsPrivate::nativeToAddressType(int type)
{
- switch (type)
- {
+ switch (type) {
case MSG_ADDRESS_TYPE_PLMN:
return MsgAddress::Phone;
-
case MSG_ADDRESS_TYPE_EMAIL:
return MsgAddress::Email;
-
default:
case MSG_ADDRESS_TYPE_UNKNOWN:
return MsgAddress::UnknownAddressType;
MsgReport::DeliveryStatus MsgUtilsPrivate::nativeToReportDeliveryStatus(int status)
{
- switch (status)
- {
+ switch (status) {
case MSG_DELIVERY_REPORT_SUCCESS:
return MsgReport::StatusSuccess;
-
case MSG_DELIVERY_REPORT_EXPIRED:
return MsgReport::StatusExpired;
-
case MSG_DELIVERY_REPORT_REJECTED:
return MsgReport::StatusRejected;
-
default:
case MSG_DELIVERY_REPORT_NONE:
return MsgReport::StatusNone;
MsgReport::ReadStatus MsgUtilsPrivate::nativeToReportReadStatus(int status)
{
- switch (status)
- {
+ switch (status) {
case MSG_READ_REPORT_IS_READ:
return MsgReport::ReadStatusIsRead;
-
case MSG_READ_REPORT_IS_DELETED:
return MsgReport::ReadStatusIsDeleted;
-
case MSG_READ_REPORT_REJECT_BY_USER:
return MsgReport::ReadStatusRejectByUser;
-
default:
case MSG_READ_REPORT_NONE:
return MsgReport::ReadStatusNone;
int MsgUtilsPrivate::reportReadReportStatusToNative(MsgReport::ReadStatus status)
{
- switch (status)
- {
+ switch (status) {
case MsgReport::ReadStatusIsRead:
return MSG_READ_REPORT_IS_READ;
-
case MsgReport::ReadStatusIsDeleted:
return MSG_READ_REPORT_IS_DELETED;
-
case MsgReport::ReadStatusRejectByUser:
return MSG_READ_REPORT_REJECT_BY_USER;
-
default:
case MsgReport::ReadStatusNone:
return MSG_READ_REPORT_NONE;
MsgReport::Type MsgUtilsPrivate::nativeToReportType(int type)
{
- switch (type)
- {
+ switch (type) {
case MSG_REPORT_TYPE_READ:
return MsgReport::TypeRead;
-
case MSG_REPORT_TYPE_READ_REPORT_SENT:
return MsgReport::TypeReadReportSent;
-
default:
case MSG_REPORT_TYPE_DELIVERY:
return MsgReport::TypeDelivery;
int MsgUtilsPrivate::recipientTypeToNative(MsgAddress::RecipientType type)
{
- switch (type)
- {
+ switch (type) {
case MsgAddress::To:
return MSG_RECIPIENTS_TYPE_TO;
-
case MsgAddress::Cc:
return MSG_RECIPIENTS_TYPE_CC;
-
case MsgAddress::Bcc:
return MSG_RECIPIENTS_TYPE_BCC;
-
default:
case MsgAddress::UnknownRecipientType:
return MSG_RECIPIENTS_TYPE_UNKNOWN;
MsgAddress::RecipientType MsgUtilsPrivate::nativeToRecipientType(int type)
{
- switch (type)
- {
+ switch (type) {
case MSG_RECIPIENTS_TYPE_TO:
return MsgAddress::To;
-
case MSG_RECIPIENTS_TYPE_CC:
return MsgAddress::Cc;
-
case MSG_RECIPIENTS_TYPE_BCC:
return MsgAddress::Bcc;
-
default:
case MSG_RECIPIENTS_TYPE_UNKNOWN:
return MsgAddress::UnknownRecipientType;
Message::Type MsgUtilsPrivate::nativeToMessageType(int type)
{
- switch (type)
- {
+ switch (type) {
case MSG_TYPE_SMS:
case MSG_TYPE_SMS_CB:
case MSG_TYPE_SMS_JAVACB:
MsgMedia::Type MsgUtilsPrivate::nativeToSmilType(int type)
{
- switch (type)
- {
+ switch (type) {
case MMS_SMIL_MEDIA_IMG:
return MsgMedia::ImageType;
case MMS_SMIL_MEDIA_AUDIO:
int MsgUtilsPrivate::smilTypeToNative(MsgMedia::Type type)
{
- switch (type)
- {
+ switch (type) {
case MsgMedia::ImageType:
return MMS_SMIL_MEDIA_IMG;
case MsgMedia::AudioType:
std::string res;
char buf[maxStrLen + 1];
if (msg_get_str_value(msgStruct, field, buf, maxStrLen) == 0)
- {
res.assign(buf);
- }
+
return res;
}
Message::NetworkStatus MsgUtilsPrivate::nativeToNetworkStatus(int status)
{
- switch (status)
- {
+ switch (status) {
case MSG_NETWORK_NOT_SEND:
return Message::NS_Not_Send;
case MSG_NETWORK_SENDING:
int MsgUtilsPrivate::activeNotifPolicyToNative(MsgSettings::ActiveNotifPolicy policy)
{
- switch (policy)
- {
+ switch (policy) {
case MsgSettings::AppBackgroundPolicy:
return -1;
case MsgSettings::AppForegroundPolicy:
MsgTransport::SendResult MsgUtilsPrivate::nativeToSendResult(int sendRes)
{
- switch (sendRes)
- {
+ switch (sendRes) {
case MSG_SUCCESS:
return MsgTransport::SendSuccess;
case MSG_ERR_NO_SIM:
MsgSettings::RingtoneType MsgUtilsPrivate::nativeToRingtoneType(int type)
{
- switch (type)
- {
+ switch (type) {
case MSG_RINGTONE_TYPE_SILENT:
return MsgSettings::SilentRingtone;
case MSG_RINGTONE_TYPE_USER:
int MsgUtilsPrivate::ringtoneTypeToNative(MsgSettings::RingtoneType type)
{
- switch (type)
- {
+ switch (type) {
case MsgSettings::SilentRingtone:
return MSG_RINGTONE_TYPE_SILENT;
case MsgSettings::UserRingtone:
MsgStorage::StorageResult MsgUtilsPrivate::nativeToStorageResult(int resultCode)
{
MsgStorage::StorageResult res = MsgStorage::StorageFail;
- switch (resultCode)
- {
+ switch (resultCode) {
case MSG_SUCCESS:
res = MsgStorage::StorageSuccess;
break;
#include <assert.h>
#include <type_traits>
-namespace Msg
-{
- class MsgUtilsPrivate
- {
+namespace Msg {
+ class MsgUtilsPrivate {
public:
static int directionToNative(Message::Direction direction);
static int addressTypeToNative(MsgAddress::AddressType type);
#include <telephony.h>
#include <dpm/device-policy-manager.h>
-namespace Msg
-{
+namespace Msg {
class ISystemSettingsManager;
/**
* @brief Monitors changing of time format and system language. Also reads telephony settings.
*/
- class SystemSettingsManager
- {
+ class SystemSettingsManager {
public:
/**
* @brief A constructor initializes telephony handle to make system settings manager instance to read telephony settings.
/**
* @brief A listener-interface that should be implemented by subscriber in order to be notified about time format or nsystem language change.
*/
- class ISystemSettingsManager
- {
+ class ISystemSettingsManager {
public:
virtual ~ISystemSettingsManager() {}
using namespace Msg;
-namespace
-{
+namespace {
const char *sim1Id = "sim1";
}
bool res = false;
const_cast<SystemSettingsManager*>(this)->prepareTel();
- if (m_TelHandleList.count > 0)
- {
+ if (m_TelHandleList.count > 0) {
telephony_h handle = m_TelHandleList.handle[0];
telephony_sim_state_e simState = TELEPHONY_SIM_STATE_UNAVAILABLE;
telephony_sim_get_state(handle, &simState);
bool res = false;
const_cast<SystemSettingsManager*>(this)->prepareTel();
- if (m_TelHandleList.count > 0)
- {
+ if (m_TelHandleList.count > 0) {
telephony_h telHandle = m_TelHandleList.handle[0];
telephony_network_service_state_e servState;
- if (telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE)
- {
+ if (telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE) {
res = (servState == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE);
MSG_LOG("servState = ", servState);
}
void SystemSettingsManager::onTimeFormatChanged()
{
for (ISystemSettingsManager *it : m_Listeners)
- {
it->onTimeFormatChanged();
- }
}
void SystemSettingsManager::onLanguageChanged()
{
for (ISystemSettingsManager *it : m_Listeners)
- {
it->onLanguageChanged();
- }
}
bool SystemSettingsManager::isMessagingRestrictedByDpm() const
void SystemSettingsManager::deinitDpmHandle()
{
- if (m_DpmHandle)
- {
+ if (m_DpmHandle) {
dpm_manager_destroy(m_DpmHandle);
m_DpmHandle = nullptr;
}
#include <string>
-namespace Msg
-{
- class BidiUtils
- {
+namespace Msg {
+ class BidiUtils {
public:
static constexpr const char *lrmChar = "\u200E";
static constexpr const char *rlmChar = "\u200F";
#include <string>
#include <list>
-namespace Msg
-{
- class FileUtils
- {
+namespace Msg {
+ class FileUtils {
public:
/**
* @brief Get file size.
#include <Evas.h>
#include <efl_extension.h>
-namespace Msg
-{
- class IHwButtonListener
- {
+namespace Msg {
+ class IHwButtonListener {
public:
virtual ~IHwButtonListener() {};
virtual void onHwBackButtonClicked() {};
#include <stdio.h>
#include <stdarg.h>
-namespace Msg
-{
+namespace Msg {
// Translatable Text
- struct TText
- {
+ struct TText {
explicit TText(const char *stringId, const char *domainName)
: m_pDomain(domainName)
, m_pMsg(stringId)
};
// dgettext
- struct DText
- {
+ struct DText {
explicit DText(const char *stringId, const char *domainName)
{
m_pMsg = dgettext(domainName, stringId);
#include <sstream>
#include <dlog.h>
-enum class LogPriority
-{
+enum class LogPriority {
DEFAULT = DLOG_DEFAULT,
VERBOSE = DLOG_VERBOSE, /**< Verbose */
DEBUG = DLOG_DEBUG, /**< Debug */
ERROR = DLOG_ERROR, /**< Error */
FATAL = DLOG_FATAL, /**< Fatal */
SILEN = DLOG_SILENT, /**< Silent */
- MAX = DLOG_PRIO_MAX/**< Keep this always at the end. */
+ MAX = DLOG_PRIO_MAX /**< Keep this always at the end. */
};
template<typename... Tail>
#include <string>
-namespace Msg
-{
- class MediaUtils
- {
+namespace Msg {
+ class MediaUtils {
public:
static std::string getTitle(const std::string &path);
static int getDuration(const std::string &uri); // msec;
#include <string>
#include "Resource.h"
-namespace Msg
-{
- class PathUtils
- {
+namespace Msg {
+ class PathUtils {
public:
/**
* @brief Gets the absolute path to file in the application resource directory.
#include <string>
-namespace Msg
-{
- class PhoneNumberUtils
- {
+namespace Msg {
+ class PhoneNumberUtils {
public:
static PhoneNumberUtils &getInst();
std::string getNormalizedNumber(const std::string &number) const;
#include <string>
-namespace Msg
-{
- enum class TextAlign
- {
+namespace Msg {
+ enum class TextAlign {
None,
Left,
Center,
Right
};
- class TextStyle
- {
+ class TextStyle {
public:
static const char *defaultColor;
static const char *whiteColor;
/**
* @brief Class with text decorator utils
*/
- class TextDecorator
- {
+ class TextDecorator {
public:
static std::string make(const std::string &text, const TextStyle &style);
static std::string make(const std::string &text, const std::string &color);
#include "MsgAddress.h"
#include "ContactManager.h"
-namespace Msg
-{
+namespace Msg {
class App;
typedef long ThumbId;
const ThumbId invalidThumbId = -1;
class ThumbnailMaker
- : public IContactManagerListener
- {
+ : public IContactManagerListener {
public:
- enum DefaultThumbs
- {
+ enum DefaultThumbs {
SingleThumb = 0, // Static thumb
GroupThumb, // Static thumb
OwnerThumb, // Mutable thumb
#include <string>
#include <utils_i18n_types.h>
-namespace Msg
-{
- class TimeUtils
- {
- enum TimeFormat
- {
+namespace Msg {
+ class TimeUtils {
+ enum TimeFormat {
TimeFormatUnknown,
TimeFormat24H,
TimeFormat12H
#include <string>
#include <list>
-namespace Msg
-{
- class CalendarEvent
- {
+namespace Msg {
+ class CalendarEvent {
public:
CalendarEvent(calendar_record_h record);
std::string m_StartDate;
};
- class VCalendarParser
- {
+ class VCalendarParser {
public:
static VCalendarParser &getInst();
static std::list<CalendarEvent> parse(const std::string &filePath);
struct stat st = {};
if (stat(file.c_str(), &st) == 0)
- {
size = st.st_size;
- }
return size;
}
return false;
f2 = fopen(dst.c_str(), "wb");
- if (!f2)
- {
+ if (!f2) {
fclose(f1);
return false;
}
- while ((num = fread(buf, 1, sizeof(buf), f1)) > 0)
- {
- if (fwrite(buf, 1, num, f2) != num)
- {
+ while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) {
+ if (fwrite(buf, 1, num, f2) != num) {
ret = false;
}
}
std::string FileUtils::addFileToDataDir(const std::string &path)
{
std::string newPath;
- if (isExists(path))
- {
+ if (isExists(path)) {
std::string dataPath = PathUtils::getDataPath("");
- if (path.find(dataPath) != std::string::npos)
- {
+ if (path.find(dataPath) != std::string::npos) {
newPath = path;
MSG_LOG("File is already exists: ", newPath);
} else {
struct stat st = {};
if (stat(file.c_str(), &st) == 0)
- {
res = S_ISDIR(st.st_mode);
- }
return res;
}
name = path.substr(pos + 1);
pos = name.find_last_of('.');
- if (pos != std::string::npos)
- {
+ if (pos != std::string::npos) {
extension = name.substr(pos + 1);
if (pos != 0)
fileName = name.substr(0, pos);
struct dirent *dirData = nullptr;
DIR *dp = opendir(path.c_str());
- if (dp)
- {
- while (true)
- {
+ if (dp) {
+ while (true) {
dirData = nullptr;
readdir_r(dp, &ep, &dirData);
if (dirData == nullptr)
break;
- if (strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0)
- {
+ if (strcmp(dirData->d_name, ".") != 0 && strcmp(dirData->d_name, "..") != 0) {
std::string child = path + "/" + dirData->d_name;
res &= remove(child, true);
}
closedir(dp);
if (removeCurrentDir)
- {
res &= rmdir(path.c_str()) == 0;
- }
} else {
res &= unlink(path.c_str()) == 0;
}
splitPath(filePath, base, name, ext);
unsigned i = 0;
- do
- {
+ do {
res = storagePath;
if (res.back() != '/')
res += '/';
std::string name;
std::string ext;
splitPath(filePath, base, name, ext);
- if (!ext.empty())
- {
+ if (!ext.empty()) {
char *mime = nullptr;
mime_type_get_mime_type(ext.c_str(), &mime);
- if (mime)
- {
+ if (mime) {
res = mime;
std::transform(res.begin(), res.end(), res.begin(), ::tolower);
free(mime);
return false;
for (const std::string &file : files)
- {
res &= saveFileToStoragePrivate(file);
- }
+
media_content_disconnect();
return res;
}
void IHwButtonListener::setHwButtonListener(Evas_Object * obj, IHwButtonListener *listener)
{
- if (listener)
- {
+ if (listener) {
setHwButtonListener(obj, nullptr);
eext_object_event_callback_add(obj, EEXT_CALLBACK_MORE, more_event_cb, listener);
eext_object_event_callback_add(obj, EEXT_CALLBACK_BACK, back_event_cb, listener);
#include "LoggerImpl.h"
-namespace
-{
+namespace {
const std::string enterFraseFormat = "%s: %s(%d) -> [ENTER]";
const std::string leaveFraseFormat = "%s: %s -> [LEAVE]";
const log_priority defaultPriority = DLOG_DEBUG;
using namespace Msg;
-namespace
-{
+namespace {
const int QUALITY = 50;
const unsigned char EXIF_HEADER[] = { 0xff, 0xd8, 0xff, 0xe1 };
const unsigned int EXIF_HEADER_LEN = sizeof(EXIF_HEADER);
const unsigned int JPEG_HEADER_OFFSET = 20;
- class MetadataExtractor
- {
+ class MetadataExtractor {
public:
MetadataExtractor(const std::string &path)
: m_Metadata()
{
- if (FileUtils::isExists(path))
- {
+ if (FileUtils::isExists(path)) {
metadata_extractor_create(&m_Metadata);
- if (metadata_extractor_set_path(m_Metadata, path.c_str()) != 0)
- {
+ if (metadata_extractor_set_path(m_Metadata, path.c_str()) != 0) {
metadata_extractor_destroy(m_Metadata);
m_Metadata = nullptr;
}
std::string res;
char *cStr = nullptr;
metadata_extractor_get_metadata(m_Metadata, attr, &cStr);
- if (cStr)
- {
+ if (cStr) {
res = cStr;
free(cStr);
}
{
MetadataExtractor extractor(uri);
int duration = 0;
- if (extractor.isValid())
- {
+ if (extractor.isValid()) {
duration = extractor.getInt(METADATA_DURATION);
MSG_LOG("Duration msec: ", duration);
}
MSG_LOG("File: ", videoFilePath);
MSG_LOG("Frame: width = ", videoW, " height = ", videoH, " size = ", thumbSize);
- if (thumbnail)
- {
+ if (thumbnail) {
const int quality = 90; // JPEG image quality(1 ~ 100)
image_util_encode_h encode_h = {};
bool isOk = false;
isOk = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h) == IMAGE_UTIL_ERROR_NONE;
- if (!isOk)
- {
+ if (!isOk) {
free(thumbnail);
return false;
}
isOk &= image_util_encode_set_quality(encode_h, quality) == IMAGE_UTIL_ERROR_NONE;
isOk &= image_util_encode_set_input_buffer(encode_h, (unsigned char *)thumbnail) == IMAGE_UTIL_ERROR_NONE;
isOk &= image_util_encode_set_output_path(encode_h, imageFilePath.c_str()) == IMAGE_UTIL_ERROR_NONE;
- if (!isOk)
- {
+ if (!isOk) {
image_util_encode_destroy(encode_h);
free(thumbnail);
return false;
exifData = exif_data_new_from_file(imagePath.c_str());
if (exifData)
- {
exif_data_save_data(exifData, &exifBuff, &exifBuffLen);
- }
res = image_util_decode_create(&decode_h);
if (res != IMAGE_UTIL_ERROR_NONE)
- {
return FileUtils::getFileSize(imagePath);
- }
res = image_util_decode_set_input_path(decode_h, imagePath.c_str());
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
image_util_decode_destroy(decode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_decode_set_output_buffer(decode_h, &buffer);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
image_util_decode_destroy(decode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_decode_run(decode_h, &width, &height, nullptr);
image_util_decode_destroy(decode_h);
if (res != IMAGE_UTIL_ERROR_NONE)
- {
return FileUtils::getFileSize(imagePath);
- }
res = image_util_encode_create(IMAGE_UTIL_JPEG, &encode_h);
if (res != IMAGE_UTIL_ERROR_NONE)
- {
return FileUtils::getFileSize(imagePath);
- }
res = image_util_encode_set_resolution(encode_h, width, height);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE){
image_util_encode_destroy(encode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_encode_set_quality(encode_h, QUALITY);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
image_util_encode_destroy(encode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_encode_set_input_buffer(encode_h, buffer);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
image_util_encode_destroy(encode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_encode_set_output_buffer(encode_h, &jpegBuff);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
image_util_encode_destroy(encode_h);
return FileUtils::getFileSize(imagePath);
}
res = image_util_encode_run(encode_h, &jpegBuffLen);
image_util_encode_destroy(encode_h);
- if (res != IMAGE_UTIL_ERROR_NONE)
- {
+ if (res != IMAGE_UTIL_ERROR_NONE) {
free(buffer);
free(jpegBuff);
return FileUtils::getFileSize(imagePath);
}
outputFile.open(imagePath.c_str());
- if (!outputFile.is_open())
- {
+ if (!outputFile.is_open()) {
MSG_LOG_ERROR("Can't open file for write");
free(buffer);
free(jpegBuff);
return FileUtils::getFileSize(imagePath);
}
- if (exifData)
- {
+ if (exifData) {
// Write EXIF header
outputFile.write((char *)EXIF_HEADER, EXIF_HEADER_LEN);
// Write EXIF block length in big-endian order
{
std::string res;
static std::string basePath;
- if (basePath.empty())
- {
+ if (basePath.empty()) {
char *path = app_get_resource_path();
- if (path)
- {
+ if (path) {
basePath = path;
free(path);
}
{
std::string res;
static std::string basePath;
- if (basePath.empty())
- {
+ if (basePath.empty()) {
char *path = app_get_data_path();
- if (path)
- {
+ if (path) {
basePath = path;
free(path);
}
{
std::string res;
char* resPath = app_get_resource_path();
- if (resPath)
- {
+ if (resPath) {
res = resPath;
free(resPath);
}
{
std::string resPath(getResourcePath());
if (!resPath.empty())
- {
resPath.append("locale");
- }
return resPath;
}
static bool storageCb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData)
{
- if (type == STORAGE_TYPE_INTERNAL)
- {
+ if (type == STORAGE_TYPE_INTERNAL) {
int *internalStorage = (int *)userData;
*internalStorage = storageId;
return false;
if (error == STORAGE_ERROR_NONE)
storage_get_directory(storageId, STORAGE_DIRECTORY_DOWNLOADS, &dirPath);
- if (dirPath)
- {
+ if (dirPath) {
downloadPath = dirPath;
free(dirPath);
}
std::string res;
char *normalizedNum = nullptr;
phone_number_get_normalized_number(number.c_str(), &normalizedNum);
- if (normalizedNum)
- {
+ if (normalizedNum) {
res = normalizedNum;
free(normalizedNum);
}
#define OPEN_TAG(name, val) "<" name "=" << (val) << ">"
#define CLOSE_TAG(name) "</" name ">"
-namespace
-{
+namespace {
const char *alignAsString(TextAlign align)
{
- switch (align)
- {
+ switch (align) {
case TextAlign::Center:
return "center";
case TextAlign::Left:
std::ostringstream ss;
ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color);
if (align != TextAlign::None)
- {
ss << OPEN_TAG("align", alignAsString(align));
- }
+
ss << text;
if (align != TextAlign::None)
- {
ss << CLOSE_TAG("align");
- }
+
ss << CLOSE_TAG("color") << CLOSE_TAG("font_size");
return ss.str();
}
m_OriginsMap.reserve(defaultCache);
for (int i = 0; i <= maxStaticThumbId; i++)
- {
getThumbId((DefaultThumbs)i);
- }
}
ThumbnailMaker::~ThumbnailMaker()
ThumbId ThumbnailMaker::getThumbIdFromFile(const std::string &path)
{
- if (path.empty())
- {
+ if (path.empty()) {
return getThumbId(SingleThumb);
} else {
auto it = m_ContactsMap.find(path);
ThumbId ThumbnailMaker::getThumbId(DefaultThumbs thumb)
{
auto it = m_ContactsMap.find(defaultThumbsToStr(thumb));
- if (it != m_ContactsMap.end())
- {
+ if (it != m_ContactsMap.end()) {
return it->second;
} else {
Evas_Object *origin = nullptr;
- if (thumb != OwnerThumb)
- {
+ if (thumb != OwnerThumb) {
origin = makeDefaultOriginThumb(m_App.getWindow(), defaultThumbsToPath(thumb));
} else {
ContactMyProfileRef ownerProfile = m_App.getContactManager().getOwnerProfile();
Evas_Object *ThumbnailMaker::getThumb(Evas_Object *parent, ThumbId id, int thumbSize)
{
auto it = m_OriginsMap.find(id);
- if (it == m_OriginsMap.end())
- {
+ if (it == m_OriginsMap.end()) {
MSG_LOG_ERROR("Invalid thumbnail id");
return nullptr;
}
// m_OriginsMap:
auto originsIt = m_OriginsMap.begin();
- for (; originsIt != m_OriginsMap.end();)
- {
- if (originsIt->first > maxStaticThumbId)
- {
+ for (; originsIt != m_OriginsMap.end();) {
+ if (originsIt->first > maxStaticThumbId) {
MSG_LOG(originsIt->first);
evas_object_del(originsIt->second);
originsIt = m_OriginsMap.erase(originsIt);
// m_ContactsMap:
auto contactsIt = m_ContactsMap.begin();
- for (; contactsIt != m_ContactsMap.end();)
- {
+ for (; contactsIt != m_ContactsMap.end();) {
if (contactsIt->second > maxStaticThumbId)
contactsIt = m_ContactsMap.erase(contactsIt);
else
static const std::string gThumb = "GroupThumb";
static const std::string oThumb = "OwnerThumb";
static const std::string emptyThumb = "";
- switch (thumb)
- {
+ switch (thumb) {
case SingleThumb:
return sThumb;
case GroupThumb:
std::string ThumbnailMaker::defaultThumbsToPath(DefaultThumbs thumb)
{
- switch (thumb)
- {
+ switch (thumb) {
case SingleThumb:
return PathUtils::getResourcePath(THUMB_CONTACT_IMG_PATH);
case GroupThumb:
using namespace Msg;
-namespace
-{
+namespace {
const int maxUcharLen = 64;
const int maxCharLen = 128;
const int defBufLen = 512;
bool isToday = (curDay - msgDay == 0);
- if (isToday)
- {
+ if (isToday) {
const std::string &timeFormat = getTimeFormat() == TimeFormat24H ? time24H : time12H;
return getFormattedDate(locale, getDateBestPattern(locale, timeFormat), msgTime);
} else {
char *str = nullptr;
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &str);
- if (str)
- {
+ if (str) {
i18n_ulocale_set_default(str);
res = str;
size_t i = res.find(".");
ssize_t len = readlink("/opt/etc/localtime", buf, sizeof(buf) - 1);
int filePathLength = 20;
- if (len != -1)
- {
+ if (len != -1) {
buf[len] = '\0';
} else {
MSG_LOG_ERROR("Getting default timezone failed, use system settings value");
char *time_zone = nullptr;
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, &time_zone);
- if (time_zone)
- {
+ if (time_zone) {
res = time_zone;
free(time_zone);
}
i18n_ucalendar_get_now(&date);
dateFormat = getDateFormat(locale, uBestPattern, &status);
- if (status == I18N_ERROR_NONE)
- {
+ if (status == I18N_ERROR_NONE) {
/* get formatted string */
i18n_udate_format_date(dateFormat, date, formatted, formattedCapacity, nullptr, &formattedLength);
/* convert uchar to char */
m_Summary = summary;
calendar_time_s start = {};
- if (calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0)
- {
- if (start.type == CALENDAR_TIME_UTIME) // Unix time
- {
+ if (calendar_record_get_caltime(record, _calendar_event.start_time, &start) == 0) {
+ if (start.type == CALENDAR_TIME_UTIME) { // Unix time
m_StartDate = TimeUtils::makeCalEventString(start.time.utime);
} else { // Local time
m_StartDate = TimeUtils::makeCalEventString
calendar_list_get_count(records, &count);
calendar_list_first(records);
- for (int i = 0; i < count; ++i)
- {
+ for (int i = 0; i < count; ++i) {
calendar_record_h record = nullptr;
calendar_list_get_current_record_p(records, &record);
- if (record)
- {
+ if (record) {
char *viewUri = nullptr;
calendar_record_get_uri_p(record, &viewUri);
if (viewUri && !strcmp(viewUri, _calendar_event._uri))
#include "Config.h"
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Wrapper for Elm_Interface_Atspi_Accessible interface (Screen reader)
*/
- class AtspiAccessibleInterface
- {
+ class AtspiAccessibleInterface {
public:
AtspiAccessibleInterface(Elm_Interface_Atspi_Accessible *obj);
void wrap(Elm_Interface_Atspi_Accessible *obj);
#include <Evas.h>
#include "PathUtils.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Basic interface for all visual objects used across the whole application.
*/
- class BaseView
- {
+ class BaseView {
public:
virtual ~BaseView() {};
virtual void destroy() = 0;
#include "View.h"
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Wraps all basic Box operations.
*/
class Box
- : public View
- {
+ : public View {
public:
Box(Evas_Object *parent);
virtual ~Box();
#include <Elementary.h>
#include <string>
-namespace Msg
-{
+namespace Msg {
class ContextPopup;
class ContextPopupItem;
class Window;
typedef void (*ContextPopupItemPressedCb)(ContextPopupItem &item, void *userData);
class ContextPopupItem
- : public ViewItem
- {
+ : public ViewItem {
friend class ContextPopup;
public:
};
class ContextPopup
- : public View
- {
+ : public View {
public:
ContextPopup(Evas_Object *parent);
virtual ~ContextPopup();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class DefaultLayout
- : public View
- {
+ : public View {
public:
DefaultLayout(Evas_Object *parent);
virtual ~DefaultLayout();
#include <vector>
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
class ListView;
class ListItemStyle;
class ListItem;
typedef std::shared_ptr<ListItemStyle> ListItemStyleRef;
typedef std::vector<ListItem *> ListItemCollection;
- class ListItemStyle
- {
+ class ListItemStyle {
public:
ListItemStyle(const char *itemStyle,
const char *decorateItemStyle = nullptr,
* @brief Wraps all basic genlist item operations.
*/
class ListItem
- : public ViewItem
- {
+ : public ViewItem {
friend class ListItemStyle;
friend class ListView;
#include <Evas.h>
-namespace Msg
-{
+namespace Msg {
class IListViewListener;
/**
* @brief Wraps all basic genlist operations.
*/
class ListView
- : public View
- {
+ : public View {
public:
/**@brief Function of comparing two list-items, used for sorted item insertion.*/
typedef int (*CmpFunc)(const ListItem &item1, const ListItem &item2);
/**
* @brief A listener-interface aimed to make subscribers to get notified about genlist events.
*/
- class IListViewListener
- {
+ class IListViewListener {
public:
virtual ~IListViewListener() {};
std::vector<T*> list;
list.reserve(elm_genlist_items_count(getEo()));
Elm_Object_Item *elmItem = elm_genlist_first_item_get(getEo());
- while (elmItem)
- {
+ while (elmItem) {
void *data = elm_object_item_data_get(elmItem);
- if (data)
- {
+ if (data) {
T *listItem = dynamic_cast<T*>(static_cast<ListItem*>(data));
if (listItem)
list.push_back(listItem);
{
T *res = nullptr;
ListItem *next = &item;
- do
- {
+ do {
next = getNextItem(*next);
res = dynamic_cast<T*>(next);
} while (next && !res);
{
T *res = nullptr;
ListItem *prev = &item;
- do
- {
+ do {
prev = getPrevItem(*prev);
res = dynamic_cast<T*>(prev);
} while (prev && !res);
#include "ViewItem.h"
#include "MsgAddress.h"
-namespace Msg
-{
+namespace Msg {
class MbeRecipientsView;
/**
* @brief Wraps all basic multibutton entry item operations.
*/
class MbeRecipientItem
- : public ViewItem
- {
+ : public ViewItem {
friend class MbeRecipientsView;
public:
#include <vector>
-namespace Msg
-{
+namespace Msg {
class IMbeRecipientsListener;
/**
* @brief Wraps all basic multibutton entry(mbe) operations.
*/
class MbeRecipientsView
- : public View
- {
+ : public View {
public:
MbeRecipientsView(Evas_Object *parent);
virtual ~MbeRecipientsView();
/**
* @brief A listener class that should be implemented by all mbe event subscribers.
*/
- class IMbeRecipientsListener
- {
+ class IMbeRecipientsListener {
public:
virtual ~IMbeRecipientsListener() {};
#include <vector>
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
class NaviFrameView;
class NaviFrameItem;
typedef std::vector<NaviFrameItem*> NaviFrameItemList;
* @brief Wraps all basic Naviframe-item operations.
*/
class NaviFrameItem
- : public ViewItem
- {
+ : public ViewItem {
friend class NaviFrameView;
public:
/**
* @brief An identifiers of buttons that can be shown on the top naviframe-item.
*/
- enum NaviButtonId
- {
+ enum NaviButtonId {
NaviCancelButtonId = 0,/**< Cancel-button */
NaviOkButtonId, /**< OK-button */
NaviCenterButtonId, /**< Central-button */
* @brief A bar at the top of NaviFrameItem.
*/
class NaviFrameItem::NaviBar
- : public View
- {
+ : public View {
friend class NaviFrameItem;
public:
/**
* @brief An enumeration of colors that could be applied to Navibar's background.
*/
- enum NaviColorId
- {
+ enum NaviColorId {
NaviBlueColorId = 0,/**< Blue */
NaviWhiteColorId, /**< White */
NaviColorMax
static void on_button_clicked(void *data, Evas_Object *obj, void *event_info);
private:
- struct ButtonStruct
- {
+ struct ButtonStruct {
ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr, const char *d = nullptr)
: button(b)
, part(p)
#include "NaviFrameItem.h"
#include <vector>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Wraps all basic Naviframe operations.
*/
class NaviFrameView
- : public View
- {
+ : public View {
public:
NaviFrameView(Evas_Object *parent);
NaviFrameView(View &parent);
#include "LangUtils.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
/**
* @brief A Layout that shows a message text when ThreadList is empty
*/
class NoContentLayout
- : public View
- {
+ : public View {
public:
NoContentLayout(Evas_Object *parent);
virtual ~NoContentLayout();
#include <Evas.h>
#include <string>
-namespace Msg
-{
+namespace Msg {
class IPopupListener;
class Popup;
class PopupManager;
}
class Popup
- : public View
- {
+ : public View {
public:
static void defaultButtonCb(Popup &popup, int buttonId, void *userData);
- enum ButtonID
- {
+ enum ButtonID {
OkButtonId,
CancelButtonId
};
#include "PopupListItem.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief A class of popup-for attach files
*/
class PopupAttachmentListItem
- : public PopupCheckListItem
- {
+ : public PopupCheckListItem {
public:
PopupAttachmentListItem(PopupList &parent, const std::string &text, const std::string &path,
PopupListItemPressedCb cb, void *userData);
#include "ListView.h"
#include "PopupListItem.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief A popup with list of available popup items.
*/
class PopupList
: public Popup
- , private IListViewListener
- {
+ , private IListViewListener {
public:
- enum PopupListType
- {
+ enum PopupListType {
ListPopup, /**< Popup with title >*/
MoreMenuPopup /**< Popup without title, hides by more button and pause events >*/
};
#include "ListItem.h"
-namespace Msg
-{
+namespace Msg {
class PopupList;
class PopupListItem;
/**
* @brief Generic Popup-list item class
*/
- class PopupListItem: public ListItem
- {
+ class PopupListItem: public ListItem {
public:
PopupListItem(PopupList &parent, PopupListItemPressedCb cb, void *userData);
PopupList &getParent();
/**
* @brief A class of popup-item with single text displayed.
*/
- class PopupTextListItem: public PopupListItem
- {
+ class PopupTextListItem: public PopupListItem {
public:
PopupTextListItem(PopupList &parent, const std::string &text, PopupListItemPressedCb cb, void *userData);
virtual ~PopupTextListItem();
/**
* @brief A class of popup-item with text and check field.
*/
- class PopupCheckListItem: public PopupListItem
- {
+ class PopupCheckListItem: public PopupListItem {
public:
PopupCheckListItem(PopupList &parent, const std::string &text, PopupListItemPressedCb cb, void *userData);
virtual ~PopupCheckListItem();
#include "PopupList.h"
#include "ContextPopup.h"
-namespace Msg
-{
+namespace Msg {
class Window;
/**
* @brief A global instance that manages context popups and regular popups lifecycle in context of one window.
*/
- class PopupManager
- {
+ class PopupManager {
public:
/**
* @brief Creating PopupManager instance in context of specified window.
#include "View.h"
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
class Scroller
- : public View
- {
+ : public View {
public:
Scroller(Evas_Object *parent);
virtual ~Scroller();
#include <string>
-namespace Msg
-{
+namespace Msg {
class SelectAllListItem
- : public ListItem
- {
+ : public ListItem {
public:
SelectAllListItem();
virtual ~SelectAllListItem();
#include "Window.h"
-namespace Msg
-{
+namespace Msg {
class StandardWindow
- : public Window
- {
+ : public Window {
public:
StandardWindow();
virtual ~StandardWindow();
#include <Evas.h>
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Wraps all basic Evas_Object operations and manages automatic self-removal by EVAS_CALLBACK_FREE and EVAS_CALLBACK_DEL events.
*/
class View
- : public BaseView
- {
+ : public BaseView {
public:
View();
#include <Elementary.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Wraps all basic Elm_Object_Item operations and manages automatic self-removal by delete-callback.
*/
class ViewItem
- : public BaseView
- {
+ : public BaseView {
public:
ViewItem();
ViewItem(ViewItem&) = delete;
#include "View.h"
#include <Evas.h>
-namespace Msg
-{
+namespace Msg {
/**
* @brief An interface that should be implemented by all window-classes across whole application.
*/
class Window
- : public View
- {
+ : public View {
public:
virtual ~Window() {};
ContextPopupItem *newItem = new ContextPopupItem(*this, id, cb, userData);
Elm_Object_Item *elmItem = elm_ctxpopup_item_append(getEo(), text.c_str(), icon, on_item_pressed_cb, newItem);
- if (elmItem)
- {
+ if (elmItem) {
newItem->setElmObjItem(elmItem);
} else {
delete newItem;
int pos = win.getRotation();
win.getScreenSize(nullptr, nullptr, &w, &h);
- switch (pos)
- {
+ switch (pos) {
case 0:
case 180:
move(w/2, h);
using namespace Msg;
-namespace
-{
+namespace {
const char *floatingPart = "elm.swallow.floatingbutton";
}
void DefaultLayout::showFloatingButton(bool show)
{
- if (show)
- {
+ if (show) {
View::setContent(m_pFloatingBtn, floatingPart, true);
evas_object_show(m_pFloatingBtn);
} else {
{
ListItem *self = static_cast<ListItem*>(data);
- if (self)
- {
+ if (self) {
std::string text = self->getText(*self, part);
return text.empty() ? nullptr : strdup(text.c_str());
}
if (!self)
return nullptr;
- if (self->getOwner()->getCheckMode())
- {
+ if (self->getOwner()->getCheckMode()) {
const char *checkPart = self->getCheckPart(*self);
if (checkPart && strcmp(checkPart, part) == 0)
- {
return self->addCheck();
- }
}
return self->getContent(*self, part);
using namespace Msg;
-namespace
-{
+namespace {
inline ListItem *getItem(Elm_Object_Item *obj)
{
return obj ? static_cast<ListItem*>(elm_object_item_data_get(obj)) : nullptr;
{
ListItemCollection list;
Elm_Object_Item *elmItem = elm_genlist_first_item_get(getEo());
- while (elmItem)
- {
+ while (elmItem) {
void *data = elm_object_item_data_get(elmItem);
MSG_ASSERT(data, "Genlist item data is NULL");
- if (data)
- {
+ if (data) {
ListItem *listItem = static_cast<ListItem *>(data);
list.push_back(listItem);
}
{
ListItemCollection collection;
Eina_List *list = elm_genlist_realized_items_get(getEo());
- if (list)
- {
+ if (list) {
void *obj = nullptr;
Eina_List *l = nullptr;
- EINA_LIST_FOREACH(list, l, obj)
- {
+ EINA_LIST_FOREACH(list, l, obj) {
collection.push_back(getItem((Elm_Object_Item *)obj));
}
ListItem *item = ListItem::staticCast<ListItem*>(event_info);
MSG_ASSERT(item, "Item is null");
- if (item)
- {
+ if (item) {
ListView *owner = item->getOwner();
MSG_ASSERT(owner, "ListItem::owner is null");
void ListView::checkAllItems(bool check, bool updateFullItem)
{
for (ListItem *item: getItems())
- {
item->setCheckedState(check, false);
- }
if (updateFullItem)
updateRealizedItems();
else
for (ListItem *item: getRealizedItems())
- {
item->updateFields(item->getCheckPart(*item), ELM_GENLIST_ITEM_FIELD_ALL);
- }
}
void ListView::updateRealizedItems()
ListItem *item = ListItem::staticCast<ListItem*>(event_info);
item->setSelected(false);
- if (item->getOwner()->getCheckMode() && item->isCheckable())
- {
+ if (item->getOwner()->getCheckMode() && item->isCheckable()) {
item->changeCheckedState(true);
notifyListener(data, obj, event_info, &IListViewListener::onListItemChecked);
} else {
MbeRecipientsView::~MbeRecipientsView()
{
- if (m_pChangedJob)
- {
+ if (m_pChangedJob) {
ecore_job_del(m_pChangedJob);
m_pChangedJob = nullptr;
}
std::vector<MbeRecipientItem*> res;
Elm_Object_Item *elmItem = elm_multibuttonentry_first_item_get(getEo());
- while (elmItem)
- {
+ while (elmItem) {
MbeRecipientItem *item = static_cast<MbeRecipientItem*>(elm_object_item_data_get(elmItem));
res.push_back(item);
elmItem = elm_multibuttonentry_item_next_get(elmItem);
using namespace Msg;
-namespace
-{
+namespace {
const char *titleStyleName = "title";
const char *naviTitlePart = "title";
const char *titleTextPart = "text.center";
void NaviFrameItem::setTitleVisibility(bool visible)
{
- if (visible)
- {
+ if (visible) {
setContent(*m_pNaviBar, naviTitlePart);
evas_object_show(*m_pNaviBar);
} else {
void NaviFrameItem::NaviBar::getButton(NaviButtonId id)
{
- if (!m_ButtonList[id].button)
- {
+ if (!m_ButtonList[id].button) {
Evas_Object *btn = elm_button_add(getEo());
m_ButtonList[id].button = btn;
elm_object_style_set(btn, m_ButtonList[id].style);
void NaviFrameItem::NaviBar::showButton(NaviButtonId id, bool value)
{
- if (value)
- {
+ if (value) {
getButton(id);
if (getContent(m_ButtonList[id].part) != m_ButtonList[id].button)
setButtonColor(id, m_CurrentColor);
evas_object_show(m_ButtonList[id].button);
} else {
- if (getContent(m_ButtonList[id].part) == m_ButtonList[id].button)
- {
+ if (getContent(m_ButtonList[id].part) == m_ButtonList[id].button) {
evas_object_del(m_ButtonList[id].button);
m_ButtonList[id].button = nullptr;
}
}
- switch (id)
- {
+ switch (id) {
case NaviCancelButtonId:
showCancelButtonPart(value);
break;
void NaviFrameItem::NaviBar::showCancelButtonPart(bool value)
{
- if (value)
- {
+ if (value) {
emitSignal("cancel,show,btn", "*");
} else if (getContent(cancelButtonPart) == nullptr) {
emitSignal("left,clear", "*");
void NaviFrameItem::NaviBar::setColor(NaviColorId id)
{
- switch (id)
- {
+ switch (id) {
case NaviBlueColorId:
emitSignal("title,color,blue", "*");
m_CurrentColor = NaviBlueColorId;
// Note that, button's color is opposite to title's color
TextStyle style;
- switch (m_CurrentColor)
- {
+ switch (m_CurrentColor) {
case NaviBlueColorId:
style.setColor(textColorWhiteTitleButtons);
break;
void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleColor)
{
// Note that, button's color is opposite to title's color
- if (id == NaviPrevButtonId || id == NaviExpandButtonId)
- {
+ if (id == NaviPrevButtonId || id == NaviExpandButtonId) {
switch (titleColor)
{
case NaviBlueColorId:
} else {
TextStyle style;
- switch (titleColor)
- {
+ switch (titleColor) {
case NaviBlueColorId:
style.setColor(textColorWhiteTitleButtons);
break;
style.setSize(getTextSize(id));
const char *buttonText = elm_object_text_get(m_ButtonList[id].button);
if (buttonText != nullptr)
- {
elm_object_text_set(m_ButtonList[id].button, TextDecorator::make(buttonText, style).c_str());
- }
}
}
{
emitSignal("sides,clear", "*");
for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++)
- {
evas_object_hide(elm_object_part_content_unset(getEo(), m_ButtonList[iter].part));
- }
+
showCenterButtonPart(false);
}
{
int res = 0;
Eina_List *list = elm_naviframe_items_get(getEo());
- if (list)
- {
+ if (list) {
res = eina_list_count(list);
eina_list_free(list);
}
NaviFrameItemList result;
Eina_List *list = elm_naviframe_items_get(getEo());
- if (list)
- {
+ if (list) {
Eina_List *l = nullptr;
void *obj = nullptr;
- EINA_LIST_FOREACH(list, l, obj)
- {
+ EINA_LIST_FOREACH(list, l, obj) {
NaviFrameItem *item = static_cast<NaviFrameItem*>(elm_object_item_data_get((Elm_Object_Item*)obj));
result.push_back(item);
}
{
// Workaround solution to avoid rejected JIRA issue: http://suprem.sec.samsung.net/jira/browse/TSAM-6776
item.m_IsPopping = true;
- if (getTransitionStatus())
- {
+ if (getTransitionStatus()) {
m_ItemsToDelete.push_back(&item);
} else {
- if (getTopFrame() == &item)
- {
+ if (getTopFrame() == &item) {
m_TransitionStatus = getItemsCount() > 1;
pause();
elm_naviframe_item_pop(getEo());
Elm_Object_Item *before = elm_naviframe_bottom_item_get(getEo());
Elm_Object_Item *insert = nullptr;
- if (before)
- {
+ if (before) {
insert = elm_naviframe_item_insert_before(getEo(), before, nullptr, nullptr, nullptr, nullptr, naviTitleStyleEmpty);
item.setElmObjItem(insert);
} else {
void NaviFrameView::promote(NaviFrameItem &item)
{
bool isTop = &item == getTopFrame();
- if (!isTop)
- {
+ if (!isTop) {
m_TransitionStatus = true;
pause();
elm_naviframe_item_promote(item);
auto *transFinishedItem = ViewItem::staticCast<NaviFrameItem*>(eventInfo);
- for (NaviFrameItem *item: m_ItemsToDelete)
- {
+ for (NaviFrameItem *item: m_ItemsToDelete) {
if (item == transFinishedItem)
transFinishedItem = nullptr;
item->destroy();
using namespace Msg;
-namespace
-{
+namespace {
const char *buttonIdKey = "id";
const char *buttonCbKey = "cb";
const char *buttonCbDataKey = "cb-data";
Popup::~Popup()
{
MSG_LOG("Destructor");
- if (m_pShowIdler)
- {
+ if (m_pShowIdler) {
ecore_idler_del(m_pShowIdler);
m_pShowIdler = nullptr;
}
elm_object_style_set(btn, buttonStyle);
View::setContent(btn, ss.str().c_str());
- if (elm_object_part_content_get(getEo(), ss.str().c_str()))
- {
+ if (elm_object_part_content_get(getEo(), ss.str().c_str())) {
++m_CurrentButtonIndex;
evas_object_show(btn);
evas_object_data_set(btn, buttonIdKey, (void*)(intptr_t)buttonId);
void Popup::show(bool deferred)
{
- if (!deferred)
- {
+ if (!deferred) {
View::show();
} else {
- if (!m_pShowIdler)
- {
+ if (!m_pShowIdler) {
m_pShowIdler = ecore_idler_add
(
[](void *data)->Eina_Bool
void Popup::on_button_clicked(void *data, Evas_Object *obj, void *event_info)
{
PopupButtonCb cb = (PopupButtonCb)evas_object_data_get(obj, buttonCbKey);
- if (cb)
- {
+ if (cb) {
void *userData = evas_object_data_get(obj, buttonCbDataKey);
auto *popup = static_cast<Popup*>(data);
int buttonId = (int)(intptr_t)evas_object_data_get(obj, buttonIdKey);
//set popup's behavior
setDismissByOutsideTapFlag(true);
- if (type == MoreMenuPopup)
- {
+ if (type == MoreMenuPopup) {
setDismissByMoreMenuKeyFlag(true);
setDismissByPauseAppFlag(true);
}
void PopupManager::reset(void *popupOwner)
{
- if (!popupOwner || (popupOwner == m_pPopupOwner))
- {
- if (m_pPopup)
- {
+ if (!popupOwner || (popupOwner == m_pPopupOwner)) {
+ if (m_pPopup) {
m_pPopup->View::destroy();
m_pPopup = nullptr;
}
void PopupManager::reset(Popup &popup, void *newOwner)
{
m_pPopupOwner = newOwner;
- if (&popup != m_pPopup)
- {
+ if (&popup != m_pPopup) {
reset();
eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, SMART_CALLBACK(PopupManager, onHwBackButtonPopupClicked), this);
m_pPopup = &popup;
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef style = ListItemStyle::create("type1");
const char *textPart = "elm.text";
const char *checkPart = "elm.swallow.end";
std::string SelectAllListItem::getText(ListItem &item, const char *part)
{
if (strcmp(part, textPart) == 0)
- {
return msg("IDS_MSG_MBODY_SELECT_ALL");
- }
return "";
}
using namespace Msg;
-namespace
-{
+namespace {
const char *thisKey = "this";
}
void View::setEventCb(Evas_Callback_Type type)
{
Evas_Object_Event_Cb cb = getCb(type);
- if (cb)
- {
+ if (cb) {
evas_object_event_callback_add(m_pEo, type, cb, this);
} else {
MSG_LOG_ERROR("Not implemented");
void View::setEo(Evas_Object *eo)
{
- if (m_pEo)
- {
+ if (m_pEo) {
MSG_LOG_ERROR("m_pEo not null");
assert(false);
}
m_pEo = eo;
- if (eo)
- {
+ if (eo) {
setData(this);
setEventCb(EVAS_CALLBACK_FREE);
setEventCb(EVAS_CALLBACK_DEL);
void View::unsetEventCb(Evas_Callback_Type type)
{
Evas_Object_Event_Cb cb = getCb(type);
- if (cb)
- {
+ if (cb) {
evas_object_event_callback_del(m_pEo, type, cb);
} else {
MSG_LOG_ERROR("Not implemented");
std::string res;
char *markup = elm_entry_markup_to_utf8(str);
- if (markup)
- {
+ if (markup) {
res = markup;
free(markup);
}
std::string res;
char *markup = elm_entry_utf8_to_markup(str);
- if (markup)
- {
+ if (markup) {
res = markup;
free(markup);
}
#include <list>
#include <attach_panel.h>
-namespace Msg
-{
+namespace Msg {
class IAttachPanelListener;
- class AttachPanel
- {
+ class AttachPanel {
public:
typedef std::list<std::string> FileList;
IAttachPanelListener *m_pListener;
};
- class IAttachPanelListener
- {
+ class IAttachPanelListener {
public:
virtual ~IAttachPanelListener() {}
virtual void onFileSelected(AttachPanel &panel, const AttachPanel::FileList &files) {};
#include "AppControlUtils.h"
#include "AppControlLauncher.h"
-namespace Msg
-{
+namespace Msg {
class IContactPickerListener;
/**
* @brief An utility-class aimed to launch contacts-application with pick-operation passed via app-control.
*/
class ContactPicker
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
ContactPicker();
IContactPickerListener *m_pListener;
};
- class IContactPickerListener
- {
+ class IContactPickerListener {
public:
- enum AddressType
- {
+ enum AddressType {
PhoneType,
EmailType
};
- struct ResultData
- {
+ struct ResultData {
AddressType type;
int id;
};
#include "AppControlLauncher.h"
-namespace Msg
-{
+namespace Msg {
class SettingsNetwork
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
SettingsNetwork();
void launch();
using namespace Msg;
-namespace
-{
+namespace {
const char *appControlTotalSize = "http://tizen.org/appcontrol/data/total_size";
const char *appControlTotalCount = "http://tizen.org/appcontrol/data/total_count";
}
void AttachPanel::reset()
{
- if (m_Handle)
- {
+ if (m_Handle) {
attach_panel_hide(m_Handle);
attach_panel_destroy(m_Handle);
m_Handle = nullptr;
return m_Handle;
attach_panel_create(m_App.getWindow().getConformEvasObject(), &m_Handle);
- if (m_Handle)
- {
+ if (m_Handle) {
bundle *extraData = bundle_create();
int maxMmsSize = m_App.getMsgEngine().getSettings().getMaxMmsSize();
std::string maxAttachment = std::to_string(m_App.getMsgEngine().getSettings().getAttachmentsMaxCount());
bundle_add_str(extraData, appControlTotalCount, maxAttachment.c_str());
- if (extraData)
- {
+ if (extraData) {
attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extraData);
attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extraData);
attach_panel_add_content_category(m_Handle, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extraData);
using namespace Msg;
-namespace
-{
+namespace {
const char* mimeContact = "application/vnd.tizen.contact";
const char* single = "single";
const char* multiple = "multiple";
bool ContactPicker::launch(size_t howManyToPick)
{
bool res = false;
- if (m_Handle)
- {
- if (howManyToPick > 1)
- {
+ if (m_Handle) {
+ if (howManyToPick > 1) {
app_control_add_extra_data(m_Handle, APP_CONTROL_DATA_SELECTION_MODE, multiple);
app_control_add_extra_data(m_Handle, APP_CONTROL_DATA_TOTAL_COUNT, std::to_string(howManyToPick).c_str());
} else {
void ContactPicker::onReply(app_control_h request, app_control_h reply, app_control_result_e result)
{
- if (result == APP_CONTROL_RESULT_SUCCEEDED)
- {
+ if (result == APP_CONTROL_RESULT_SUCCEEDED) {
std::list<int> addressIds;
std::list<std::string> types;
std::list<IContactPickerListener::ResultData> result;
int minLen = std::min(addressIds.size(), types.size());
auto itId = addressIds.begin();
auto itType = types.begin();
- for (int i = 0; i < minLen; ++i, ++itId, ++itType)
- {
+ for (int i = 0; i < minLen; ++i, ++itId, ++itType) {
if (*itType == typePhone) {
result.push_back({IContactPickerListener::PhoneType, *itId});
} else if (*itType == typeEmail) {
#include <queue>
#include <Ecore.h>
-namespace Msg
-{
+namespace Msg {
class IBodyListener;
class App;
class PopupListItem;
class Body
: public BodyView
, private IAttachmentHandlerListener
- , private IComposeListItemListener
- {
+ , private IComposeListItemListener {
public:
Body(Evas_Object *parent, App &app, WorkingDirRef workingDir, ConvList &convList);
virtual ~Body();
int m_Utf8TextSize;
};
- class IBodyListener
- {
+ class IBodyListener {
public:
virtual ~IBodyListener() {}
using namespace Msg;
-namespace
-{
+namespace {
const std::string contactFileName = "Contact.vcf";
const std::string contactsFileName = "Contacts.vcf";
}
Body::~Body()
{
- if (m_pOnChangedJob)
- {
+ if (m_pOnChangedJob) {
ecore_job_del(m_pOnChangedJob);
m_pOnChangedJob = nullptr;
}
void Body::addFileToPage(MessageMms &msg, const std::string &filePath)
{
static const int defaultPageDuration = 5000; // msec
- if (!filePath.empty())
- {
+ if (!filePath.empty()) {
MsgPage &msgPage = msg.addPage();
MediaTypeData mediaData = getMsgMediaTypeByFileExt(filePath);
int pageDuration = 0;
void Body::runFileProcessing()
{
- if (!m_SelectedFiles.empty())
- {
+ if (!m_SelectedFiles.empty()) {
long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize();
if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
showResizingPopup();
void Body::updateTextMetricIfNeeded()
{
- if (m_TextMetricNeedUpdate)
- {
+ if (m_TextMetricNeedUpdate) {
std::string text = getPlainUtf8Text();
m_Utf8TextSize = text.length();
MsgEngine::calculateTextMetric(text, m_TextMetric);
// Attachments:
auto attachments = getComposeItem().getAttachments();
for (auto *attachment : attachments)
- {
totalSize += attachment->getFileSize();
- }
// Text:
updateTextMetricIfNeeded();
// Pages:
const MsgPageList &pages = msg.getPageList();
int pageCount = pages.getLength();
- for (int pageIndex = 0; pageIndex < pageCount; ++pageIndex)
- {
+ for (int pageIndex = 0; pageIndex < pageCount; ++pageIndex) {
const MsgPage &page = pages[pageIndex];
// Media:
const MsgMediaList &mediaList = page.getMediaList();
int mediaCount = mediaList.getLength();
- for (int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex)
- {
+ for (int mediaIndex = 0; mediaIndex < mediaCount; ++mediaIndex) {
const MsgMedia &media = mediaList[mediaIndex];
std::string filePath = media.getFilePath();
- if (!filePath.empty())
- {
+ if (!filePath.empty()) {
std::string mime = FileUtils::getMimeType(filePath);
- if (mime != "text/plain") // Skip text on page
- {
+ 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)
- {
+ for (int i = 0; i < attachmentCount; ++i) {
const MsgAttachment &attachment = attachments[i];
std::string filePath = attachment.getFilePath();
- if (!filePath.empty())
- {
+ if (!filePath.empty()) {
std::string mime = FileUtils::getMimeType(filePath);
- if (mime != "application/smil") // Skip SMIL layout
- {
+ if (mime != "application/smil") { // Skip SMIL layout
std::string newFilePath = m_WorkingDir->addFile(filePath);
getComposeItem().addAttachment(newFilePath);
}
void Body::readAttachments(MessageMms &msg)
{
const auto &attachments = getComposeItem().getAttachments();
- for (auto *attach : attachments)
- {
+ for (auto *attach : attachments) {
const std::string &filePath = attach->getFilePath();
if (filePath.empty())
continue;
- switch (getMsgMediaTypeByFileExt(filePath).type)
- {
+ switch (getMsgMediaTypeByFileExt(filePath).type) {
case MsgMedia::ImageType:
case MsgMedia::AudioType:
case MsgMedia::VideoType:
- {
addFileToPage(msg, filePath);
break;
- }
default:
- {
MsgAttachment &msgAttach = msg.addAttachment();
msgAttach.setFilePath(filePath);
break;
- }
}
}
}
void Body::readText(MessageMms &msg)
{
- if (!BodyView::isEmpty())
- {
+ if (!BodyView::isEmpty()) {
writeTextToFile();
addFileToPage(msg, m_MmsTextFilePath);
}
void Body::execCmd(const AppControlDefaultRef &cmd)
{
- if (cmd->getDefaultType() == AppControlDefault::ReplyType)
- {
+ if (cmd->getDefaultType() == AppControlDefault::ReplyType) {
clear();
setText(cmd->getReplyText());
}
void Body::onCheckBoundaryText(char **text)
{
MSG_LOG("");
- if (isMms())
- {
+ if (isMms()) {
long long maxSize = m_App.getMsgEngine().getSettings().getMaxMmsSize();
std::string utfText = markupToUtf8(*text);
- if (getMsgSize() + static_cast<long long>(utfText.size()) > maxSize)
- {
+ if (getMsgSize() + static_cast<long long>(utfText.size()) > maxSize) {
free(*text);
*text = nullptr;
showMaxCharactersPopup();
void Body::showTooLargePopup(const std::list <std::string> &tooBigFiles)
{
- if (!m_TooLargePopupShow)
- {
+ if (!m_TooLargePopupShow) {
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onTooLargePopupDel), this);
popup.addButton(msgt("IDS_MSG_BUTTON_OK_ABB"), Popup::OkButtonId);
popup.setTitle(msgt("IDS_MSG_HEADER_FILE_SIZE_TOO_LARGE_ABB"));
std::string content(msg("IDS_MSG_POP_UNABLE_TO_ATTACH_FILE_FILE_SIZE_TOO_LARGE_TRY_SENDING_VIA_EMAIL_BLUETOOTH_WI_FI_ETC"));
- for (auto& file: tooBigFiles)
- {
+ for (auto& file: tooBigFiles) {
content.append("<br/>");
content.append(FileUtils::getFileName(file));
}
void Body::showResizingPopup()
{
- if (!m_ResizingPopupShow)
- {
+ if (!m_ResizingPopupShow) {
Popup &popup = m_App.getPopupManager().getPopup();
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Body, onResizingPopupDel), this);
int maxSize = m_App.getMsgEngine().getSettings().getMaxMmsSize();
std::string content;
std::string path;
- if (cmd->getComposeType() == AppControlCompose::OpShare)
- {
+ if (cmd->getComposeType() == AppControlCompose::OpShare) {
content = m_App.getContactManager().makeVcard(*idList.begin(), cmd->getVcfInfo().isMyProfile);
path = contactFileName;
} else if (cmd->getComposeType() == AppControlCompose::OpMultiShare) {
void Body::notifyContentChanged()
{
- if (!m_pOnChangedJob)
- {
+ if (!m_pOnChangedJob) {
m_pOnChangedJob = ecore_job_add(
[](void *data)
{
void Body::onAttachmentDeleted(const std::list<std::string> &files)
{
for (const std::string &file : files)
- {
m_WorkingDir->removeFile(file);
- }
+
notifyContentChanged();
}
{
int numAttached = getComposeItem().getAttachments().size();
int numAttachMax = m_App.getMsgEngine().getSettings().getAttachmentsMaxCount();
- if (numAttached == numAttachMax)
- {
+ if (numAttached == numAttachMax) {
std::queue <std::string> empty;
std::swap(m_SelectedFiles, empty);
showTooMuchAttachedPopup();
BodyView::setFocus(true);
m_SelectedFiles.pop();
- if (!m_SelectedFiles.empty())
- {
+ if (!m_SelectedFiles.empty()) {
long long freeSpace = m_App.getMsgEngine().getSettings().getMaxMmsSize() - getMsgSize();
if (freeSpace < FileUtils::getFileSize(m_SelectedFiles.front()))
showResizingPopup();
void Body::onFileFails()
{
std::list <std::string> overflowList;
- while (!m_SelectedFiles.empty())
- {
+ while (!m_SelectedFiles.empty()) {
overflowList.push_back(m_SelectedFiles.front());
m_SelectedFiles.pop();
}
namespace Msg
{
class BodyView
- : public View
- {
+ : public View {
public:
BodyView(Evas_Object *parent, int maxCharCount);
virtual ~BodyView();
using namespace Msg;
-namespace
-{
+namespace {
#define maxBodyHeight ELM_SCALE_SIZE(360)
}
void BodyView::setText(const std::string &text)
{
- if (!text.empty())
- {
+ if (!text.empty()) {
char *markupText = elm_entry_utf8_to_markup(text.c_str());
- if (markupText)
- {
+ if (markupText) {
elm_object_text_set(m_pEntry, markupText);
free(markupText);
}
std::string res;
const char *plainText = elm_entry_entry_get(m_pEntry);
- if (plainText)
- {
+ if (plainText) {
char *text = elm_entry_markup_to_utf8(plainText);
- if (text)
- {
+ if (text) {
res.assign(text);
free(text);
}
#include "ContactAddress.h"
#include "App.h"
-namespace Msg
-{
+namespace Msg {
class ContactListItem
- : public ContactListViewItem
- {
+ : public ContactListViewItem {
public:
ContactListItem(const ContactPersonPhoneLog &rec, App &app, const std::string &searchWord);
ContactListItem(const ContactAddress &rec, App &app, const std::string &searchWord);
#include <Ecore.h>
-namespace Msg
-{
+namespace Msg {
class IConvContactListListener;
class ConvContactList
: public ConvContactListView
- , private IListViewListener
- {
+ , private IListViewListener {
public:
ConvContactList(Evas_Object *parent, App &app);
virtual ~ConvContactList();
std::string m_SearchWord;
};
- class IConvContactListListener
- {
+ class IConvContactListListener {
public:
virtual ~IConvContactListListener() {}
ConvContactList::~ConvContactList()
{
- if (m_pPredictSearchIdler)
- {
+ if (m_pPredictSearchIdler) {
ecore_idler_del(m_pPredictSearchIdler);
m_pPredictSearchIdler = nullptr;
}
void ConvContactList::search()
{
getList().clear();
- if (!m_SearchWord.empty())
- {
+ if (!m_SearchWord.empty()) {
search<ContactPersonNumber>();
search<ContactPersonEmail>();
search<ContactPersonPhoneLog>();
void ConvContactList::search()
{
auto list = m_App.getContactManager().search<ContactRecord>(m_SearchWord);
- if (list)
- {
- do
- {
+ if (list) {
+ do {
auto &rec = list->get();
- if (MsgUtils::isValidAddress(rec.getAddress()))
- {
+ if (MsgUtils::isValidAddress(rec.getAddress())) {
ContactListItem *item = new ContactListItem(rec, m_App, m_SearchWord);
getList().appendItem(*item);
} else {
#include "ListItem.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class ContactListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
ContactListViewItem();
virtual ~ContactListViewItem();
#include "ListView.h"
-namespace Msg
-{
+namespace Msg {
class ConvContactListView
- : public View
- {
+ : public View {
public:
ConvContactListView(Evas_Object *parent);
virtual ~ConvContactListView();
std::string ContactListViewItem::getText(ListItem &item, const char *part)
{
- if (getStyle() == nameOrEmailStyle)
- {
+ if (getStyle() == nameOrEmailStyle) {
const char *mainTextPart = "elm.text";
const char *subTextPart = "elm.text.sub";
- if (strcmp(part, mainTextPart) == 0)
- {
+ if (strcmp(part, mainTextPart) == 0) {
return getMainText();
} else if (strcmp(part, subTextPart) == 0) {
return getSubText();
}
}
- if (getStyle() == logStyle)
- {
+ if (getStyle() == logStyle) {
const char *mainTextPart = "elm.text";
if (strcmp(part, mainTextPart) == 0)
- {
return getMainText();
- }
}
return "";
Evas_Object *ContactListViewItem::getContent(ListItem &item, const char *part)
{
if (strcmp(part, "elm.swallow.icon") == 0)
- {
return getThumbnail();
- }
+
return nullptr;
}
#include "BubbleAudioViewItem.h"
#include "BubbleBgEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleAudioEntity
- : public BubbleBgEntity
- {
+ : public BubbleBgEntity {
public:
BubbleAudioEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction);
virtual ~BubbleAudioEntity();
#include "BubbleEntity.h"
#include "BubbleBgViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleBgEntity
- : public BubbleEntity
- {
+ : public BubbleEntity {
public:
BubbleBgEntity(Type type, BubbleBgViewItem::BgType bgType, Message::Direction direction, const std::string &filePath = "");
virtual ~BubbleBgEntity();
#include "BubbleCalEventViewItem.h"
#include "BubbleBgEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleCalEventEntity
- : public BubbleBgEntity
- {
+ : public BubbleBgEntity {
public:
BubbleCalEventEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction);
virtual ~BubbleCalEventEntity();
#include "App.h"
#include "Contact.h"
-namespace Msg
-{
+namespace Msg {
class BubbleContactEntity
- : public BubbleBgEntity
- {
+ : public BubbleBgEntity {
public:
BubbleContactEntity(App &app, const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction);
virtual ~BubbleContactEntity();
#include "BubbleDownloadButtonViewItem.h"
#include "BubbleEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleDownloadButtonEntity
- : public BubbleEntity
- {
+ : public BubbleEntity {
public:
BubbleDownloadButtonEntity();
virtual ~BubbleDownloadButtonEntity();
#include <string>
-namespace Msg
-{
- class BubbleEntity
- {
+namespace Msg {
+ class BubbleEntity {
public:
- enum Type
- {
+ enum Type {
TextItem,
ImageItem,
AudioItem,
#include <string>
-namespace Msg
-{
- class BubbleEntityFactory
- {
+namespace Msg {
+ class BubbleEntityFactory {
public:
BubbleEntityFactory(App &app, WorkingDirRef workingDir);
~BubbleEntityFactory();
#include "BubbleImageViewItem.h"
#include "BubbleEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleImageEntity
- : public BubbleEntity
- {
+ : public BubbleEntity {
public:
BubbleImageEntity(const std::string &filePath, Message::Direction direction);
virtual ~BubbleImageEntity();
#include "BubbleTextViewItem.h"
#include "BubbleBgEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleTextEntity
- : public BubbleBgEntity
- {
+ : public BubbleBgEntity {
public:
BubbleTextEntity(BubbleBgViewItem::BgType type, Message::Direction direction, std::string text);
virtual ~BubbleTextEntity();
#include "BubbleUnknownFileViewItem.h"
#include "BubbleBgEntity.h"
-namespace Msg
-{
+namespace Msg {
class BubbleUnknownFileEntity
- : public BubbleBgEntity
- {
+ : public BubbleBgEntity {
public:
BubbleUnknownFileEntity(const std::string &filePath, const std::string &fileName, BubbleBgViewItem::BgType bgType, Message::Direction direction);
virtual ~BubbleUnknownFileEntity();
#include "BubbleEntity.h"
#include "WorkingDir.h"
-namespace Msg
-{
+namespace Msg {
class BubbleVideoEntity
- : public BubbleEntity
- {
+ : public BubbleEntity {
public:
BubbleVideoEntity(WorkingDirRef workingDir, const std::string &filePath, Message::Direction direction);
virtual ~BubbleVideoEntity();
#include <list>
-namespace Msg
-{
+namespace Msg {
class IComposeListItemListener;
class FileViewer;
typedef std::list<BubbleEntity*> BubbleEntityList;
class ComposeListItem
: public ComposeListViewItem
- , private IBubbleViewItemListener
- {
+ , private IBubbleViewItemListener {
public:
ComposeListItem(BubbleEntityFactory &entityFactory, FileViewer &fileViewer);
virtual ~ComposeListItem();
FileViewer &m_FileViewer;
};
- class IComposeListItemListener
- {
+ class IComposeListItemListener {
public:
virtual ~IComposeListItemListener() {}
virtual void onAttachmentAdded(const std::list<std::string> &files) {};
#include <unordered_set>
#include <functional>
-namespace Msg
-{
+namespace Msg {
class IConvListListener;
class ConvList
, private IListViewListener
, private IConvListItemListener
, private IContactManagerListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
- enum Mode
- {
+ enum Mode {
NormalMode,
SelectMode
};
Share m_Share;
};
- class IConvListListener
- {
+ class IConvListListener {
public:
virtual ~IConvListListener() {};
#include "BubbleBgViewItem.h"
#include "BubbleEntityFactory.h"
-namespace Msg
-{
+namespace Msg {
class MsgConversationItem;
class IConvListItemListener;
class FileViewer;
class ConvListItem
: public ConvListViewItem
- , public IBubbleViewItemListener
- {
+ , public IBubbleViewItemListener {
public:
/**
* @brief Creates item for Conversation list
bool m_IsNeededReadReport;
};
- class IConvListItemListener
- {
+ class IConvListItemListener {
public:
virtual ~IConvListItemListener() {}
virtual void onEditDraftMsg(ConvListItem &item) {};
#include "DateLineViewItem.h"
#include <time.h>
-namespace Msg
-{
+namespace Msg {
class DateLineItem
- : public DateLineViewItem
- {
+ : public DateLineViewItem {
public:
DateLineItem(time_t dateTime);
DateLineItem(time_t dateTime, const std::string &dateTimeStr);
#include "ContactManager.h"
#include "SystemSettingsManager.h"
-namespace Msg
-{
+namespace Msg {
class MsgDetailsPopup
: public Popup
, private IContactManagerListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
MsgDetailsPopup(PopupManager &mngr, App &app, MsgId msgId);
virtual ~MsgDetailsPopup();
: BubbleBgEntity(CalendarEventItem, bgType, direction, filePath)
{
auto list = VCalendarParser::getInst().parse(filePath);
- if (list.size() == 1)
- {
+ if (list.size() == 1) {
const CalendarEvent &event = list.front();
m_Name = event.getSummary();
m_DateTime = event.getStartDate();
, m_ThumbMaker(app.getThumbnailMaker())
{
auto list = app.getContactManager().parseVcard(getFilePath());
- if (!list.empty())
- {
- if (list.size() == 1)
- {
+ if (!list.empty()) {
+ if (list.size() == 1) {
m_Contact = list.front();
- if (m_Contact)
- {
+ if (m_Contact) {
m_Name = m_Contact->getDispName();
m_Address = m_Contact->getAddress();
m_ThumbPath = m_Contact->getThumb();
BubbleEntity *BubbleEntityFactory::createEntity(const std::string &filePath, const std::string &fileName, std::string mime, BubbleBgViewItem::BgType bgType, Message::Direction direction)
{
- if (FileUtils::isExists(filePath))
- {
+ if (FileUtils::isExists(filePath)) {
std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
MsgMedia::Type msgMediaType = getMsgMediaTypeByMime(mime);
- switch (msgMediaType)
- {
+ switch (msgMediaType) {
case MsgMedia::ImageType:
return new BubbleImageEntity(filePath, direction);
case MsgMedia::AudioType:
case MsgMedia::VideoType:
return createVideoEntity(filePath, fileName, bgType, direction);
default:
- {
if (mime == "text/x-vcalendar" || mime == "text/calendar")
return new BubbleCalEventEntity(filePath, fileName, bgType, direction);
else if (mime == "text/x-vcard" ||
return new BubbleContactEntity(m_App, filePath, fileName , bgType, direction);
else if (mime != "application/smil")
return new BubbleUnknownFileEntity(filePath, fileName, bgType, direction);
- }
}
}
void ComposeListItem::addAttachment(const std::string &filePath)
{
auto *entity = m_BubbleEntityFactory.createEntity(filePath, BubbleBgViewItem::DraftStyle, Message::MD_Sent);
- if (entity)
- {
+ if (entity) {
m_BubbleEntityList.push_back(entity);
updateBubblePart();
show(true);
void ComposeListItem::clear(bool updateUi)
{
std::list<std::string> fileList;
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
fileList.push_back(entity->getFilePath());
delete entity;
}
m_BubbleEntityList.clear();
- if (updateUi)
- {
+ if (updateUi) {
show(false);
ComposeListItem::updateBubblePart();
}
return nullptr;
auto *bubble = new BubbleItemContainer(*getOwner());
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
BubbleViewItem *item = entity->createView(*bubble);
- if (item)
- {
+ if (item) {
item->showDelButton(true);
item->setListener(this);
bubble->append(*item, entity->getDirection());
void ComposeListItem::deleteEntity(BubbleEntity &entity)
{
auto it = std::find(m_BubbleEntityList.begin(), m_BubbleEntityList.end(), &entity);
- if (it != m_BubbleEntityList.end())
- {
+ if (it != m_BubbleEntityList.end()) {
std::string filePath = entity.getFilePath();
delete *it;
m_BubbleEntityList.erase(it);
using namespace Msg;
-namespace
-{
+namespace {
const int minMessagesBulk = 100;
const int additionalMessagesBulk = 50;
const std::string solidStyle = "solid/default";
showSelectAllMode(isCheckMode);
m_pList->setCheckMode(isCheckMode);
- if (isCheckMode)
- {
+ if (isCheckMode) {
selectListItems(false);
m_pSelectAll->setCheckState(false);
} else {
m_ConvListItemMap.reserve(reserveSize);
m_DateLineItemSet.reserve(reserveSize);
- for (int i = 0; i < convListLen; ++i)
- {
+ for (int i = 0; i < convListLen; ++i) {
MsgConversationItem &item = convList->at(i);
insertItem(item);
}
{
bool fillList = false;
- if (m_ThreadId != id)
- {
+ if (m_ThreadId != id) {
fillList = true;
m_ThreadId = id;
updateRecipThumbId();
}
- if (searchWord && strcmp(searchWord, m_SearchWord.c_str()))
- {
+ if (searchWord && strcmp(searchWord, m_SearchWord.c_str())) {
fillList = true;
m_SearchWord = searchWord;
}
void ConvList::updateRecipThumbId()
{
const MsgAddressListRef addressList = m_App.getMsgEngine().getStorage().getAddressList(m_ThreadId);
- if (addressList)
- {
+ if (addressList) {
int countContact = addressList->getLength();
- if (countContact > 1)
- {
+ if (countContact > 1) {
m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb);
} else if (countContact == 1) {
m_RecipThumbId = m_App.getThumbnailMaker().getThumbId(addressList->at(0));
void ConvList::navigateToBottom()
{
ListItem *item = m_pList->getLastItem();
- if (item)
- {
+ if (item) {
ComposeListViewItem *composeItem = dynamic_cast<ComposeListViewItem*>(item);
if (!(composeItem && composeItem->isVisible()))
item = m_pList->getPrevItem(*item);
bool ConvList::deleteItems(const MsgIdList &idList)
{
bool res = false;
- for (const MsgId &id: idList)
- {
+ for (const MsgId &id: idList) {
ConvListItem *deleted = getItem(id);
if (deleted)
{
void ConvList::clear()
{
auto items = m_pList->getItems();
- for (ListItem *item : items)
- {
+ for (ListItem *item : items) {
if (item != m_pComposeItem)
item->destroy();
}
{
auto items = getConvItems();
MsgIdList messages;
- for (ConvListItem *item : items)
- {
+ for (ConvListItem *item : items) {
if (item->getCheckedState())
messages.push_back(item->getMsgId());
}
{
auto items = getConvItems();
int count = 0;
- for (ConvListItem *item : items)
- {
+ for (ConvListItem *item : items) {
if (item->getCheckedState())
count++;
}
void ConvList::updateSelectAllItem()
{
- if (m_Mode == SelectMode && m_pSelectAll)
- {
+ if (m_Mode == SelectMode && m_pSelectAll) {
bool check = true;
auto items = getConvItems();
- for (ConvListItem *item : items)
- {
- if (!item->getCheckedState())
- {
+ for (ConvListItem *item : items) {
+ if (!item->getCheckedState()) {
check = false;
break;
}
ComposeListItem &ConvList::getComposeItem()
{
- if (!m_pComposeItem)
- {
+ if (!m_pComposeItem) {
m_pComposeItem = new ComposeListItem(m_BubbleEntityFactory, m_FileViewer);
m_pList->appendItem(*m_pComposeItem);
m_pComposeItem->show(false);
void ConvList::onMsgStorageUpdate(const MsgIdList &msgIdList)
{
- for (auto &itemId: msgIdList)
- {
+ for (auto &itemId: msgIdList) {
ConvListItem *updated = getItem(itemId);
- if (updated)
- {
+ if (updated) {
time_t beforeTime = updated->getRawTime();
updated->updateStatus();
if (beforeTime != updated->getRawTime())
void ConvList::onMsgStorageInsert(const MsgIdList &msgIdList)
{
bool inserted = false;
- for (MsgId msgId: msgIdList)
- {
+ for (MsgId msgId: msgIdList) {
if (getItem(msgId))
continue;
MessageRef msg = m_MsgEngine.getStorage().getMessage(msgId);
- if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim)
- {
+ if (msg && msg->getThreadId() == m_ThreadId && msg->getMessageStorageType() != Message::MS_Sim) {
MsgConversationItemRef item = m_MsgEngine.getStorage().getConversationItem(msgId);
- if (item)
- {
+ if (item) {
insertItem(*item);
inserted = true;
}
void ConvList::onEditDraftMsg(ConvListItem &item)
{
- if (m_pListener)
- {
+ if (m_pListener) {
item.disabled(true);
m_pListener->onEditDraftMsg(item.getMsgId());
}
{
MSG_LOG("");
auto items = getConvItems();
- for (ConvListItem *item : items)
- {
+ for (ConvListItem *item : items) {
item->updateTime();
}
m_pList->updateRealizedItems();
// Update ConvListItem:
auto convListItems = getConvItems();
for (ConvListItem *item : convListItems)
- {
item->updateTime();
- }
// Update DateLineItem:
m_DateLineItemSet.clear();
auto DateLineItems = m_pList->getItems<DateLineItem>();
- for (DateLineItem *item : DateLineItems)
- {
+ for (DateLineItem *item : DateLineItems) {
item->update();
m_DateLineItemSet.insert(item->getDateLine());
}
{
m_App.getPopupManager().reset(this);
for (auto *entity : m_BubbleEntityList)
- {
delete entity;
- }
+
m_BubbleEntityList.clear();
}
m_NetworkStatus = msg->getNetworkStatus();
m_IsRestrictedByDpm = msg->isRestrictedByDpm();
- if (m_NetworkStatus == Message::NS_Send_Fail)
- {
+ if (m_NetworkStatus == Message::NS_Send_Fail) {
updateItemType(ConvItemType::Failed);
updateEntityBgType(BubbleBgViewItem::FailedStyle);
} else if (m_NetworkStatus == Message::NS_Send_Success || m_NetworkStatus == Message::NS_Sending) {
ConvListViewItem::ConvItemType ConvListItem::getConvItemType(const MsgConversationItem &item)
{
ConvItemType type = ConvItemType::Sent;
- if (item.getDirection() == Message::Direction::MD_Sent)
- {
+ if (item.getDirection() == Message::Direction::MD_Sent) {
if (item.isDraft())
type = ConvItemType::Draft;
else if (item.getNetworkStatus() == Message::NS_Send_Fail)
BubbleBgViewItem::BgType ConvListItem::getBubbleBgType(const MsgConversationItem &item)
{
BubbleBgViewItem::BgType type = BubbleBgViewItem::SentStyle;
- if (item.getDirection() == Message::Direction::MD_Sent)
- {
+ if (item.getDirection() == Message::Direction::MD_Sent) {
if (item.isDraft())
type = BubbleBgViewItem::DraftStyle;
else if (item.getNetworkStatus() == Message::NS_Send_Fail)
BubbleDownloadButtonEntity *ConvListItem::findDownloadButton() const
{
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
if (entity->getType() == BubbleEntity::DownloadButtonItem)
return static_cast<BubbleDownloadButtonEntity*>(entity);
}
void ConvListItem::updateEntityBgType(BubbleBgViewItem::BgType bgType)
{
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
auto *bgEntity = dynamic_cast<BubbleBgEntity*>(entity);
if (bgEntity)
bgEntity->setBgType(bgType);
void ConvListItem::prepareBubble(const MsgConversationItem &item, const std::string &searchWord)
{
BubbleBgViewItem::BgType bgType = getBubbleBgType(item);
- if (m_IsRestrictedByDpm)
- {
+ if (m_IsRestrictedByDpm) {
addEntity(createTextEntity(BubbleBgViewItem::RestrictedStyle, msg("IDS_MSG_BODY_COULDNT_RECEIVE_THIS_MESSAGE_THE_SECURITY_POLICY_PREVENTS_RECEIVING_MESSAGES"), false, ""));
} else if (!MsgUtils::isMms(m_Type)) {
addEntity(createTextEntity(bgType, item.getText(), true, searchWord));
updateDownloadButton();
} else {
const MsgConvMediaList &list = item.getMediaList();
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
const MsgConvMedia &media = list.at(i);
std::string mime = media.getMime();
std::transform(mime.begin(), mime.end(), mime.begin(), ::tolower);
void ConvListItem::shareContent()
{
- if (MsgUtils::isSms(m_Type))
- {
+ if (MsgUtils::isSms(m_Type)) {
m_Share.launch(getAllMsgText());
} else {
std::list<std::string> fileList;
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
const std::string &filePath = entity->getFilePath();
if (!filePath.empty())
fileList.push_back(filePath);
{
MsgStorage::StorageResult result = MsgStorage::StorageFail;
MessageRef msg = m_App.getMsgEngine().getStorage().getMessage(m_MsgId);
- if (msg)
- {
+ if (msg) {
msg->setMessageStorageType(Message::MS_Sim);
m_App.getMsgEngine().getStorage().saveMessage(*msg, false, &result);
Evas_Object *ConvListItem::getBubbleContent()
{
auto *bubble = new BubbleItemContainer(*getOwner());
- for (BubbleEntity *entity : m_BubbleEntityList)
- {
+ for (BubbleEntity *entity : m_BubbleEntityList) {
BubbleViewItem *item = entity->createView(*bubble);
- if (item)
- {
+ if (item) {
bubble->append(*item, entity->getDirection());
item->setListener(this);
}
if (!msgText.empty())
listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TEXT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onCopyTextItemPressed), this);
- if (!m_IsRestrictedByDpm)
- {
+ if (!m_IsRestrictedByDpm) {
listPopup.appendItem(msg("IDS_MSGF_OPT_FORWARD"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onForwardItemPressed), this);
listPopup.appendItem(msg("IDS_COM_BUTTON_SHARE"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onShareItemPressed), this);
}
if (m_NetworkStatus == Message::NS_Send_Fail)
listPopup.appendItem(msg("IDS_MSG_OPT_EDIT"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onEditItemPressed), this);
- if (m_Type == Message::MT_MMS)
- {
+ if (m_Type == Message::MT_MMS) {
MessageMmsRef mms = std::dynamic_pointer_cast<MessageMms>(m_App.getMsgEngine().getStorage().getMessage(m_MsgId));
if (mms && (!mms->getAttachmentList().isEmpty() || mms->getMediaCount() > 0))
listPopup.appendItem(msg("IDS_MSG_OPT_SAVE_ATTACHMENTS_ABB"), POPUPLIST_ITEM_PRESSED_CB(ConvListItem, onSaveAttachmentsItemPressed), this);
void ConvListItem::tryToDownloadMms(bool showToast)
{
- if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm())
- {
+ if (!m_App.getSysSettingsManager().isMessagingRestrictedByDpm()) {
m_App.getMsgEngine().getTransport().retrieveMessage(m_MsgId);
auto *button = findDownloadButton();
- if (button)
- {
+ if (button) {
button->disabled(true);
updateContent();
}
{
MSG_LOG("");
- switch (item.getEntity().getType())
- {
+ switch (item.getEntity().getType()) {
case BubbleEntity::DownloadButtonItem:
- {
tryToDownloadMms();
break;
- }
case BubbleEntity::TextItem:
- {
break;
- }
default:
- {
const std::string &filePath = item.getEntity().getFilePath();
if (!filePath.empty())
m_FileViewer.launchWithCopy(filePath);
break;
- }
}
}
content += getContactsInfo(m_App, msgDirection, msgThreadId);
content += getSentReceivedTime(*message, msgDirection);
- if (msgDirection == Message::MD_Sent && msgType == Message::MT_SMS)
- {
+ if (msgDirection == Message::MD_Sent && msgType == Message::MT_SMS) {
content += brTag;
content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId);
content += getSmsStatus(msgStatus);
content += getMmsSubject(*message, ViewDetailsTextStyle);
content += getMmsMessageSize(*message, ViewDetailsTextStyle);
- if (msgDirection == Message::MD_Sent)
- {
+ if (msgDirection == Message::MD_Sent) {
content += brTag;
content += makeDeliveryReportResult(m_App, msgStatus, msgType, msgThreadId, m_MsgId);
content += makeReadReportResult(m_App, m_MsgId, msgThreadId, msgStatus);
#include "BubbleIconTextLayoutItem.h"
#include "Resource.h"
-namespace Msg
-{
+namespace Msg {
class BubbleAudioViewItem
- : public BubbleIconTextLayoutItem
- {
+ : public BubbleIconTextLayoutItem {
public:
BubbleAudioViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType);
virtual ~BubbleAudioViewItem();
#include "BubbleViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleBgViewItem
- : public BubbleViewItem
- {
+ : public BubbleViewItem {
public:
- enum BgType
- {
+ enum BgType {
SentStyle,
ReceivedStyle,
DraftStyle,
#include "BubbleIconTextLayoutItem.h"
#include "Resource.h"
-namespace Msg
-{
+namespace Msg {
class BubbleCalEventViewItem
- : public BubbleIconTextLayoutItem
- {
+ : public BubbleIconTextLayoutItem {
public:
BubbleCalEventViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType layoutType);
virtual ~BubbleCalEventViewItem();
#include "BubbleIconTextLayoutItem.h"
#include "Resource.h"
-namespace Msg
-{
+namespace Msg {
class BubbleContactViewItem
- : public BubbleIconTextLayoutItem
- {
+ : public BubbleIconTextLayoutItem {
public:
BubbleContactViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, LayoutType type);
virtual ~BubbleContactViewItem();
#include "BubbleViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleDownloadButtonViewItem
- : public BubbleViewItem
- {
+ : public BubbleViewItem {
public:
BubbleDownloadButtonViewItem(BubbleEntity &entity, Evas_Object *parent);
virtual ~BubbleDownloadButtonViewItem();
#include "BubbleBgViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleIconTextLayoutItem
- : public BubbleBgViewItem
- {
+ : public BubbleBgViewItem {
public:
- enum LayoutType
- {
+ enum LayoutType {
Layout1Icon1Text,
Layout1Icon2Text
};
#include "BubbleViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleImageViewItem
- : public BubbleViewItem
- {
+ : public BubbleViewItem {
public:
BubbleImageViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath);
virtual ~BubbleImageViewItem();
#include "BubbleViewItem.h"
#include "Message.h"
-namespace Msg
-{
+namespace Msg {
class BubbleItemContainer
- : public View
- {
+ : public View {
public:
BubbleItemContainer(Evas_Object *parent);
virtual ~BubbleItemContainer();
#include "BubbleBgViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleTextViewItem
- : public BubbleBgViewItem
- {
+ : public BubbleBgViewItem {
public:
BubbleTextViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType, const std::string &text);
virtual ~BubbleTextViewItem();
#include "BubbleIconTextLayoutItem.h"
#include "Resource.h"
-namespace Msg
-{
+namespace Msg {
class BubbleUnknownFileViewItem
- : public BubbleIconTextLayoutItem
- {
+ : public BubbleIconTextLayoutItem {
public:
BubbleUnknownFileViewItem(BubbleEntity &entity, Evas_Object *parent, BgType bgType);
virtual ~BubbleUnknownFileViewItem();
#include "BubbleViewItem.h"
-namespace Msg
-{
+namespace Msg {
class BubbleVideoViewItem
- : public BubbleViewItem
- {
+ : public BubbleViewItem {
public:
BubbleVideoViewItem(BubbleEntity &entity, Evas_Object *parent, const std::string &imagePath);
virtual ~BubbleVideoViewItem();
#include "View.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class IBubbleViewItemListener;
class BubbleEntity;
class BubbleViewItem
- : public View
- {
+ : public View {
public:
static const int maxWidth = 408;
Evas_Object *m_pDelButton;
};
- class IBubbleViewItemListener
- {
+ class IBubbleViewItemListener {
public:
virtual ~IBubbleViewItemListener() {};
virtual void onAction(BubbleViewItem &item) {}; // Tap or Click
#include "ListItem.h"
-namespace Msg
-{
+namespace Msg {
class ComposeListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
ComposeListViewItem();
virtual ~ComposeListViewItem();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class ConvListLayout
- : public View
- {
+ : public View {
public:
ConvListLayout(Evas_Object *parent);
virtual ~ConvListLayout();
#include "ListItem.h"
-namespace Msg
-{
+namespace Msg {
class ConvListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
- enum ConvItemType
- {
+ enum ConvItemType {
InitType,
Sent,
Received,
#include "View.h"
#include "LangUtils.h"
-namespace Msg
-{
+namespace Msg {
class ConvSelectAll
- : public View
- {
+ : public View {
public:
ConvSelectAll(Evas_Object *parent);
virtual ~ConvSelectAll();
#include "ListItem.h"
-namespace Msg
-{
+namespace Msg {
class DateLineViewItem
- : public ListItem
- {
+ : public ListItem {
public:
DateLineViewItem(const std::string &dateLine);
virtual ~DateLineViewItem();
, m_BgType(bgType)
{
const char *group = nullptr;
- switch (bgType)
- {
+ switch (bgType) {
case SentStyle:
group = "conv/list/bubble_sent_bg";
break;
, m_pIconTextLayout(nullptr)
{
const char *group = nullptr;
- switch (layoutType)
- {
+ switch (layoutType) {
case Layout1Icon1Text:
group = "conv/list/1icon_1text";
break;
elm_image_aspect_fixed_set(image, true);
elm_image_file_set(image, path.c_str(), nullptr);
elm_image_object_size_get(image, &imageWidth, &imageHeight);
- if (imageWidth > maxWidth)
- {
+ if (imageWidth > maxWidth) {
double scale = maxWidth/(double)imageWidth;
imageWidth *= scale;
imageHeight *= scale;
using namespace Msg;
-namespace
-{
+namespace {
const int verticalBoxPads = 10;
const int horizontalBoxPads = 0;
}
int imageWidth = 0;
int imageHeight = 0;
elm_image_object_size_get(image, &imageWidth, &imageHeight);
- if (imageWidth > maxWidth)
- {
+ if (imageWidth > maxWidth) {
double scale = maxWidth/(double)imageWidth;
imageWidth *= scale;
imageHeight *= scale;
void BubbleViewItem::showDelButton(bool show)
{
- if (show && !m_pDelButton)
- {
+ if (show && !m_pDelButton) {
m_pDelButton = elm_button_add(getEo());
elm_object_style_set(m_pDelButton, "transparent");
evas_object_smart_callback_add(m_pDelButton, "clicked", SMART_CALLBACK(BubbleViewItem, onDelButtonClicked), this);
elm_object_content_set(m_pDelButton, icon);
setContent(m_pDelButton, delButtonPart);
- if (!getContent(delButtonPart))
- {
+ if (!getContent(delButtonPart)) {
MSG_LOG_ERROR("Layout has not 'del_button' part");
evas_object_del(m_pDelButton);
m_pDelButton = nullptr;
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef sentStyle = ListItemStyle::create("sentbubble");
const char *bubbleContentPart = "bubble.content";
}
using namespace Msg;
-namespace
-{
+namespace {
const char *layoutStyle = "conv_list_base";
}
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef sentStyle = ListItemStyle::create("sentbubble");
ListItemStyleRef receivedStyle = ListItemStyle::create("receivebubble");
ListItemStyleRef draftStyle = ListItemStyle::create("draft");
Evas_Object *ConvListViewItem::getContent(ListItem &item, const char *part)
{
if (!strcmp(part, bubbleContentPart))
- {
return getBubbleContent();
- } else if (!strcmp(part, thumbContentPart)) {
+ else if (!strcmp(part, thumbContentPart))
return getThumbnail();
- } else if (!strcmp(part, draftButtonPart)) {
+ else if (!strcmp(part, draftButtonPart))
return createButton(!getOwner()->getCheckMode(), Draft);
- } else if (!strcmp(part, failedButtonPart)) {
+ else if (!strcmp(part, failedButtonPart))
return createButton(!getOwner()->getCheckMode(), Failed);
- } else if (!strcmp(part, infoStatus)){
+ else if (!strcmp(part, infoStatus))
return getProgress();
- }
+
return nullptr;
}
elm_object_style_set(button, "transparent");
Evas_Object *icon = nullptr;
- if (type == Draft)
- {
+ if (type == Draft) {
icon = View::addLayout(button, ICONS_EDJ_PATH, "draft_icon");
evas_object_smart_callback_add(button, "clicked", SMART_CALLBACK(ConvListViewItem, onEditButtonClicked), this);
} else if (type == Failed) {
return;
m_Type = type;
- switch (type)
- {
+ switch (type) {
case Sent:
setStyle(sentStyle);
break;
void ConvListViewItem::resetCheckMode(ListView &listView)
{
for (ListItem *item: listView.getRealizedItems())
- {
item->emitSignal("elm,state,default", "elm");
- }
}
using namespace Msg;
-namespace
-{
+namespace {
const char *groupName = "elm/layout/select_all_layout";
const char *textPart = "elm.select_all_text";
const char *iconPart = "elm.swallow.select_icon";
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef dateLineStyle = ListItemStyle::create("dateline");
const char *datePart = "text.date";
}
#include <functional>
-namespace Msg
-{
+namespace Msg {
class NaviFrameController;
class Scroller;
class ConversationInputPanel;
, private IConvListListener
, private IAttachPanelListener
, private IContactManagerListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
Conversation(NaviFrameController &parent);
virtual ~Conversation();
void forwardMsg(MsgId id);
private:
- enum Mode
- {
+ enum Mode {
InitMode,
NewMessageMode,
ConversationMode
};
- struct DefferedCmd
- {
+ struct DefferedCmd {
AppControlComposeRef composeCmd;
AppControlDefaultRef defaultCmd;
};
std::function<void()> m_TransFinishedFunc;
};
- class IConversationListener
- {
+ class IConversationListener {
public:
virtual ~IConversationListener() {};
virtual void onConversationSentMessage() {};
#include "PopupListItem.h"
#include "ContactAddress.h"
-namespace Msg
-{
+namespace Msg {
class PopupAddressListItem
- : public PopupTextListItem
- {
+ : public PopupTextListItem {
public:
PopupAddressListItem(PopupList &parent,
const std::string &text,
};
class PopupPersonIdListItem
- : public PopupTextListItem
- {
+ : public PopupTextListItem {
public:
PopupPersonIdListItem(PopupList &parent,
const std::string &text,
using namespace Msg;
-namespace
-{
+namespace {
std::string makeDispAddress(std::string address, std::string dispName)
{
if (dispName.empty())
m_pRecipPanel->setListener(nullptr);
if (m_pContactsList)
m_pContactsList->setListener(nullptr);
- if (m_pConvList)
- {
+ if (m_pConvList) {
m_pConvList->setListener(nullptr);
m_pConvList->setBodyFocusCb(nullptr);
}
m_AttachPanel.setListener(nullptr);
- if (m_NnotifyConvertMsgTypeIdler)
- {
+ if (m_NnotifyConvertMsgTypeIdler) {
ecore_idler_del(m_NnotifyConvertMsgTypeIdler);
m_NnotifyConvertMsgTypeIdler = nullptr;
}
{
getApp().getPopupManager().reset();
setDeleteMode(false);
- if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
- {
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) { // Check if we can save draft to avoid losing data
m_DefferedCmd.composeCmd = cmd;
showNoRecipPopup();
return;
if (m_pRecipPanel)
m_pRecipPanel->execCmd(cmd);
- if (m_pBody)
- {
+ if (m_pBody) {
m_pBody->enableAutoFocusForAttachments(isRecipExists());
m_pBody->execCmd(cmd);
}
{
getApp().getPopupManager().reset();
setDeleteMode(false);
- if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) // Check if we can save draft to avoid losing data
- {
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) { // Check if we can save draft to avoid losing data
m_DefferedCmd.defaultCmd = cmd;
showNoRecipPopup();
return;
m_pBody->clear();
}
- if (cmd->getDefaultType() == AppControlDefault::SendFailedType)
- {
+ if (cmd->getDefaultType() == AppControlDefault::SendFailedType) {
pop();
return;
}
- if (cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
- {
+ if (cmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) {
pop();
return;
}
navigateTo(msgId);
else
navigateToBottom();
- if (cmd->getDefaultType() == AppControlDefault::ReplyType)
- {
+ if (cmd->getDefaultType() == AppControlDefault::ReplyType) {
m_pBody->execCmd(cmd);
m_pBody->setFocus(true);
}
MSG_ASSERT(m_Mode != InitMode, "m_Mode is in initial state");
ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(address);
- if (contactAddress)
- {
- if (m_Mode == NewMessageMode)
- {
+ if (contactAddress) {
+ if (m_Mode == NewMessageMode) {
MbeRecipientItem *pItem = m_pRecipPanel->getSelectedItem();
if (pItem)
showSavedRecipientPopup(pItem->getDispName(), contactAddress->getOwnerId(), contactAddress->getOwnerType());
{
PopupList &popup = createPopupList(address);
popup.addEventCb(EVAS_CALLBACK_DEL, EVAS_EVENT_CALLBACK(Conversation, onRecipPopupDel), this);
- if (m_Mode == NewMessageMode)
- {
+ if (m_Mode == NewMessageMode) {
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSGF_OPT_REMOVE"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onRecipRemoveItemPressed), this));
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_EDIT"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onEditItemPressed), this));
} else if (m_Mode == ConversationMode) {
- if (MsgUtils::isValidNumber(address))
- {
+ if (MsgUtils::isValidNumber(address)) {
popup.appendItem(*new PopupAddressListItem(popup, msg("IDS_MSG_OPT_MAKE_VOICE_CALL"), address,
POPUPLIST_ITEM_PRESSED_CB(Conversation, onMakeVoiceItemPressed), this));
}
{
m_IsMms = false;
m_DispIsMms = false;
- if (m_NnotifyConvertMsgTypeIdler)
- {
+ if (m_NnotifyConvertMsgTypeIdler) {
ecore_idler_del(m_NnotifyConvertMsgTypeIdler);
m_NnotifyConvertMsgTypeIdler = nullptr;
}
bool Conversation::isHiddenAddress() const
{
- if (m_AddressList && !m_AddressList->isEmpty())
- {
+ if (m_AddressList && !m_AddressList->isEmpty()) {
std::string addr = m_AddressList->at(0).getAddress();
return !MsgUtils::isValidAddress(addr);
}
void Conversation::forwardMsg(MsgId id)
{
MessageRef msg = getMsgEngine().getStorage().getMessage(id);
- if (msg)
- {
+ if (msg) {
resetMsgThread();
if (m_pBody)
m_pBody->write(*msg);
if (m_Mode == mode)
return;
- switch (mode)
- {
+ switch (mode) {
case NewMessageMode:
setNewMessageMode();
break;
m_Mode = ConversationMode;
m_pLayout->showRecipEditMode(false);
MsgAddressListRef addressList = getAddressList();
- if (addressList && addressList->getLength() > 1)
- {
+ if (addressList && addressList->getLength() > 1) {
showRecipPanel(true);
m_pRecipPanel->showEntry(false);
m_pRecipPanel->update(addressList);
updateNavibar();
showMsgInputPanelIfNeeded(!value);
- if (value)
- {
+ if (value) {
if (m_AttachPanel.isFullExpanded())
m_AttachPanel.show(false);
m_pConvList->setMode(ConvList::SelectMode);
void Conversation::showConvList(bool show)
{
- if (show)
- {
- if (!m_pConvList)
- {
+ if (show) {
+ if (!m_pConvList) {
m_pConvList = new ConvList(*m_pLayout, getApp(), m_WorkingDir);
m_pConvList->setBodyFocusCb(std::bind(&Conversation::getSipVisibility, this));
m_pConvList->setListener(this);
void Conversation::showRecipPanel(bool show)
{
- if (show)
- {
- if (!m_pRecipPanel)
- {
+ if (show) {
+ if (!m_pRecipPanel) {
m_pRecipPanel = new ConvRecipientsPanel(*m_pLayout, getApp());
m_pRecipPanel->setListener(this);
m_pRecipPanel->show();
void Conversation::showContactList(bool show)
{
- if (show)
- {
- if (!m_pContactsList)
- {
+ if (show) {
+ if (!m_pContactsList) {
m_pContactsList = new ConvContactList(*m_pLayout, getApp());
m_pContactsList->setListener(this);
m_pLayout->setContactList(*m_pContactsList);
}
} else {
- if (m_pContactsList)
- {
+ if (m_pContactsList) {
m_pContactsList->destroy();
m_pContactsList = nullptr;
m_pLayout->showContactList(false);
void Conversation::createMsgInputPanel()
{
- if (!m_pMsgInputPanel)
- {
+ if (!m_pMsgInputPanel) {
m_pMsgInputPanel = new MessageInputPanel(*m_pConvList);
m_pMsgInputPanel->setListener(this);
m_pLayout->setMsgInputPanel(*m_pMsgInputPanel);
}
- if (!m_pBody && m_pConvList)
- {
+ if (!m_pBody && m_pConvList) {
m_pBody = new Body(*m_pMsgInputPanel, getApp(), m_WorkingDir, *m_pConvList);
m_pBody->setListener(this);
m_pMsgInputPanel->setEntry(*m_pBody);
void Conversation::destroyMsgInputPanel()
{
- if (m_pBody)
- {
+ if (m_pBody) {
m_pBody->setListener(this);
m_pBody->destroy();
m_pBody = nullptr;
}
- if (m_pMsgInputPanel)
- {
+ if (m_pMsgInputPanel) {
m_pMsgInputPanel->setListener(this);
m_pMsgInputPanel->destroy();
m_pMsgInputPanel = nullptr;
bool Conversation::read(Message &msg)
{
- if (readMsgAddress(msg))
- {
+ if (readMsgAddress(msg)) {
if (m_pBody)
m_pBody->read(msg);
return true;
bool Conversation::readMsgAddress(Message &msg)
{
bool res = false;
- if (m_ThreadId.isValid())
- {
+ if (m_ThreadId.isValid()) {
MsgAddressListRef addressList = getAddressList();
- if (addressList)
- {
+ if (addressList) {
res = !addressList->isEmpty();
msg.addAddresses(*addressList);
}
} else {
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
m_pRecipPanel->read(msg);
res = !m_pRecipPanel->isMbeEmpty();
}
return;
const char *strId = nullptr;
- switch (result)
- {
+ switch (result) {
case MsgTransport::SendNoSIM:
strId = "IDS_MSG_BODY_UNABLE_TO_SEND_THIS_MESSAGE_INSERT_YOUR_SIM_CARD_AND_TRY_AGAIN";
break;
bool Conversation::checkBeforeSend(const Message &msg)
{
- if (!getApp().getSysSettingsManager().isSimInserted())
- {
+ if (!getApp().getSysSettingsManager().isSimInserted()) {
handleSendResult(msg, MsgTransport::SendNoSIM); // Show no SIM card
return false;
}
- if (getApp().getSysSettingsManager().isMessagingRestrictedByDpm())
- {
+ if (getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) {
showSendDpmNotif(msg.getAddressList());
return false;
}
- if (msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled())
- {
+ if (msg.isMms() && !getApp().getSysSettingsManager().isMobileDataEnabled()) {
showMobileDataPopup();
return false;
}
std::vector<MsgId> Conversation::getMsgIdListForReadReport() const
{
std::vector<MsgId> msgIds;
- if (m_pConvList)
- {
+ if (m_pConvList) {
auto items = m_pConvList->getConvItems();
- for (ConvListItem *item : items)
- {
+ for (ConvListItem *item : items) {
if (item->isNeededReadReport())
msgIds.push_back(item->getMsgId());
}
bool Conversation::sendReadReportIfNeeded()
{
if (getMsgEngine().getSettings().getMmsReadReport() &&
- !getApp().getSysSettingsManager().isMessagingRestrictedByDpm())
- {
+ !getApp().getSysSettingsManager().isMessagingRestrictedByDpm()) {
auto msgIds = getMsgIdListForReadReport();
- if (!msgIds.empty())
- {
+ if (!msgIds.empty()) {
showSendReadReportPopup();
return true;
}
{
auto ids = getMsgIdListForReadReport();
for (MsgId id : ids)
- {
getMsgEngine().getTransport().sendReadReport(id, status);
- }
}
void Conversation::sendMessage(MsgId msgId)
{
MessageRef msg = getMsgEngine().getStorage().getMessage(msgId);
- if (msg && checkBeforeSend(*msg))
- {
+ if (msg && checkBeforeSend(*msg)) {
auto sentRes = getMsgEngine().getTransport().sendMessage(msg);
handleSendResult(*msg, sentRes);
}
MSG_LOG("Send result = ", sendRes);
MSG_LOG("New threadId = ", m_ThreadId);
- if (sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid())
- {
+ if (sendRes == MsgTransport::SendSuccess && m_ThreadId.isValid()) {
m_DispIsMms = false; // Skip "Convert to SMS" after sent message with MMS body.
setThreadId(m_ThreadId);
m_pMsgInputPanel->disabledButton(MessageInputPanel::SendButtonId, true);
MsgId Conversation::saveDraftMsg()
{
MsgId msgId;
- if (!isBodyEmpty())
- {
+ if (!isBodyEmpty()) {
MessageRef msg = getMsgEngine().getComposer().createMessage(m_IsMms ? Message::MT_MMS : Message::MT_SMS);
- if (msg)
- {
+ if (msg) {
read(*msg);
msg->setMessageStorageType(Message::MS_Phone);
msgId = getMsgEngine().getStorage().saveMessage(*msg, false);
return;
MessageRef msg = getMsgEngine().getStorage().getMessage(id);
- if (msg)
- {
+ if (msg) {
MsgId draftMsgId = saveDraftMsg();
m_pBody->clear();
if (m_pConvList->getMessageCount() <= 1 && !draftMsgId.isValid())
setThreadId(ThreadId());
write(*msg);
- if (getMsgEngine().getStorage().deleteMessage(id))
- {
+ if (getMsgEngine().getStorage().deleteMessage(id)) {
// Fast remove item in order to avoid blink:
m_pConvList->deleteItems({id});
}
void Conversation::notifyConvertMsgType()
{
- if (!m_NnotifyConvertMsgTypeIdler)
- {
+ if (!m_NnotifyConvertMsgTypeIdler) {
m_NnotifyConvertMsgTypeIdler = ecore_idler_add(
[](void *data)->Eina_Bool
{
auto *self =(Conversation*)data;
self->m_NnotifyConvertMsgTypeIdler = nullptr;
- if (self->m_DispIsMms != self->m_IsMms)
- {
+ if (self->m_DispIsMms != self->m_IsMms) {
self->m_DispIsMms = self->m_IsMms;
std::string notifText = self->m_IsMms ?
msg("IDS_MSGF_POP_CONVERTING_TO_MULTIMEDIA_MESSAGE_ING") :
if (!isMms && m_pRecipPanel && !m_pRecipPanel->isMbeEmpty())
isMms = m_pRecipPanel->isMms();
- if (force || isMms != m_IsMms)
- {
+ if (force || isMms != m_IsMms) {
m_IsMms = isMms;
convertMsgTypeHandler();
}
void Conversation::setBodyFocus()
{
- if (getOwner().getTransitionStatus())
- {
+ if (getOwner().getTransitionStatus()) {
m_TransFinishedFunc = [this]()
{
if (m_pBody)
void Conversation::setRecipEntryFocus()
{
- if (getOwner().getTransitionStatus())
- {
+ if (getOwner().getTransitionStatus()) {
m_TransFinishedFunc = [this]()
{
if (m_pRecipPanel)
int len = addressList.getLength();
std::string addresses;
- for (int i = 0; i < len; ++i)
- {
+ for (int i = 0; i < len; ++i) {
std::string address = addressList[i].getAddress();
std::string dispName;
- if (!address.empty())
- {
+ if (!address.empty()) {
ContactAddressRef rec = getApp().getContactManager().getContactAddress(address);
if (rec)
dispName = rec->getDispName();
}
}
- if (len <= 1)
- {
+ if (len <= 1) {
std::string text = msgArgs("IDS_MSG_POP_THE_SECURITY_POLICY_PREVENTS_SENDING_MESSAGES_TO_PS", addresses.c_str());
notification_status_message_post(text.c_str());
} else {
{
PopupList &popup = getApp().getPopupManager().getMorePopup();
popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(Conversation, onDeleteItemPressed), this);
- if (m_AddressList && m_AddressList->getLength() == 1)
- {
+ if (m_AddressList && m_AddressList->getLength() == 1) {
const std::string adress = m_AddressList->at(0).getAddress();
ContactAddressRef contactAddress = getApp().getContactManager().getContactAddress(adress);
- if (contactAddress)
- {
+ if (contactAddress) {
popup.appendItem(*new PopupPersonIdListItem(popup, msg("IDS_MSG_OPT_VIEW_CONTACT_DETAILS_ABB"), contactAddress->getOwnerId(),
contactAddress->getOwnerType(), POPUPLIST_ITEM_PRESSED_CB(Conversation, onViewContactDetailsItemPressed), this));
} else if (!isHiddenAddress()) {
void Conversation::onKeyDown(ConvRecipientsPanel &panel, Evas_Event_Key_Down &ev)
{
- if (ev.keyname)
- {
- if ((strcmp(ev.keyname, "Return") == 0))
- {
+ if (ev.keyname) {
+ if ((strcmp(ev.keyname, "Return") == 0)) {
m_pBody->setFocus(true);
} else {
- if (m_pContactsList)
- {
+ if (m_pContactsList) {
m_pContactsList->setSearchWorld(m_pRecipPanel->getEntryText());
m_pContactsList->requestSearch();
}
if (m_pBody)
m_pBody->setMmsRecipFlag(m_pRecipPanel->isMms());
checkAndSetMsgType();
- if (m_pConvList)
- {
+ if (m_pConvList) {
std::list<std::string> recips;
auto items = panel.getMbeRecipients().getItems();
- for (MbeRecipientItem *item : items)
- {
+ for (MbeRecipientItem *item : items) {
recips.push_back(item->getAddress());
}
ThreadId id;
if (!m_pBody || !m_pMsgInputPanel)
return;
- if (m_pBody->isMms())
- {
+ if (m_pBody->isMms()) {
// Mms:
m_pMsgInputPanel->setCounter(MsgUtils::makeKbStr(m_pBody->getMsgSize()));
} else {
naviBar.clear();
naviBar.setColor(NaviBar::NaviWhiteColorId);
- if (m_Mode == NewMessageMode)
- {
+ if (m_Mode == NewMessageMode) {
naviBar.setTitle(msgt("IDS_MSG_HEADER_COMPOSE_MESSAGE_ABB"));
naviBar.showButton(NaviPrevButtonId, true);
} else if (m_Mode == ConversationMode) {
- if (m_DeleteMode)
- {
+ if (m_DeleteMode) {
updateSelectMsgTitle();
naviBar.showButton(NaviCancelButtonId, true);
naviBar.showButton(NaviOkButtonId, true);
} else {
naviBar.showButton(NaviPrevButtonId, true);
MsgAddressListRef addressList = getAddressList();
- if (addressList)
- {
+ if (addressList) {
naviBar.showButton(NaviCenterButtonId, true);
FrameController::setNaviBarTitle(*addressList);
}
void Conversation::updateSelectMsgTitle()
{
- if (m_pConvList && m_DeleteMode)
- {
+ if (m_pConvList && m_DeleteMode) {
int checked = m_pConvList->getMessageCheckedCount();
if (checked > 0)
getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked));
{
MSG_LOG("MessageInputPanel: button clicked: id = ", id);
- switch (id)
- {
+ switch (id) {
case MessageInputPanel::AddButtonId:
m_AttachPanel.show(true);
break;
void Conversation::onTransitionFinished(NaviFrameItem &item)
{
MSG_LOG("");
- if (m_TransFinishedFunc)
- {
+ if (m_TransFinishedFunc) {
m_TransFinishedFunc();
m_TransFinishedFunc = nullptr;
}
void Conversation::onHwBackButtonClicked()
{
MSG_LOG("");
- if (m_DeleteMode)
- {
+ if (m_DeleteMode) {
setDeleteMode(false);
return;
}
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
if (m_pRecipPanel->isMbeVisible() || m_pRecipPanel->getItemsCount() == 0)
m_pRecipPanel->addRecipientsFromEntry(false);
m_pRecipPanel->clearEntry();
}
- if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode)
- {
+ if (!isRecipExists() && !isBodyEmpty() && m_Mode == NewMessageMode) {
showNoRecipPopup();
return;
}
void Conversation::onNaviOkButtonClicked()
{
MSG_LOG("");
- if (m_Mode == ConversationMode && m_DeleteMode)
- {
+ if (m_Mode == ConversationMode && m_DeleteMode) {
m_pConvList->deleteSelectedItems();
setDeleteMode(false);
}
void Conversation::onNaviCenterButtonClicked()
{
MSG_LOG("");
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
onNaviExpandButtonClicked();
} else {
MsgAddressListRef addressList = getAddressList();
void Conversation::onNaviExpandButtonClicked()
{
MSG_LOG("");
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
bool isMbeInvisible = !m_pRecipPanel->isMbeVisible();
m_pRecipPanel->showMbe(isMbeInvisible);
getNaviBar().setDownButtonState(isMbeInvisible);
void Conversation::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- switch (buttonId)
- {
+ switch (buttonId) {
case NaviPrevButtonId:
onHwBackButtonClicked();
break;
-
case NaviExpandButtonId:
onNaviExpandButtonClicked();
break;
-
case NaviCenterButtonId:
onNaviCenterButtonClicked();
break;
-
case NaviCancelButtonId:
onHwBackButtonClicked();
break;
-
case NaviOkButtonId:
onNaviOkButtonClicked();
break;
-
default:
MSG_LOG_ERROR("Invalid buttonId: ", buttonId);
break;
void Conversation::onNoRecipDiscardButtonClicked(Popup &popup, int buttonId)
{
- if (isDefferedCmd())
- {
+ if (isDefferedCmd()) {
if (m_pBody)
m_pBody->clear();
- if (m_DefferedCmd.defaultCmd)
- { // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view
- if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1)
- {
+ if (m_DefferedCmd.defaultCmd) { // If we came from notification menu and unread threads will be more than one, we should to go back on thread list view
+ if (m_DefferedCmd.defaultCmd->getDefaultType() == AppControlDefault::NotificationType && getMsgEngine().getStorage().getUnreadThreadCount() > 1) {
pop();
} else {
// Go to needed conversation
void Conversation::onAllConvItemsDeleted(ConvList &list)
{
MSG_LOG("");
- if (m_Mode != NewMessageMode)
- {
+ if (m_Mode != NewMessageMode) {
auto convList = getMsgEngine().getStorage().getConversationList(m_ThreadId);
- if ((convList && convList->getLength() == 0) || !convList)
- {
- if (isBodyEmpty())
- {
+ if ((convList && convList->getLength() == 0) || !convList) {
+ if (isBodyEmpty()) {
onHwBackButtonClicked();
} else {
// Current MsgThread is dead, so create new MsgThread from existing recipients.
#include <string>
-namespace Msg
-{
+namespace Msg {
class ConversationLayout
- : public View
- {
+ : public View {
public:
ConversationLayout(Evas_Object *parent);
virtual ~ConversationLayout();
#include <string>
-namespace Msg
-{
+namespace Msg {
class IMessageInputPanelListener;
class MessageInputPanel
- : public View
- {
+ : public View {
public:
- enum ButtonId
- {
+ enum ButtonId {
AddButtonId,
SendButtonId
};
Evas_Object *m_pAddButton;
};
- class IMessageInputPanelListener
- {
+ class IMessageInputPanelListener {
public:
virtual ~IMessageInputPanelListener() {}
virtual void onButtonClicked(MessageInputPanel &obj, MessageInputPanel::ButtonId id) {};
#define BUTTON_PRESSED_COLOR 60, 75, 140, 255
#define BUTTON_DISABLED_COLOR 179, 197, 218, 255
-namespace
-{
+namespace {
const char *buttonIdKey = "id";
}
Evas_Object *MessageInputPanel::getButton(ButtonId id)
{
- switch (id)
- {
+ switch (id) {
case AddButtonId:
return m_pAddButton;
break;
-
case SendButtonId:
return m_pSendButton;
break;
-
default:
MSG_ASSERT(false, "Unknown button id");
break;
void MessageInputPanel::onButtonClicked(Evas_Object *obj, void *event_info)
{
feedback_play(FEEDBACK_PATTERN_TAP);
- if (m_pListener)
- {
+ if (m_pListener) {
int id = (int)(intptr_t)evas_object_data_get(obj, buttonIdKey);
m_pListener->onButtonClicked(*this, (ButtonId)id);
}
#include "ContactPicker.h"
#include "ContactManager.h"
-namespace Msg
-{
+namespace Msg {
class IConvRecipientsPanelListener;
class ConvRecipientsPanel
: public ConvRecipientsPanelView
, private IContactPickerListener
, private IMbeRecipientsListener
- , private IContactManagerListener
- {
+ , private IContactManagerListener {
public:
ConvRecipientsPanel(Evas_Object *parent, App &app);
virtual ~ConvRecipientsPanel();
MbeRecipients *m_pMbe;
};
- class IConvRecipientsPanelListener
- {
+ class IConvRecipientsPanelListener {
public:
virtual ~IConvRecipientsPanelListener() {}
void ConvRecipientsPanel::read(Message &msg)
{
auto list = m_pMbe->getItems();
- for (auto it : list)
- {
+ for (auto it : list) {
MbeRecipientItem *recipItem = static_cast<MbeRecipientItem*>(it);
MsgAddress &msgAddr = msg.addAddress();
msgAddr.setAddress(recipItem->getAddress());
msgAddr.setAddressType(recipItem->getAddressType());
}
- if (list.empty())
- {
+ if (list.empty()) {
showInvalidIcon(true);
showAddRecipNotif();
setEntryFocus(true);
bool ConvRecipientsPanel::isMms() const
{
auto items = m_pMbe->getItems();
- for (MbeRecipientItem *it : items)
- {
+ for (MbeRecipientItem *it : items) {
MbeRecipientItem *item = static_cast<MbeRecipientItem*>(it);
if (item->getAddressType() == MsgAddress::Email)
return true;
TokenizedRecipients result = MsgUtils::tokenizeRecipients(text);
bool duplicateFound = false;
- for (auto &it : result.validResults)
- {
+ for (auto &it : result.validResults) {
if (it.second == MsgAddress::Phone)
it.first = MsgUtils::makeNormalizedNumber(it.first);
duplicateFound |= appendItem(it.first, it.second) == MbeRecipients::DuplicatedStatus;
}
- if (duplicateFound)
- {
+ if (duplicateFound) {
showDuplicatedRecipientNotif();
return false;
}
setEntryText(result.invalidResult);
- if (!result.invalidResult.empty() && showPopup)
- {
+ if (!result.invalidResult.empty() && showPopup) {
showInvalidRecipientPopup();
return false;
}
{
clearMbe();
int addrListLen = addressList.getLength();
- for (int i = 0; i < addrListLen; ++i)
- {
+ for (int i = 0; i < addrListLen; ++i) {
auto &addr = addressList.at(i);
appendItem(addr.getAddress(), addr.getAddressType());
}
void ConvRecipientsPanel::execCmd(const AppControlComposeRef &cmd)
{
m_pMbe->clear();
- for (auto recipStr: cmd->getRecipientList())
- {
+ for (auto recipStr: cmd->getRecipientList()) {
appendStatusHandler(appendItem(recipStr));
}
}
void ConvRecipientsPanel::appendStatusHandler(MbeRecipients::AppendItemStatus status)
{
- switch (status)
- {
+ switch (status) {
case MbeRecipients::SuccessStatus:
showInvalidIcon(false);
if (getEntryFocus())
void ConvRecipientsPanel::onKeyDown(Evas_Event_Key_Down *ev)
{
- if (ev && ev->keyname)
- {
+ if (ev && ev->keyname) {
MSG_LOG("Key: ", ev->keyname);
- if ((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0))
- {
+ if ((strcmp(ev->keyname, "semicolon") == 0) || (strcmp(ev->keyname, "comma") == 0)) {
addRecipientsFromEntry();
} else {
if (m_pListener)
if (!getEntryFocus())
showButton(ContactButton);
- if (getEntryFocus())
- {
+ if (getEntryFocus()) {
expandRecipients();
} else {
addRecipientsFromEntry();
void ConvRecipientsPanel::onEntryChanged()
{
unselectMbeItem();
- if (!isEntryEmpty() && getEntryFocus())
- {
+ if (!isEntryEmpty() && getEntryFocus()) {
showButton(PlusButton);
showInvalidIcon(false);
} else {
int addressOfInvalids = 0;
int duplicateRecip = 0;
int sizeOfList = addressIdList.size();
- for (auto &addressData : addressIdList)
- {
+ for (auto &addressData : addressIdList) {
ContactAddressRef address;
if (addressData.type == IContactPickerListener::PhoneType)
address = m_App.getContactManager().getContactPersonNumber(addressData.id);
else if (addressData.type == IContactPickerListener::EmailType)
address = m_App.getContactManager().getContactPersonEmail(addressData.id);
- if (address)
- {
+ if (address) {
auto apendStatus = appendItem(address->getAddress(), address->getDispName(), MsgAddress::UnknownAddressType);
if (apendStatus == MbeRecipients::InvalidRecipStatus)
++addressOfInvalids;
#include <string>
#include <vector>
-namespace Msg
-{
+namespace Msg {
class ConvRecipientsPanelView
- : public View
- {
+ : public View {
public:
ConvRecipientsPanelView(Evas_Object *parent, int entryMaxCharCount);
virtual ~ConvRecipientsPanelView();
void updateShortenedRecipients();
protected:
- enum ButtonType
- {
+ enum ButtonType {
NoneButton,
ContactButton,
PlusButton
#define BUTTON_COLOR 61, 185, 204, 255
#define BUTTON_PRESSED_COLOR 50, 160, 170, 255
-namespace
-{
+namespace {
const char *buttonPart = "swl.contact_btn";
}
if (button)
evas_object_hide(button);
- switch (buttonType)
- {
+ switch (buttonType) {
case NoneButton:
break;
-
case ContactButton:
elm_object_part_content_set(m_pLayout, buttonPart, getContactBtn());
break;
-
case PlusButton:
elm_object_part_content_set(m_pLayout, buttonPart, getPlusBtn());
break;
-
default:
assert(false);
break;
void ConvRecipientsPanelView::setButtonEnabled(ButtonType buttonType, bool enabled)
{
Evas_Object *pBtn = nullptr;
- switch (buttonType)
- {
+ switch (buttonType) {
case NoneButton:
break;
-
case ContactButton:
pBtn = getContactBtn();
break;
-
case PlusButton:
pBtn = getPlusBtn();
break;
-
default:
assert(false);
break;
}
- if(pBtn)
- {
+ if (pBtn)
elm_object_disabled_set(pBtn, !enabled);
- }
}
void ConvRecipientsPanelView::addGeometryChangedCb(Evas_Object *obj)
void ConvRecipientsPanelView::setEntryText(const std::string &utf8)
{
char *text = elm_entry_utf8_to_markup(utf8.c_str());
- if (text)
- {
+ if (text) {
elm_entry_entry_set(m_pEntry, text);
elm_entry_cursor_end_set(m_pEntry);
free(text);
Evas_Object *ConvRecipientsPanelView::getContactBtn()
{
- if (m_pContactBtn)
- {
+ if (m_pContactBtn) {
evas_object_show(m_pContactBtn);
return m_pContactBtn;
}
Evas_Object *ConvRecipientsPanelView::getPlusBtn()
{
- if (m_pPlusBtn)
- {
+ if (m_pPlusBtn) {
evas_object_show(m_pPlusBtn);
return m_pPlusBtn;
}
void ConvRecipientsPanelView::deleteNextRecipient()
{
- if (!isMbeEmpty())
- {
+ if (!isMbeEmpty()) {
Elm_Object_Item *selectedItem = elm_multibuttonentry_selected_item_get(*m_pMbe);
if (selectedItem)
elm_object_item_del(selectedItem);
{
Elm_Object_Item *lastItem = elm_multibuttonentry_last_item_get(*m_pMbe);
- if (lastItem)
- {
+ if (lastItem) {
elm_object_focus_allow_set(*m_pMbe, true);
elm_multibuttonentry_item_selected_set(lastItem, true);
} else {
void ConvRecipientsPanelView::expandRecipients()
{
showMbe(!isMbeEmpty());
- if (!m_IsEditItemClicked)
- {
+ if (!m_IsEditItemClicked) {
setEntryText(m_SavedRecipText);
} else {
setEditMode(false);
{
const auto &items = m_pMbe->getItems();
std::string shortenedRecipients;
- if (!items.empty())
- {
+ if (!items.empty()) {
shortenedRecipients = items[0]->getDispName();
if (items.size() > 1)
shortenedRecipients += " + " + std::to_string(items.size() - 1);
void ConvRecipientsPanelView::editSelectedItem()
{
MbeRecipientItem* pItem = getSelectedItem();
- if (pItem)
- {
+ if (pItem) {
setEditMode(true);
setEntryText(pItem->getAddress());
showEntry(true);
void ConvRecipientsPanelView::removeSelectedItem()
{
MbeRecipientItem* pItem = getSelectedItem();
- if (pItem)
- {
+ if (pItem) {
pItem->destroy();
if (isMbeEmpty())
showMbe(false, false);
#include <Eina.h>
#include "WorkingDir.h"
-namespace Msg
-{
+namespace Msg {
class IAttachmentHandlerListener;
- class AttachmentHandler
- {
+ class AttachmentHandler {
public:
AttachmentHandler(WorkingDirRef workingDir);
~AttachmentHandler();
std::queue <std::string> m_Task;
};
- class IAttachmentHandlerListener
- {
+ class IAttachmentHandlerListener {
public:
virtual ~IAttachmentHandlerListener() {};
virtual long long onFreeSpaceRequest() = 0;
#include "App.h"
#include <string>
-namespace Msg
-{
- namespace MessageDetailContent
- {
- enum TextStyle
- {
+namespace Msg {
+ namespace MessageDetailContent {
+ enum TextStyle {
ViewDetailsTextStyle,
DownloadTextStyle
};
#include <memory>
#include <mutex>
-namespace Msg
-{
- class WorkingDir
- {
+namespace Msg {
+ class WorkingDir {
public:
WorkingDir();
~WorkingDir();
, m_ThreadCreated(false)
, m_NeedTerminate(false)
{
-
}
AttachmentHandler::~AttachmentHandler()
void AttachmentHandler::processFile(const std::string &file)
{
- if (!m_ThreadCreated)
- {
- if (eina_thread_create(&m_Thread, EINA_THREAD_NORMAL, 0, on_routine_cb, this))
- {
+ if (!m_ThreadCreated) {
+ if (eina_thread_create(&m_Thread, EINA_THREAD_NORMAL, 0, on_routine_cb, this)) {
m_ThreadCreated = true;
} else {
- if(m_pListener)
+ if (m_pListener)
m_pListener->onFileFails();
}
}
void AttachmentHandler::onRoutine()
{
- while (!m_NeedTerminate)
- {
+ while (!m_NeedTerminate) {
std::unique_lock<std::mutex> _lock(m_Mutex);
if (m_Task.empty() && !m_NeedTerminate)
m_Condition.wait(_lock);
m_Task.pop();
_lock.unlock();
- if (!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile))
- {
+ if (!FileUtils::isExists(m_CurrentFile) || FileUtils::isDir(m_CurrentFile)) {
MSG_LOG_ERROR("File not exists: ", m_CurrentFile);
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
continue;
}
m_CurrentFile = m_WorkingDir->addFile(m_CurrentFile);
- if (m_CurrentFile.empty())
- {
+ if (m_CurrentFile.empty()) {
MSG_LOG_ERROR("Error while copy file");
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
continue;
}
ecore_main_loop_thread_safe_call_sync(safeCallOnFreeSpaceRequest, this);
- if (FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace)
- {
+ if (FileUtils::getFileSize(m_CurrentFile) > m_CurrentFreeSpace) {
bool isImage = getMsgMediaTypeByFileExt(m_CurrentFile).type == MsgMedia::ImageType;
- if ((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage)
- {
+ if ((isImage && MediaUtils::downgradeImageQuality(m_CurrentFile) > m_CurrentFreeSpace) || !isImage) {
m_WorkingDir->removeFile(m_CurrentFile);
ecore_main_loop_thread_safe_call_sync(safeCallOnFileFails, this);
continue;
#include <telephony_common.h>
#include <telephony_sim.h>
-namespace Msg
-{
-namespace MessageDetailContent
-{
+namespace Msg {
+namespace MessageDetailContent {
-namespace
-{
+namespace {
const std::string secondTextColor = "#737373";
const unsigned int mainTextSize = 40;
const unsigned int secondTextSize = 32;
std::string msgDetails = makeMainText(msg("IDS_MSG_POP_TYPE"));
msgDetails.append("<br/>");
- switch (msgType)
- {
+ switch (msgType) {
case Message::MT_SMS:
msgDetails.append(makeSecondText(msg("IDS_MSGF_OPT_TEXT_MESSAGE")));
break;
MsgAddressListRef addrList = app.getMsgEngine().getStorage().getAddressList(msgThreadId);
std::string contactsInfo;
- if (msgDirection == Message::MD_Sent)
- {
+ if (msgDirection == Message::MD_Sent) {
contactsInfo.append(msg("IDS_MSG_HEADER_TO_M_RECIPIENT"));
contactsInfo.append("<br/>");
}
- if (msgDirection == Message::MD_Received)
- {
+ if (msgDirection == Message::MD_Received) {
contactsInfo.append(makeMainText(msg("IDS_MSG_BODY_FROM_ABB_M_PERIOD")));
contactsInfo.append("<br/>");
}
int addressListLength = addrList->getLength();
- for (int i = 0; i < addressListLength; ++i)
- {
+ for (int i = 0; i < addressListLength; ++i) {
std::string address = addrList->at(i).getAddress();
contactsInfo.append(makeSecondText(makeDispAddress(app, address)));
if (i != addressListLength - 1)
std::string deliverText = makeMainText(msg("IDS_MSGF_BODY_DELIVERY_REPORT"));
bool deliverFlag = app.getMsgEngine().getStorage().isDeliverReportChecked(msgId);
- if (deliverFlag)
- {
+ if (deliverFlag) {
MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId);
int size = reportList->getLength();
bool isDelivReportExists = false;
- for (int i = 0; i < size; i++)
- {
+ for (int i = 0; i < size; i++) {
const MsgReport &report = reportList->at(i);
- if (report.getType() == MsgReport::TypeDelivery)
- {
+ if (report.getType() == MsgReport::TypeDelivery) {
isDelivReportExists = true;
deliverText.append("<br/>");
deliverText.append(makeSecondText(makeDispAddress(app, report.getAddress())));
deliverText.append(makeSecondText(": "));
MsgReport::DeliveryStatus deliveryStatus = report.getDeliveryStatus();
- switch (deliveryStatus)
- {
+ switch (deliveryStatus) {
case MsgReport::StatusSuccess:
- {
deliverText.append(makeSecondText(msg("IDS_MSG_BODY_DELIVERED_M_STATUS")));
break;
- }
case MsgReport::StatusExpired:
- {
deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_EXPIRED")));
break;
- }
case MsgReport::StatusRejected:
- {
deliverText.append(makeSecondText(msg("IDS_MSGF_POP_REJECTED")));
break;
- }
case MsgReport::StatusNone:
- {
deliverText.append(makeSecondText(msg("IDS_MSG_BODY_REQUESTED_M_MESSAGE_STATUS")));
break;
- }
}
}
}
- if (!isDelivReportExists)
- {
+ if (!isDelivReportExists) {
deliverText.append("<br/>");
deliverText.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN")));
}
std::string status = makeMainText(msg("IDS_MSG_BODY_STATUS_C"));
status.append("<br/>");
- switch (msgStatus)
- {
+ switch (msgStatus) {
case Message::NS_Sending:
status.append(makeSecondText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB")));
break;
{
std::string msgDetails;
std::string subject = message.getSubject();
- switch (style)
- {
+ switch (style) {
case ViewDetailsTextStyle:
msgDetails.append(makeMainText(msg("IDS_MSG_HEADER_SUBJECT"))).append("<br/>");
if (subject.empty())
{
int msgSize = message.getSize();
std::string msgDetails;
- switch (style)
- {
+ switch (style) {
case ViewDetailsTextStyle:
msgDetails.append(makeMainText(msg("IDS_MSGF_BODY_MESSAGE_SIZE")));
msgDetails.append("<br/>");
{
const MessageMms *mms = dynamic_cast<const MessageMms*>(&message);
std::string msgDetails;
- switch (style)
- {
+ switch (style) {
case ViewDetailsTextStyle:
msgDetails.append("<br/><br/>");
msgDetails.append(makeMainText(msg("IDS_MSG_BODY_EXPIRES_ON_C")));
msgDetails.append("<br/>");
- if (mms)
- {
+ if (mms) {
time_t msgExpired = mms->getExpired();
msgDetails.append(makeSecondText(TimeUtils::makeDateString(msgExpired)));
}
case DownloadTextStyle:
msgDetails.append(msg("IDS_MSG_BODY_EXPIRES_ON_C"));
msgDetails.append(" ");
- if (mms)
- {
+ if (mms) {
time_t msgExpired = mms->getExpired();
msgDetails.append(TimeUtils::makeDateString(msgExpired));
}
{
std::string readReport = makeMainText(msg("IDS_MSGF_POP_READ_REPORT"));
bool readFlag = app.getMsgEngine().getStorage().isReadReportChecked(msgId);
- if (readFlag)
- {
+ if (readFlag) {
MsgReportListRef reportList = app.getMsgEngine().getStorage().getMsgReportList(msgId);
int size = reportList->getLength();
bool isReadReportExists = false;
- for (int i = 0; i < size; i++)
- {
+ for (int i = 0; i < size; i++) {
const MsgReport &report = reportList->at(i);
- if (report.getType() == MsgReport::TypeRead)
- {
+ if (report.getType() == MsgReport::TypeRead) {
isReadReportExists = true;
readReport.append("<br/>");
readReport.append(makeSecondText(makeDispAddress(app, report.getAddress())));
readReport.append(makeSecondText(": "));
MsgReport::ReadStatus readStatus = report.getReadStatus();
- switch (readStatus)
- {
+ switch (readStatus) {
case MsgReport::ReadStatusIsRead:
- {
readReport.append(makeSecondText(msg("IDS_MSGF_BODY_MMSREADREPLYMSGREAD")));
break;
- }
case MsgReport::ReadStatusIsDeleted:
- {
readReport.append(makeSecondText(msg("IDS_MSG_POP_DELETED")));
break;
- }
case MsgReport::ReadStatusNone:
- {
readReport.append(makeSecondText(msg("IDS_MSG_BODY_REQUESTED_M_MESSAGE_STATUS")));
break;
- }
default:
- {
readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN")));
- }
}
}
}
- if (!isReadReportExists)
- {
+ if (!isReadReportExists) {
readReport.append("<br/>");
readReport.append(makeSecondText(msg("IDS_MSGF_BODY_UNKNOWN")));
}
// Create common dir. if not exists:
std::string commonDir = PathUtils::getDataPath(commonWorkingDirName);
bool isCommonExists = FileUtils::isExists(commonDir);
- if (!isCommonExists)
- {
+ if (!isCommonExists) {
isCommonExists = FileUtils::makeDir(commonDir);
MSG_ASSERT(isCommonExists, "Can't create common working dir: ", commonDir);
}
// Create current dir:
- if (isCommonExists)
- {
+ if (isCommonExists) {
std::string uniqueDir = getUniqueDirName(commonDir + "/" + currentWorkingDirPrefix);
FileUtils::makeDir(uniqueDir);
bool isExists = FileUtils::isExists(uniqueDir);
MSG_ASSERT(isExists, "Can't create current working dir: ", uniqueDir);
if (isExists)
- {
m_Path = uniqueDir;
- }
}
}
void WorkingDir::removeWorkingDir()
{
- if (!m_Path.empty())
- {
+ if (!m_Path.empty()) {
bool res = FileUtils::remove(m_Path, true);
MSG_LOG("Working dir remove with result = ", res);
}
std::lock_guard<std::recursive_mutex> _lock(m_Mutex);
std::string newPath;
- if (FileUtils::isExists(path))
- {
- if (path.find(m_Path) != std::string::npos)
- {
+ if (FileUtils::isExists(path)) {
+ if (path.find(m_Path) != std::string::npos) {
newPath = path;
MSG_LOG("File is already exists: ", newPath);
} else {
newPath = genUniqueFilePath(path);
- if (FileUtils::copy(path, newPath))
- {
+ if (FileUtils::copy(path, newPath)) {
MSG_LOG("File added: ", newPath);
} else {
MSG_LOG_ERROR("Can't copy to working dir: ", path);
std::string path = genUniqueFilePath(result);
std::ofstream file(path, std::ofstream::trunc | std::ofstream::binary | std::ofstream::out);
- if (file.is_open())
- {
+ if (file.is_open()) {
file << text;
MSG_LOG("Text file added: ", path);
} else {
{
std::string res;
unsigned i = 0;
- do
- {
+ do {
res = path + "-" + std::to_string(i);
++i;
- }
- while (FileUtils::isExists(res));
+ } while (FileUtils::isExists(res));
return res;
}
void MainApp::terminate()
{
- if (m_NeedToCloseApp)
- {
+ if (m_NeedToCloseApp) {
// Close app completely
ui_app_exit();
} else if (m_pWindow) {
app_control_get_launch_mode(app_control, &mode);
m_NeedToCloseApp = (mode == APP_CONTROL_LAUNCH_MODE_GROUP);
- switch (cmd->getOperationType())
- {
+ switch (cmd->getOperationType()) {
case AppControlCommand::OpDefault:
if (m_pRootController)
m_pRootController->execCmd(std::static_pointer_cast<AppControlDefault>(cmd));
{
char *lang = nullptr;
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &lang);
- if (lang)
- {
+ if (lang) {
MSG_LOG("Language: ", lang);
elm_language_set(lang);
i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN;
- if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE)
- {
+ if (i18n_ulocale_get_character_orientation(lang, &layout) == I18N_ERROR_NONE) {
if (layout == I18N_ULOCALE_LAYOUT_LTR)
elm_config_mirrored_set(false);
else if (layout == I18N_ULOCALE_LAYOUT_RTL)
elm_config_mirrored_set(true);
else
- {
MSG_LOG_ERROR("Unsupported character orientation type: ", layout);
- }
}
free(lang);
}
#include <app_control.h>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class StandardWindow;
class NaviFrameController;
class MainApp:
- public App
- {
+ public App {
public:
MainApp();
virtual ~MainApp();
#include <time.h>
-namespace Msg
-{
+namespace Msg {
class BaseThreadListItem
- : public ThreadListViewItem
- {
+ : public ThreadListViewItem {
public:
BaseThreadListItem(App &app);
virtual ~BaseThreadListItem();
#include "BaseThreadListItem.h"
#include "Message.h"
-namespace Msg
-{
+namespace Msg {
class MsgSearchListItem
- : public BaseThreadListItem
- {
+ : public BaseThreadListItem {
public:
MsgSearchListItem(App &app, const Message &msg, const std::string &searchWord);
virtual ~MsgSearchListItem();
#include <string>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class SelectAllListItem;
class NaviFrameController;
class ThreadListItem;
, private IFloatingButtonListener
, private IThreadListListener
, private IThreadSearchListListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
MsgThread(NaviFrameController &parent);
virtual ~MsgThread();
virtual void onLanguageChanged();
private:
- enum Mode
- {
+ enum Mode {
InitMode,
DeleteMode,
NormalMode,
#include "MsgTypes.h"
#include <set>
-namespace Msg
-{
+namespace Msg {
class IThreadListListener;
class SelectAllListItem;
class ThreadListItem;
, private IMsgStorageListener
, private IListViewListener
, private IContactManagerListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
ThreadList(Evas_Object *parent, App &app);
virtual ~ThreadList();
bool m_DeleteMode;
};
- class IThreadListListener
- {
+ class IThreadListListener {
public:
virtual ~IThreadListListener() {}
virtual void onListItemSelected(ThreadId id) {};
#include "ContactManager.h"
#include "App.h"
-namespace Msg
-{
+namespace Msg {
class ThreadListItem
- : public BaseThreadListItem
- {
+ : public BaseThreadListItem {
public:
ThreadListItem(const MsgThreadItem &threadItem, App &app);
virtual ~ThreadListItem();
#include <Ecore.h>
-namespace Msg
-{
+namespace Msg {
class IThreadSearchListListener;
class ThreadSearchList
, private IListViewListener
, private IContactManagerListener
, private ISystemSettingsManager
- , private IMsgStorageListener
- {
+ , private IMsgStorageListener {
public:
ThreadSearchList(Evas_Object *parent, App &app);
virtual ~ThreadSearchList();
IThreadSearchListListener *m_pListener;
};
- class IThreadSearchListListener
- {
+ class IThreadSearchListListener {
public:
virtual ~IThreadSearchListListener() {}
virtual void onSearchListChanged() {};
#include "MsgThreadItem.h"
#include "MsgTypes.h"
-namespace Msg
-{
+namespace Msg {
class ThreadSearchListItem
- : public BaseThreadListItem
- {
+ : public BaseThreadListItem {
public:
ThreadSearchListItem(App &app, const MsgThreadItem &item, const std::string &searchWord);
virtual ~ThreadSearchListItem();
void BaseThreadListItem::updateThumbnailAndName(const MsgAddressList &addressList, bool decorateName)
{
int countContact = addressList.getLength();
- if (countContact <= 0)
- {
+ if (countContact <= 0) {
MSG_LOG_WARN("Msg address list is empty");
return;
}
const MsgAddress &addr = addressList[0];
- if (countContact > 1)
- {
+ if (countContact > 1) {
m_ThumbId = m_App.getThumbnailMaker().getThumbId(ThumbnailMaker::GroupThumb);
updateName(addr, countContact, decorateName);
} else if (countContact == 1) {
void MsgThread::prepareSearchPanel()
{
- if (!m_pSearchPanel)
- {
+ if (!m_pSearchPanel) {
m_pSearchPanel = new MsgThreadSearchPanel(*m_pLayout);
m_pSearchPanel->setListener(this);
getNaviBar().setSearch(*m_pSearchPanel);
void MsgThread::prepareSearchList()
{
- if (!m_pSearchList)
- {
+ if (!m_pSearchList) {
m_pSearchList = new ThreadSearchList(*m_pLayout, getApp());
m_pSearchList->setListener(this);
m_pSearchList->show();
void MsgThread::prepareNoContentLayout()
{
- if (!m_pNoContent)
- {
+ if (!m_pNoContent) {
m_pNoContent = new NoContentLayout(*m_pLayout);
m_pNoContent->show();
m_pLayout->setNoContent(*m_pNoContent);
void MsgThread::prepareThreadList()
{
- if (!m_pThreadList)
- {
+ if (!m_pThreadList) {
m_pThreadList = new ThreadList(*m_pLayout, getApp());
m_pThreadList->setListener(this);
m_pThreadList->show();
void MsgThread::showMainPopup()
{
PopupList &popup = getApp().getPopupManager().getMorePopup();
- if (!m_pThreadList->isEmpty())
- {
+ if (!m_pThreadList->isEmpty()) {
popup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgThread, onDeleteItemPressed), this);
popup.appendItem(msg("IDS_MSG_OPT_SEARCH"), POPUPLIST_ITEM_PRESSED_CB(MsgThread, onSearchItemPressed), this);
}
getNaviBar().setColor(colorId);
setNormalMode();
- switch (mode)
- {
+ switch (mode) {
case NormalMode:
break;
-
case SearchMode:
setSearchMode(true);
break;
-
case DeleteMode:
setDeleteMode(true);
break;
-
case InitMode:
default:
MSG_ASSERT(false, "Not supported mode");
MSG_LOG("");
getNaviBar().clear();
// Reset previus mode:
- switch (m_Mode)
- {
+ switch (m_Mode) {
case DeleteMode:
setDeleteMode(false);
break;
-
case SearchMode:
setSearchMode(false);
break;
-
default:
break;
}
NaviBar &naviBar = getNaviBar();
naviBar.showButton(NaviOkButtonId, value);
- if (value)
- {
+ if (value) {
m_pLayout->showFloatingButton(false);
updateSelectItemsTitle();
naviBar.setButtonText(NaviOkButtonId, msgt("IDS_MSG_ACBUTTON_DELETE_ABB"));
MSG_LOG("");
getNaviBar().showButton(NaviPrevButtonId, value);
- if (value)
- {
+ if (value) {
m_pLayout->showFloatingButton(false);
prepareSearchList();
prepareSearchPanel();
void MsgThread::update()
{
bool searchEnabled = m_Mode == SearchMode;
- if (searchEnabled)
- {
+ if (searchEnabled) {
bool showSearch = !m_pSearchList->isEmpty();
bool showThread = !showSearch && !m_pThreadList->isEmpty() && m_pSearchList->getSearchWord().empty();
bool showNoContent = !showThread && !showSearch;
void MsgThread::updateSelectItemsTitle()
{
- if (m_Mode == DeleteMode)
- {
+ if (m_Mode == DeleteMode) {
int checked = m_pThreadList->getThreadsCheckedCount();
if (checked > 0)
getNaviBar().setTitle(msgArgs("IDS_MSG_HEADER_PD_SELECTED_ABB3", checked));
void ThreadList::deleteSelectedItems()
{
auto items = getItems<ThreadListItem>();
- for (ThreadListItem *it : items)
- {
+ for (ThreadListItem *it : items) {
if (it->getCheckedState())
m_App.getMsgEngine().getStorage().deleteThread(it->getThreadId());
}
{
auto items = getItems<ThreadListItem>();
int count = 0;
- for (ThreadListItem *item : items)
- {
+ for (ThreadListItem *item : items) {
if (item->isCheckable() && item->getCheckedState())
++count;
}
{
SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(getFirstItem());
- if (show)
- {
- if (!item)
- {
+ if (show) {
+ if (!item) {
item = new SelectAllListItem;
prependItem(*item);
}
{
// Simple impl. but not fast:
auto items = getItems<ThreadListItem>();
- for (ThreadListItem *item : items)
- {
+ for (ThreadListItem *item : items) {
if (item->isCheckable() && !item->getCheckedState())
return false;
}
void ThreadList::insertItem(ThreadId id)
{
MsgThreadItemRef threadItem = m_App.getMsgEngine().getStorage().getThread(id);
- if (threadItem)
- {
+ if (threadItem) {
auto newItem = new ThreadListItem(*threadItem, m_App);
ListView::sortedInsertItem(*newItem);
navigateTo(*newItem);
ThreadListItem *ThreadList::getItem(ThreadId id) const
{
auto items = ListView::getItems<ThreadListItem>();
- for (ThreadListItem *item : items)
- {
+ for (ThreadListItem *item : items) {
if (item->getThreadId() == id)
return item;
}
int length = msgThreadList->getLength();
- for (int i = 0; i < length; ++i)
- {
+ for (int i = 0; i < length; ++i) {
const MsgThreadItem &msgThreadItem = msgThreadList->at(i);
ListView::appendItem(*new ThreadListItem(msgThreadItem, m_App));
}
std::set<ThreadId> threadIdSet;
int length = msgThreadList->getLength();
- for (int i = 0; i < length; ++i)
- {
+ for (int i = 0; i < length; ++i) {
const MsgThreadItem &msgThreadItem = msgThreadList->at(i);
threadIdSet.insert(msgThreadItem.getId());
}
auto items = ListView::getItems<ThreadListItem>();
- for (ThreadListItem *item : items)
- {
+ for (ThreadListItem *item : items) {
if (threadIdSet.count(item->getThreadId()) == 0)
ListView::deleteItem(*item);
}
auto threadIdSet = getThreadIdSet(idList);
auto threadItems = getItems<ThreadListItem>();
- for (ThreadListItem *item: threadItems)
- {
+ for (ThreadListItem *item: threadItems) {
if (threadIdSet.count(item->getThreadId()))
updateItem(*item);
}
void ThreadList::updateItems()
{
auto items = getItems<ThreadListItem>();
- for (ThreadListItem *item: items)
- {
+ for (ThreadListItem *item: items) {
updateItem(*item);
}
}
void ThreadList::updateItem(ThreadListItem &item)
{
MsgThreadItemRef msgThread = m_App.getMsgEngine().getStorage().getThread(item.getThreadId());
- if (!msgThread)
- {
+ if (!msgThread) {
MSG_LOG_ERROR("msgThread is null");
return;
}
time_t threadTime = msgThread->getTime();
if ((next && threadTime < next->getRawTime()) ||
- (prev && threadTime > prev->getRawTime()))
- {
+ (prev && threadTime > prev->getRawTime())) {
auto newItem = new ThreadListItem(*msgThread, m_App);
newItem->setCheckedState(item.getCheckedState(), false);
item.destroy();
std::set<ThreadId> ThreadList::getThreadIdSet(const MsgIdList &idList)
{
std::set<ThreadId> res;
- for (MsgId msgId : idList)
- {
+ for (MsgId msgId : idList) {
ThreadId threadId = m_App.getMsgEngine().getStorage().getThreadId(msgId);
if (threadId.isValid())
res.insert(threadId);
{
MSG_LOG("");
auto* thread = getItem(threadId);
- if (thread)
- {
+ if (thread) {
ListView::deleteItem(*thread);
updateSelectAllItem();
}
{
MSG_LOG("");
auto items = ListView::getItems<ThreadListItem>();
- for (ThreadListItem *item : items)
- {
+ for (ThreadListItem *item : items) {
item->updateTime();
}
State state = NormalState;
MsgConversationListRef convList = m_App.getMsgEngine().getStorage().getConversationList(m_ThreadId);
- if (convList && convList->getLength() > 0)
- {
+ if (convList && convList->getLength() > 0) {
MsgConversationItem &item = convList->at(convList->getLength() - 1);
Message::NetworkStatus status = item.getNetworkStatus();
- if (status == Message::NS_Sending)
- {
+ if (status == Message::NS_Sending) {
state = StatusState;
m_Status = decorateSendingText(msg("IDS_MSG_BODY_SENDING_ING_M_STATUS_ABB"));
} else if (status == Message::NS_Send_Fail) {
void ThreadSearchList::requestSearch(const std::string &searchWord)
{
m_SearchWord = searchWord;
- if (!m_pIdler)
- {
+ if (!m_pIdler) {
m_pIdler = ecore_idler_add
(
[](void *data)->Eina_Bool
void ThreadSearchList::cancelSearch()
{
- if (m_pIdler)
- {
+ if (m_pIdler) {
ecore_idler_del(m_pIdler);
m_pIdler = nullptr;
}
MSG_LOG("Search word: ", m_SearchWord);
ListView::clear();
- if (!m_SearchWord.empty())
- {
+ if (!m_SearchWord.empty()) {
MsgStorage &msgSotrage = m_App.getMsgEngine().getStorage();
// Thread:
MsgThreadListRef threadList = msgSotrage.searchThread(m_SearchWord);
- if (threadList)
- {
+ if (threadList) {
int length = threadList->getLength();
- for (int i = 0; i < length; ++i)
- {
+ for (int i = 0; i < length; ++i) {
const MsgThreadItem &threadItem = threadList->at(i);
ListView::appendItem(*new ThreadSearchListItem(m_App, threadItem, m_SearchWord));
}
// Message:
MessageListRef msgList = msgSotrage.searchMessage(m_SearchWord);
- if (msgList)
- {
+ if (msgList) {
int length = msgList->getLength();
- for (int i = 0; i < length; ++i)
- {
+ for (int i = 0; i < length; ++i) {
const Message &msg = msgList->at(i);
ListView::appendItem(*new MsgSearchListItem(m_App, msg, m_SearchWord));
}
void ThreadSearchList::updateTime()
{
auto items = ListView::getItems<BaseThreadListItem>();
- for (BaseThreadListItem *item : items)
- {
+ for (BaseThreadListItem *item : items) {
item->updateTime();
}
void ThreadSearchList::onListItemSelected(ListItem &listItem)
{
- if (m_pListener)
- {
+ if (m_pListener) {
if (auto it = dynamic_cast<MsgSearchListItem*>(&listItem))
m_pListener->onSearchListItemSelected(it->getMsgId(), m_SearchWord);
else if (auto it = dynamic_cast<ThreadSearchListItem*>(&listItem))
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class IFloatingButtonListener;
class FloatingButton
- : public View
- {
+ : public View {
public:
FloatingButton(Evas_Object *parent);
IFloatingButtonListener* m_pListener;
};
- class IFloatingButtonListener
- {
+ class IFloatingButtonListener {
public:
virtual ~IFloatingButtonListener() {};
virtual void onFloatingButtonPressed() = 0;
#include "View.h"
#include "DefaultLayout.h"
-namespace Msg
-{
+namespace Msg {
class MsgThreadLayout
- : public DefaultLayout
- {
+ : public DefaultLayout {
public:
MsgThreadLayout(Evas_Object *parent);
virtual ~MsgThreadLayout();
#include "View.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class IMsgThreadSearchPanelListener;
class MsgThreadSearchPanel
- : public View
- {
+ : public View {
public:
MsgThreadSearchPanel(Evas_Object *parent);
virtual ~MsgThreadSearchPanel();
Ecore_Job *m_pEntryJob;
};
- class IMsgThreadSearchPanelListener
- {
+ class IMsgThreadSearchPanelListener {
public:
virtual ~IMsgThreadSearchPanelListener() {};
#include "ListItem.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
class ThreadListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
- enum State
- {
+ enum State {
NormalState,
StatusState,
IconState
void FloatingButton::pressed(Evas_Object *obj, void *event_info)
{
if (m_pListener)
- {
m_pListener->onFloatingButtonPressed();
- }
}
MsgThreadSearchPanel::~MsgThreadSearchPanel()
{
- if (m_pEntryJob)
- {
+ if (m_pEntryJob) {
ecore_job_del(m_pEntryJob);
m_pEntryJob = nullptr;
}
std::string res;
const char *plainText = elm_entry_entry_get(m_pEntry);
- if (plainText)
- {
+ if (plainText) {
char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(m_pEntry));
- if (text)
- {
+ if (text) {
res.assign(text);
free(text);
}
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef threadItemStyle = ListItemStyle::create("msg_thread");
const char *messagePart = "elm.text";
std::string ThreadListViewItem::getText(ListItem &item, const char *part)
{
- if (!strcmp(part, messagePart))
- {
+ if (!strcmp(part, messagePart)) {
return getMessage();
} else if (!strcmp(part, namePart)) {
return getName();
{
Evas_Object *content = nullptr;
- if (!strcmp(part, thumbnailPart))
- {
+ if (!strcmp(part, thumbnailPart)) {
content = getThumbnail();
} else if (!strcmp(part, iconPart)) {
- if (m_State == IconState)
- {
+ if (m_State == IconState) {
content = getIcon();
}
}
void ThreadListViewItem::setState(State state, bool updateUi)
{
m_State = state;
- if (updateUi)
- {
+ if (updateUi) {
updateFields(iconPart, ELM_GENLIST_ITEM_FIELD_CONTENT);
updateFields(statusPart, ELM_GENLIST_ITEM_FIELD_TEXT);
}
void ThreadListViewItem::resetCheckMode(ListView &listView)
{
for (ListItem *item: listView.getRealizedItems())
- {
item->emitSignal("elm,state,reset_check", "elm");
- }
}
#include "SystemSettingsManager.h"
#include "PopupList.h"
-namespace Msg
-{
+namespace Msg {
class NaviFrameController;
class MsgSettings;
, private IHwButtonListener
, private IListViewListener
, private IMsgStorageListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
MsgOnSimCard(NaviFrameController &parent);
virtual ~MsgOnSimCard();
virtual void onLanguageChanged();
private:
- enum SimMode
- {
+ enum SimMode {
NormalMode,
CopyToDeviceMode,
DeleteMode
#include "SystemSettingsManager.h"
#include "SettingsSound.h"
-namespace Msg
-{
+namespace Msg {
class NaviFrameController;
class MsgSettings;
class IMsgSettingsListener;
, private IListViewListener
, private ISettingsListViewItemListener
, private IMsgSettingsListener
- , private ISystemSettingsManager
- {
+ , private ISystemSettingsManager {
public:
/**
* @brief A constructor of Settings object based on outside parent object.
#include "SettingsListViewItem.h"
-namespace Msg
-{
+namespace Msg {
class Settings;
/**
* @brief Visual representation of particular element of message-settings list.
*/
class SettingsListItem
- : public SettingsListViewItem
- {
+ : public SettingsListViewItem {
public:
typedef void (Settings::*MethodHandler)(SettingsListItem &item); /**< A delegate fired when user taps on particular settings list element. */
#include "AppControlLauncher.h"
-namespace Msg
-{
+namespace Msg {
class MsgSettings;
/**
* @brief This class is aimed to launch preinstalled utility from settings-app that allows to chose message-alert sound.
*/
class SettingsSound
- : public AppControlHandle
- {
+ : public AppControlHandle {
public:
/**
* @brief Constructs an instance of SettingsSound based on message-service settings wrapper passed from outside.
#include <string>
#include "MessageSMS.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Visual representation of an element in "Messages on SIM" list.
*/
class SimListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
/**
* @brief Creates element of "Messages on SIM" list based on message-service structure and genlist item type passed from outside.
{
MessageSMSListRef list = getMsgEngine().getStorage().getSimMsgList();
int length = list->getLength();
- for (int i = 0; i < length; ++i)
- {
+ for (int i = 0; i < length; ++i) {
SimListViewItem *item = new SimListViewItem(list->at(i));
m_pList->appendItem(*item);
}
void MsgOnSimCard::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
- if (buttonId == NaviOkButtonId)
- {
- if (m_SimMode == DeleteMode)
- {
+ if (buttonId == NaviOkButtonId) {
+ if (m_SimMode == DeleteMode) {
deleteSelectedItems();
} else if (m_SimMode == CopyToDeviceMode) {
copySelectedItems();
void MsgOnSimCard::onListItemChecked(ListItem &listItem)
{
- if (dynamic_cast<SelectAllListItem*>(&listItem))
- {
+ if (dynamic_cast<SelectAllListItem*>(&listItem)) {
bool checked = listItem.getCheckedState();
m_pList->checkAllItems(checked);
}
void MsgOnSimCard::showCopyDeletePopup()
{
- if (!m_pList->isEmpty())
- {
+ if (!m_pList->isEmpty()) {
PopupList &listPopup = getApp().getPopupManager().getMorePopup();
listPopup.appendItem(msg("IDS_MSG_OPT_COPY_TO_DEVICE_ABB"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onCopyToDeviceItemPressed), this);
listPopup.appendItem(msg("IDS_MSG_OPT_DELETE"), POPUPLIST_ITEM_PRESSED_CB(MsgOnSimCard, onDeleteItemPressed), this);
void MsgOnSimCard::onMsgStorageDelete(const MsgIdList &msgIdList)
{
auto simListItems = m_pList->getItems<SimListViewItem>();
- for (auto &itemId: msgIdList)
- {
- for (auto *simItem : simListItems)
- {
- if (simItem->getMsgId() == itemId)
- {
+ for (auto &itemId: msgIdList) {
+ for (auto *simItem : simListItems) {
+ if (simItem->getMsgId() == itemId) {
simItem->destroy();
break;
}
if (m_SimMode == mode)
return;
- switch (mode)
- {
+ switch (mode) {
case CopyToDeviceMode:
setCopyToDeviceMode(true);
break;
-
case DeleteMode:
setDeleteMode(true);
break;
-
case NormalMode:
setNormalMode();
break;
-
default:
MSG_ASSERT(false, "Not supported mode");
break;
void MsgOnSimCard::setNormalMode()
{
// Reset previus mode:
- switch (m_SimMode)
- {
+ switch (m_SimMode) {
case CopyToDeviceMode:
setCopyToDeviceMode(false);
break;
-
case DeleteMode:
setDeleteMode(false);
break;
-
default:
break;
}
getNaviBar().clear();
getNaviBar().showButton(NaviOkButtonId, value);
- if (value)
- {
+ if (value) {
if (m_SimMode == DeleteMode)
getNaviBar().setButtonText(NaviOkButtonId, msgt("IDS_MSG_ACBUTTON_DELETE_ABB"));
else
auto items = m_pList->getItems<SimListViewItem>();
MsgIdList messages;
- for (auto *item : items)
+ for (auto *item : items) {
if (item->getCheckedState())
messages.push_back(item->getMsgId());
+ }
getApp().getMsgEngine().getStorage().deleteMessages(messages);
}
void MsgOnSimCard::copySelectedItems()
{
auto items = m_pList->getItems<SimListViewItem>();
- for (auto *item : items)
- {
- if (item->getCheckedState())
- {
+ for (auto *item : items) {
+ if (item->getCheckedState()) {
MessageRef msg = getApp().getMsgEngine().getStorage().getMessage(item->getMsgId());
- if (msg)
- {
+ if (msg) {
msg->setMessageStorageType(Message::MS_Phone);
getApp().getMsgEngine().getStorage().saveMessage(*msg, false);
}
{
SelectAllListItem *item = dynamic_cast<SelectAllListItem*>(m_pList->getFirstItem());
- if (show)
- {
- if (!item)
- {
+ if (show) {
+ if (!item) {
item = new SelectAllListItem;
m_pList->prependItem(*item);
}
check = 0;
total = 0;
auto items = m_pList->getItems<SimListViewItem>();
- for (ListItem *item: items)
- {
+ for (ListItem *item: items) {
if (item->getCheckedState())
++check;
++total;
MSG_LOG("");
getMsgSettings().setMmsAutoRetr(item.getCheckButtonState());
bool mmsAutoRetr = getMsgSettings().getMmsAutoRetr();
- if (mmsAutoRetr)
- {
+ if (mmsAutoRetr) {
// Restore:
if (isExistingMmsAutoRetrRoamingBackup())
getMsgSettings().setMmsAutoRetrRoaming(getMmsAutoRetrRoamingBackup());
MSG_LOG("Item: ", &listItem);
listItem.setSelected(false);
SettingsListItem *settingItem = dynamic_cast<SettingsListItem*>(&listItem);
- if (settingItem)
- {
+ if (settingItem) {
settingItem->changeCheckButtonState();
callItemHandler(*settingItem);
}
using namespace Msg;
-namespace
-{
+namespace {
const char *sRingtoneValuePath = "/opt/share/settings/Alerts";
const char *sRingtoneKeySilent = "silent";
const char *sRingtoneKeyDefault = "default";
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef SimItemStyle = ListItemStyle::create("multiline");
const char *messagePart = "elm.text.multiline";
const MsgAddressList &addressList = msg.getAddressList();
int length = addressList.getLength();
for (int i = 0; i < length; ++i)
- {
m_Name += addressList.at(i).getAddress();
- }
m_MessageText = msg.getText();
m_Time = TimeUtils::makeDateTimeString(msg.getTime());
#include "ListItem.h"
#include <string>
-namespace Msg
-{
+namespace Msg {
/**
* @brief Visual representation of grouping settings list items(a genlist item with "group_index" style).
*/
class SettingsGroupListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
/**
* @brief Constructs genlist-item with "group_index style" and title based on text passed from outside.
#include "ListItem.h"
-namespace Msg
-{
+namespace Msg {
class ISettingsListViewItemListener;
/**
* @brief Generic visual representation of messages-settings list element.
*/
class SettingsListViewItem
- : public ListItem
- {
+ : public ListItem {
public:
static ListItemStyleRef multiLineStyle; /**< style for "multiline" genlist-item. */
static ListItemStyleRef multiLineIconStyle; /**< style for "multiline + icon" genlist-item. */
/**
* @brief Listener to send list-item events to subscribers.
*/
- class ISettingsListViewItemListener
- {
+ class ISettingsListViewItemListener {
public:
virtual ~ISettingsListViewItemListener(){}
#include "View.h"
#include "DefaultLayout.h"
-namespace Msg
-{
+namespace Msg {
/**
* @brief Represents a layout of "Messages on SIM" view.
*/
class SimMsgLayout
- : public DefaultLayout
- {
+ : public DefaultLayout {
public:
/**
* @brief Constructs an instance of SimMsgLayout based on parent passed from outside.
using namespace Msg;
-namespace
-{
+namespace {
ListItemStyleRef itemStyle = ListItemStyle::create("group_index");
}
void SettingsListViewItem::setCheckButtonState(bool state)
{
- if (m_CheckButtonState != state)
- {
+ if (m_CheckButtonState != state) {
m_CheckButtonState = state;
update();
}
std::string SettingsListViewItem::getText(ListItem &item, const char *part)
{
- if (getStyle().get() == oneLineIconStyle.get())
- {
+ if (getStyle().get() == oneLineIconStyle.get()) {
if (strcmp(part, "elm.text") == 0)
return msg(m_MainText);
} else if (getStyle().get() == multiLineStyle.get() || getStyle().get() == multiLineIconStyle.get()) {
Evas_Object *SettingsListViewItem::getContent(ListItem &item, const char *part)
{
- if (getStyle().get() == oneLineIconStyle.get() || getStyle().get() == multiLineIconStyle.get())
- {
+ if (getStyle().get() == oneLineIconStyle.get() || getStyle().get() == multiLineIconStyle.get()) {
if (strcmp(part, "elm.swallow.end") == 0)
return createCheckButton(*getOwner());
} else if (getStyle().get() == multiLineStyle.get()) {
Evas_Object *SettingsListViewItem::createCheckButton(Evas_Object *parent)
{
Evas_Object *check = nullptr;
- if (m_ShowCheckButton)
- {
+ if (m_ShowCheckButton) {
check = elm_check_add(parent);
elm_object_focus_allow_set(check, false);
elm_object_style_set(check, "on&off");
#include <list>
-namespace Msg
-{
+namespace Msg {
class SmilImageItemView;
class FileViewer;
class SmilPage
: public SmilPageLayout
, private ISmilSaveAllItemViewListener
- , private ISmilAttachmentItemViewListener
- {
+ , private ISmilAttachmentItemViewListener {
public:
SmilPage(Evas_Object *parent, FileViewer &fileViewer, const MsgPage &page);
SmilPage(Evas_Object *parent, FileViewer &fileViewer, const MsgAttachmentList &list);
#include <vector>
#include <memory>
-namespace Msg
-{
+namespace Msg {
class ISmilPlayerListener;
class SmilPlayer
: public SmilPlayerView
- , private IMediaPlayerListener
- {
+ , private IMediaPlayerListener {
public:
typedef std::vector<SmilPage*> PageList;
- enum State
- {
+ enum State {
StopState, // Stop = Pause
PlayState,
};
FileViewer m_FileViewer;
};
- class ISmilPlayerListener
- {
+ class ISmilPlayerListener {
public:
virtual ~ISmilPlayerListener() {}
virtual void onSmilPlayerPageChanged() {};
#include "MsgStorage.h"
#include "ContactViewer.h"
-namespace Msg
-{
+namespace Msg {
class NaviFrameController;
class Viewer
, private IConversationListener
, private ISmilPlayerListener
, private ISystemSettingsManager
- , private IMsgStorageListener
- {
+ , private IMsgStorageListener {
public:
Viewer(NaviFrameController &parent, MsgId id);
virtual ~Viewer();
const MsgMedia *SmilPage::getMedia(const MsgPage &page, MsgMedia::Type type) const
{
const MsgMediaList &list = page.getMediaList();
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
if (list[i].getType() == type)
return &list[i];
}
bool SmilPage::isEmpty(const MsgPage &page)
{
const MsgMediaList &list = page.getMediaList();
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
const MsgMedia &media = list[i];
std::string filePath = media.getFilePath();
if (media.getType() != MsgMedia::UnknownType && FileUtils::getFileSize(filePath) > 0)
m_Duration = page.getPageDuration() / 1000.0 + 0.5;
const MsgMediaList &list = page.getMediaList();
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
m_Attachments.push_back(list[i].getFilePath());
}
const MsgMedia *video = getMedia(page, MsgMedia::VideoType);
- if (video)
+ if (video) {
buildVideo(*video);
- else
- {
+ } else {
const MsgMedia *image = getMedia(page, MsgMedia::ImageType);
if (image)
buildImage(*image);
if (text)
buildText(*text);
- if (!video)
- {
+ if (!video) {
const MsgMedia *audio = getMedia(page, MsgMedia::AudioType);
if (audio)
buildAudio(*audio);
{
m_Duration = defaultPageDuration;
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
m_Attachments.push_back(list[i].getFilePath());
}
buildAttachmentInfo(list.getLength());
buildSaveAllItem(list.getLength());
- for (int i = 0; i < list.getLength(); ++i)
- {
+ for (int i = 0; i < list.getLength(); ++i) {
buildAttachment(list[i]);
}
}
void SmilPage::buildText(const MsgMedia& media)
{
std::string text = FileUtils::readTextFile(media.getFilePath());
- if (!text.empty())
- {
+ if (!text.empty()) {
SmilTextItemView *item = new SmilTextItemView(getBox(), text);
item->show();
appendItem(*item);
m_HasAudio = true;
int duration = MediaUtils::getDurationSec(m_MediaPath);
- if (duration == 0)
- {
+ if (duration == 0) {
m_HasInvalidFiles = true;
return;
}
m_MediaPath = media.getFilePath();
int duration = MediaUtils::getDurationSec(m_MediaPath);
- if (duration == 0)
- {
+ if (duration == 0) {
m_HasInvalidFiles = true;
return;
}
int height = 0;
MediaUtils::getFrameSize(m_MediaPath, width, height);
- if (width * height == 0)
- {
+ if (width * height == 0) {
MSG_LOG_ERROR("Wrong video dimension");
m_HasInvalidFiles = true;
return;
{
// Pages:
const MsgPageList &pages = mms.getPageList();
- for (int i = 0; i < pages.getLength(); ++i)
- {
+ for (int i = 0; i < pages.getLength(); ++i) {
const MsgPage &page = pages[i];
- if (!SmilPage::isEmpty(page))
- {
+ if (!SmilPage::isEmpty(page)) {
SmilPage *smilPage = new SmilPage(getEo(), m_FileViewer, page);
m_Duration += smilPage->getDuration();
m_PageList.push_back(smilPage);
}
// Attachment:
- if (!mms.getAttachmentList().isEmpty())
- {
+ if (!mms.getAttachmentList().isEmpty()) {
SmilPage *smilPage = new SmilPage(getEo(), m_FileViewer, mms.getAttachmentList());
m_Duration += smilPage->getDuration();
m_PageList.push_back(smilPage);
void SmilPlayer::startTimer(int sec)
{
- if (m_pTimer)
- {
+ if (m_pTimer) {
ecore_timer_del(m_pTimer);
m_pTimer = nullptr;
}
void SmilPlayer::setState(State state)
{
- if (m_State != state)
- {
+ if (m_State != state) {
m_State = state;
if (m_pListener)
m_pListener->onSmilPlayerStateChanged();
void SmilPlayer::start()
{
- if (m_pTimer)
- {
- if (canPlay(getCurrentPage()))
- {
+ if (m_pTimer) {
+ if (canPlay(getCurrentPage())) {
MSG_LOG("Continue");
setState(PlayState);
continueTimer();
startTimer(page->getDuration());
playAnimation(true);
- if (page->hasMedia())
- {
+ if (page->hasMedia()) {
prepareMedia();
- if (!canPlay(page))
- {
+ if (!canPlay(page)) {
stop();
showUnableToPlayNotif(*page);
return false;
void SmilPlayer::prepareMedia()
{
- if (m_MediaPlayer)
- {
+ if (m_MediaPlayer) {
m_MediaPlayer->stop();
m_MediaPlayer->setPosition(0);
}
SmilPage *page = getCurrentPage();
- if (page->hasMedia())
- {
- if (!m_MediaPlayer)
- {
+ if (page->hasMedia()) {
+ if (!m_MediaPlayer) {
m_MediaPlayer.reset(new MediaPlayer);
m_MediaPlayer->setListener(this);
}
if (!page)
return false;
- if (page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus())
- {
+ if (page->hasMedia() && m_MediaPlayer && !m_MediaPlayer->getFocus()) {
showUnableToPlayNotif(*page);
return false;
}
{
unsigned pos = 0;
for (unsigned i = 0; i < m_CurrentPageIndex; ++i)
- {
pos += m_PageList[i]->getDuration();
- }
pos += m_PageTickCounter;
bool SmilPlayer::nextPage()
{
- if (probeNextPage())
- {
+ if (probeNextPage()) {
stopMedia();
++m_CurrentPageIndex;
playPage();
bool SmilPlayer::prevPage()
{
- if (probePrevPage())
- {
+ if (probePrevPage()) {
stopMedia();
--m_CurrentPageIndex;
playPage();
stop();
for (SmilPage *page : m_PageList)
- {
page->destroy();
- }
- if (m_pTimer)
- {
+ if (m_pTimer) {
ecore_timer_del(m_pTimer);
m_pTimer = nullptr;
}
void SmilPlayer::onMediaPlayerSoundFocusChanged()
{
- if (m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus())
- {
+ if (m_MediaPlayer->isPlaying() && !m_MediaPlayer->getFocus()) {
SmilPage *page = getCurrentPage();
- if (page)
- {
- if (page->hasMedia())
- {
+ if (page) {
+ if (page->hasMedia()) {
showUnableToPlayNotif(*page);
stop();
}
using namespace Msg;
-namespace
-{
+namespace {
std::string makeTimeStr(int timeSec)
{
const int digitCount = 2;
void Viewer::create(MsgId id)
{
m_Msg = std::dynamic_pointer_cast<MessageMms>(getMsgEngine().getStorage().getMessage(id));
- if (!m_Msg)
- {
+ if (!m_Msg) {
MSG_LOG_ERROR("Can't get message by id");
// Create empty message:
m_Msg = getMsgEngine().getComposer().createMms();
void Viewer::createLayout()
{
- if (!m_pLayout)
- {
+ if (!m_pLayout) {
m_pLayout = new ViewerLayout(getParent());
m_pLayout->setListener(this);
m_pLayout->show();
void Viewer::createSubjectLayout()
{
- if (!m_pSubjectLayout)
- {
+ if (!m_pSubjectLayout) {
int numberOfPages = m_pSmilPlayer ? m_pSmilPlayer->getPages().size() : 0;
m_pSubjectLayout = new SubjectLayout(*m_pLayout);
m_pSubjectLayout->setNumberOfPages(numberOfPages);
void Viewer::createPlayerControl()
{
- if (!m_pPlayerControl)
- {
+ if (!m_pPlayerControl) {
m_pPlayerControl = new PlayerControl(*m_pLayout);
m_pPlayerControl->setListener(this);
void Viewer::createRecipPanel()
{
- if (!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1)
- {
+ if (!m_pRecipPanel && m_Msg->getAddressList().getLength() > 1) {
m_pRecipPanel = new MbeRecipients(*m_pLayout, getApp());
m_pRecipPanel->addSmartCb("item,clicked", SMART_CALLBACK(Viewer, onRecipItemClicked), this);
m_pRecipPanel->show();
void Viewer::createSmilPlayer()
{
- if (!m_pSmilPlayer)
- {
+ if (!m_pSmilPlayer) {
m_pSmilPlayer = new SmilPlayer(*m_pLayout, *m_Msg);
m_pSmilPlayer->setListener(this);
m_pSmilPlayer->show();
void Viewer::naviExpandButtonHandler()
{
MSG_LOG("");
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
bool isRecipInvisible = !m_pLayout->isRecipientsVisible();
m_pLayout->showRecipients(isRecipInvisible);
getNaviBar().setDownButtonState(isRecipInvisible);
void Viewer::naviCenterButtonHandler()
{
MSG_LOG("");
- if (m_pRecipPanel)
- {
+ if (m_pRecipPanel) {
naviExpandButtonHandler();
} else {
const MsgAddressList &addressList = m_Msg->getAddressList();
void Viewer::updateSubject()
{
- if (m_pSubjectLayout)
- {
+ if (m_pSubjectLayout) {
std::string subject = m_Msg->getSubject();
if (subject.empty())
subject = msg("IDS_MSGF_BODY_NO_SUBJECT");
void Viewer::onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId)
{
MSG_LOG("");
- switch (buttonId)
- {
+ switch (buttonId) {
case NaviCenterButtonId:
naviCenterButtonHandler();
break;
-
case NaviPrevButtonId:
naviPrevButtonHandler();
break;
-
case NaviExpandButtonId:
naviExpandButtonHandler();
break;
-
default:
break;
};
{
MSG_LOG("");
item.getParent().destroy();
- VoiceCall::launch(m_SelectedAddress);
+ VoiceCall::launch(m_SelectedAddress);
}
void Viewer::onCreateContactItemPressed(PopupListItem &item)
void Viewer::onMsgStorageDelete(const MsgIdList &msgIdList)
{
MSG_LOG("");
- if (m_Msg)
- {
+ if (m_Msg) {
MsgId id = m_Msg->getId();
if (std::find(msgIdList.begin(), msgIdList.end(), id) != msgIdList.end())
pop();
#include <string>
#include <Evas.h>
-namespace Msg
-{
+namespace Msg {
class IMediaPlayerListener;
- class MediaPlayer
- {
+ class MediaPlayer {
public:
MediaPlayer();
~MediaPlayer();
sound_stream_info_h m_StreamInfo;
};
- class IMediaPlayerListener
- {
+ class IMediaPlayerListener {
public:
virtual ~IMediaPlayerListener() {}
virtual void onMediaPlayerCompleted() {};
, m_StreamInfo()
{
sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, on_sound_stream_focus_state_changed_cb, this, &m_StreamInfo);
- if (m_StreamInfo)
- {
+ if (m_StreamInfo) {
player_create(&m_Player);
- if (m_Player)
- {
+ if (m_Player) {
player_set_sound_type(m_Player, SOUND_TYPE_MEDIA);
player_set_volume(m_Player, 1.0, 1.0);
player_set_looping(m_Player, false);
if (m_StreamInfo)
sound_manager_destroy_stream_information(m_StreamInfo);
- if (m_Player)
- {
+ if (m_Player) {
player_unprepare(m_Player);
player_destroy(m_Player);
}
int flags = 0;
char *extraInfo = nullptr;
- if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE)
- {
+ if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE) {
free(extraInfo);
return !isCallReason(acquiredBy);
}
int MediaPlayer::getDuration(const std::string &uri)
{
int msec = 0;
- if (!uri.empty())
- {
+ if (!uri.empty()) {
player_h player = {};
player_create(&player);
- if (player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE)
- {
+ if (player_set_uri(player, uri.c_str()) == PLAYER_ERROR_NONE) {
player_prepare(player);
player_get_duration(player, &msec);
player_unprepare(player);
{
MSG_LOG("Interrupted focus change reason = ", reason);
auto *self = static_cast<MediaPlayer*>(user_data);
- if (isCallReason(reason))
- {
+ if (isCallReason(reason)) {
ecore_main_loop_thread_safe_call_async(
[](void *data)
{
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class IPlayerControlListener;
class PlayerControl
- : public View
- {
+ : public View {
public:
- enum PlayPauseState
- {
+ enum PlayPauseState {
PlayState,
PauseState
};
Evas_Object *m_pProgress;
};
- class IPlayerControlListener
- {
+ class IPlayerControlListener {
public:
virtual ~IPlayerControlListener() {}
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class ISmilAttachmentItemViewListener;
class ISmilSaveAllItemViewListener;
// SmilAttachmentItemView:
class SmilAttachmentItemView
- : public View
- {
+ : public View {
public:
SmilAttachmentItemView(Evas_Object *parent);
virtual ~SmilAttachmentItemView();
// SmilAttachmentInfoItemView :
class SmilAttachmentInfoItemView
- : public View
- {
+ : public View {
public:
SmilAttachmentInfoItemView(Evas_Object *parent, bool manyAttachments);
virtual ~SmilAttachmentInfoItemView();
// SmilSaveAllItemView :
class SmilSaveAllItemView
- : public View
- {
+ : public View {
public:
SmilSaveAllItemView(Evas_Object *parent, int count);
virtual ~SmilSaveAllItemView();
const int m_Count;
};
- class ISmilAttachmentItemViewListener
- {
+ class ISmilAttachmentItemViewListener {
public:
virtual ~ISmilAttachmentItemViewListener() {}
virtual void onItemClicked(SmilAttachmentItemView &item) {};
virtual void onSaveButtonClicked(SmilAttachmentItemView &item) {};
};
- class ISmilSaveAllItemViewListener
- {
+ class ISmilSaveAllItemViewListener {
public:
virtual ~ISmilSaveAllItemViewListener() {}
virtual void onItemClicked(SmilSaveAllItemView &item) {};
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilAudioItemView
- : public View
- {
+ : public View {
public:
SmilAudioItemView(Evas_Object *parent, const std::string &label);
virtual ~SmilAudioItemView();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilImageItemView
- : public View
- {
+ : public View {
public:
SmilImageItemView(Evas_Object *parent, const std::string &imagePath);
virtual ~SmilImageItemView();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilPageLayout
- : public View
- {
+ : public View {
public:
SmilPageLayout(Evas_Object *parent);
virtual ~SmilPageLayout();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilPlayerView
- : public View
- {
+ : public View {
public:
SmilPlayerView(Evas_Object *parent);
virtual ~SmilPlayerView();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilTextItemView
- : public View
- {
+ : public View {
public:
SmilTextItemView(Evas_Object *parent, const std::string &text);
virtual ~SmilTextItemView();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class SmilVideoItemView
- : public View
- {
+ : public View {
public:
SmilVideoItemView(Evas_Object *parent, int videoWidth, int videoHeight, const std::string &thumbPath);
virtual ~SmilVideoItemView();
#include <string.h>
#include "MessageMms.h"
-namespace Msg
-{
+namespace Msg {
class SubjectLayout
- : public View
- {
+ : public View {
public:
SubjectLayout(Evas_Object *parent);
~SubjectLayout();
#include "View.h"
-namespace Msg
-{
+namespace Msg {
class IViewerLayoutListener;
class ViewerLayout
- : public View
- {
+ : public View {
public:
ViewerLayout(Evas_Object *parent);
virtual ~ViewerLayout();
IViewerLayoutListener *m_pListener;
};
- class IViewerLayoutListener
- {
+ class IViewerLayoutListener {
public:
virtual ~IViewerLayoutListener() {}
virtual void onLayoutTap() {};
using namespace Msg;
-namespace
-{
+namespace {
const char *groupName = "player";
const char *prevCb = "prev_clicked";
const char *playCb = "play_clicked";
using namespace Msg;
-namespace
-{
+namespace {
const float fileButtonWeight = 2.0 / 3.0;
const float saveButtonWeight = 1.0 / 3.0;
const char *layoutGroupName = "smil_attachment_item_layout";
Evas_Object *SmilImageItemView::createImage(Evas_Object *parent, const std::string &imagePath)
{
m_pImage = elm_image_add(parent);
- if (!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr))
- {
+ if (!elm_image_file_set(m_pImage, imagePath.c_str(), nullptr)) {
evas_object_del(m_pImage);
m_pImage = nullptr;
return m_pImage;
void SmilPlayerView::displayPage(Evas_Object *page)
{
Eina_List *list = elm_box_children_get(getEo());
- if (list)
- {
+ if (list) {
Eina_List *l = nullptr;
void *obj = nullptr;
- EINA_LIST_FOREACH(list, l, obj)
- {
+ EINA_LIST_FOREACH(list, l, obj) {
evas_object_hide((Evas_Object*)obj);
}
eina_list_free(list);
evas_object_show(entry);
char *markupText = elm_entry_utf8_to_markup(text.c_str());
- if (markupText)
- {
+ if (markupText) {
elm_entry_entry_set(entry, markupText);
free(markupText);
}
#include "Logger.h"
using namespace Msg;
-namespace
-{
+namespace {
const int viewerMaxWidth = 656; // Max width size according to UI
const int viewerMaxHeight = 369; // Max height size according to UI
{
bool isLandscape = contentW > contentH;
- if (isLandscape)
- {
+ if (isLandscape) {
w = viewerMaxWidth;
h = viewerMaxWidth * contentH / contentW;
- if (h > viewerMaxHeight)
- {
+ if (h > viewerMaxHeight) {
w = viewerMaxHeight * contentW / contentH;
h = viewerMaxHeight;
}
} else {
w = viewerMaxHeight * contentH / contentW;
h = viewerMaxHeight;
- if (w > viewerMaxWidth)
- {
+ if (w > viewerMaxWidth) {
w = viewerMaxWidth;
h = viewerMaxWidth * contentW / contentH;
}
using namespace Msg;
-namespace
-{
+namespace {
const char *groupName = "subject/pageindex";
const char *partSubject = "subject/text";
const char *partPageText = "page/text";
using namespace Msg;
-namespace
-{
+namespace {
const char *layoutGroup = "viewer_layout";
const char *bodyPart = "body";
const char *playerPart = "swallow.playctrl";
int error = CONTACTS_ERROR_NONE;
error = contacts_db_get_record(_contacts_contact._uri, contactId, &contact);
- if (error != CONTACTS_ERROR_NONE)
- {
+ if (error != CONTACTS_ERROR_NONE) {
MSG_LOG_ERROR("contacts_db_get_record failed");
return false;
}
error = contacts_record_get_child_record_at_p(contact, _contacts_contact.name, 0, &name);
- if (error != CONTACTS_ERROR_NONE)
- {
+ if (error != CONTACTS_ERROR_NONE) {
MSG_LOG_ERROR("contacts_record_get_child_record_at_p failed");
contacts_record_destroy(contact, true);
return false;
contacts_record_h name = NULL;
int error = CONTACTS_ERROR_NONE;
- if (getContactName(contactId, contact, name))
- {
+ if (getContactName(contactId, contact, name)) {
contacts_record_set_str(name, _contacts_name.first, newName.c_str());
error = contacts_db_update_record(contact);
- if (error != CONTACTS_ERROR_NONE)
- {
+ if (error != CONTACTS_ERROR_NONE) {
MSG_LOG_ERROR("contacts_db_update_record failed");
contacts_record_destroy(contact, true);
return;
int error = CONTACTS_ERROR_NONE;
std::string result;
- if (getContactName(contactId, contact, name))
- {
+ if (getContactName(contactId, contact, name)) {
contacts_record_get_str(name, _contacts_name.first, &str);
- if (str)
- {
+ if (str) {
result = str;
free(str);
}
{
namespace Test
{
- class ContactUtils
- {
+ class ContactUtils {
public:
static ContactUtils &getInst();
using namespace Msg;
-class TestAppControlUtils: public testing::Test
-{
+class TestAppControlUtils: public testing::Test {
protected:
virtual void SetUp()
{
AppControlUtils::getExtraDataArray(m_handle, APP_CONTROL_DATA_PATH, gotList);
int i = 0;
- for (auto num: gotList)
- {
+ for (auto num: gotList) {
std::string s(arr[i]);
ASSERT_EQ(s, num);
++i;
std::list<int> gotNums;
AppControlUtils::getExtraDataIntArray(m_handle, APP_CONTROL_DATA_SELECTED, gotNums);
int i = 0;
- for (auto num: gotNums)
- {
+ for (auto num: gotNums) {
std::string s(numsStrList[i]);
ASSERT_EQ(s, std::to_string(num));
++i;
using namespace Msg;
-class TestContactManager: public testing::Test
-{
+class TestContactManager: public testing::Test {
protected:
virtual void SetUp()
{
using namespace Msg;
-class TestMessageSender: public testing::Test
-{
+class TestMessageSender: public testing::Test {
protected:
virtual void SetUp()
{
#include <utils_i18n_ulocale.h>
class TimeUtilsTest
- : public Msg::TimeUtils
-{
+ : public Msg::TimeUtils {
public:
using TimeUtils::getDefaultLocale;
using TimeUtils::getDateBestPattern;
static int instancesNum = 0;
-struct FinishTestListener : public testing::EmptyTestEventListener
-{
+struct FinishTestListener : public testing::EmptyTestEventListener {
virtual ~FinishTestListener()
{}
virtual void OnTestProgramEnd(const testing::UnitTest& /*unit_test*/)