void WApp::onAppControl(app_control_h request, bool firstLaunch)
{
Evas_Object* win = getWindow()->getEvasObj();
- if( win )
- {
+ if( win ) {
elm_win_activate( win);
evas_object_show( win);
}
void __WAppEventHandlerImpl::__removeEventHandler()
{
- if( __handle )
- {
+ if( __handle ) {
ui_app_remove_event_handler( __handle );
__handle = NULL;
__userData = NULL;
if(__name)
free(__name);
- if( __popupMonitor )
- {
- if( auto p = __popupMonitor->lock() )
- {
+ if( __popupMonitor ) {
+ if( auto p = __popupMonitor->lock() ) {
p->destroy();
}
}
WControl::~WControl()
{
- if( __pv->__name)
- {
+ if( __pv->__name) {
WDEBUG( "name=%s", __pv->__name );
- }
- else
- {
+ } else {
WHIT();
}
//
else
WHIT();
- if( __pv->__obj )
- {
+ if( __pv->__obj ) {
WDEBUG("Already created!");
return true;
}
void WControl::destroy()
{
- if(__pv->__obj)
- {
+ if(__pv->__obj) {
evas_object_del(__pv->__obj);
// Do not leave any code here.
// After executing upper statement "evas_object_del", this object will be deleted at evas object deletion callback!
- }
- else
- {
+ } else {
onDestroy();
delete this;
}
void WControl::setName(const char* name)
{
- if( __pv->__name)
- {
+ if( __pv->__name) {
free( __pv->__name);
__pv->__name = NULL;
}
- if( name )
- {
+ if( name ) {
size_t len = strlen(name) + 1;
__pv->__name = (char*)malloc(len);
strncpy( __pv->__name, name, len);
std::weak_ptr<IWUiObject> WControl::getWeakPtr()
{
- if( __pv->__selfPtr )
- {
+ if( __pv->__selfPtr ) {
return std::weak_ptr<IWUiObject>(*__pv->__selfPtr);
}
__pv->__selfPtr = new std::shared_ptr<IWUiObject>( this,[](IWUiObject* p){} );
{
Evas_Object* parent = NULL;
Evas_Object* obj = getEvasObj();
- while( (obj = elm_object_parent_widget_get( obj )) != NULL )
- {
+ while( (obj = elm_object_parent_widget_get( obj )) != NULL ) {
WView* view = WView_getInstanceFromEvasObj( obj );
- if( view != NULL )
- {
+ if( view != NULL ) {
parent = WView_getWindowBaseLayoutEvasObj( view );
break;
}
}
- if( parent == NULL )
- {
+ if( parent == NULL ) {
WERROR("Cannot find parent View!");
// If the pop-up has been already created, the following statement will just return without creating pop-up.
popup->create( elm_object_top_widget_get( getEvasObj() ), NULL);
- }
- else
- {
+ } else {
// If the pop-up has been already created, the following statement will just return without creating pop-up.
popup->create( parent, NULL );
}
{
if( __pv->__popupMonitor == NULL ) return;
- if( auto p = __pv->__popupMonitor->lock() )
- {
+ if( auto p = __pv->__popupMonitor->lock() ) {
p->destroy();
__pv->__popupMonitor->reset();
}
bool WGenlistItem::attachToView( WControl* popup )
{
- if( __pv->__objectItem == NULL )
- {
+ if( __pv->__objectItem == NULL ) {
WERROR("object item is not created!");
return false;
}
Evas_Object* obj = elm_object_item_widget_get( __pv->__objectItem );
- while( (obj = elm_object_parent_widget_get( obj )) != NULL )
- {
+ while( (obj = elm_object_parent_widget_get( obj )) != NULL ) {
WView* view = WView_getInstanceFromEvasObj( obj );
- if( view != NULL )
- {
+ if( view != NULL ) {
view->attachPopup( popup );
return true;
}
WENTER();
auto p = (WMenuPopup*)WControl_getInstanceFromEvasObj(obj);
const unsigned int itemIndex = reinterpret_cast<unsigned long long>(data);
- if (p && p->__pv)
- {
+ if (p && p->__pv) {
p->__pv->__vSelectItemCb[itemIndex]();
}
evas_object_del(obj);
WMenuPopup::~WMenuPopup()
{
WHIT();
- if (__pv->__popup)
- {
+ if (__pv->__popup) {
evas_object_event_callback_del(__pv->__navi, EVAS_CALLBACK_RESIZE, __WMenuPopupImpl::__popupResizeCb);
evas_object_smart_callback_del(__pv->__win, "rotation,changed", __WMenuPopupImpl::__popupWinRotateCb);
}
Evas_Object* WMenuPopup::onCreate(Evas_Object* parent, void* param)
{
- if(__pv->__popup == NULL)
- {
+ if(__pv->__popup == NULL) {
WERROR("Not initialized!");
return NULL;
}
bool WNaviframe::create( Evas_Object* parent, void* param )
{
- if( __pv->__evasObj )
- {
+ if( __pv->__evasObj ) {
WDEBUG("Already created!");
return true;
}
else
__pv->__evasObj = onCreate(parent, param);
- if(__pv->__evasObj == NULL)
- {
+ if(__pv->__evasObj == NULL) {
WERROR("No frame object created!");
return false;
}
void WNaviframe::destroy()
{
WHIT();
- if(__pv->__evasObj)
- {
+ if(__pv->__evasObj) {
destroyAllViews();
evas_object_del(__pv->__evasObj);
// Do not leave any code here.
// After executing upper statement "evas_object_del", this object will be deleted at evas object deletion callback!
- }
- else
- {
+ } else {
onDestroy();
delete this;
}
void WNaviframe::setName(const char* name)
{
- if( __pv->__name)
- {
+ if( __pv->__name) {
free(__pv->__name);
__pv->__name = NULL;
}
- if( name )
- {
+ if( name ) {
size_t len = strlen(name) + 1;
__pv->__name = (char*)malloc(len);
strncpy( __pv->__name, name, len);
Eina_List* list = elm_naviframe_items_get( getEvasObj());
Eina_List* temp = NULL;
void* it = NULL;
- EINA_LIST_FOREACH( list, temp, it)
- {
+ EINA_LIST_FOREACH( list, temp, it) {
elm_object_item_del( (Elm_Object_Item*)it);
}
}
WHIT();
*popOut = false;
WWindow* window = getWindow();
- if (window != NULL)
- {
+ if (window != NULL) {
Evas_Object* evasObj = window->getEvasObj();
- if (evasObj != NULL)
- {
+ if (evasObj != NULL) {
elm_win_lower(evasObj);
}
}
{
WNaviframe* nf = view->getNaviframe();
- if( item == elm_naviframe_bottom_item_get( nf->getEvasObj() ))
- {
+ if( item == elm_naviframe_bottom_item_get( nf->getEvasObj() )) {
bool ret = view->onPop();
if( ret == false )
return EINA_FALSE;
else
nf->onLastItemPop(&popOut);
return popOut;
- }
- else
- {
+ } else {
return view->onPop();
}
}
{
__content = NULL;
__count = 0;
- for( int i=0; i< __MAX_BUTTON_NUM; i++)
- {
+ for( int i=0; i< __MAX_BUTTON_NUM; i++) {
buttonPropertyCb[i] = NULL;
}
}
__WPopupImpl::~__WPopupImpl()
{
- for( int i=0; i< __MAX_BUTTON_NUM; i++)
- {
+ for( int i=0; i< __MAX_BUTTON_NUM; i++) {
delete buttonPropertyCb[i];
}
}
__pv->__text = text;
else
__pv->__text.clear();
- if( __pv->__content )
- {
+ if( __pv->__content ) {
__pv->__content->destroy();
__pv->__content = NULL;
}
void WPopup::setContent( const std::function<Evas_Object* (Evas_Object* parent)> contentCreateCb )
{
__pv->__text = "";
- if( __pv->__content )
- {
+ if( __pv->__content ) {
__pv->__content->destroy();
__pv->__content = NULL;
}
bool WPopup::addButton(const char* buttonText, const std::function<void (bool* destroyPopup)> buttonCb, const std::function<void (Evas_Object* button)> setPropertyCb )
{
- if( __pv->__count >= __MAX_BUTTON_NUM )
- {
+ if( __pv->__count >= __MAX_BUTTON_NUM ) {
WERROR("Over the max button number! =%d", __pv->__count);
return false;
}
WPopup* p = (WPopup*)data;
bool destroyPopup = true;
p->__pv->__backCb( &destroyPopup );
- if( destroyPopup )
- {
+ if( destroyPopup ) {
p->destroy();
}
}, this);
if( __pv->__morePropertiesCb )
__pv->__morePropertiesCb( popup );
- if (!__pv->__title.empty())
- {
+ if (!__pv->__title.empty()) {
if (!__pv->__textDomain.empty())
elm_object_domain_translatable_part_text_set(popup, "title,text", __pv->__textDomain.c_str(), __pv->__title.c_str());
else
elm_object_part_text_set(popup, "title,text", __pv->__title.c_str() );
}
- if (!__pv->__text.empty())
- {
+ if (!__pv->__text.empty()) {
if (!__pv->__textDomain.empty())
elm_object_domain_translatable_part_text_set(popup, NULL, __pv->__textDomain.c_str(), __pv->__text.c_str());
else
elm_object_text_set(popup, __pv->__text.c_str());
- }
- else if( __pv->__content)
- {
+ } else if( __pv->__content) {
__pv->__content->create(popup, NULL);
elm_object_content_set(popup, __pv->__content->getEvasObj());
- }
- else if( __pv->__contentCreateCb )
- {
+ } else if( __pv->__contentCreateCb ) {
Evas_Object* obj = __pv->__contentCreateCb( popup );
elm_object_content_set(popup, obj);
}
- for( int i=0; i< __pv->__count; i++ )
- {
+ for( int i=0; i< __pv->__count; i++ ) {
Evas_Object* button = elm_button_add(popup);
elm_object_style_set(button, "popup");
if (!__pv->__textDomain.empty())
break;
}
- if( __pv->buttonPropertyCb[i] )
- {
+ if( __pv->buttonPropertyCb[i] ) {
(*__pv->buttonPropertyCb[i])( button );
}
evas_object_show( button);
void __WUiTimerImpl::__deleteTimer()
{
- if( __timer )
- {
- switch( __type )
- {
+ if( __timer ) {
+ switch( __type ) {
case WUiTimer::IDLER:
ecore_idler_del( (Ecore_Idler*)__timer);
break;
{
auto p = (WUiTimer*)data;
- if( p->__pv->__uiObjMonitor && p->__pv->__uiObjMonitor->expired() )
- {
+ if( p->__pv->__uiObjMonitor && p->__pv->__uiObjMonitor->expired() ) {
p->__pv->__timer = NULL;
delete p;
return ECORE_CALLBACK_CANCEL;
}
Eina_Bool ret = p->__pv->__timerFunc( p->__pv->__userData );
- if( ret == ECORE_CALLBACK_CANCEL )
- {
+ if( ret == ECORE_CALLBACK_CANCEL ) {
p->__pv->__timer = NULL;
delete p;
}
{
auto p = (WUiTimer*)data;
- if( p->__pv->__uiObjMonitor && p->__pv->__uiObjMonitor->expired())
- {
+ if( p->__pv->__uiObjMonitor && p->__pv->__uiObjMonitor->expired()) {
p->__pv->__timer = NULL;
delete p;
return;
{
WUiTimer* timer = new WUiTimer();
timer->__pv->__type = WUiTimer::IDLER;
- if( !monitorObj.expired() )
- {
+ if( !monitorObj.expired() ) {
timer->__pv->__uiObjMonitor = new std::weak_ptr<IWUiObject>;
*timer->__pv->__uiObjMonitor = monitorObj;
- }
- else
- {
+ } else {
WDEBUG( "No monitored object is set!");
}
timer->__pv->__timerFunc = timerFunc;
timer->__pv->__userData = userData;
Ecore_Idler* ecoreIdler = ecore_idler_add( __WUiTimerImpl::__timerCb, timer );
- if( ecoreIdler == NULL )
- {
+ if( ecoreIdler == NULL ) {
WERROR("failed to add ecore idler!");
delete timer;
return NULL;
{
WUiTimer* timer = new WUiTimer();
timer->__pv->__type = WUiTimer::ANIMATOR;
- if( !monitorObj.expired() )
- {
+ if( !monitorObj.expired() ) {
timer->__pv->__uiObjMonitor = new std::weak_ptr<IWUiObject>;
*timer->__pv->__uiObjMonitor = monitorObj;
- }
- else
- {
+ } else {
WDEBUG( "No monitored object is set!");
}
timer->__pv->__timerFunc = timerFunc;
timer->__pv->__userData = userData;
Ecore_Animator* ecoreAnimator = ecore_animator_add( __WUiTimerImpl::__timerCb, timer );
- if( ecoreAnimator == NULL )
- {
+ if( ecoreAnimator == NULL ) {
WERROR("failed to add ecore animator!");
delete timer;
return NULL;
{
WUiTimer* timer = new WUiTimer();
timer->__pv->__type = WUiTimer::TIMER;
- if( !monitorObj.expired() )
- {
+ if( !monitorObj.expired() ) {
timer->__pv->__uiObjMonitor = new std::weak_ptr<IWUiObject>;
*timer->__pv->__uiObjMonitor = monitorObj;
- }
- else
- {
+ } else {
WDEBUG( "No monitored object is set!");
}
timer->__pv->__timerFunc = timerFunc;
timer->__pv->__userData = userData;
Ecore_Timer* ecoreTimer = ecore_timer_add( interval, __WUiTimerImpl::__timerCb, timer );
- if( ecoreTimer == NULL )
- {
+ if( ecoreTimer == NULL ) {
WERROR("failed to add ecore timer!");
delete timer;
return NULL;
{
WUiTimer* timer = new WUiTimer();
timer->__pv->__type = WUiTimer::JOB;
- if( !monitorObj.expired() )
- {
+ if( !monitorObj.expired() ) {
timer->__pv->__uiObjMonitor = new std::weak_ptr<IWUiObject>;
*timer->__pv->__uiObjMonitor = monitorObj;
- }
- else
- {
+ } else {
WDEBUG( "No monitored object is set!");
}
timer->__pv->__jobFunc = timerFunc;
timer->__pv->__userData = userData;
Ecore_Job* ecoreJob = ecore_job_add( __WUiTimerImpl::__jobCb, timer );
- if( ecoreJob == NULL )
- {
+ if( ecoreJob == NULL ) {
WERROR("failed to add ecore job!");
delete timer;
return NULL;
free(__title);
//
- if( __popupMonitor )
- {
- if( auto p = __popupMonitor->lock() )
- {
+ if( __popupMonitor ) {
+ if( auto p = __popupMonitor->lock() ) {
p->destroy();
}
}
WView::~WView()
{
- if( __pv->__name)
- {
+ if( __pv->__name) {
WDEBUG( "name=%s", __pv->__name );
- }
- else
- {
+ } else {
WHIT();
}
{
WHIT();
- if( __pv->__obj )
- {
+ if( __pv->__obj ) {
WDEBUG("Already created!");
return true;
}
void WView::destroy()
{
- if(__pv->__obj)
- {
- if( getNaviframe() )
- {
+ if(__pv->__obj) {
+ if( getNaviframe() ) {
elm_object_item_del( __pv->__naviItem );
- }
- else
- {
+ } else {
evas_object_del(__pv->__obj);
}
// Do not leave any code here.
// After executing upper statement "evas_object_del", this object will be deleted at evas object deletion callback!
- }
- else
- {
+ } else {
__destroy();
}
}
void WView::setName(const char* name)
{
- if( __pv->__name)
- {
+ if( __pv->__name) {
free( __pv->__name);
__pv->__name = NULL;
}
- if( name )
- {
+ if( name ) {
size_t len = strlen(name) + 1;
__pv->__name = (char*)malloc(len);
strncpy( __pv->__name, name, len);
void WView::setTitle( const char* title )
{
- if( __pv->__title)
- {
+ if( __pv->__title) {
free( __pv->__title);
__pv->__title = NULL;
}
- if( title )
- {
+ if( title ) {
size_t len = strlen(title) + 1;
__pv->__title = (char*)malloc(len);
strncpy( __pv->__title, title, len);
std::weak_ptr<IWUiObject> WView::getWeakPtr()
{
- if( __pv->__selfPtr )
- {
+ if( __pv->__selfPtr ) {
return std::weak_ptr<IWUiObject>(*__pv->__selfPtr);
}
__pv->__selfPtr = new std::shared_ptr<IWUiObject>( this,[](IWUiObject* p){} );
bool WView::popOut()
{
- if( getEvasObj() == NULL)
- {
+ if( getEvasObj() == NULL) {
WWARNING("Not created view! No Evas Object!");
return false;
}
- if( getNaviframe() == NULL)
- {
+ if( getNaviframe() == NULL) {
WWARNING("Not pushed to naviframe!");
return false;
}
destroyPopup(); // Before popping out view, pop-up is destroyed, if it has.Because pop-up is disappeared too late.
- if( __pv->__naviItem != elm_naviframe_top_item_get(getNaviframe()->getEvasObj()) )
- {
+ if( __pv->__naviItem != elm_naviframe_top_item_get(getNaviframe()->getEvasObj()) ) {
elm_object_item_del(__pv->__naviItem);
return true;
}
WNaviframe* WView::getNaviframe()
{
- if( __pv->__naviframe == NULL)
- {
+ if( __pv->__naviframe == NULL) {
WWARNING("naviframe does not exist!");
}
Elm_Object_Item* WView::getNaviItem()
{
- if( __pv->__naviItem == NULL)
- {
+ if( __pv->__naviItem == NULL) {
WWARNING("naviItem does not exist!");
}
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
char* path = app_get_resource_path();
- if( path == NULL )
- {
+ if( path == NULL ) {
WERROR("Failed to get resource path=NULL");
return layout;
}
free(path);
edjPath += "edje/app-assist-efl.edj";
- if( elm_layout_file_set(layout, edjPath.c_str(), "default-view") == EINA_TRUE)
- {
+ if( elm_layout_file_set(layout, edjPath.c_str(), "default-view") == EINA_TRUE) {
Evas_Object* rect = evas_object_rectangle_add(evas_object_evas_get(layout));
evas_object_color_set(rect, rand() % 256, rand() % 256, rand() % 256, 255);
evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
if( getName() != NULL )
elm_object_part_text_set(layout, "name", getName());
- }
- else
- {
+ } else {
WERROR("Fail to set layout. Check EDJ file(%s)", edjPath.c_str());
}
bool WView::enableMoreButton( Elm_Object_Item* naviItem, Evas_Smart_Cb clickedCb, void* userData )
{
- if( getNaviframe() == NULL )
- {
+ if( getNaviframe() == NULL ) {
WERROR("naviframe is not set");
return false;
}
{
// If the pop-up has been already created, the following statement will just return without creating pop-up.
Evas_Object* parent = WView_getWindowBaseLayoutEvasObj( this );
- if( parent == NULL )
- {
+ if( parent == NULL ) {
WERROR("Parent is NULL! Fail to attach popup");
return;
}
{
if( __pv->__popupMonitor == NULL ) return;
- if( auto p = __pv->__popupMonitor->lock() )
- {
+ if( auto p = __pv->__popupMonitor->lock() ) {
p->destroy();
__pv->__popupMonitor->reset();
}
bool WView::__callPushedHandlerFunc(Elm_Object_Item* naviItem)
{
- if( __pv->__pushedHandler )
- {
+ if( __pv->__pushedHandler ) {
__pv->__pushedHandler(naviItem);
return true;
}
Evas_Object* WView_getWindowBaseLayoutEvasObj( WView* view )
{
- if( view->getWindow() )
- {
+ if( view->getWindow() ) {
return view->getWindow()->getBaseLayoutEvasObj();
- }
- else
- {
+ } else {
WERROR("Fail to get base layout");
return NULL;
}
Evas_Object* WView_getWindowEvasObj( WView* view )
{
- if( view->getWindow() )
- {
+ if( view->getWindow() ) {
return view->getWindow()->getEvasObj();
- }
- else
- {
+ } else {
WERROR("Fail to get window evas object");
return NULL;
}
__createBaseLayoutHandler(NULL),
__owner(false)
{
- if(win)
- {
+ if(win) {
__winType = elm_win_type_get(win);
const char *title = elm_win_title_get(win);
if(title)
bool WWindow::create()
{
- if(__pv->__win || !__pv->__owner)
- {
+ if(__pv->__win || !__pv->__owner) {
WDEBUG("Already created!");
return true;
}
else
win = onCreateWin();
__pv->__win = win;
- if( win )
- {
+ if( win ) {
Evas_Object* cf = NULL;
if(__pv->__createBaseLayoutHandler)
__pv->__baseLayout = __pv->__createBaseLayoutHandler(win,&cf);
evas_object_show( win );
return true;
- }
- else
- {
+ } else {
return false;
}
}
void WWindow::destroy()
{
- if(__pv->__owner)
- {
- if( __pv->__win)
- {
+ if(__pv->__owner) {
+ if( __pv->__win) {
evas_object_del(__pv->__win);
// Do not leave any code here.
// After executing upper statement "evas_object_del", this object will be deleted at evas object deletion callback!
- }
- else
- {
+ } else {
onDestroy();
delete this;
}
- }
- else
- {
+ } else {
delete this;
}
}
WASSERT( __pv->__baseObj == NULL);
- if( baseObj->create( __pv->__baseLayout, creationParam) == false )
- {
+ if( baseObj->create( __pv->__baseLayout, creationParam) == false ) {
return false;
}
Evas_Object* WWindow::onCreateWin()
{
Evas_Object* win = elm_win_add( NULL, getName(), getWinType() );
- if( win == NULL)
- {
+ if( win == NULL) {
WERROR("Fail to create win!");
return NULL;
}
elm_win_title_set( win, getName() );
elm_win_conformant_set( win, EINA_TRUE);
elm_win_autodel_set( win, EINA_TRUE);
- if( elm_win_wm_rotation_supported_get(win))
- {
+ if( elm_win_wm_rotation_supported_get(win)) {
int rotation[4] = {0,90,180,270};
elm_win_wm_rotation_available_rotations_set( win, (const int*)(&rotation), 4);
CalAlertApp::~CalAlertApp()
{
WENTER();
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
}
{
WENTER();
Mode mode = __getMode(request);
- switch (mode)
- {
+ switch (mode) {
case CALALERT_VIEW:
WDEBUG("Show Alert");
__createWindowSafe(firstLaunch, true);
break;
}
- if(getWindow())
- {
+ if(getWindow()) {
WApp::onAppControl(request, firstLaunch);
}
}
void CalAlertApp::__createWindowSafe(bool isFirstLaunch, bool isAlertPopup)
{
- if (isFirstLaunch)
- {
+ if (isFirstLaunch) {
__createWindow(isAlertPopup);
- }
- else
- {
+ } else {
WWindow* win = getWindow();
- if (win == NULL)
- {
+ if (win == NULL) {
__stopExit();
__createWindow(isAlertPopup);
}
}
void CalAlertApp::__createWindow(bool isAlertPopup)
{
- if (isAlertPopup)
- {
+ if (isAlertPopup) {
device_power_wakeup(false);
device_display_change_state(DISPLAY_STATE_NORMAL);
attachWindow(new WWindow("Calendar", ELM_WIN_NOTIFICATION));
efl_util_set_notification_window_level(getWindow()->getEvasObj(), EFL_UTIL_NOTIFICATION_LEVEL_TOP);
- }
- else
- {
+ } else {
attachWindow(new WWindow("Calendar", ELM_WIN_BASIC));
}
elm_win_indicator_mode_set(getWindow()->getEvasObj(), ELM_WIN_INDICATOR_SHOW);
CalNaviframe* naviframe = new CalNaviframe();
- if (!isAlertPopup)
- {
+ if (!isAlertPopup) {
naviframe->setOnLastItemPop([] (bool* popOut) {
*popOut = false;
elm_exit();
char *caller = NULL;
app_control_get_extra_data(request, CAL_APPSVC_PARAM_CALLER, &caller);
- if (caller != NULL)
- {
+ if (caller != NULL) {
WDEBUG("caller [%s]", caller);
- if(!strcmp(caller, CAL_APPSVC_PARAM_CALLER_NOTIFICATION))
- {
+ if(!strcmp(caller, CAL_APPSVC_PARAM_CALLER_NOTIFICATION)) {
char *action = NULL;
app_control_get_extra_data(request, CAL_APPALERT_PARAM_ACTION, &action);
- if (action != NULL)
- {
+ if (action != NULL) {
WDEBUG("action [%s]", action);
- if (!strcmp(action, CAL_APPALERT_ACTION_DISMISS))
- {
+ if (!strcmp(action, CAL_APPALERT_ACTION_DISMISS)) {
mode = CALALERT_DISMISS;
- }
- else if (!strcmp(action, CAL_APPALERT_ACTION_SNOOZE))
- {
+ } else if (!strcmp(action, CAL_APPALERT_ACTION_SNOOZE)) {
mode = CALALERT_SNOOZE;
- }
- else if (!strcmp(action, CAL_APPALERT_ACTION_SHOW_NOTIFICATION_LIST))
- {
+ } else if (!strcmp(action, CAL_APPALERT_ACTION_SHOW_NOTIFICATION_LIST)) {
mode = CALALERT_SHOW_NOTIFICATION_LIST;
- }
- else
- {
+ } else {
WERROR("Wrong action");
}
free(action);
__alertData = std::make_shared<CalAlertData>();
__model = std::make_shared<CalAlertModel>(__alertData);
- }
- else if(!strcmp(caller, CAL_APPSVC_PARAM_CALLER_CALENDAR))
- {
+ } else if(!strcmp(caller, CAL_APPSVC_PARAM_CALLER_CALENDAR)) {
mode = CALALERT_UPDATE_STATUSBAR;
}
free(caller);
- }
- else
- {
+ } else {
__alertData = std::make_shared<CalAlertData>(request);
- if(__alertData->getCount())
- {
+ if(__alertData->getCount()) {
mode = CalAlertModel::isDeviceLocked() ? CALALERT_VIEW :
CALALERT_ACTIVE_NOTIFICATION;
}
{
WENTER();
CalNaviframe* frame = (CalNaviframe*)getWindow()->getBaseUiObject();
- if (auto view = __alertView.lock())
- {
+ if (auto view = __alertView.lock()) {
static_cast<CalAlertView *>(view.get())->replaceAlertData(alertData);
- }
- else
- {
+ } else {
CalAlertView *newView = new CalAlertView(alertData);
frame->push(newView);
__alertView = newView->getWeakPtr();
{
WENTER();
CalNaviframe* frame = (CalNaviframe*)getWindow()->getBaseUiObject();
- if (auto view = __notificationsView.lock())
- {
+ if (auto view = __notificationsView.lock()) {
static_cast<CalNotificationsView *>(view.get())->replaceAlertData(alertData);
- }
- else
- {
+ } else {
CalNotificationsView *newView = new CalNotificationsView(alertData);
frame->push(newView);
__notificationsView = newView->getWeakPtr();
void CalAlertApp::__exit()
{
- if (__timer)
- {
+ if (__timer) {
return;
}
void CalAlertApp::__stopExit()
{
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
}
WENTER();
char *value = NULL;
app_control_get_extra_data(request, CAL_APPCALSVC_PARAM_TICK, &value);
- if (value)
- {
+ if (value) {
__tick = atoi(value);
free(value);
value = NULL;
}
app_control_get_extra_data(request, CAL_APPCALSVC_PARAM_UNIT, &value);
- if (value)
- {
+ if (value) {
__unit = atoi(value);
free(value);
value = NULL;
int len = 0;
app_control_get_extra_data_array(request, CAL_APPCALSVC_PARAM_IDS, &ids, &len);
WDEBUG("len(%d)", len);
- if (len > 0)
- {
+ if (len > 0) {
// calendar-service
- for (int i = 0; i < len; i++)
- {
+ for (int i = 0; i < len; i++) {
int recordIndex = atoi(ids[i]);
__addRecord(recordIndex, false);
WDEBUG("alert index[%d]",recordIndex);
}
- if (ids)
- {
+ if (ids) {
free(ids);
}
return;
}
- if (ids)
- {
+ if (ids) {
free(ids);
}
app_control_get_extra_data(request, CAL_APPSVC_PARAM_COUNT, &value);
- if (value)
- {
+ if (value) {
free(value);
value = NULL;
}
WDEBUG("alert count[%d]",getCount());
- if (getCount() > 1)
- {
+ if (getCount() > 1) {
char key[ID_LENGTH] = {0};
char snoozedKey[ID_LENGTH] = {0};
int index = 0;
char *snoozed = NULL;
bool isSnoozed = false;
- while (getCount() != index)
- {
+ while (getCount() != index) {
snprintf(key, sizeof(key), "%d", index);
app_control_get_extra_data(request, key, &value);
snprintf(snoozedKey, sizeof(snoozedKey), "%d.%s", index, CAL_APPALERT_PARAM_IS_SNOOZED);
- if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data(request, snoozedKey, &snoozed))
- {
+ if(APP_CONTROL_ERROR_NONE == app_control_get_extra_data(request, snoozedKey, &snoozed)) {
isSnoozed = snoozed && !strcmp(snoozed, CAL_APPALERT_IS_SNOOZED);
free(snoozed);
}
- if (value)
- {
+ if (value) {
int recordIndex = atoi(value);
free(value);
value = NULL;
}
index++;
}
- }
- else
- {
+ } else {
app_control_get_extra_data(request, CAL_APPCALSVC_PARAM_ID, &value);
- if (value)
- {
+ if (value) {
int recordIndex = atoi(value);
free(value);
value = NULL;
__addRecord(recordIndex, false);
WDEBUG("alert index[%d]",recordIndex);
- }
- else
- {
+ } else {
WERROR("get value fail");
}
}
const CalAlertData& CalAlertData::operator=(const CalAlertData& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
__tick = obj.__tick;
__unit = obj.__unit;
__alerts = obj.__alerts;
std::shared_ptr<CalAlertNotificationItem> CalAlertData::getAt(int nth)
{
WENTER();
- if (nth >= getCount())
- {
+ if (nth >= getCount()) {
WERROR("invalid input[%d/%d]", nth, getCount());
return nullptr;
}
void CalAlertData::remove(int nth)
{
WENTER();
- if (nth >= getCount())
- {
+ if (nth >= getCount()) {
WERROR("invalid input[%d/%d]", nth, getCount());
return;
}
{
WENTER();
- for (auto alertNotiItem = __alerts.begin() ; alertNotiItem != __alerts.end(); ++alertNotiItem)
- {
- if ((*alertNotiItem)->getRecordIndex() == id)
- {
+ for (auto alertNotiItem = __alerts.begin() ; alertNotiItem != __alerts.end(); ++alertNotiItem) {
+ if ((*alertNotiItem)->getRecordIndex() == id) {
__alerts.erase(alertNotiItem);
WLEAVE();
__tick = data.__tick;
__unit = data.__unit;
- for (auto item : data.__alerts)
- {
+ for (auto item : data.__alerts) {
auto result = std::find_if(__alerts.begin(), __alerts.end(),
[item](const std::shared_ptr<CalAlertNotificationItem> &it) -> bool
{
return item->getScheduleId() == it->getScheduleId();
});
- if(__alerts.end() == result)
- {
+ if(__alerts.end() == result) {
__alerts.insert(__alerts.begin(), item);
}
}
{
calendar_record_h record = nullptr;
int error = calendar_db_get_record(_calendar_event._uri, recordIndex, &record);
- if (error == CALENDAR_ERROR_NONE)
- {
+ if (error == CALENDAR_ERROR_NONE) {
auto item = std::make_shared<CalAlertNotificationItem>(recordIndex);
item->setSnoozed(isSnoozed);
__alerts.push_back(item);
calendar_record_destroy(record, true);
- }
- else
- {
+ } else {
WERROR("Record %d isn't found in the calendar database", recordIndex);
}
}
{
CalAlertItem* self = (CalAlertItem*)data;
- if(self && self->__alertItem.get())
- {
- if (!strcmp(part, "elm.text.main.top"))
- {
+ if(self && self->__alertItem.get()) {
+ if (!strcmp(part, "elm.text.main.top")) {
return self->__alertItem->getEventName();
- }
- else if (!strcmp(part, "elm.text.time.up"))
- {
+ } else if (!strcmp(part, "elm.text.time.up")) {
return self->__alertItem->getStartTime();
- }
- else if (!strcmp(part, "elm.text.time.down"))
- {
+ } else if (!strcmp(part, "elm.text.time.down")) {
return self->__alertItem->getEndTime();
- }
- else if (!strcmp(part, "elm.text.location"))
- {
+ } else if (!strcmp(part, "elm.text.location")) {
return self->__alertItem->getLocation();
}
}
itc.func.content_get = [](void *data, Evas_Object *obj, const char *part)->Evas_Object*
{
CalAlertItem* self = (CalAlertItem*)data;
- if (!strcmp(part, PART_CHECK) && self->__isCheckVisible)
- {
+ if (!strcmp(part, PART_CHECK) && self->__isCheckVisible) {
Evas_Object *check = elm_check_add(obj);
elm_check_state_set(check, EINA_FALSE);
evas_object_propagate_events_set(check, EINA_FALSE);
, self);
self->__check = check;
return self->__check;
- }
- else if (!strcmp(part, "elm.swallow.color.bar"))
- {
+ } else if (!strcmp(part, "elm.swallow.color.bar")) {
Evas_Object* icon = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
void CalAlertItem::onCheck()
{
- if (__check)
- {
+ if (__check) {
elm_check_state_set(__check, !elm_check_state_get(__check));
- if (__checkCb)
- {
+ if (__checkCb) {
__checkCb();
}
}
void CalAlertItem::onSelect()
{
- if (__selectCb)
- {
+ if (__selectCb) {
__selectCb();
}
}
void CalAlertItem::setCheckVisibility(bool isVisible)
{
- if (__isCheckVisible != isVisible)
- {
+ if (__isCheckVisible != isVisible) {
__isCheckVisible = isVisible;
elm_genlist_item_fields_update (getElmObjectItem(), PART_CHECK, ELM_GENLIST_ITEM_FIELD_CONTENT);
}
{
WENTER();
int count = __alertData->getCount();
- if (count <= 0)
- {
+ if (count <= 0) {
WERROR("count[%d]",count);
return ;
}
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
std::shared_ptr<CalAlertNotificationItem> alertItem = __alertData->getAt(i);
- if(alertItem)
- {
+ if(alertItem) {
alertItem->setSnoozed(true);
__snooze(alertItem);
}
WENTER();
std::shared_ptr<CalAlertNotificationItem> alertItem = __alertData->getAt(nth);
- if (alertItem == NULL)
- {
+ if (alertItem == NULL) {
WERROR("fail");
return;
}
{
WENTER();
int count = __alertData->getCount();
- if(count > 0)
- {
- for (int i = 0; i < count; i++)
- {
+ if(count > 0) {
+ for (int i = 0; i < count; i++) {
std::shared_ptr<CalAlertNotificationItem> alertItem = __alertData->getAt(i);
- if(alertItem->isSnoozed())
- {
+ if(alertItem->isSnoozed()) {
__dismiss(alertItem);
}
}
{
WENTER();
std::shared_ptr<CalAlertNotificationItem> alertItem = __alertData->getAt(nth);
- if (alertItem == NULL)
- {
+ if (alertItem == NULL) {
WERROR("fail");
return;
}
- if(alertItem->isSnoozed())
- {
+ if(alertItem->isSnoozed()) {
__dismiss(alertItem);
}
void CalAlertModel::dismiss(std::vector<int> &nths)
{
WENTER();
- for (auto nth : nths)
- {
+ for (auto nth : nths) {
__alertData->remove(nth);
}
CalStatusBarManager::getInstance().update(__alertData);
void CalAlertModel::turnOnLcd(void)
{
int error = device_power_wakeup(false);
- if (error != DEVICE_ERROR_NONE)
- {
+ if (error != DEVICE_ERROR_NONE) {
WERROR("device_power_wakeup error %d", error);
}
// set display normal
display_state_e state = DISPLAY_STATE_NORMAL;
device_display_get_state(&state);
- if (state != DISPLAY_STATE_NORMAL)
- {
+ if (state != DISPLAY_STATE_NORMAL) {
device_display_change_state(DISPLAY_STATE_NORMAL);
}
WDEBUG("display state: %d -> %d", state, DISPLAY_STATE_NORMAL);
// power
WHIT();
error = device_power_request_lock(POWER_LOCK_DISPLAY, 60*1000);
- if (error != DEVICE_ERROR_NONE)
- {
+ if (error != DEVICE_ERROR_NONE) {
WERROR("device_power_request_lock error %d", error);
}
}
{
display_state_e state = DISPLAY_STATE_NORMAL;
device_display_get_state(&state);
- if (state != DISPLAY_STATE_SCREEN_DIM)
- {
+ if (state != DISPLAY_STATE_SCREEN_DIM) {
device_display_change_state(DISPLAY_STATE_SCREEN_DIM);
}
WDEBUG("display state: %d -> %d", state ,DISPLAY_STATE_SCREEN_DIM);
int ret = device_power_release_lock(POWER_LOCK_DISPLAY);
- if (ret != 0)
- {
+ if (ret != 0) {
WERROR("fail");
}
}
{
int lock_state = SYSTEM_SETTINGS_LOCK_STATE_LOCK;
int ret = system_settings_get_value_int(SYSTEM_SETTINGS_KEY_LOCK_STATE, &lock_state);
- if (ret == SYSTEM_SETTINGS_ERROR_NONE)
- {
+ if (ret == SYSTEM_SETTINGS_ERROR_NONE) {
WDEBUG("lock state: %d", lock_state);
return !(lock_state == SYSTEM_SETTINGS_LOCK_STATE_UNLOCK);
}
int error = PREFERENCE_ERROR_NONE;
error = preference_set_int(CALENDAR_ALERT_NOTI_MIN_KEY, min);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_set_int is failed(%x)", error);
}
}
int error = PREFERENCE_ERROR_NONE;
int min;
error = preference_get_int(CALENDAR_ALERT_NOTI_MIN_KEY, &min);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
min = DEFAULT_SNOOZE_TIME;
}
WDEBUG("%d", min);
int alarm_id = 0;
int error = ALARM_ERROR_NONE;
error = alarm_schedule_once_after_delay(service, getSnoozeMinute() * 60, &alarm_id);
- if (error != ALARM_ERROR_NONE)
- {
+ if (error != ALARM_ERROR_NONE) {
WERROR("fail");
}
WDEBUG("alarm_id[%d]", alarm_id);
WENTER();
int alarmId = item->getAlarmId();
int error = alarm_cancel(alarmId);
- if (error != ALARM_ERROR_NONE)
- {
+ if (error != ALARM_ERROR_NONE) {
WERROR("Failed to delete alarm %d", alarmId);
}
}
void CalAlertNotificationItem::__getRecord(int recordIndex)
{
WENTER();
- if(recordIndex)
- {
+ if(recordIndex) {
calendar_record_h record = NULL;
int error = calendar_db_get_record(_calendar_event._uri, recordIndex, &record);
- if (error == CALENDAR_ERROR_NONE)
- {
+ if (error == CALENDAR_ERROR_NONE) {
__schedule = std::make_shared<CalOriginalSchedule>(record);
}
}
const char *summary = __schedule->getSummary();
const char *eventName = NULL;
- if (summary && *summary)
- {
+ if (summary && *summary) {
eventName = summary;
- }
- else
- {
+ } else {
eventName = _L_("IDS_CLD_MBODY_MY_EVENT");
}
- if (isSnoozed())
- {
+ if (isSnoozed()) {
int newSize = strlen(eventName) + strlen(_L_("IDS_CLD_MBODY_PS_HSNOOZED_T_CALENDAR")) + 1;
char *newName = (char*)calloc(1, newSize);
snprintf(newName, newSize, _L_("IDS_CLD_MBODY_PS_HSNOOZED_T_CALENDAR"), eventName);
return newName;
- }
- else
- {
+ } else {
return strdup(eventName);
}
}
{
WENTER();
const char *location = __schedule->getLocation();
- if (location && *location)
- {
+ if (location && *location) {
return strdup(location);
- }
- else
- {
+ } else {
return strdup("");
}
}
WENTER();
__model.turnOffLcd();
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
__timer = NULL;
}
std::stringstream ss(startText);
int iteration = 0;
- while (ss >> buf)
- {
- switch (iteration)
- {
+ while (ss >> buf) {
+ switch (iteration) {
case 0:
elm_object_part_text_set(layout, "event_time", buf.c_str());
break;
CalAlertView* self = (CalAlertView*)data;
self->__dismissDown = true;
Evas_Event_Mouse_Up* ev = (Evas_Event_Mouse_Up*)eventInfo;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
return;
}
Evas_Coord_Point currentPoint = ev->canvas;
evas_object_event_callback_add(dismissImage, EVAS_CALLBACK_MOUSE_MOVE,
[](void *data, Evas *e, Evas_Object *obj, void *eventInfo){
CalAlertView* self = (CalAlertView*)data;
- if(!self->__dismissDown)
- {
+ if(!self->__dismissDown) {
return;
}
Evas_Event_Mouse_Up* ev = (Evas_Event_Mouse_Up*)eventInfo;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
return;
}
Evas_Coord_Point currentPoint = ev->canvas;
int distanceCentreY = abs(currentPoint.y - DISTANCE_Y);
int distanceForActivate = sqrt(distanceCentreX * distanceCentreX + distanceCentreY * distanceCentreY);
- if(distanceForActivate > ACTIVATE_DISTANCE)
- {
+ if(distanceForActivate > ACTIVATE_DISTANCE) {
self->__actionLock = true;
- }
- else
- {
+ } else {
self->__actionLock = false;
int centerX = DISTANCE_X;
int centerY = DISTANCE_Y;
evas_object_event_callback_add(dismissImage, EVAS_CALLBACK_MOUSE_UP,
[](void *data, Evas *e, Evas_Object *obj, void *eventInfo){
CalAlertView* self = (CalAlertView*)data;
- if (self->__actionLock && self->__dismissDown)
- {
+ if (self->__actionLock && self->__dismissDown) {
self->__actionLock = false;
self->__dismissDown = false;
self->__model.dismiss(0);
CalAlertView* self = (CalAlertView*)data;
self->__snoozeDown = true;
Evas_Event_Mouse_Up* ev = (Evas_Event_Mouse_Up*)eventInfo;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
return;
}
Evas_Coord_Point currentPoint = ev->canvas;
evas_object_event_callback_add(snoozeImage, EVAS_CALLBACK_MOUSE_MOVE,
[](void *data, Evas *e, Evas_Object *obj, void *eventInfo){
CalAlertView* self = (CalAlertView*)data;
- if(!self->__snoozeDown)
- {
+ if(!self->__snoozeDown) {
return;
}
Evas_Event_Mouse_Up* ev = (Evas_Event_Mouse_Up*)eventInfo;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
return;
}
Evas_Coord_Point currentPoint = ev->canvas;
int distanceCentreY = abs(currentPoint.y - DISTANCE_Y);
int distanceForActivate = sqrt(distanceCentreX * distanceCentreX + distanceCentreY * distanceCentreY);
- if(distanceForActivate > ACTIVATE_DISTANCE)
- {
+ if(distanceForActivate > ACTIVATE_DISTANCE) {
self->__actionLock = true;
- }
- else
- {
+ } else {
self->__actionLock = false;
int centerX = CENTER_X_POSITION;
int centerY = DISTANCE_Y;
evas_object_event_callback_add(snoozeImage, EVAS_CALLBACK_MOUSE_UP,
[](void *data, Evas *e, Evas_Object *obj, void *eventInfo){
CalAlertView* self = (CalAlertView*)data;
- if (self->__actionLock && self->__snoozeDown)
- {
+ if (self->__actionLock && self->__snoozeDown) {
self->__actionLock = false;
self->__snoozeDown = false;
self->__model.snooze(0);
itc.item_style = "type1";
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
- if (!strcmp(part, "elm.text"))
- {
+ if (!strcmp(part, "elm.text")) {
return strdup(_L_("IDS_CLD_OPT_SELECT_ALL"));
}
};
itc.func.content_get = [](void *data, Evas_Object *obj, const char *part)->Evas_Object*
{
- if (!strcmp(part, "elm.swallow.end"))
- {
+ if (!strcmp(part, "elm.swallow.end")) {
CalNotificationsSelectAllItem *self = (CalNotificationsSelectAllItem *)data;
Evas_Object *check = elm_check_add(obj);
self->__checkbox = check;
- if (self->__isAllVisible)
- {
+ if (self->__isAllVisible) {
elm_check_state_set(check, EINA_TRUE);
- }
- else
- {
+ } else {
elm_check_state_set(check, EINA_FALSE);
}
evas_object_propagate_events_set(check, EINA_FALSE);
void CalNotificationsSelectAllItem::onSelect()
{
WENTER();
- if (__selectCb)
- {
+ if (__selectCb) {
__selectCb();
}
}
__isAllVisible = !__isAllVisible;
__updateSelectAllCheck();
- for (auto it = __itemMap.begin(); it != __itemMap.end(); ++it)
- {
+ for (auto it = __itemMap.begin(); it != __itemMap.end(); ++it) {
CalAlertItem* item = it->second;
elm_check_state_set(item->getCheckObject(), __isAllVisible);
}
{
WENTER();
int checkedCount = 0;
- for (auto it = __itemMap.begin(); it != __itemMap.end(); ++it)
- {
+ for (auto it = __itemMap.begin(); it != __itemMap.end(); ++it) {
CalAlertItem* item = it->second;
Evas_Object* obj = item->getCheckObject();
- if (elm_check_state_get(obj) == EINA_TRUE)
- {
+ if (elm_check_state_get(obj) == EINA_TRUE) {
++checkedCount;
}
__updateButtonStatus(!checkedCount, !checkedCount);
- if (__model.getCount() > 1)
- {
+ if (__model.getCount() > 1) {
__isAllVisible = (__model.getCount() == checkedCount);
__updateSelectAllCheck();
}
void CalNotificationsView::__update()
{
WENTER();
- if (__dialog->getEvasObj())
- {
+ if (__dialog->getEvasObj()) {
elm_genlist_clear(__dialog->getEvasObj());
}
int count = __model.getCount();
- if(count > 1)
- {
+ if(count > 1) {
__selectAllItem = new CalNotificationsSelectAllItem(__isAllVisible,
- [this] ()
- {
+ [this] () {
__updateSelectAllItems();
});
__dialog->add(__selectAllItem);
- }
- else
- {
+ } else {
__selectAllItem = NULL;
}
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
std::shared_ptr<CalAlertNotificationItem> alertItem = __model.getAt(i);
CalAlertItem* item = new CalAlertItem(alertItem);
__itemMap.insert(std::pair<int, CalAlertItem*>(i, item));
}
- if (__itemMap.size() == 1)
- {
+ if (__itemMap.size() == 1) {
__itemMap[0]->setCheckVisibility(false);
}
evas_object_smart_callback_add(left_button, "clicked",
[](void* data, Evas_Object* obj, void* event_info){
CalNotificationsView* self = (CalNotificationsView*)data;
- if (self->__selectAllItem)
- {
- if(self->__isAllVisible)
- {
+ if (self->__selectAllItem) {
+ if(self->__isAllVisible) {
WDEBUG("Dismiss all");
self->__model.dismissAll();
- }
- else
- {
+ } else {
WDEBUG("Dismiss selected");
int i = 0;
std::vector<int> nths;
- for (auto item : self->__itemMap)
- {
+ for (auto item : self->__itemMap) {
Evas_Object* obj = item.second->getCheckObject();
- if (elm_check_state_get(obj))
- {
+ if (elm_check_state_get(obj)) {
nths.push_back(i);
}
i++;
}
self->__model.dismiss(nths);
}
- }
- else
- {
+ } else {
WDEBUG("Dismiss one");
self->__model.dismissAll();
}
evas_object_smart_callback_add(right_button, "clicked",
[](void* data, Evas_Object* obj, void* event_info){
CalNotificationsView* self = (CalNotificationsView*)data;
- if (self->__selectAllItem)
- {
- if(self->__isAllVisible)
- {
+ if (self->__selectAllItem) {
+ if(self->__isAllVisible) {
WDEBUG("Snooze all");
self->__model.snoozeAll();
- }
- else
- {
+ } else {
WDEBUG("Snooze selected");
int i = 0;
- for (auto item : self->__itemMap)
- {
+ for (auto item : self->__itemMap) {
Evas_Object* obj = item.second->getCheckObject();
- if (elm_check_state_get(obj))
- {
+ if (elm_check_state_get(obj)) {
self->__model.snooze(i);
}
i++;
}
}
- }
- else
- {
+ } else {
WDEBUG("Snooze one");
self->__model.snoozeAll();
}
{
CalStatusBarManager::getInstance().checkDeletedEvent();
std::shared_ptr<CalAlertData> alertData = std::make_shared<CalAlertData>();
- if (alertData->getCount() == 0)
- {
+ if (alertData->getCount() == 0) {
elm_exit();
}
__model.relaceAlertData(alertData);
break;
}
case CalEvent::APP_RESUMED:
- if(__model.getCount() == 0)
- {
+ if(__model.getCount() == 0) {
elm_exit();
} else {
__update();
WDEBUG("Notification: %p", notification);
app_control_h service = NULL;
- if (NULL == notification)
- {
+ if (NULL == notification) {
WDEBUG("Create new notification");
notification = notification_create(NOTIFICATION_TYPE_NOTI);
__setTag(notification);
service = __createAppControl();
- }
- else
- {
+ } else {
WDEBUG("Notification already on status bar");
notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void*)&service);
- if (service)
- {
+ if (service) {
__getNotificationData(alertData);
- }
- else
- {
+ } else {
WDEBUG("There is no app-control");
}
}
__setNotificationData(service, alertData);
notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service);
- if(addSound)
- {
+ if(addSound) {
__addSound(notification);
__addVib(notification);
}
WENTER();
int count = alertData->getCount();
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
auto alertItem = alertData->getAt(i);
auto schedule = alertItem->getSchedule();
WPRET_M((schedule == NULL),"invalid param");
WENTER();
notification_h notification = __getHandle();
- if (notification != NULL)
- {
- if (alertData->getCount() > 0)
- {
+ if (notification != NULL) {
+ if (alertData->getCount() > 0) {
app_control_h service = NULL;
notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void*)&service);
- if(service)
- {
+ if(service) {
__setupStatusBarNotification(notification, alertData);
__setNotificationData(service, alertData);
notification_set_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, service);
}
notification_update(notification);
- }
- else
- {
+ } else {
WDEBUG("No more events! Delete notification");
notification_delete(notification);
notification_free(notification);
WENTER();
notification_h notification = __getHandle();
- if (notification != NULL)
- {
+ if (notification != NULL) {
WDEBUG("Remove id[%d] from notification", id);
std::shared_ptr<CalAlertData> alertData = std::make_shared<CalAlertData>();
- if (alertData->removeById(id))
- {
- if (alertData->getCount() == 0)
- {
+ if (alertData->removeById(id)) {
+ if (alertData->getCount() == 0) {
WDEBUG("No more events! Delete notification");
notification_delete(notification);
return;
std::vector<std::shared_ptr<CalAlertNotificationItem> > items;
getAllStatusBar(items);
- for (auto it = items.begin() ; it != items.end(); ++it)
- {
+ for (auto it = items.begin() ; it != items.end(); ++it) {
calendar_record_h record = NULL;
int recordIndex = (*it)->getRecordIndex();
int error = calendar_db_get_record(_calendar_event._uri, recordIndex, &record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WDEBUG("remove[%d]",recordIndex);
removeFromNotification(recordIndex);
}
- if (record)
- {
+ if (record) {
calendar_record_destroy(record, true);
}
}
WENTER();
std::string sound;
__getSound(sound);
- if (!sound.empty())
- {
+ if (!sound.empty()) {
WDEBUG("sound:%s",sound.c_str());
- if (!strcmp(sound.c_str(), CAL_SETTING_NOTIFICATION_SOUND_DEFAULT))
- {
+ if (!strcmp(sound.c_str(), CAL_SETTING_NOTIFICATION_SOUND_DEFAULT)) {
char *value = NULL;
int result = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, &value);
- if (result == SYSTEM_SETTINGS_ERROR_NONE && value)
- {
+ if (result == SYSTEM_SETTINGS_ERROR_NONE && value) {
WDEBUG("get default ringtone(%s)", value);
notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_USER_DATA, value);
- }
- else
- {
+ } else {
WERROR("fail");
notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_USER_DATA, NULL);
}
free(value);
- }
- else
- {
+ } else {
notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_USER_DATA, sound.c_str());
}
- }
- else
- {
+ } else {
WERROR("sound is null");
notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_NONE, NULL);
}
{
WENTER();
const char* alertSound = CalSettingsManager::getInstance().getAlertSound();
- if (alertSound)
- {
+ if (alertSound) {
sound = alertSound;
}
}
const char *event_name = schedule->getSummary();
notification_h notification = notification_create(NOTIFICATION_TYPE_NOTI);
- if (event_name && *event_name)
- {
+ if (event_name && *event_name) {
CalDateTime startTime;
std::string timeBuff;
std::stringstream title;
title << timeBuff;
const char * location = schedule->getLocation();
- if (location)
- {
- if (strlen(location))
- {
+ if (location) {
+ if (strlen(location)) {
title << ", ";
title << location;
}
}
notification_set_text(notification, NOTIFICATION_TEXT_TYPE_INFO_1, event_name, NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, title.str().c_str(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- }
- else
- {
+ } else {
notification_set_text(notification, NOTIFICATION_TEXT_TYPE_INFO_1, _L_("IDS_CLD_MBODY_MY_EVENT"), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
}
- if (addSound)
- {
+ if (addSound) {
__addSound(notification);
__addVib(notification);
}
notification_set_time(notification, time(NULL));
int noti_err = notification_post(notification);
- if (noti_err != NOTIFICATION_ERROR_NONE)
- {
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
WERROR("Notification post fail [%d]", noti_err);
}
}
notification_h notification = __getHandle();
WDEBUG("Notification: %p", notification);
- if (notification)
- {
+ if (notification) {
notification_delete(notification);
notification_free(notification);
}
{
WENTER();
notification_h notification = __getHandle();
- if (!notification)
- {
+ if (!notification) {
WWARNING("No status-bar notification");
return;
}
app_control_h service = NULL;
int err = notification_get_launch_option(notification, NOTIFICATION_LAUNCH_OPTION_APP_CONTROL, (void *)&service);
- if (service && err == NOTIFICATION_ERROR_NONE)
- {
+ if (service && err == NOTIFICATION_ERROR_NONE) {
WDEBUG("service: %p", service);
char **idsStr = NULL;
int alertCount = 0;
int recordIndex = 0;
app_control_get_extra_data_array(service, CAL_APPCALSVC_PARAM_IDS, &idsStr, &alertCount);
- if (idsStr && alertCount > 0)
- {
- for (int i = 0; i < alertCount; i++)
- {
+ if (idsStr && alertCount > 0) {
+ for (int i = 0; i < alertCount; i++) {
recordIndex = atoi(idsStr[i]);
WDEBUG("recordIndex: %d", recordIndex);
app_control_get_extra_data(service, key, &isSnoozed);
auto item = std::make_shared<CalAlertNotificationItem>(recordIndex);
- if(isSnoozed && !strcmp(isSnoozed, CAL_APPALERT_IS_SNOOZED))
- {
+ if(isSnoozed && !strcmp(isSnoozed, CAL_APPALERT_IS_SNOOZED)) {
WDEBUG("Snoozed!!!");
item->setSnoozed(true);
free(isSnoozed);
free(idsStr[i]);
}
free(idsStr);
- }
- else
- {
+ } else {
WERROR("Get notification data fail");
app_control_destroy(service);
notification_free(notification);
char recordIndexText[INDEX_BUFFER] = {0};
snprintf(recordIndexText, sizeof(recordIndexText), "%d", recordIndex);
- do
- {
+ do {
app_control_h app_control = NULL;
- if (APP_CONTROL_ERROR_NONE != app_control_create(&app_control))
- {
+ if (APP_CONTROL_ERROR_NONE != app_control_create(&app_control)) {
WERROR("Failed to create app_control");
break;
}
app_control_set_app_id(app_control, CALENDAR_NOTI_PACKAGE);
- if (CAL_ALERT_DISMISS == action)
- {
+ if (CAL_ALERT_DISMISS == action) {
WDEBUG("Set app control for DISMISS");
app_control_add_extra_data(app_control, CAL_APPALERT_PARAM_ACTION, CAL_APPALERT_ACTION_DISMISS);
- }
- else if (CAL_ALERT_SNOOZE == action)
- {
+ } else if (CAL_ALERT_SNOOZE == action) {
WDEBUG("Set app control for SNOOZE");
app_control_add_extra_data(app_control, CAL_APPALERT_PARAM_ACTION, CAL_APPALERT_ACTION_SNOOZE);
- }
- else
- {
+ } else {
WERROR("Wrong action");
app_control_destroy(app_control);
break;
notification_h notification = NULL;
notification = notification_load_by_tag(CALENDAR_NOTI_PACKAGE);
WDEBUG("Notification: %p", notification);
- if(NULL == notification)
- {
+ if(NULL == notification) {
int err = get_last_result();
WDEBUG("Load notification by tag fail: '%s', %d (%s)", CALENDAR_NOTI_PACKAGE, err, get_error_message(err));
}
int ret = notification_set_tag(notification, CALENDAR_NOTI_PACKAGE);
WDEBUG("set tag %s, notification: %p", CALENDAR_NOTI_PACKAGE, notification);
- if (ret != NOTIFICATION_ERROR_NONE)
- {
+ if (ret != NOTIFICATION_ERROR_NONE) {
WERROR("set tag option fail: %d", ret);
}
}
{
WENTER();
int alertCount = alertData->getCount();
- if (alertCount > 0)
- {
+ if (alertCount > 0) {
char snoozedKey[ID_LENGTH] = {0};
char alarmIdKey[ID_LENGTH] = {0};
char alarmId[ID_LENGTH] = {0};
char **ids = g_new0(char*, alertCount);
- for (int i = 0; i < alertCount; ++i)
- {
+ for (int i = 0; i < alertCount; ++i) {
auto alertItem = alertData->getAt(i);
int id = alertItem->getScheduleId();
char* strId = g_strdup_printf("%d", id);
ids[i] = strId;
- if(alertItem->isSnoozed())
- {
+ if(alertItem->isSnoozed()) {
snprintf(snoozedKey, sizeof(snoozedKey), "%d.%s", id, CAL_APPALERT_PARAM_IS_SNOOZED);
app_control_add_extra_data(service, snoozedKey, CAL_APPALERT_IS_SNOOZED);
}
app_control_add_extra_data_array(service, CAL_APPCALSVC_PARAM_IDS, (const char**)ids, alertCount);
- for (int i = 0; i < alertCount; i++)
- {
+ for (int i = 0; i < alertCount; i++) {
g_free(ids[i]);
}
g_free(ids);
int count = alertData->getCount();
WDEBUG("Alerts count: %d", count);
- if (count > 1)
- {
+ if (count > 1) {
WDEBUG("Multiple event");
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
auto alertItem = alertData->getAt(i);
char *eventName = alertItem->getEventOriginalName();
WDEBUG("Event name: %s", eventName);
- if (eventName && *eventName)
- {
+ if (eventName && *eventName) {
subTitle << eventName;
free(eventName);
- }
- else
- {
+ } else {
subTitle << _L_("IDS_CLD_MBODY_MY_EVENT");
}
- if (i < count - 1)
- {
+ if (i < count - 1) {
subTitle << ", ";
}
}
notification_set_text(notification, NOTIFICATION_TEXT_TYPE_TITLE, title.str().c_str(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
notification_set_text(notification, NOTIFICATION_TEXT_TYPE_CONTENT, subTitle.str().c_str(), NULL, NOTIFICATION_VARIABLE_TYPE_NONE);
- }
- else if (count == 1)
- {
+ } else if (count == 1) {
WDEBUG("Single event");
auto alertItem = alertData->getAt(0);
char *eventName = alertItem->getEventOriginalName();
subTitle << startTime;
char * location = alertItem->getLocation();
- if (*location)
- {
+ if (*location) {
subTitle << ", ";
subTitle << location;
}
WDEBUG("Title: %s", title);
WDEBUG("Sub-title: %s", subTitle.str().c_str());
- }
- else
- {
+ } else {
WERROR("No events!");
}
}
{
CalTheme::finalize();
- if(!__replyToRequest)
- {
+ if(!__replyToRequest) {
__replyError();
}
}
WDEBUG(" __editMode: %d", __editMode);
CalNaviframe* frame = (CalNaviframe*)getWindow()->getBaseUiObject();
CalEditView* view = new CalEditView(__schedule, __editMode,
- [this](int newId)
- {
+ [this](int newId) {
app_control_h reply;
app_control_create(&reply);
{
char *value = NULL;
int ret = app_control_get_extra_data(__request, APP_CONTROL_DATA_ID, &value);
- if (APP_CONTROL_ERROR_NONE != ret || !value || !strlen(value))
- {
- if(!__replyToRequest)
- {
+ if (APP_CONTROL_ERROR_NONE != ret || !value || !strlen(value)) {
+ if(!__replyToRequest) {
__replyError();
}
free(value);
- if(__schedule)
- {
+ if(__schedule) {
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_START_TIME, &value);
- if (value)
- {
+ if (value) {
struct tm startTm = {0};
strptime(value, "%Y-%m-%d %H:%M:%S", &startTm);
free(value);
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_END_TIME, &value);
- if (value)
- {
+ if (value) {
struct tm endTm = {0};
strptime(value, "%Y-%m-%d %H:%M:%S", &endTm);
free(value);
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_ALLDAY, &value);
- if (value)
- {
- if (!strcasecmp(value, "true") || !strcasecmp(value, "1"))
- {
+ if (value) {
+ if (!strcasecmp(value, "true") || !strcasecmp(value, "1")) {
CalDateTime startTime, endTime;
__schedule->getStart(startTime);
__schedule->getEnd(endTime);
bool isAllDay = false;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_ALLDAY, &value);
WDEBUG("all_day = %s", value);
- if (value)
- {
- if (!strcasecmp(value, "true") || !strcasecmp(value, "1"))
- {
+ if (value) {
+ if (!strcasecmp(value, "true") || !strcasecmp(value, "1")) {
isAllDay = true;
}
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_START_TIME, &value);
WDEBUG("%s", value);
- if (value)
- {
+ if (value) {
WDEBUG("start_time = %s", value);
struct tm startTm = {0};
strptime(value, "%Y-%m-%d %H:%M:%S", &startTm);
free(value);
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_CALENDAR_END_TIME, &value);
- if (value)
- {
+ if (value) {
WDEBUG("end_time = %s", value);
struct tm endTm = {0};
strptime(value, "%Y-%m-%d %H:%M:%S", &endTm);
CalDateTime startDateTime(startTm);
CalDateTime endDateTime(endTm);
- if(isAllDay && endDateTime.isSameDay(startDateTime))
- {
+ if(isAllDay && endDateTime.isSameDay(startDateTime)) {
// reset hours & minutes, if any
CalDateTime dateTemp = CalDateTime(startDateTime.getYear(), startDateTime.getMonth(), startDateTime.getMday(), 0, 0, 0);
startDateTime = dateTemp;
endDateTime = dateTemp;
}
__schedule = CalSchedule::makeDefaultSchedule(startDateTime, endDateTime);
- }
- else
- {
+ } else {
CalDateTime startDateTime(startTm);
startDateTime.setAllDay(isAllDay);
__schedule = CalSchedule::makeDefaultSchedule(startDateTime);
}
- }
- else
- {
+ } else {
__schedule = CalSchedule::makeDefaultSchedule(isAllDay);
}
{
char *value = NULL;
int ret = app_control_get_operation(__request, &value);
- if (APP_CONTROL_ERROR_NONE == ret && value && !strcmp(value, APP_CONTROL_OPERATION_EDIT))
- {
+ if (APP_CONTROL_ERROR_NONE == ret && value && !strcmp(value, APP_CONTROL_OPERATION_EDIT)) {
__editMode = CalEditView::EDIT_EXTERNAL;
}
free(value);
WDEBUG("mode = %d", __editMode);
- if(__editMode == CalEditView::EDIT_EXTERNAL)
- {
+ if(__editMode == CalEditView::EDIT_EXTERNAL) {
__makeScheduleForEditMode();
- }
- else
- {
+ } else {
__makeScheduleForCreateMode();
}
}
char *value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_TITLE, &value);
WDEBUG("title = %s", value);
- if (value && __schedule)
- {
+ if (value && __schedule) {
__schedule->setSummary(value);
}
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_TEXT, &value);
WDEBUG("description = %s", value);
- if (value && __schedule)
- {
+ if (value && __schedule) {
__schedule->setDescription(value);
}
value = NULL;
app_control_get_extra_data(__request, APP_CONTROL_DATA_LOCATION, &value);
WDEBUG("location = %s", value);
- if (value && __schedule)
- {
+ if (value && __schedule) {
__schedule->setLocation(value);
}
WPRET_M(ret != APP_CONTROL_ERROR_NONE, "Can't clone the request");
ret = app_control_get_extra_data(__request, APP_CONTROL_DATA_SELECTION_MODE, &value);
- if(APP_CONTROL_ERROR_NONE == ret && value && !strcasecmp(APP_CONTROL_DATA_SELECTION_MODE_MULTIPLE, value))
- {
+ if(APP_CONTROL_ERROR_NONE == ret && value && !strcasecmp(APP_CONTROL_DATA_SELECTION_MODE_MULTIPLE, value)) {
__mode = CalPickApp::SELECTION_MODE_MULTIPLE;
__maxLimit = MULTI_SELECT_MAX;
}
value = NULL;
ret = app_control_get_extra_data(__request, APP_CONTROL_DATA_TOTAL_COUNT, &value);
- if (APP_CONTROL_ERROR_NONE == ret && value)
- {
+ if (APP_CONTROL_ERROR_NONE == ret && value) {
__maxLimit = atoi(value);
}
ret = app_control_get_extra_data(__request, APP_CONTROL_DATA_TYPE, &value);
WDEBUG("Result type: %s", value);
- if (APP_CONTROL_ERROR_NONE == ret && value)
- {
- if (!strcasecmp(APP_CONTROL_KEY_VCS, value))
- {
+ if (APP_CONTROL_ERROR_NONE == ret && value) {
+ if (!strcasecmp(APP_CONTROL_KEY_VCS, value)) {
__resultType = CalPickView::RESULT_TYPE_VCS;
- }
- else if (!strcasecmp(APP_CONTROL_KEY_ID, value))
- {
+ } else if (!strcasecmp(APP_CONTROL_KEY_ID, value)) {
__resultType = CalPickView::RESULT_TYPE_ID;
- }
- else
- {
+ } else {
app_control_h reply;
app_control_create(&reply);
app_control_reply_to_launch_request(reply, __request, APP_CONTROL_RESULT_FAILED);
}
ret = app_control_get_mime(__request, &value);
- if (APP_CONTROL_ERROR_NONE == ret && value && !strcasecmp(APP_CONTROL_MIME_TEXT_CALENDAR, value))
- {
+ if (APP_CONTROL_ERROR_NONE == ret && value && !strcasecmp(APP_CONTROL_MIME_TEXT_CALENDAR, value)) {
__mimeType = CalPickApp::MIME_ICS;
}
{
WENTER();
- if (__mode != CalPickApp::SELECTION_MODE_MULTIPLE && __mode != CalPickApp::SELECTION_MODE_SINGLE)
- {
+ if (__mode != CalPickApp::SELECTION_MODE_MULTIPLE && __mode != CalPickApp::SELECTION_MODE_SINGLE) {
WERROR("Unsupported mode : %d", __mode);
return;
}
- if(schedules.size() <= 0)
- {
+ if(schedules.size() <= 0) {
WERROR("No events selected");
elm_exit();
}
char* filePath = NULL;
- if (__resultType == CalPickView::RESULT_TYPE_VCS)
- {
+ if (__resultType == CalPickView::RESULT_TYPE_VCS) {
std::string fileTemplate = __mimeType == CalPickApp::MIME_ICS ? CAL_ICS_FILE_TEMPLATE : CAL_VCS_FILE_TEMPLATE;
std::string pathFormat = CalPath::getPath(fileTemplate, CalPath::DATA);
- for (auto it : schedules)
- {
+ for (auto it : schedules) {
filePath = g_strdup_printf(pathFormat.c_str(), it->getIndex());
CalDataManager::getInstance().generateVcsFromSchedule(*it, filePath);
resultArray[resultIndex] = filePath;
WDEBUG("resultArray[%d] = %s", resultIndex, resultArray[resultIndex]);
resultIndex++;
}
- }
- else if (__resultType == CalPickView::RESULT_TYPE_ID)
- {
- for (auto it : schedules)
- {
+ } else if (__resultType == CalPickView::RESULT_TYPE_ID) {
+ for (auto it : schedules) {
resultArray[resultIndex] = g_strdup_printf("%d", it->getIndex());
WDEBUG("resultArray[%d] = %s", resultIndex, resultArray[resultIndex]);
resultIndex++;
__request = nullptr;
app_control_destroy(reply);
- for (int i = 0; i < resultIndex; i++)
- {
+ for (int i = 0; i < resultIndex; i++) {
g_free(resultArray[i]);
}
);
elm_object_item_part_content_set(naviItem, "title_right_btn", button);
- createList([this](std::shared_ptr<CalSchedule> schedule)
- {
- if(__selectedScheduleSet.exists(schedule))
- {
+ createList([this](std::shared_ptr<CalSchedule> schedule) {
+ if(__selectedScheduleSet.exists(schedule)) {
WHIT();
__selectedScheduleSet.remove(schedule);
- }
- else
- {
+ } else {
WHIT();
__selectedScheduleSet.add(schedule);
}
this->__updateTitleInfo();
}, true);
- if(__maxLimit > 0)
- {
- __list->setMaxLimitSelectCb([this]()
- {
+ if(__maxLimit > 0) {
+ __list->setMaxLimitSelectCb([this]() {
char warningText[CAL_WARNING_MAX_LENGTH] = {0};
- if (__resultType == CalPickView::RESULT_TYPE_TEXT || __resultType == CalPickView::RESULT_TYPE_ID)
- {
+ if (__resultType == CalPickView::RESULT_TYPE_TEXT || __resultType == CalPickView::RESULT_TYPE_ID) {
snprintf(warningText, sizeof(warningText)-1, _L_("IDS_CLD_TPOP_MAXIMUM_NUMBER_OF_EVENTS_THAT_CAN_BE_INSERTED_HPD_REACHED"), __maxLimit);
- }
- else
- {
+ } else {
snprintf(warningText, sizeof(warningText)-1, _L_("IDS_CLD_TPOP_MAXIMUM_NUMBER_OF_ATTACHMENTS_HPD_REACHED"), __maxLimit);
}
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::DB_CHANGED:
case CalEvent::TIME_CHANGED:
case CalEvent::LANGUAGE_CHANGED:
int selectedItemCount = 0;
selectedItemCount = __selectedScheduleSet.getCount();
- if (__maxLimit > 0)
- {
+ if (__maxLimit > 0) {
snprintf(title, sizeof(title), "%d/%d", selectedItemCount, __maxLimit);
- }
- else
- {
+ } else {
snprintf(title, sizeof(title), _L_("IDS_CLD_HEADER_PD_SELECTED_ABB3"), selectedItemCount);
}
setTitle(title);
- if (getNaviItem())
- {
+ if (getNaviItem()) {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", getTitle());
Evas_Object* button = elm_object_item_part_content_get(getNaviItem(), "title_right_btn");
elm_object_disabled_set(button, selectedItemCount > 0 ? EINA_FALSE : EINA_TRUE);
void CalPickView::__reCheck()
{
WENTER();
- if(__selectedScheduleSet.getCount() <= 0)
- {
+ if(__selectedScheduleSet.getCount() <= 0) {
return;
}
__selectedScheduleSet.getList(selectedScheduleList);
auto it = selectedScheduleList.begin();
- for( ; it != selectedScheduleList.end(); ++it)
- {
+ for( ; it != selectedScheduleList.end(); ++it) {
int eventId = (*it)->getIndex();
CalDateTime startTime;
(*it)->getStart(startTime);
{
CalTheme::finalize();
- if(!__replyToRequest)
- {
+ if(!__replyToRequest) {
__replyError();
}
}
{
CalNaviframe* frame = (CalNaviframe*)getWindow()->getBaseUiObject();
const char* filePath = __getFilePath();
- if (filePath)
- {
+ if (filePath) {
WDEBUG("URI = %s", filePath);
- if (__isVtsFile(filePath))
- {
+ if (__isVtsFile(filePath)) {
notification_status_message_post(_L_("IDS_CLD_TPOP_VTS_FILES_NOT_SUPPORTED"));
}
std::list<std::shared_ptr<CalSchedule>> schedules;
CalDataManager::getInstance().getSchedulesFromVcs(filePath, schedules);
int count = schedules.size();
- if (count == 1)
- {
+ if (count == 1) {
std::shared_ptr<CalSchedule> inputSchedule = *(schedules.begin());
frame->push(new CalDetailView(inputSchedule, CalDetailView::MENU_DISABLED, true));
- }
- else
- {
+ } else {
frame->push(new CalVcsView(schedules));
}
__replyToRequest = true;
- }
- else
- {
+ } else {
WDEBUG("MIME") ;
char *value = NULL;
int ret = app_control_get_extra_data(__request, APP_CONTROL_DATA_ID, &value);
WDEBUG("get %s [%s]", APP_CONTROL_DATA_ID, value);
- if (APP_CONTROL_ERROR_NONE != ret || !value || !strlen(value))
- {
+ if (APP_CONTROL_ERROR_NONE != ret || !value || !strlen(value)) {
free(value);
__replyError();
bool CalViewApp::__isVtsFile(const char* filePath)
{
- if (!filePath)
- {
+ if (!filePath) {
return false;
}
int len = strlen(filePath);
free(__internalFilePath);
__internalFilePath = NULL;
int ret = app_control_get_uri(__request, &__internalFilePath);
- if (ret != CALENDAR_ERROR_NONE || !__internalFilePath || !strlen(__internalFilePath))
- {
+ if (ret != CALENDAR_ERROR_NONE || !__internalFilePath || !strlen(__internalFilePath)) {
WERROR("app_control_get_uri failed : %d", ret);
free(__internalFilePath);
__internalFilePath = NULL;
#define CAL_URI_FILE_FORMAT "file://"
WDEBUG("vcs path = %s", __internalFilePath);
- if (!strstr(__internalFilePath, CAL_URI_FILE_FORMAT))
- {
+ if (!strstr(__internalFilePath, CAL_URI_FILE_FORMAT)) {
return __internalFilePath;
}
WENTER();
char* value = NULL;
app_control_get_extra_data(request, APP_CONTROL_DATA_ID, &value);
- if (value && strlen(value))
- {
+ if (value && strlen(value)) {
int scheduleId = atoi(value);
free(value);
value = NULL;
calendar_record_h record = NULL;
int error = calendar_db_get_record(_calendar_event._uri, scheduleId, &record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("unable to find %d event", scheduleId);
return nullptr;
}
CalAppControlLauncher& CalAppControlLauncher::getInstance()
{
- if(__instance == NULL)
- {
+ if(__instance == NULL) {
__instance = new CalAppControlLauncher();
}
__appControl = request;
- if (objToBlock)
- {
+ if (objToBlock) {
__evasObjBlocked = WEvasObject_getWeakPtr(objToBlock);
auto p = __evasObjBlocked.lock();
}
int ret = app_control_send_launch_request(request, callback, userData);
- if(ret != APP_CONTROL_ERROR_NONE)
- {
+ if(ret != APP_CONTROL_ERROR_NONE) {
WERROR("app_control return error code= %d", ret);
app_control_destroy(__appControl);
__appControl = NULL;
void CalAppControlLauncher::unblockUi()
{
- if(auto safeObj = __evasObjBlocked.lock())
- {
+ if(auto safeObj = __evasObjBlocked.lock()) {
Evas_Object* obj = safeObj->getEvasObj();
evas_object_freeze_events_set(obj, EINA_FALSE);
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, __evasObjDelCb, this);
__evasObjBlocked.reset();
}
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
__timer = NULL;
}
bool CalAppControlLauncher::isUiBlocked()
{
- if (auto safeObj = __evasObjBlocked.lock())
- {
+ if (auto safeObj = __evasObjBlocked.lock()) {
return true;
}
CalAppControlLauncher* p = (CalAppControlLauncher*)userData;
- if( auto safeObj = p->__evasObjBlocked.lock() )
- {
+ if( auto safeObj = p->__evasObjBlocked.lock() ) {
Evas_Object* obj = safeObj->getEvasObj();
evas_object_freeze_events_set(obj, EINA_FALSE);
evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL, __evasObjDelCb, p);
void CalAppControlLauncher::__evasObjDelCb(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
CalAppControlLauncher* p = (CalAppControlLauncher*)data;
- if ( p->__timer)
- {
+ if ( p->__timer) {
ecore_timer_del( p->__timer);
p->__timer = NULL;
}
void CalAppControlLauncher::__clearAll()
{
- if( __appControl )
- {
+ if( __appControl ) {
WHIT();
int ret = app_control_send_terminate_request( __appControl );
- if( ret != APP_CONTROL_ERROR_NONE )
- {
+ if( ret != APP_CONTROL_ERROR_NONE ) {
WWARNING("app_control ret error code= %d", ret);
}
app_control_destroy(__appControl);
{
int fontSize = 0;
Eina_Bool res = edje_text_class_get("list_item", NULL, &fontSize);
- if (!res)
- {
+ if (!res) {
fontSize = TEXT_ITEM_DEFAULT_SIZE;
- }
- else if (fontSize < 0)
- {
+ } else if (fontSize < 0) {
fontSize = -fontSize * TEXT_ITEM_DEFAULT_SIZE / 100;
}
- if(fontSize > TEXT_MAX_GOOD_SIZE)
- {
+ if(fontSize > TEXT_MAX_GOOD_SIZE) {
fontSize = TEXT_MAX_GOOD_SIZE;
}
WPRET_VM((genlist == NULL),NULL,"get fail");
objectItem = elm_genlist_item_append(genlist, item->getItemClassStatic(), item, NULL, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
CalDialogControl::Item* item = (CalDialogControl::Item*)data;
const int dy = currentPoint.y - __pressedPoint.y;
WDEBUG("%x (%d, %d) (%d, %d)", this, currentPoint.x, currentPoint.y, dx, dy);
- if (!__isValidDrag && (abs(dx) > THRESHOLD || abs(dy) > THRESHOLD) && claimThisTouchToBeMine())
- {
+ if (!__isValidDrag && (abs(dx) > THRESHOLD || abs(dy) > THRESHOLD) && claimThisTouchToBeMine()) {
__isValidDrag = true;
}
- if (__isValidDrag)
- {
+ if (__isValidDrag) {
__onDragged(dx, dy);
}
}
const CalEvent& CalEvent::operator=(const CalEvent& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
type = obj.type;
source = obj.source;
}
WENTER();
WDEBUG("%p", listener);
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
WDEBUG("null");
return;
}
WENTER();
WDEBUG("%p", listener);
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
WDEBUG("null");
return;
}
WENTER();
WDEBUG("%p", listener);
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
WDEBUG("null");
return;
}
void CalEventManager::notify(const CalEvent& event)
{
WENTER();
- if (__isSuspended)
- {
- for (auto it = __listenerMap.begin(); it != __listenerMap.end();)
- {
+ if (__isSuspended) {
+ for (auto it = __listenerMap.begin(); it != __listenerMap.end();) {
auto node = it->second;
it++;
__addtoEventTable(node, event);
return;
}
- for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it)
- {
+ for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it) {
auto node = it->second;
- if (node->isBlocked)
- {
+ if (node->isBlocked) {
WDEBUG("node->isBlocked");
__addtoEventTable(node, event);
- }
- else
- {
- if (event.source == CalEvent::REMOTE)
- {
+ } else {
+ if (event.source == CalEvent::REMOTE) {
int timeout = __getTimeoutForTimerForPendingEvents();
WDEBUG("an event from a remote one, timeout = %d", timeout);
- if (timeout == 0)
- {
+ if (timeout == 0) {
node->listener->onEvent(event);
- }
- else
- {
+ } else {
__addtoEventTable(node, event);
}
- }
- else
- {
+ } else {
node->listener->onEvent(event);
}
}
}
- if (event.source == CalEvent::REMOTE)
- {
+ if (event.source == CalEvent::REMOTE) {
__addTimerForPendingEvents();
}
void CalEventManager::clear()
{
- for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it)
- {
+ for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it) {
auto node = it->second;
auto first = it->first;
void CalEventManager::__resetEventTable(ListenerNode* node)
{
// reset the event table
- for (int i = 1; i < CalEvent::TYPE_MAX; i++)
- {
- for (int j = 0; j < CalEvent::SOURCE_MAX; j++)
- {
+ for (int i = 1; i < CalEvent::TYPE_MAX; i++) {
+ for (int j = 0; j < CalEvent::SOURCE_MAX; j++) {
node->eventTable[i][j] = NULL;
}
}
void CalEventManager::__addtoEventTable(ListenerNode* node, const CalEvent& event)
{
// add it to the event table
- if (node->eventTable[event.type][event.source])
- {
+ if (node->eventTable[event.type][event.source]) {
delete node->eventTable[event.type][event.source];
}
void CalEventManager::__notifyFromEventTable(ListenerNode* node)
{
// notify events from the event table
- for (int i = 1; i < CalEvent::TYPE_MAX; i++)
- {
- for (int j = 0; j < CalEvent::SOURCE_MAX; j++)
- {
- if (node->eventTable[i][j])
- {
+ for (int i = 1; i < CalEvent::TYPE_MAX; i++) {
+ for (int j = 0; j < CalEvent::SOURCE_MAX; j++) {
+ if (node->eventTable[i][j]) {
ICalEventListener* listener = node->listener;
node->listener->onEvent(*(node->eventTable[i][j]));
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
WDEBUG("null");
return;
}
void CalEventManager::__notifyFromEventTable(ListenerNode* node, CalEvent::Source source)
{
// notify events from the event table
- for (int i = 1; i < CalEvent::TYPE_MAX; i++)
- {
- if (node->eventTable[i][source])
- {
+ for (int i = 1; i < CalEvent::TYPE_MAX; i++) {
+ if (node->eventTable[i][source]) {
ICalEventListener* listener = node->listener;
node->listener->onEvent(*(node->eventTable[i][source]));
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
WDEBUG("null");
return;
}
void CalEventManager::__clearEventTable(ListenerNode* node)
{
// clear the event table
- for (int i = 1; i < CalEvent::TYPE_MAX; i++)
- {
- for (int j = 0; j < CalEvent::SOURCE_MAX; j++)
- {
- if (node->eventTable[i][j])
- {
+ for (int i = 1; i < CalEvent::TYPE_MAX; i++) {
+ for (int j = 0; j < CalEvent::SOURCE_MAX; j++) {
+ if (node->eventTable[i][j]) {
delete node->eventTable[i][j];
node->eventTable[i][j] = NULL;
}
void CalEventManager::__processTimerForPendingEvents()
{
WENTER();
- for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it)
- {
+ for (auto it = __listenerMap.begin(); it != __listenerMap.end(); ++it) {
auto node = it->second;
- if (node->isBlocked)
- {
+ if (node->isBlocked) {
WDEBUG("node->isBlocked");
continue;
- }
- else
- {
+ } else {
__notifyFromEventTable(node, CalEvent::REMOTE);
}
}
__timerForPeindingEvents = NULL;
- if (__pendingEvents)
- {
+ if (__pendingEvents) {
__addTimerForPendingEvents();
- }
- else
- {
+ } else {
WDEBUG("expired");
__resetTimeoutForTimerForPendingEvents();
}
void CalEventManager::__addTimerForPendingEvents()
{
WENTER();
- if (__timerForPeindingEvents)
- {
+ if (__timerForPeindingEvents) {
//a request before timed out, just set the flag
__pendingEvents = true;
return;
void CalEventManager::__removeTimerForPendingEvents()
{
WENTER();
- if (__timerForPeindingEvents)
- {
+ if (__timerForPeindingEvents) {
ecore_timer_del(__timerForPeindingEvents);
}
{
WENTER();
// check if there is any request before timed out, if it's true, update the next timeout for update (x2)
- if (__timeout == 0)
- {
+ if (__timeout == 0) {
__timeout = 2;
- }
- else
- {
- if (__timeout >= __timeoutMax)
- {
+ } else {
+ if (__timeout >= __timeoutMax) {
__timeout = __timeoutMax;
- }
- else
- {
+ } else {
__timeout *= 2;
}
}
WENTER();
__isSuspended = false;
- for (auto it = __listenerMap.begin(); it != __listenerMap.end();)
- {
+ for (auto it = __listenerMap.begin(); it != __listenerMap.end();) {
auto node = it->second;
it++;
- if (node->isBlocked)
- {
+ if (node->isBlocked) {
WDEBUG("node->isBlocked");
continue;
- }
- else
- {
+ } else {
__notifyFromEventTable(node);
}
}
{
WENTER();
auto finder = __listenerMap.find(listener);
- if (finder == __listenerMap.end())
- {
+ if (finder == __listenerMap.end()) {
return true;
}
WENTER();
CalEventManager::getInstance().attach((CalView*)view);
Elm_Object_Item* item = elm_naviframe_top_item_get(getEvasObj());
- if (item)
- {
+ if (item) {
CalView* targetView = (CalView*)WView_getInstanceFromEvasObj(
elm_object_item_part_content_get(item, "elm.swallow.content"));
{
WENTER();
bool ret = WNaviframe::onItemPop(view, item);
- if (!ret)
- {
+ if (!ret) {
return false;
}
{
CalEventManager::getInstance().detach((CalView*)view);
Eina_List* itemList = elm_naviframe_items_get(getEvasObj());
- if (itemList)
- {
+ if (itemList) {
int nth = eina_list_count(itemList) - 2;
- if (nth >= 0)
- {
+ if (nth >= 0) {
Elm_Object_Item* tempItem = (Elm_Object_Item*)eina_list_nth(itemList, nth);
- if (tempItem)
- {
+ if (tempItem) {
CalView* targetView = (CalView*)WView_getInstanceFromEvasObj(
elm_object_item_part_content_get(tempItem, "elm.swallow.content"));
WASSERT(targetView);
{
WENTER();
- if (!CalEventManager::getInstance().isDetached((CalView*)view))
- {
+ if (!CalEventManager::getInstance().isDetached((CalView*)view)) {
__arrangeEventManager(view, item);
}
const std::string &CalPath::getEdjeDir()
{
static std::string edjeDir;
- if(edjeDir.empty())
- {
+ if(edjeDir.empty()) {
edjeDir = getResourceDir();
edjeDir.append(CAL_EDJE_DIR);
}
const std::string &CalPath::getSharedResourceDir()
{
static std::string sharedResDir;
- if(sharedResDir.empty())
- {
+ if(sharedResDir.empty()) {
char *sharedPath = app_get_shared_resource_path();
sharedResDir = sharedPath;
free(sharedPath);
const std::string &CalPath::getLocaleDir()
{
static std::string localeDir;
- if(localeDir.empty())
- {
+ if(localeDir.empty()) {
localeDir = getResourceDir();
localeDir.append(CAL_LOCALE_DIR);
}
const std::string &CalPath::getThemeDir()
{
static std::string themeDir;
- if(themeDir.empty())
- {
+ if(themeDir.empty()) {
themeDir = getEdjeDir();
themeDir.append(CAL_THEME_DIR);
}
const std::string &CalPath::getImageDir()
{
static std::string imageDir;
- if(imageDir.empty())
- {
+ if(imageDir.empty()) {
imageDir = getResourceDir();
imageDir.append(CAL_IMAGE_DIR);
}
const std::string &CalPath::getDataDir()
{
static std::string dataDir;
- if(dataDir.empty())
- {
+ if(dataDir.empty()) {
char *dataPath = app_get_data_path();
dataDir = dataPath;
free(dataPath);
const std::string &CalPath::getResourceDir()
{
static std::string resourceDir;
- if(resourceDir.empty())
- {
+ if(resourceDir.empty()) {
#ifdef CAL_DIR
resourceDir = CAL_DIR "/res/";
#else
CalSlideAnimator::~CalSlideAnimator()
{
- if(__mAnimator)
- {
+ if(__mAnimator) {
ecore_animator_del(__mAnimator);
}
__mAnimator = NULL;
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
}
__max = max;
__dir = 0;
evas_object_geometry_get(__obj, RECT_REF(__origin));
- for (auto it = __sidekicks.begin(); it != __sidekicks.end(); it++)
- {
+ for (auto it = __sidekicks.begin(); it != __sidekicks.end(); it++) {
Evas_Coord_Rectangle rect;
evas_object_geometry_get(it->obj, RECT_REF(rect));
it->offset.x = rect.x - __origin.x;
void CalSlideAnimator::update(Evas_Coord delta)
{
- if (delta < __min)
- {
+ if (delta < __min) {
delta = __min;
- }
- else if (delta > __max)
- {
+ } else if (delta > __max) {
delta = __max;
}
void CalSlideAnimator::__update(Evas_Object* obj, const Evas_Coord_Rectangle& origin, Evas_Coord delta)
{
- switch (__mode)
- {
+ switch (__mode) {
case VERTICAL_MOVE:
evas_object_move(obj, origin.x, origin.y + delta);
break;
break;
}
- for (auto it = __sidekicks.begin(); it != __sidekicks.end(); it++)
- {
+ for (auto it = __sidekicks.begin(); it != __sidekicks.end(); it++) {
evas_object_move(it->obj, origin.x + it->offset.x, origin.y + delta + it->offset.y);
}
}
__dir = dir;
- if (noAnimation)
- {
+ if (noAnimation) {
__finalize();
- }
- else if (__dir < 0)
- {
+ } else if (__dir < 0) {
__slide(__min + __origin.y);
- }
- else
- {
+ } else {
__slide(__max + __origin.y);
}
}
{
WASSERT(__dir == 0);
- if (noAnimation)
- {
+ if (noAnimation) {
__finalize();
- }
- else
- {
+ } else {
__slide(__origin.y);
}
}
const double remainingRatio = double(__target - __start.y) / __target;
WDEBUG("%d %d %f", __start.y, target, remainingRatio);
- if(__mAnimator)
- {
+ if(__mAnimator) {
ecore_animator_del(__mAnimator);
}
bool CalSlideAnimator::__tween(double pos)
{
- if (pos < 1.0)
- {
+ if (pos < 1.0) {
double map = ecore_animator_pos_map(pos, ECORE_POS_MAP_LINEAR, 0, 0);
__update(__obj, __start, map * (__target - __start.y));
return true;
- }
- else
- {
+ } else {
__update(__obj, __start, (__target - __start.y));
- if(__timer)
- {
+ if(__timer) {
ecore_timer_del(__timer);
}
void CalSlideAnimator::__finalize()
{
- if (__slideFinishedCb)
- {
+ if (__slideFinishedCb) {
__slideFinishedCb(__dir);
}
evas_object_freeze_events_set(__obj, EINA_FALSE);
void CalTapRecognizer::onRelease(Evas_Object* obj, Evas_Event_Mouse_Up* eventInfo)
{
- if ((eventInfo->event_flags & EVAS_EVENT_FLAG_ON_HOLD) == EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if ((eventInfo->event_flags & EVAS_EVENT_FLAG_ON_HOLD) == EVAS_EVENT_FLAG_ON_HOLD) {
/**
* @note
* Do not process the TAP event in this case.
*/
WDEBUG("On Hold triggered");
- }
- else
- {
+ } else {
const Evas_Coord_Point& currentPoint = eventInfo->canvas;
const int dx = currentPoint.x - __pressedPoint.x;
const int dy = currentPoint.y - __pressedPoint.y;
WDEBUG("(%d, %d) (%d, %d)", currentPoint.x, currentPoint.y, dx, dy);
- if (claimThisTouchToBeMine())
- {
+ if (claimThisTouchToBeMine()) {
__onTap(obj);
}
}
void CalTouchInputRecognizer::terminate(Evas_Object* obj)
{
- if(obj)
- {
+ if(obj) {
__waitPress(obj);
}
}
void CalTouchInputRecognizer::__onPress(void* data, Evas* evas, Evas_Object* obj, void* event_info)
{
CalTouchInputRecognizer* self = (CalTouchInputRecognizer*)data;
- if (self->__blocked)
- {
+ if (self->__blocked) {
WDEBUG("blocked");
return;
}
Evas_Event_Mouse_Down* ev = (Evas_Event_Mouse_Down*)event_info;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
WDEBUG("EVAS_EVENT_FLAG_ON_HOLD");
return;
}
void CalTouchInputRecognizer::__onMove(void* data, Evas* evas, Evas_Object* obj, void* event_info)
{
CalTouchInputRecognizer* self = (CalTouchInputRecognizer*)data;
- if (self->__blocked)
- {
+ if (self->__blocked) {
WDEBUG("blocked");
return;
}
Evas_Event_Mouse_Move* ev = (Evas_Event_Mouse_Move*)event_info;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- {
+ if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) {
WDEBUG("EVAS_EVENT_FLAG_ON_HOLD");
return;
}
- if (self->thisTouchIsFreeOrMine())
- {
+ if (self->thisTouchIsFreeOrMine()) {
self->onMove(obj, ev);
}
}
void CalTouchInputRecognizer::__onRelease(void* data, Evas* evas, Evas_Object* obj, void* event_info)
{
CalTouchInputRecognizer* self = (CalTouchInputRecognizer*)data;
- if (self->__blocked)
- {
+ if (self->__blocked) {
WDEBUG("blocked");
self->__waitPress(obj);
return;
bool CalTouchInputRecognizer::claimThisTouchToBeMine()
{
- if (!thisTouchIsFreeOrMine())
- {
+ if (!thisTouchIsFreeOrMine()) {
return false;
}
CalView::~CalView()
{
CalNaviframe *naviframe = static_cast<CalNaviframe *>(getNaviframe());
- if(naviframe)
- {
+ if(naviframe) {
naviframe->destroyView(this, getNaviItem());
}
}
Evas_Object* CalView::__createMenuBtn(Evas_Object* parent, Evas_Smart_Cb func, void* data)
{
Evas_Object* btn = elm_button_add(parent);
- if (!btn)
- {
+ if (!btn) {
return NULL;
}
void CalWorker::wait()
{
WENTER();
- if (__workerThread)
- {
+ if (__workerThread) {
g_thread_join(__workerThread);
__workerThread = NULL;
}
const CalBook& CalBook::operator=(const CalBook& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
this->destroyBook();
return *(obj.cloneBook());
}
void CalBook::destroyBook()
{
cal_book_s *lbook = (cal_book_s*) __book;
- if (lbook)
- {
+ if (lbook) {
calendar_record_destroy(*lbook, true);
free(lbook);
}
bool CalBook::isReadOnly() const
{
- if (getMode() != CALENDAR_BOOK_MODE_NONE || getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID)
- {
+ if (getMode() != CALENDAR_BOOK_MODE_NONE || getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
return true;
}
{
WENTER();
auto finder = __bookMap.find(index);
- if (finder == __bookMap.end())
- {
+ if (finder == __bookMap.end()) {
WDEBUG("null");
return nullptr;
}
calendar_query_h query = NULL;
calendar_list_h list = NULL;
int account_id = _CALENDAR_LOCAL_ACCOUNT_ID;
- do
- {
+ do {
error = calendar_query_create(_calendar_book._uri, &query);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
- if (account_id != _CALENDAR_ALL_ACCOUNT_ID)
- {
+ if (account_id != _CALENDAR_ALL_ACCOUNT_ID) {
error = calendar_filter_create(_calendar_book._uri, &filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_int(filter, _calendar_book.account_id, CALENDAR_MATCH_EQUAL, account_id);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_set_filter(query, filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
}
error = calendar_db_get_records_with_query(query, 0, 0, &list);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
}
while(0);
- if (filter)
- {
+ if (filter) {
calendar_filter_destroy(filter);
}
- if (query)
- {
+ if (query) {
calendar_query_destroy(query);
}
calendar_list_get_count(list, &count);
calendar_record_h record = NULL;
- for (int i = 0; i < count; ++i)
- {
+ for (int i = 0; i < count; ++i) {
calendar_list_get_current_record_p(list, &record);
std::shared_ptr<CalBook> instance(new CalBook((cal_book_h) &record));
- if (instance->getStoreType() != CALENDAR_BOOK_TYPE_TODO)
- {
+ if (instance->getStoreType() != CALENDAR_BOOK_TYPE_TODO) {
bookMap.insert(std::pair<int, std::shared_ptr<CalBook>>(instance->getIndex(), instance));
}
calendar_list_next(list);
cal_book_color_s color = {0};
std::vector<int> ids;
- for (auto it = bookMap.begin(); it != bookMap.end(); ++it)
- {
+ for (auto it = bookMap.begin(); it != bookMap.end(); ++it) {
auto instance = it->second;
instance->getColor(color.r, color.g, color.b, color.a);
- if (color.r < 0 || color.g < 0 || color.b < 0 || color.a < 0)
- {
+ if (color.r < 0 || color.g < 0 || color.b < 0 || color.a < 0) {
int id = instance->getIndex();
WDEBUG("need to set a color for a book(id = %d)", id);
color = __books_default_rgb_color[id % COLOR_ARRAY_LENTH];
}
}
- for (auto it = ids.begin(); it != ids.end(); ++it)
- {
+ for (auto it = ids.begin(); it != ids.end(); ++it) {
auto entity = bookMap.find(*it);
- if (entity != bookMap.end())
- {
+ if (entity != bookMap.end()) {
std::shared_ptr<CalBook> instance = entity->second;
bookMap.erase(*it);
std::shared_ptr<CalBook> instanceNew(new CalBook(*instance));
{
WDEBUG("[%d%d]", __dir, __allDay);
__fetcher.prefetch(fillBothBuffers);
- if (!__currentSchedule)
- {
+ if (!__currentSchedule) {
loadNext();
}
}
void CalComplexListProvider::loadNext()
{
- if (__list.size() == 0 || __iter == __list.end())
- {
+ if (__list.size() == 0 || __iter == __list.end()) {
__deleteFinishedFromList();
__updateCurrentDateAndFillList();
- if (__list.size() == 0)
- {
+ if (__list.size() == 0) {
__currentSchedule = NULL;
return;
}
void CalComplexListProvider::__deleteFinishedFromList()
{
- for (auto it = __list.begin(); it != __list.end();)
- {
+ for (auto it = __list.begin(); it != __list.end();) {
WASSERT((*it).__remainingDays >= 0);
- if ((*it).__remainingDays == 0)
- {
+ if ((*it).__remainingDays == 0) {
it = __list.erase(it);
- }
- else
- {
+ } else {
++it;
}
}
{
WDEBUG("[%d%d] %s %d", __dir, __allDay, __currentDate.dump().c_str(), __list.size());
- if (!__pending)
- {
+ if (!__pending) {
__pending = __getNextScheduleFromDbList(__pendingDate);
}
- if (__list.size() > 0 || !__pending)
- {
+ if (__list.size() > 0 || !__pending) {
__currentDate.addDays(__dir > 0 ? 1 : -1);
- }
- else
- {
+ } else {
__currentDate = __pendingDate;
}
- while (__pending && __pendingDate == __currentDate)
- {
+ while (__pending && __pendingDate == __currentDate) {
const int duration = __getDuration(*__pending);
WASSERT(duration >= 0);
WDEBUG("%d", duration);
- if (duration > 0)
- {
+ if (duration > 0) {
__list.push_back(Occupant(__pending, duration));
}
__pending = __getNextScheduleFromDbList(__pendingDate);
std::shared_ptr<CalInstanceSchedule> CalComplexListProvider::__getNextScheduleFromDbList(CalDate& date)
{
calendar_record_h record = __fetcher.getNext(true);
- if (record == NULL)
- {
+ if (record == NULL) {
return nullptr;
}
CalDate adjustedStart, adjustedEnd;
__getAdjustedDates(*schedule, adjustedStart, adjustedEnd);
- if (adjustedStart < CalDate(CalDate::INIT_LOWER_BOUND))
- {
+ if (adjustedStart < CalDate(CalDate::INIT_LOWER_BOUND)) {
WDEBUG("Start is out of supported range(%s)", adjustedStart.dump().c_str());
return nullptr;
}
- if (CalDate(CalDate::INIT_UPPER_BOUND) < adjustedEnd)
- {
+ if (CalDate(CalDate::INIT_UPPER_BOUND) < adjustedEnd) {
WDEBUG("End is out of supported range(%s)", adjustedEnd.dump().c_str());
return nullptr;
}
schedule.getEndForComplexList(endDateTime);
const CalDate end(endDateTime.getYear(), endDateTime.getMonth(), endDateTime.getMday());
- if (__allDay)
- {
+ if (__allDay) {
WASSERT(start <= end);
- if (__dir > 0)
- {
+ if (__dir > 0) {
WASSERT(__base <= end); // 2014/5/4 ~ 2014/5/5 event should show on 2014/5/5
- }
- else
- {
+ } else {
WASSERT(start < __base);
}
- }
- else
- {
+ } else {
WASSERT(startDateTime <= endDateTime);
- if (__dir > 0)
- {
+ if (__dir > 0) {
WASSERT(__base <= end); // 2014/5/5 00:00 ~ 2014/5/5 00:00 event should show on 2014/5/5
- }
- else
- {
+ } else {
// http://en.wikipedia.org/wiki/Magadan_Time
// http://www.timeanddate.com/time/zone/russia/magadan
WASSERT(start <= __base);
}
}
- if (__dir > 0)
- {
+ if (__dir > 0) {
adjustedStart = __base <= start ? start : __base;
adjustedEnd = end;
- }
- else
- {
+ } else {
adjustedStart = start;
- if (end < __base)
- {
+ if (end < __base) {
adjustedEnd = end;
- }
- else
- {
+ } else {
adjustedEnd = __base;
- if (start < end)
- {
+ if (start < end) {
WINFO("The 2014/10/26 2:00 AM Magadan timezone case");
adjustedEnd.addDays(-1);
}
CalDate adjustedStart, adjustedEnd;
__getAdjustedDates(schedule, adjustedStart, adjustedEnd);
- if (__allDay)
- {
+ if (__allDay) {
return CalDate::getDayDiff(adjustedEnd, adjustedStart) + 1;
- }
- else
- {
+ } else {
CalDateTime startDateTime, endDateTime;
schedule.getStart(startDateTime);
schedule.getEndForComplexList(endDateTime);
if (startDateTime.getDateCompareVal() < endDateTime.getDateCompareVal() &&
- endDateTime.getHour() == 0 && endDateTime.getMinute() == 0 && endDateTime.getSecond() == 0)
- {
+ endDateTime.getHour() == 0 && endDateTime.getMinute() == 0 && endDateTime.getSecond() == 0) {
return CalDate::getDayDiff(adjustedEnd, adjustedStart);
- }
- else
- {
+ } else {
return CalDate::getDayDiff(adjustedEnd, adjustedStart) + 1;
}
}
a.__schedule->getStart(startA);
b.__schedule->getStart(startB);
- if (startA == startB)
- {
+ if (startA == startB) {
return CAL_STRCMP(a.__schedule->getSummary(), b.__schedule->getSummary()) < 0;
- }
- else
- {
+ } else {
return startA < startB;
}
}
{
WENTER();
__it = __schedules.begin();
- if (!schedules.empty())
- {
+ if (!schedules.empty()) {
CalDateTime start;
(*__it)->getStart(start);
__currentDate.set(start.getYear(), start.getMonth(), start.getMday());
std::shared_ptr<CalSchedule> CalCustomListModel::getNext(bool& dayChanged)
{
WENTER();
- if (__it == __schedules.end())
- {
+ if (__it == __schedules.end()) {
return nullptr;
}
int id = 0;
int error = calendar_db_insert_record(record, &id);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_insert_record failed : %d", error);
return -1;
}
const calendar_record_h record = workingCopy.getRecord();
int error = calendar_db_update_record(record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_update_record failed : %d", error);
return;
}
calendar_record_h originalRecord = NULL;
int error = calendar_db_get_record(_calendar_event._uri, originalRecordId, &originalRecord);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_get_record(%d) failed : %d", originalRecordId, error);
return nullptr;
}
WENTER();
WASSERT(workingCopy.getType() == CalSchedule::ORIGINAL);
- switch (mode)
- {
+ switch (mode) {
case CalDataManager::ONLY_THIS:
__updateOnlyThisInstance(inputSchedule, (CalOriginalSchedule&)workingCopy);
break;
void CalDataManager::__updateOnlyThisInstance(const CalSchedule& inputSchedule, CalOriginalSchedule& workingCopy)
{
- if (inputSchedule.isException())
- {
+ if (inputSchedule.isException()) {
WASSERT(workingCopy.isException());
__updateSchedule(workingCopy);
- }
- else
- {
+ } else {
workingCopy.setOriginalEventId(__getOriginalSchedule(inputSchedule)->getIndex());
workingCopy.setRecurranceId(inputSchedule.getExceptionString());
insertSchedule(workingCopy);
auto originalSchedule = __getOriginalSchedule(inputSchedule);
- if (originalSchedule->getInstanceCountBeforeDate(inputInstanceStartTime) == 0)
- {
+ if (originalSchedule->getInstanceCountBeforeDate(inputInstanceStartTime) == 0) {
__updateAllInstances(inputSchedule, workingCopy);
*newId = workingCopy.getIndex();
return;
const calendar_record_h record = workingCopy.getRecord();
int error = calendar_db_update_record(record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_update_record failed : %d", error);
return;
}
{
WENTER();
int ret = __deleteSchedule(inputSchedule);
- if (ret == 0)
- {
+ if (ret == 0) {
__notify(CalEvent::LOCAL);
__notifyAlert();
}
int CalDataManager::deleteSchedule(OperationMode mode, const CalSchedule& inputSchedule)
{
WENTER();
- switch (mode)
- {
+ switch (mode) {
case CalDataManager::ONLY_THIS:
__deleteOnlyThisInstance(inputSchedule);
break;
int CalDataManager::__deleteSchedule(const CalSchedule& inputSchedule)
{
int error = calendar_db_delete_record(_calendar_event._uri, inputSchedule.getIndex());
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_delete(%d) failed : %d", inputSchedule.getIndex(), error);
return -1;
}
void CalDataManager::__deleteOnlyThisInstance(const CalSchedule& inputSchedule)
{
- if (inputSchedule.isException())
- {
+ if (inputSchedule.isException()) {
deleteSchedule(inputSchedule);
- }
- else
- {
+ } else {
auto originalSchedule = __getOriginalSchedule(inputSchedule);
calendar_record_h originalRecord = originalSchedule->getRecord();
c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_str() has failed(%x)", error);
char* new_exdate = NULL;
- if (exdate && *exdate)
- {
+ if (exdate && *exdate) {
new_exdate = g_strdup_printf("%s,%s", exdate, inputSchedule.getExceptionString());
- }
- else
- {
+ } else {
new_exdate = g_strdup_printf("%s", inputSchedule.getExceptionString());
}
inputSchedule.getStart(inputInstanceStartTime);
auto originalSchedule = __getOriginalSchedule(inputSchedule);
- if (originalSchedule->getInstanceCountBeforeDate(inputInstanceStartTime) == 0)
- {
+ if (originalSchedule->getInstanceCountBeforeDate(inputInstanceStartTime) == 0) {
__deleteAllInstances(inputSchedule);
return;
}
void CalDataManager::__deleteAllInstances(const CalSchedule& inputSchedule)
{
- if (inputSchedule.isException())
- {
+ if (inputSchedule.isException()) {
deleteSchedule(*__getOriginalSchedule(inputSchedule));
- }
- else
- {
+ } else {
deleteSchedule(inputSchedule);
}
}
std::shared_ptr<CalSchedule> CalDataManager::getUpdatedWorkingCopy(OperationMode mode, const CalSchedule& inputSchedule)
{
- switch (mode)
- {
+ switch (mode) {
case CalDataManager::ONLY_THIS:
case CalDataManager::THIS_AND_FUTURE:
{
auto workingCopy = __getWorkingUpdatedCopy(inputSchedule);
- if (workingCopy)
- {
+ if (workingCopy) {
return workingCopy;
}
return __getWorkingInstanceCopy(inputSchedule);
std::shared_ptr<CalSchedule> CalDataManager::getWorkingCopy(OperationMode mode, const CalSchedule& inputSchedule)
{
- switch (mode)
- {
+ switch (mode) {
case CalDataManager::ONLY_THIS:
return __getWorkingInstanceCopy(inputSchedule);
case CalDataManager::THIS_AND_FUTURE:
std::shared_ptr<CalSchedule> CalDataManager::getWorkingCopyForForward(OperationMode mode, const CalSchedule& inputSchedule)
{
- switch (mode)
- {
+ switch (mode) {
case CalDataManager::ONLY_THIS:
{
auto workingCopy = __getWorkingInstanceCopy(inputSchedule);
calendar_record_h originalRecord = NULL;
int error = calendar_db_get_record(_calendar_event._uri, originalRecordId, &originalRecord);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_get_record(%d) failed : %d", originalRecordId, error);
return NULL;
}
// If inputSchedule is an exception instance, originalRecord is the exception record
// from the original table, which is precisely what we want to work with.
auto workingCopy = std::make_shared<CalOriginalSchedule>(originalRecord);
- if (!workingCopy->isException() && workingCopy->hasRepeat() == true)
- {
+ if (!workingCopy->isException() && workingCopy->hasRepeat() == true) {
CalDateTime startTime, endTime;
inputSchedule.getStart(startTime);
inputSchedule.getEnd(endTime);
{
auto workingCopy = __getOriginalSchedule(inputSchedule);
- if (!workingCopy->hasRepeat())
- {
+ if (!workingCopy->hasRepeat()) {
const char* myTimezone = workingCopy->getTimeZone();
- if (myTimezone == NULL || g_strcmp0(myTimezone, TIMEZONE_ETC_GMT) == 0)
- {
+ if (myTimezone == NULL || g_strcmp0(myTimezone, TIMEZONE_ETC_GMT) == 0) {
WHIT();
std::string calendarTimezone;
CalSettingsManager::getInstance().getCalendarTimeZone(calendarTimezone);
{
CalScheduleRepeat repeat = workingCopy.getRepeat();
repeat.print();
- if (repeat.untilType != CalScheduleRepeat::UntilType::TIMES)
- {
+ if (repeat.untilType != CalScheduleRepeat::UntilType::TIMES) {
return;
}
{
WENTER();
- if (inputSchedule.hasRepeat())
- {
+ if (inputSchedule.hasRepeat()) {
std::shared_ptr<CalOriginalSchedule> workingCopy = NULL;
int originalRecordId = 0;
char *recurrenceId = NULL;
int error = 0;
- if (inputSchedule.isException() == true)
- {
+ if (inputSchedule.isException() == true) {
originalRecordId = inputSchedule.getOriginalEventId();
// get recurrence_id
recurrenceId = inputSchedule.getExceptionString();
- }
- else
- {
+ } else {
originalRecordId = inputSchedule.getIndex();
// make recurrence_id
recurrenceId = inputSchedule.getExceptionString();
calendar_filter_h filter = NULL;
const char* view_uri = _calendar_event._uri;
calendar_list_h list = NULL;
- do
- {
+ do {
error = calendar_query_create(view_uri, &query);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_create(view_uri, &filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_int(filter, _calendar_event.original_event_id,CALENDAR_MATCH_EQUAL,originalRecordId);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_operator(filter, CALENDAR_FILTER_OPERATOR_AND);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_str(filter, _calendar_event.recurrence_id, CALENDAR_MATCH_CONTAINS,recurrenceId);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_set_filter(query,filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_db_get_records_with_query(query,0,0,&list);
}
while(0);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail : %d", error);
}
- if (list != NULL)
- {
+ if (list != NULL) {
int count = 0;
calendar_list_first(list);
calendar_record_h record2 = NULL;
error = calendar_list_get_count(list, &count);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail : %d", error);
}
error = calendar_list_get_current_record_p(list, &record2);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail : %d", error);
}
- if (count > 0 && record2 != NULL)
- {
+ if (count > 0 && record2 != NULL) {
calendar_record_h clone = NULL;
error = calendar_record_clone(record2, &clone);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail : %d", error);
}
workingCopy = std::make_shared<CalOriginalSchedule>(clone);
struct stat st = {0};
int ret = stat(filePath, &st);
- if (ret != 0 || st.st_size <= 0)
- {
+ if (ret != 0 || st.st_size <= 0) {
WERROR("stat(%s) failed : %s", filePath, strerror(errno));
return;
}
FILE* file = fopen(filePath, "r");
- if (!file)
- {
+ if (!file) {
WERROR("fopen(%s) failed : %s", filePath, strerror(errno));
return;
}
char* vcsData = (char*)g_malloc0(st.st_size);
- if(vcsData == NULL)
- {
+ if(vcsData == NULL) {
WERROR("g_malloc0(%d) failed : %s", st.st_size, strerror(errno));
fclose(file);
return;
}
ret = fread(vcsData, 1, st.st_size, file);
- if (ret <= 0)
- {
+ if (ret <= 0) {
WERROR("fread(%s) failed : %s", filePath, strerror(errno));
g_free(vcsData);
fclose(file);
calendar_list_h records = NULL;
int error = calendar_vcalendar_parse_to_calendar(vcsData, &records);
g_free(vcsData);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_vcalendar_parse_to_calendar failed : %d", error);
return;
}
int count = 0;
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 = NULL;
calendar_list_get_current_record_p(records, &record);
WASSERT(record);
char *view_uri = NULL;
calendar_record_get_uri_p(record, &view_uri);
WASSERT(view_uri);
- if (strcmp(view_uri, _calendar_todo._uri) == 0)
- {
+ if (strcmp(view_uri, _calendar_todo._uri) == 0) {
WERROR("Task cannot be supported");
continue;
- }
- else if (strcmp(view_uri, _calendar_event._uri) == 0)
- {
+ } else if (strcmp(view_uri, _calendar_event._uri) == 0) {
std::shared_ptr<CalOriginalSchedule> original(std::make_shared<CalOriginalSchedule>(record));
schedules.push_back(original);
- }
- else
- {
+ } else {
WDEBUG("%s", view_uri);
}
calendar_list_next(records);
char *vcs = NULL;
int fd = -1;
- do
- {
- if (isOriginalSchedule)
- {
+ do {
+ if (isOriginalSchedule) {
error = calendar_record_clone(schedule.getRecord(), &record);
- }
- else
- {
+ } else {
error = calendar_db_get_record(_calendar_event._uri, schedule.getIndex(), &record);
}
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
// check birthday book
- if (DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID == schedule.getBookId())
- {
+ if (DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID == schedule.getBookId()) {
std::string text;
schedule.getDisplaySummary(-1, text);
char* input = elm_entry_markup_to_utf8(text.c_str());
error = calendar_record_set_str(record, _calendar_event.summary, input);
free(input);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
}
error = calendar_list_create(&list);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_list_add(list, record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_vcalendar_make_from_records(list, &vcs);
- if (vcs == NULL || strlen(vcs) == 0)
- {
+ if (vcs == NULL || strlen(vcs) == 0) {
WDEBUG("no data");
error = CALENDAR_ERROR_NO_DATA;
}
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
fd = open(filePath, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
- if (fd < 0)
- {
+ if (fd < 0) {
WDEBUG("open error: %s", strerror(errno));
error = CALENDAR_ERROR_SYSTEM;
break;
}
- if (write(fd, vcs, strlen(vcs)) == -1)
- {
+ if (write(fd, vcs, strlen(vcs)) == -1) {
WDEBUG("write error: %s", strerror(errno));
error = CALENDAR_ERROR_SYSTEM;
break;
}
while (0);
- if (record)
- {
+ if (record) {
calendar_record_destroy(record, true);
}
- if (list)
- {
+ if (list) {
calendar_list_destroy(list, false);
}
free(vcs);
- if (fd >= 0)
- {
+ if (fd >= 0) {
close(fd);
}
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WASSERT_EX(0, "cannot make a vcs file from %d event : %d", schedule.getIndex(), error);
return;
}
std::string summaryMarkUp;
std::string summary;
schedule.getDisplaySummary(-1, summaryMarkUp);
- if (summaryMarkUp.empty())
- {
+ if (summaryMarkUp.empty()) {
summaryMarkUp = _L_("IDS_CLD_MBODY_MY_EVENT");
}
char *tmp = elm_entry_markup_to_utf8(summaryMarkUp.c_str());
- if (!tmp)
- {
+ if (!tmp) {
WERROR("elm_entry_markup_to_utf8(%s) failed : %s", summaryMarkUp.c_str(), strerror(errno));
summary = "";
- }
- else
- {
+ } else {
summary = tmp;
}
free(tmp);
std::string fromToString;
schedule.getFromToString(fromToString);
std::string location;
- if (schedule.getLocation())
- {
+ if (schedule.getLocation()) {
location = schedule.getLocation();
}
std::string description;
- if (schedule.getDescription())
- {
+ if (schedule.getDescription()) {
description = schedule.getDescription();
}
- if (!location.empty() && !description.empty())
- {
+ if (!location.empty() && !description.empty()) {
return g_strdup_printf("%s\n%s\n\n%s\n\n%s", summary.c_str(), fromToString.c_str(), location.c_str(), description.c_str());
- }
- else if (location.empty() && description.empty())
- {
+ } else if (location.empty() && description.empty()) {
return g_strdup_printf("%s\n%s", summary.c_str(), fromToString.c_str());
- }
- else if (location.empty())
- {
+ } else if (location.empty()) {
return g_strdup_printf("%s\n%s\n\n%s", summary.c_str(), fromToString.c_str(), description.c_str());
- }
- else
- {
+ } else {
return g_strdup_printf("%s\n%s\n\n%s", summary.c_str(), fromToString.c_str(), location.c_str());
}
}
calendar_record_h record = NULL;
int error = calendar_db_get_record(_calendar_event._uri, eventIndex, &record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_get_record(%d) failed : %d", eventIndex, error);
return nullptr;
}
{
calendar_record_h record = NULL;
int error = calendar_db_get_record(_calendar_event._uri, eventIndex, &record);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("calendar_db_get_record(%d) failed : %d", eventIndex, error);
return nullptr;
}
calendar_time_s recordStart;
error = calendar_record_get_caltime(record, _calendar_event.start_time, &recordStart);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
calendar_record_destroy(record, true);
WERROR("calendar_record_get_caltime(%d) failed : %d", eventIndex, error);
return nullptr;
calendar_db_get_records_with_query(query, 0, 0, &list);
calendar_filter_destroy(filter);
calendar_query_destroy(query);
- }
- else // allday instance
+ } else // allday instance
{
CalDateTime tempDateTime(dateTime.getYear(), dateTime.getMonth(), dateTime.getMday());
calendar_time_s start = CalSchedule::getCaltime(tempDateTime);
int count = 0;
calendar_list_get_count(list, &count);
- if (count <= 0)
- {
+ if (count <= 0) {
calendar_list_destroy(list, true);
WERROR("There is no event for %d", eventIndex);
return nullptr;
calendar_query_h query1 = NULL;
calendar_filter_h filter = NULL;
int error = 0;
- do
- {
+ do {
calendar_time_s caltimeStart, caltimeEnd;
- if (start.type == CALENDAR_TIME_LOCALTIME)
- {
+ if (start.type == CALENDAR_TIME_LOCALTIME) {
caltimeStart.type = CALENDAR_TIME_UTIME;
caltimeStart.time.utime = startTime.getUtimeFromTm();
caltimeEnd.type = CALENDAR_TIME_UTIME;
caltimeEnd.time.utime= endTime.getUtimeFromTm();
- }
- else
- {
+ } else {
caltimeStart = start;
caltimeEnd = end;
}
unsigned int end_time_property_id = _calendar_instance_utime_calendar_book.end_time;
const char* view_uri = _calendar_instance_utime_calendar_book._uri;
error = calendar_filter_create(view_uri, &filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_caltime(filter, end_time_property_id, CALENDAR_MATCH_GREATER_THAN, caltimeStart);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_operator(filter, CALENDAR_FILTER_OPERATOR_AND);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_caltime(filter, start_time_property_id, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, caltimeEnd);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_create(view_uri, &query1);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_set_filter(query1, filter);
}
while(0);
- if (filter)
- {
+ if (filter) {
calendar_filter_destroy(filter);
filter = NULL;
}
- if (error != CALENDAR_ERROR_NONE)
- {
- if (query1)
- {
+ if (error != CALENDAR_ERROR_NONE) {
+ if (query1) {
calendar_query_destroy(query1);
}
WERROR("fail(%x)",error);
// instance allday
calendar_query_h query2 = NULL;
- do
- {
+ do {
calendar_time_s caltimeStart, caltimeEnd;
- if (start.type == CALENDAR_TIME_UTIME)
- {
+ if (start.type == CALENDAR_TIME_UTIME) {
caltimeStart.type = CALENDAR_TIME_LOCALTIME;
caltimeStart.time.date.year = startTime.getYear();
caltimeStart.time.date.month = startTime.getMonth();
caltimeEnd.time.date.year = endTime.getYear();
caltimeEnd.time.date.month = endTime.getMonth();
caltimeEnd.time.date.mday = endTime.getMday();
- }
- else
- {
+ } else {
caltimeStart = start;
caltimeEnd = end;
}
unsigned int end_time_property_id = _calendar_instance_localtime_calendar_book.end_time;
const char* view_uri = _calendar_instance_localtime_calendar_book._uri;
error = calendar_filter_create(view_uri, &filter);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_caltime(filter, end_time_property_id, CALENDAR_MATCH_GREATER_THAN, caltimeStart);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_operator(filter, CALENDAR_FILTER_OPERATOR_AND);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_filter_add_caltime(filter, start_time_property_id, CALENDAR_MATCH_LESS_THAN_OR_EQUAL, caltimeEnd);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_create(view_uri, &query2);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_query_set_filter(query2, filter);
}
while(0);
- if (filter)
- {
+ if (filter) {
calendar_filter_destroy(filter);
}
- if (error != CALENDAR_ERROR_NONE)
- {
- if (query2)
- {
+ if (error != CALENDAR_ERROR_NONE) {
+ if (query2) {
calendar_query_destroy(query2);
}
WERROR("fail(%x)",error);
- if (query1)
- {
+ if (query1) {
calendar_query_destroy(query1);
}
return false;
int count1 = 0;
int count2 = 0;
- do
- {
+ do {
error = calendar_db_get_records_with_query(query1, 0, 0, &list);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_list_get_count(list, &count1);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
calendar_list_destroy(list, true);
query1 = NULL;
error = calendar_db_get_records_with_query(query2, 0, 0, &list);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
error = calendar_list_get_count(list, &count2);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
break;
}
calendar_list_destroy(list, true);
}
while(0);
- if (error != CALENDAR_ERROR_NONE)
- {
- if (query1)
- {
+ if (error != CALENDAR_ERROR_NONE) {
+ if (query1) {
calendar_query_destroy(query1);
}
- if (query2)
- {
+ if (query2) {
calendar_query_destroy(query2);
}
- if (list)
- {
+ if (list) {
calendar_list_destroy(list, true);
}
WERROR("fail(%x)",error);
return false;
}
- if (0 < count1 || 0 < count2)
- {
+ if (0 < count1 || 0 < count2) {
return true;
}
void CalDataManager::__notify(CalEvent::Source source)
{
- if (source == CalEvent::LOCAL)
- {
+ if (source == CalEvent::LOCAL) {
int error = calendar_db_get_last_change_version(&__localVersion);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WASSERT_EX(0, "calendar_db_get_last_change_version failed : %d", error);
WERROR("calendar_db_get_last_change_version failed : %d", error);
return;
app_control_add_extra_data(service, CAL_APPSVC_PARAM_CALLER, CAL_APPSVC_PARAM_CALLER_CALENDAR);
int ret = app_control_send_launch_request(service, NULL, NULL);
- if( ret != APP_CONTROL_ERROR_NONE )
- {
+ if( ret != APP_CONTROL_ERROR_NONE ) {
WERROR("app_control ret error code= %d", ret);
}
int error = calendar_db_get_changes_by_version(_calendar_event._uri, -1, self.__localVersion, &changedList, &self.__version);
//int error = calendar_db_get_current_version(&self.__version);
calendar_list_destroy(changedList, true);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WASSERT_EX(0, "calendar_db_get_changes_by_version failed : %d", error);
WERROR("calendar_db_get_changes_by_version failed : %d", error);
return;
}
WDEBUG("version = %d:%d", self.__localVersion, self.__version);
- if (self.__localVersion == self.__version)
- {
+ if (self.__localVersion == self.__version) {
WDEBUG("already updated");
return;
}
void CalDataManager::__deleteExceptionRecordsOnAndAfter(const CalOriginalSchedule& originalSchedule, const CalDateTime& inputInstanceStartTime)
{
calendar_record_h originalRecord = originalSchedule.getRecord();
- if(originalRecord)
- {
+ if(originalRecord) {
char* exdate = NULL;
int error = calendar_record_get_str(originalRecord, _calendar_event.exdate, &exdate);
- if (error == CALENDAR_ERROR_NONE && exdate && *exdate)
- {
+ if (error == CALENDAR_ERROR_NONE && exdate && *exdate) {
// 20150124,20150125
std::string targetString(exdate);
std::istringstream iss(targetString);
sscanf(strEach.c_str(),"%4d%2d%2d", &year, &month, &day);
CalDateTime testDate(year, month, day);
- if(testDate < inputInstanceStartTime)
- {
+ if(testDate < inputInstanceStartTime) {
if(!strNew.empty())
strNew += ",";
void CalDataManager::__deleteAllExceptionRecords(const CalOriginalSchedule& originalSchedule)
{
calendar_record_h originalRecord = originalSchedule.getRecord();
- if(originalRecord)
- {
+ if(originalRecord) {
calendar_record_set_str(originalRecord, _calendar_event.exdate, NULL);
}
}
CalDate::CalDate(InitialValue initialValue)
{
- switch (initialValue)
- {
+ switch (initialValue) {
case INIT_TODAY:
{
struct tm now_tm = {0};
time_t timeFromParam = (time_t)atoll(stringParam);
memset(&__date, 0, sizeof(struct tm));
tm *t = localtime(&timeFromParam);
- if (t != NULL)
- {
+ if (t != NULL) {
__date = *t;
}
}
const CalDate& CalDate::operator=( const CalDate& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
WASSERT(obj.__date.tm_hour == 12);
WASSERT(obj.__date.tm_min == 0);
WASSERT(obj.__date.tm_sec == 0);
std::string CalDate::dump(bool showTime) const
{
char buffer[DATE_BUFFER];
- if (showTime)
- {
+ if (showTime) {
snprintf(buffer, DATE_BUFFER, "{%.04d/%.02d/%.02d (%s) %.02d:%.02d:%.02d}",
getYear(), getMonth(), getMday(), getWeekdayText(__date.tm_wday),
__date.tm_hour, __date.tm_min, __date.tm_sec);
- }
- else
- {
+ } else {
snprintf(buffer, DATE_BUFFER, "{%.04d/%.02d/%.02d (%s)}",
getYear(), getMonth(), getMday(), getWeekdayText(__date.tm_wday));
}
void CalDate::incrementMonth()
{
- if (__date.tm_mon == 11)
- {
+ if (__date.tm_mon == 11) {
__date.tm_mon = 0;
__date.tm_year++;
- }
- else
- {
+ } else {
__date.tm_mon++;
}
__normalizeMday();
{
const int mon = __date.tm_mon;
__normalizeStructTm(__date);
- if (__date.tm_mon != mon)
- {
+ if (__date.tm_mon != mon) {
__date.tm_mday = 1;
__normalizeStructTm(__date);
decrementDay();
void CalDate::decrementMonth()
{
- if (__date.tm_mon == 0)
- {
+ if (__date.tm_mon == 0) {
__date.tm_mon = 11;
__date.tm_year--;
- }
- else
- {
+ } else {
__date.tm_mon--;
}
__normalizeMday();
const int originalMon = __date.tm_mon;
__date.tm_mday = mday;
__normalizeStructTm(__date);
- if (__date.tm_mon != originalMon)
- {
+ if (__date.tm_mon != originalMon) {
__date.tm_mday = 0;
__normalizeStructTm(__date);
}
CalDateTime::CalDateTime(const CalDateTime &base, const char *timeZone)
:CalDateTime()
{
- if (timeZone && *timeZone)
- {
+ if (timeZone && *timeZone) {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, base.__utime, time);
__utime = CalLocaleManager::getInstance().getUtimeFromTm(NULL, time);
const CalDateTime& CalDateTime::operator=(const CalDateTime& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
__utime = obj.__utime;
__year = obj.__year;
__month = obj.__month;
{
if (__allday != obj.__allday)
return false;
- if (__allday == true)
- {
+ if (__allday == true) {
return (getYear() == obj.getYear() && getMonth() == obj.getMonth() &&
getMday() == obj.getMday());
- }
- else
- {
+ } else {
return (__utime == obj.__utime);
}
}
int CalDateTime::getYear(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return __year;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
return time.tm_year + 1900;
int CalDateTime::getMonth(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return __month;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
return time.tm_mon + 1;
int CalDateTime::getMday(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return __mday;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
return time.tm_mday;
int CalDateTime::getHour(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return 0;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
WDEBUG("%lld %d:%d:%d", __utime, time.tm_hour, time.tm_min, time.tm_sec);
int CalDateTime::getMinute(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return 0;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
WDEBUG("%lld %d:%d:%d", __utime, time.tm_hour, time.tm_min, time.tm_sec);
int CalDateTime::getSecond(const char *timeZone) const
{
- if (__allday == true)
- {
+ if (__allday == true) {
return 0;
- }
- else
- {
+ } else {
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(timeZone, __utime, time);
WDEBUG("%lld %d:%d:%d", __utime, time.tm_hour, time.tm_min, time.tm_sec);
void CalDateTime::getTmFromUtime(struct tm* dateTm) const
{
- if (dateTm == NULL)
- {
+ if (dateTm == NULL) {
WERROR("invalid input");
return;
}
- if (__allday == true)
- {
+ if (__allday == true) {
dateTm->tm_year = __year - 1900;
dateTm->tm_mon = __month - 1;
dateTm->tm_mday = __mday;
dateTm->tm_hour = 0;
dateTm->tm_min = 0;
dateTm->tm_sec = 0;
- }
- else
- {
+ } else {
CalLocaleManager::getInstance().getTmFromUtime(NULL, __utime, *dateTm);
}
}
long long int CalDateTime::getUtimeFromTm() const
{
- if (__allday == true)
- {
+ if (__allday == true) {
struct tm time;
memset(&time, 0, sizeof(struct tm));
time.tm_year = __year - 1900;
time.tm_sec = 0;
return CalLocaleManager::getInstance().getUtime(time);
- }
- else
- {
+ } else {
return __utime;
}
}
else
tf = CalLocaleManager::TIMEFORMAT_6;
text.clear();
- if (__allday == true)
- {
+ if (__allday == true) {
return;
}
__getString(CalLocaleManager::DATEFORMAT_NONE, tf, text);
void CalDateTime::__getString(int df, int tf, std::string& text) const
{
- if (__allday)
- {
+ if (__allday) {
CalLocaleManager::getInstance().getDateTimeText(
(CalLocaleManager::DateFormat)df,
CalLocaleManager::TimeFormat::TIMEFORMAT_NONE, *this, text);
- }
- else
- {
+ } else {
CalLocaleManager::getInstance().getDateTimeText(
(CalLocaleManager::DateFormat)df,
(CalLocaleManager::TimeFormat)tf, *this, text);
void CalDateTime::setAllDay(const bool isAllDay)
{
- if (isAllDay == true)
- {
+ if (isAllDay == true) {
if (__allday == true)
return ;
__allday = true;
__year = time.tm_year +1900;
__month = time.tm_mon +1;
__mday = time.tm_mday;
- }
- else
- {
+ } else {
if (__allday == false)
return;
void CalDateTime::addSeconds(const long long int seconds, const bool setLimit)
{
- if (__allday == true)
- {
+ if (__allday == true) {
WERROR("invalid");
return;
}
void CalDateTime::addHours(const int hours, const bool setLimit)
{
- if (__allday == true)
- {
+ if (__allday == true) {
WERROR("invalid");
return;
}
void CalDateTime::addDays(const int days, const bool setLimit)
{
- if (__allday == true)
- {
+ if (__allday == true) {
long long int utime = getUtimeFromTm();
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(NULL, utime, time);
void CalDateTime::addMonths(const int months, const bool setLimit)
{
- if (__allday == true)
- {
+ if (__allday == true) {
long long int utime = getUtimeFromTm();
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(NULL, utime, time);
void CalDateTime::addYears(const int years, const bool setLimit)
{
- if (__allday == true)
- {
+ if (__allday == true) {
long long int utime = getUtimeFromTm();
struct tm time;
CalLocaleManager::getInstance().getTmFromUtime(NULL, utime, time);
void CalDateTime::__setLimit()
{
// 1902 ~ 2036
- if (getYear() < 1902)
- {
- if (__allday == true)
- {
+ if (getYear() < 1902) {
+ if (__allday == true) {
set(1902,1,1);
- }
- else
- {
+ } else {
struct tm time;
memset(&time, 0, sizeof(struct tm));
time.tm_year = 1902 - 1900;
time.tm_sec = 0;
__utime = CalLocaleManager::getInstance().getUtime(time);
}
- }
- else if (getYear() > 2037)
- {
- if (__allday == true)
- {
+ } else if (getYear() > 2037) {
+ if (__allday == true) {
set(2037,12,31);
- }
- else
- {
+ } else {
struct tm time;
memset(&time, 0, sizeof(struct tm));
time.tm_year = 2037 - 1900;
int error = PREFERENCE_ERROR_NONE;
bool check = false;
error = preference_is_existing(key, &check);
- if (PREFERENCE_ERROR_NONE == error && !check)
- {
+ if (PREFERENCE_ERROR_NONE == error && !check) {
__setInt(key, CAL_EDIT_SETTING_INT_DEFAULT);
}
error = preference_get_int(key, &value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_get_int(%s) is failed(%x)", key, error);
return -1;
} else
const char* CalEditModel::__getKey(CalEditExpandField field)
{
- switch (field)
- {
+ switch (field) {
case TIME_ZONE:
return CAL_EDIT_KEY_PREFIX "time_zone" CAL_EDIT_KEY_SUFFIX;
case LOCATION:
char *view_uri = NULL;
int error = CALENDAR_ERROR_NONE;
error = calendar_record_get_uri_p(record, &view_uri);
- if (error == CALENDAR_ERROR_NONE)
- {
- if(g_strcmp0(view_uri, _calendar_instance_utime_calendar_book_extended._uri) == 0)
- {
+ if (error == CALENDAR_ERROR_NONE) {
+ if(g_strcmp0(view_uri, _calendar_instance_utime_calendar_book_extended._uri) == 0) {
__type = CalSchedule::INSTANCE_NORMAL;
- }
- else if(g_strcmp0(view_uri, _calendar_instance_localtime_calendar_book_extended._uri) == 0)
- {
+ } else if(g_strcmp0(view_uri, _calendar_instance_localtime_calendar_book_extended._uri) == 0) {
__type = CalSchedule::INSTANCE_ALLDAY;
}
- }
- else
- {
+ } else {
WASSERT(0);
}
if (calendar_book_id != DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
error = calendar_filter_add_int(writable_filter, property_id, CALENDAR_MATCH_EQUAL, calendar_book_id);
c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_filter_add_int() is failed(%x)", error);
- }
- else {
+ } else {
calendar_book_id = previous_book_id;
}
if (__patternGenerator)
i18n_udatepg_destroy(__patternGenerator);
- for (auto it=__mapFormat.begin(); it!=__mapFormat.end(); ++it)
- {
+ for (auto it=__mapFormat.begin(); it!=__mapFormat.end(); ++it) {
i18n_udate_format_h dateFormat= it->second;
i18n_udate_destroy(dateFormat);
}
{
WENTER();
Evas_BiDi_Direction bidi = EVAS_BIDI_DIRECTION_NATURAL;
- if(__obj)
- {
+ if(__obj) {
const char *type = evas_object_type_get(__obj);
if(type && strstr(type, "text"))
bidi = evas_object_text_direction_get(__obj);
{
char *locale = NULL;
int value = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
- if(value == SYSTEM_SETTINGS_ERROR_NONE && locale)
- {
+ if(value == SYSTEM_SETTINGS_ERROR_NONE && locale) {
/*
"ar" - Arabic
"dv" - Divehi
{
WENTER();
- if (timeZone.empty())
- {
+ if (timeZone.empty()) {
WERROR("input timezone is empty");
return;
}
- if (timeZone.compare(__tzid)== 0)
- {
+ if (timeZone.compare(__tzid)== 0) {
return;
}
i18n_udatepg_create(__locale.c_str(), &__patternGenerator);
- for (auto it=__mapFormat.begin(); it!=__mapFormat.end(); ++it)
- {
+ for (auto it=__mapFormat.begin(); it!=__mapFormat.end(); ++it) {
i18n_udate_format_h dateFormat= it->second;
i18n_udate_destroy(dateFormat);
}
{
WENTER();
- if (timezone == NULL || (timezone != NULL && __tzid.compare(timezone) == 0) )
- {
+ if (timezone == NULL || (timezone != NULL && __tzid.compare(timezone) == 0) ) {
getDateTimeText(df, tf, dt, text);
}
{
WENTER();
- if (dateFormat == DATEFORMAT_NONE || dateFormat == DATEFORMAT_END)
- {
+ if (dateFormat == DATEFORMAT_NONE || dateFormat == DATEFORMAT_END) {
WERROR("invalid input");
return;
}
const char* locale;
i18n_ulocale_get_default(&locale);
status = i18n_ucalendar_create(utf16_timezone, -1, locale, I18N_UCALENDAR_GREGORIAN , &cal);
- if (status)
- {
+ if (status) {
WERROR("i18n_ucalendar_create got an error : %d", status);
return NULL;
}
split_str = g_strsplit(locale,".", 0);
- for(ptr = split_str; *ptr; ptr++)
- {
+ for(ptr = split_str; *ptr; ptr++) {
count++;
}
- if(count == 2)
- {
- if(!strcmp(split_str[1], "UTF-8"))
- {
+ if(count == 2) {
+ if(!strcmp(split_str[1], "UTF-8")) {
str = g_strdup_printf("%s", split_str[0]);
free(locale);
WDEBUG("dest_locale:%s", str);
localeStr = str;
free(str);
return ;
- }
- else
- {
+ } else {
g_strfreev(split_str);
localeStr = locale;
free(locale);
return ;
}
- }
- else
- {
+ } else {
g_strfreev(split_str);
localeStr = locale;
free(locale);
const i18n_udate_format_h CalLocaleManager::__getUDateFormat(const DateFormat df, const TimeFormat tf)
{
WENTER();
- if (__patternGenerator == NULL)
- {
+ if (__patternGenerator == NULL) {
WASSERT(__patternGenerator);
}
char buf[1024];
std::string formatString = buf;
auto it = __mapFormat.find(formatString);
- if (it == __mapFormat.end())
- {
+ if (it == __mapFormat.end()) {
i18n_uchar custom_format[DATETIME_BUFFER]={0};
int32_t bestPatternLength, bestPatternCapacity;
i18n_udate_format_h formatter;
__mapFormat.insert(std::pair<std::string,i18n_udate_format_h>(formatString, formatter));
return formatter;
- }
- else
- {
+ } else {
return it->second;
}
}
i18n_udate_format_h CalLocaleManager::__getUDateFormat(const char* timezone, const DateFormat df, const TimeFormat tf)
{
WENTER();
- if (__patternGenerator == NULL)
- {
+ if (__patternGenerator == NULL) {
WASSERT(__patternGenerator);
}
char buf[1024];
{
WENTER();
- if (timezone == NULL || !strcmp(timezone, __tzid.c_str()))
- {
+ if (timezone == NULL || !strcmp(timezone, __tzid.c_str())) {
__setUCalendar(__cal, &tm);
i18n_udate date;
i18n_ucalendar_get_milliseconds(__cal, &date);
return ms2sec(date);
- }
- else
- {
+ } else {
i18n_ucalendar_h ucal = __getUcal(timezone);
__setUCalendar(ucal, &tm);
void CalLocaleManager::getTmFromUtime(const char *timezone, const long long int utime, struct tm &tm)
{
WENTER();
- if (timezone == NULL || !strcmp(timezone, __tzid.c_str()))
- {
+ if (timezone == NULL || !strcmp(timezone, __tzid.c_str())) {
i18n_ucalendar_set_milliseconds(__cal, sec2ms(utime));
__getUCalendar(__cal, &tm);
- }
- else
- {
+ } else {
i18n_ucalendar_h ucal = __getUcal(timezone);
i18n_ucalendar_set_milliseconds(ucal, sec2ms(utime));
__getUCalendar(ucal, &tm);
int CalLocaleManager::getDayOfWeekInMonth(const char *timezone, const long long int utime)
{
WENTER();
- if (timezone == NULL || !strcmp(timezone, __tzid.c_str()))
- {
+ if (timezone == NULL || !strcmp(timezone, __tzid.c_str())) {
i18n_ucalendar_set_milliseconds(__cal, sec2ms(utime));
int32_t result = 0;
i18n_ucalendar_get(__cal, I18N_UCALENDAR_DAY_OF_WEEK_IN_MONTH, &result);
return (int)result;
- }
- else
- {
+ } else {
int dayOfWeek = 0;
i18n_ucalendar_h ucal = __getUcal(timezone);
i18n_ucalendar_set_milliseconds(ucal, sec2ms(utime));
{
WENTER();
static char weeks[7][3] = {"SU", "MO", "TU", "WE", "TH", "FR", "SA"};
- if (timezone == NULL || !strcmp(timezone, __tzid.c_str()))
- {
+ if (timezone == NULL || !strcmp(timezone, __tzid.c_str())) {
i18n_ucalendar_set_milliseconds(__cal, sec2ms(utime));
int wday = 0;
i18n_ucalendar_get(__cal, I18N_UCALENDAR_DAY_OF_WEEK, &wday);
return weeks[wday - 1];
- }
- else
- {
+ } else {
i18n_ucalendar_h ucal = __getUcal(timezone);
i18n_ucalendar_set_milliseconds(ucal, sec2ms(utime));
int wday = 0;
int CalLocaleManager::getWeekday(const char *timezone, const long long int utime)
{
WENTER();
- if (timezone == NULL || !strcmp(timezone, __tzid.c_str()))
- {
+ if (timezone == NULL || !strcmp(timezone, __tzid.c_str())) {
i18n_ucalendar_set_milliseconds(__cal, sec2ms(utime));
int wday = 0;
i18n_ucalendar_get(__cal, I18N_UCALENDAR_DAY_OF_WEEK, &wday);
return (wday-1);
- }
- else
- {
+ } else {
i18n_ucalendar_h ucal = __getUcal(timezone);
i18n_ucalendar_set_milliseconds(ucal, sec2ms(utime));
int wday = 0;
status = i18n_ucalendar_set_date_time(calendar, tm->tm_year+1900, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
- if(status != I18N_ERROR_NONE)
- {
+ if(status != I18N_ERROR_NONE) {
WDEBUG("i18n_ucalendar_set_date_time() is fail. error:%d", status);
WDEBUG("tm->tm_year:%d, tm->tm_mon:%d, tm->tm_mday:%d, tm->tm_hour:%d, tm->tm_min:%d, tm->tm_sec:%d ", tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
}
// get Sunday
CalDate date(2013,12,1);
- for(int i=0; i < 7; i++)
- {
+ for(int i=0; i < 7; i++) {
getDateText(CalLocaleManager::DATEFORMAT_2, date, __weekdayText[i]);
getDateText(CalLocaleManager::DATEFORMAT_17, date, __weekdayShortText[i]);
date.incrementDay();
char *view_uri = NULL;
int error = CALENDAR_ERROR_NONE;
error = calendar_record_get_uri_p(record, &view_uri);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WASSERT(0);
}
- if(g_strcmp0(view_uri, _calendar_event._uri) == 0)
- {
+ if(g_strcmp0(view_uri, _calendar_event._uri) == 0) {
__type = CalSchedule::ORIGINAL;
- }
- else
- {
+ } else {
__type = CalSchedule::INVALID;
}
const CalOriginalSchedule& CalOriginalSchedule::operator=(const CalOriginalSchedule& obj)
{
CalSchedule::operator=(obj);
- if (this != &obj)
- {
+ if (this != &obj) {
__repeat = obj.__repeat;
}
return *this;
__repeat = repeat;
// set record
- switch(repeat.unitType)
- {
+ switch(repeat.unitType) {
case CalScheduleRepeat::UnitType::ONE_TIME:
{
error = calendar_record_set_int(getRecord(), _calendar_event.freq, CALENDAR_RECURRENCE_NONE);
if (error != CALENDAR_ERROR_NONE) break;
std::string byday;
- if (repeat.unitInfo.weekly.selected[0] == true)
- {
+ if (repeat.unitInfo.weekly.selected[0] == true) {
byday.append("SU");
}
- if (repeat.unitInfo.weekly.selected[1] == true)
- {
+ if (repeat.unitInfo.weekly.selected[1] == true) {
if (!byday.empty())
byday.append(",");
byday.append("MO");
}
- if (repeat.unitInfo.weekly.selected[2] == true)
- {
+ if (repeat.unitInfo.weekly.selected[2] == true) {
if (!byday.empty())
byday.append(",");
byday.append("TU");
}
- if (repeat.unitInfo.weekly.selected[3] == true)
- {
+ if (repeat.unitInfo.weekly.selected[3] == true) {
if (!byday.empty())
byday.append(",");
byday.append("WE");
}
- if (repeat.unitInfo.weekly.selected[4] == true)
- {
+ if (repeat.unitInfo.weekly.selected[4] == true) {
if (!byday.empty())
byday.append(",");
byday.append("TH");
}
- if (repeat.unitInfo.weekly.selected[5] == true)
- {
+ if (repeat.unitInfo.weekly.selected[5] == true) {
if (!byday.empty())
byday.append(",");
byday.append("FR");
}
- if (repeat.unitInfo.weekly.selected[6] == true)
- {
+ if (repeat.unitInfo.weekly.selected[6] == true) {
if (!byday.empty())
byday.append(",");
byday.append("SA");
error = calendar_record_get_caltime(getRecord(), _calendar_event.start_time, &start);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
CalDateTime dtTime;
- if (start.type == CALENDAR_TIME_UTIME)
- {
+ if (start.type == CALENDAR_TIME_UTIME) {
dtTime.set(start.time.utime);
- }
- else
- {
+ } else {
dtTime.set(start.time.date.year,start.time.date.month,start.time.date.mday);
}
// TODO check
error = calendar_record_set_int(getRecord(), _calendar_event.freq, CALENDAR_RECURRENCE_MONTHLY);
if (error != CALENDAR_ERROR_NONE) {WERROR("fail");break;}
- if (repeat.unitInfo.monthly.type == CalScheduleRepeat::MonthlyType::WEEKDAY)
- {
+ if (repeat.unitInfo.monthly.type == CalScheduleRepeat::MonthlyType::WEEKDAY) {
CalDateTime start(__repeat.startDate.year, __repeat.startDate.month, __repeat.startDate.mday);
int weekNum = CalLocaleManager::getInstance().getDayOfWeekInMonth(NULL, start.getUtimeFromTm());
error = calendar_record_set_str(getRecord(), _calendar_event.bymonthday, "");
if (error != CALENDAR_ERROR_NONE) break;
- }
- else
- {
+ } else {
char bymonthday[WEEKDAY_BUFFER];
// TODO check local mday
snprintf(bymonthday, sizeof(bymonthday), "%d", __repeat.unitInfo.monthly.date.mday);
error = calendar_record_get_caltime(getRecord(), _calendar_event.start_time, &start);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
CalDateTime dtTime;
- if (start.type == CALENDAR_TIME_UTIME)
- {
+ if (start.type == CALENDAR_TIME_UTIME) {
dtTime.set(start.time.utime);
- }
- else
- {
+ } else {
dtTime.set(start.time.date.year,start.time.date.month,start.time.date.mday);
}
// TODO check
WERROR("set fail");
// TODO until..
- switch(repeat.untilType)
- {
+ switch(repeat.untilType) {
case CalScheduleRepeat::UntilType::DUE_DATE:
error = calendar_record_set_int(getRecord(), _calendar_event.range_type, CALENDAR_RANGE_UNTIL);
if (error != CALENDAR_ERROR_NONE) break;
calendar_time_s startTime;
error = calendar_record_get_caltime(getRecord(), _calendar_event.start_time, &startTime);
if (error != CALENDAR_ERROR_NONE) break;
- if (startTime.type == CALENDAR_TIME_UTIME)
- {
+ if (startTime.type == CALENDAR_TIME_UTIME) {
struct tm startTm;
CalLocaleManager::getInstance().getTmFromUtime(getTimeZone(),startTime.time.utime, startTm);
startTm.tm_year = repeat.untilInfo.date.year - 1900;
startTm.tm_mday = repeat.untilInfo.date.mday;
untilTime.type = CALENDAR_TIME_UTIME;
untilTime.time.utime = CalLocaleManager::getInstance().getUtimeFromTm(getTimeZone(),startTm);
- }
- else
- {
+ } else {
untilTime.type = CALENDAR_TIME_LOCALTIME;
untilTime.time.date.year = repeat.untilInfo.date.year;
untilTime.time.date.month = repeat.untilInfo.date.month;
int value = 0;
error = calendar_record_get_int(getRecord(), _calendar_event.freq, &value);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
- switch(value)
- {
+ switch(value) {
default:
case CALENDAR_RECURRENCE_NONE:
__repeat.unitType = CalScheduleRepeat::UnitType::ONE_TIME;
char *byday = NULL;
error = calendar_record_get_str_p(getRecord(), _calendar_event.byday, &byday);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
- if (strstr(byday, "SU") != NULL)
- {
+ if (strstr(byday, "SU") != NULL) {
__repeat.unitInfo.weekly.selected[0] = true;
}
- if (strstr(byday, "MO") != NULL)
- {
+ if (strstr(byday, "MO") != NULL) {
__repeat.unitInfo.weekly.selected[1] = true;
}
- if (strstr(byday, "TU") != NULL)
- {
+ if (strstr(byday, "TU") != NULL) {
__repeat.unitInfo.weekly.selected[2] = true;
}
- if (strstr(byday, "WE") != NULL)
- {
+ if (strstr(byday, "WE") != NULL) {
__repeat.unitInfo.weekly.selected[3] = true;
}
- if (strstr(byday, "TH") != NULL)
- {
+ if (strstr(byday, "TH") != NULL) {
__repeat.unitInfo.weekly.selected[4] = true;
}
- if (strstr(byday, "FR") != NULL)
- {
+ if (strstr(byday, "FR") != NULL) {
__repeat.unitInfo.weekly.selected[5] = true;
}
- if (strstr(byday, "SA") != NULL)
- {
+ if (strstr(byday, "SA") != NULL) {
__repeat.unitInfo.weekly.selected[6] = true;
}
}
char *bymonthday = NULL;
error = calendar_record_get_str_p(getRecord(), _calendar_event.byday, &byday);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
- if (byday && strlen(byday) > 0)
- {
+ if (byday && strlen(byday) > 0) {
// byday
__repeat.unitInfo.monthly.type = CalScheduleRepeat::MonthlyType::WEEKDAY;
- }
- else
- {
+ } else {
// bymonthday
error = calendar_record_get_str(getRecord(), _calendar_event.bymonthday, &bymonthday);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
error = calendar_record_get_caltime(getRecord(), _calendar_event.start_time, &start);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
CalDateTime dtTime;
- if (start.type == CALENDAR_TIME_UTIME)
- {
+ if (start.type == CALENDAR_TIME_UTIME) {
dtTime.set(start.time.utime);
- }
- else
- {
+ } else {
dtTime.set(start.time.date.year,start.time.date.month,start.time.date.mday);
}
__repeat.unitInfo.monthly.date.year = dtTime.getYear();
error = calendar_record_get_int(getRecord(), _calendar_event.range_type, &value);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
- switch(value)
- {
+ switch(value) {
case CALENDAR_RANGE_UNTIL:
{
__repeat.untilType = CalScheduleRepeat::UntilType::DUE_DATE;
error = calendar_record_get_caltime(getRecord(), _calendar_event.until_time, &untilTime);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
int year = 0, month = 0, mday = 0;
- if (untilTime.type == CALENDAR_TIME_UTIME)
- {
- if (CALENDAR_RECORD_NO_UNTIL == untilTime.time.utime)
- {
+ if (untilTime.type == CALENDAR_TIME_UTIME) {
+ if (CALENDAR_RECORD_NO_UNTIL == untilTime.time.utime) {
__repeat.untilType = CalScheduleRepeat::UntilType::FOREVER;
break;
- }
- else
- {
+ } else {
CalDateTime dateTime;
dateTime.set(untilTime.time.utime);
year = dateTime.getYear();
month = dateTime.getMonth();
mday = dateTime.getMday();
}
- }
- else
- {
+ } else {
year = untilTime.time.date.year;
month = untilTime.time.date.month;
mday = untilTime.time.date.mday;
break;
}
- do
- {
+ do {
calendar_time_s start;
error = calendar_record_get_caltime(getRecord(), _calendar_event.start_time, &start);
WPRET_M((error!=CALENDAR_ERROR_NONE), "fail");
CalDateTime dtTime;
- if (start.type == CALENDAR_TIME_UTIME)
- {
+ if (start.type == CALENDAR_TIME_UTIME) {
dtTime.set(start.time.utime);
- }
- else
- {
+ } else {
dtTime.set(start.time.date.year,start.time.date.month,start.time.date.mday);
}
__repeat.startDate.year = dtTime.getYear();
WPRET_VM((NULL==alarmHandle), -1, "convert fail");
error = calendar_record_add_child_record(getRecord(), _calendar_event.calendar_alarm, alarmHandle);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("add child fail");
calendar_record_destroy(alarmHandle, true);
return -1;
WDEBUG("[tick:%d][tickUnit:%d]",tick,reminder.unitType);
}
- switch(tickUnit)
- {
+ switch(tickUnit) {
case CALENDAR_ALARM_TIME_UNIT_SPECIFIC:
// TODO specipic
reminder.unitType = CalScheduleReminder::UnitType::MIN;
{
int error = CALENDAR_ERROR_NONE;
- do
- {
+ do {
int tick = reminder.unitValue;
WDEBUG("[tick:%d][tickUnit:%d]",tick,reminder.unitType);
int tickUnit = 0;
- switch(reminder.unitType)
- {
+ switch(reminder.unitType) {
case CalScheduleReminder::UnitType::NONE:
tickUnit = CALENDAR_ALARM_NONE;
break;
{
int error = 0;
WPRET_M((getRecord()==NULL), "fail");
- do
- {
+ do {
CalDateTime bufTime = startTime;
setStart(bufTime);
bufTime.addHours(1);
setEnd(bufTime);
- if (tzid)
- {
+ if (tzid) {
error = calendar_record_set_str(getRecord(), _calendar_event.start_tzid, tzid);
if (error != CALENDAR_ERROR_NONE) break;
error = calendar_record_set_str(getRecord(), _calendar_event.end_tzid, tzid);
CalSchedule::~CalSchedule()
{
- if (__record)
- {
+ if (__record) {
calendar_record_destroy(__record, true);
}
CalSchedule::CalSchedule(const CalSchedule& obj)
{
- if (obj.__record)
- {
+ if (obj.__record) {
calendar_record_h clone;
calendar_record_clone(obj.__record, &clone);
__record = clone;
const CalSchedule& CalSchedule::operator=(const CalSchedule& obj)
{
- if (this != &obj)
- {
- if (obj.__record)
- {
+ if (this != &obj) {
+ if (obj.__record) {
calendar_record_h clone;
calendar_record_clone(obj.__record, &clone);
__record = clone;
std::string displayMyTz;
std::string displayCalendarTz;
CalLocaleManager::getInstance().getDisplayTextTimeZone(calendarTimezone, displayCalendarTz);
- if (myTimezone)
- {
+ if (myTimezone) {
CalLocaleManager::getInstance().getDisplayTextTimeZone(myTimezone, displayMyTz);
}
if (startTime.isAllDay( )== true ||
myTimezone == NULL ||
g_str_has_prefix(myTimezone, TIMEZONE_ETC_GMT) ||
- displayCalendarTz.compare(displayMyTz) == 0)
- {
+ displayCalendarTz.compare(displayMyTz) == 0) {
__getFromToDisplayString(NULL, startTime, endTime, text);
- }
- else
- {
+ } else {
text = displayCalendarTz + "<br/>";
std::string stringTemp;
if (startTime.isAllDay( )== true ||
myTimezone == NULL ||
g_strcmp0(myTimezone, TIMEZONE_ETC_GMT) == 0 ||
- calendarTimezone.compare(myTimezone) == 0)
- {
+ calendarTimezone.compare(myTimezone) == 0) {
__getFromToString(NULL, startTime, endTime, text);
- }
- else
- {
+ } else {
std::string stringTemp;
CalLocaleManager::getInstance().getDisplayTextTimeZone(calendarTimezone, stringTemp);
start.getString(startText);
end.getString(endText);
- if (start.isAllDay())
- {
- if (start.isSameDay(end))
- {
+ if (start.isAllDay()) {
+ if (start.isSameDay(end)) {
text = startText;
- }
- else
- {
+ } else {
text = startText + " - \r\n" + endText;
}
- }
- else
- {
- if (timezone)
- {
+ } else {
+ if (timezone) {
CalDateTime startInTimeZone(start, timezone);
CalDateTime endInTimeZone(end, timezone);
startInTimeZone.getString(startText);
endInTimeZone.getString(endText);
- if (startInTimeZone.isSameDay(endInTimeZone))
- {
+ if (startInTimeZone.isSameDay(endInTimeZone)) {
std::string endNoDataText;
endInTimeZone.getTimeString(endNoDataText);
text = startText + " - " + endNoDataText;
- }
- else
- {
+ } else {
text = startText + " - \r\n" + endText;
}
- }
- else
- {
- if (start.isSameDay(end))
- {
+ } else {
+ if (start.isSameDay(end)) {
std::string endNoDataText;
end.getTimeString(endNoDataText);
text = startText + " - " + endNoDataText;
- }
- else
- {
+ } else {
text = startText + " - \r\n" + endText;
}
}
std::string bufString;
__getFromToString(timezone, start, end, bufString);
char *markupStr = elm_entry_utf8_to_markup(bufString.c_str());
- if (!markupStr)
- {
+ if (!markupStr) {
WERROR("elm_entry_utf8_to_markup(%s) failed : %s", bufString.c_str(), strerror(errno));
return;
}
if (str == NULL)
return;
- while (*str != '\0')
- {
+ while (*str != '\0') {
if(*str == '\n' || *str == '\r')
*str = ' ';
str++;
std::string utfStr = text;
int bookId = getBookId();
- if (DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID == bookId)
- {
+ if (DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID == bookId) {
// TODO
char *syncData1 = NULL;
const unsigned int syncData1propertyId = getSyncData1Property();
int error = calendar_record_get_str_p(__record, syncData1propertyId, &syncData1);
WPRET_M((error != CALENDAR_ERROR_NONE),"get_str fail");
- if (!strcmp(syncData1, "anniversary"))
- {
+ if (!strcmp(syncData1, "anniversary")) {
char buffer[summaryBuffer]={0};
snprintf(buffer, sizeof( buffer)-1, _L_("IDS_CLD_MBODY_PSS_ANNIVERSARY"), utfStr.c_str());
utfStr.clear();
utfStr.append(buffer);
- }
- else if (!strcmp(syncData1, "birthday"))
- {
+ } else if (!strcmp(syncData1, "birthday")) {
char buffer[summaryBuffer]={0};
snprintf(buffer, sizeof( buffer)-1, _L_("IDS_CLD_BODY_PSS_BIRTHDAY_ABB"), utfStr.c_str());
utfStr.clear();
utfStr.append(buffer);
- }
- else if (!strcmp(syncData1, "other"))
- {
+ } else if (!strcmp(syncData1, "other")) {
utfStr.append(". ");
utfStr.append(_L_("IDS_CLD_BODY_OTHER_M_EVENT_TYPE"));
- }
- else
- {
+ } else {
utfStr.append(". ");
utfStr.append(syncData1);
}
utfStr.resize(stringLimit);
char *markupStr = elm_entry_utf8_to_markup(utfStr.c_str());
- if (!markupStr)
- {
+ if (!markupStr) {
WERROR("elm_entry_utf8_to_markup(%s) failed : %s", utfStr.c_str(), strerror(errno));
return;
}
{
const char *summary = getSummary();
- if (summary == NULL || strlen(summary) == 0)
- {
+ if (summary == NULL || strlen(summary) == 0) {
text = _L_("IDS_CLD_MBODY_MY_EVENT");
return ;
}
{
const char* summary = getSummary();
- if (summary == NULL || strlen(summary) == 0)
- {
+ if (summary == NULL || strlen(summary) == 0) {
text = _L_("IDS_CLD_MBODY_MY_EVENT");
return ;
}
- if(__trimedSummary == NULL)
- {
+ if(__trimedSummary == NULL) {
__trimedSummary = strdup(summary);
- if (!__trimedSummary)
- {
+ if (!__trimedSummary) {
WERROR("strdup(%s) failed : %s", summary, strerror(errno));
return;
}
str.resize(stringLimit);
char *markupStr = elm_entry_utf8_to_markup(str.c_str());
- if (!markupStr)
- {
+ if (!markupStr) {
WERROR("elm_entry_utf8_to_markup(%s) failed : %s", str.c_str(), strerror(errno));
return;
}
{
const char* location = getLocation();
- if (location == NULL)
- {
+ if (location == NULL) {
text.clear();
return ;
}
{
const char* location = getLocation();
- if (location)
- {
- if(__trimedLocation == NULL)
- {
+ if (location) {
+ if(__trimedLocation == NULL) {
__trimedLocation = strdup(location);
- if (!__trimedLocation)
- {
+ if (!__trimedLocation) {
WERROR("strdup(%s) failed : %s", location, strerror(errno));
return;
}
}
text = __trimedLocation;
__checkLocation(stringLimit, (int)strlen(location), text);
- }
- else
- {
+ } else {
text.clear();
WERROR("Location could not be taken from getLocation() function");
}
char *tmp = NULL;
int error = calendar_record_get_str_p(__record, propertyId, &tmp);
WPRET_M((error != CALENDAR_ERROR_NONE),"get_str fail");
- if (tmp == NULL)
- {
+ if (tmp == NULL) {
text.clear();
return ;
}
std::string utfStr = tmp;
char *markupStr = elm_entry_utf8_to_markup(utfStr.c_str());
- if (!markupStr)
- {
+ if (!markupStr) {
WERROR("elm_entry_utf8_to_markup(%s) failed : %s", utfStr.c_str(), strerror(errno));
return;
}
{
const unsigned int propertyId = getHasReminderProperty();
int count = 0;
- if (propertyId == 0)
- {
+ if (propertyId == 0) {
WASSERT(0);
return false;
- }
- else
- {
+ } else {
int error = calendar_record_get_int(__record, propertyId, &count);
WPRET_VM((error != CALENDAR_ERROR_NONE),false,"get id fail");
}
{
const unsigned int propertyId = getHasRepeatProperty();
int count = 0;
- if (propertyId == 0)
- {
+ if (propertyId == 0) {
const CalScheduleRepeat repeat = getRepeat();
return (repeat.unitType == CalScheduleRepeat::UnitType::ONE_TIME) ? false : true;
- }
- else
- {
+ } else {
int error = calendar_record_get_int(__record, propertyId, &count);
WPRET_VM((error != CALENDAR_ERROR_NONE),false,"get id fail");
}
error = calendar_record_get_child_record_count(record, _calendar_event.calendar_alarm, &alarmCount);
if (alarmCount <= 1)
return;
- for (i=0;i<(alarmCount-1);i++)
- {
+ for (i=0;i<(alarmCount-1);i++) {
calendar_record_h reminder = NULL;
int tick = 0, tickUnit = 0;
error = calendar_record_get_child_record_at_p(record,_calendar_event.calendar_alarm, i, &reminder);
continue;
}
error = calendar_record_get_int(reminder, _calendar_alarm.tick, &tick);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail");
}
error = calendar_record_get_int(reminder, _calendar_alarm.tick_unit, &tickUnit);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail");
}
- for (j = i+1;j<alarmCount;j++)
- {
+ for (j = i+1;j<alarmCount;j++) {
calendar_record_h reminder2 = NULL;
int tick2 = 0, tickUnit2 = 0;
error = calendar_record_get_child_record_at_p(record,_calendar_event.calendar_alarm, j, &reminder2);
continue;
}
error = calendar_record_get_int(reminder2, _calendar_alarm.tick, &tick2);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail");
}
error = calendar_record_get_int(reminder2, _calendar_alarm.tick_unit, &tickUnit2);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail");
}
- if (tick == tick2 && tickUnit == tickUnit2)
- {
+ if (tick == tick2 && tickUnit == tickUnit2) {
error = calendar_record_remove_child_record(record,_calendar_event.calendar_alarm, reminder2);
if ((error!=CALENDAR_ERROR_NONE)) {
WERROR("fail");
WDEBUG("remove duplicate reminder(%d --)",alarmCount);
alarmCount--;
error = calendar_record_destroy(reminder2, true);
- if (error != CALENDAR_ERROR_NONE)
- {
+ if (error != CALENDAR_ERROR_NONE) {
WERROR("fail");
}
break;
const CalScheduleReminder& CalScheduleReminder::operator=(const CalScheduleReminder& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
unitType = obj.unitType;
unitValue = obj.unitValue;
isCustom = obj.isCustom;
void CalScheduleReminder::getString(std::string& text) const
{
- if (unitType == NONE)
- {
+ if (unitType == NONE) {
text = _L_("IDS_CLD_OPT_NONE");
return;
}
- if (unitType != NONE && unitValue == 0)
- {
+ if (unitType != NONE && unitValue == 0) {
text = _L_("IDS_CLD_OPT_AT_START_TIME_ABB");
return;
}
displayUnitValue = minuteValue;
}
- switch(displayUnitType)
- {
+ switch(displayUnitType) {
case MIN:
if (displayUnitValue == 0)
snprintf(buffer, sizeof(buffer)-1, _L_("IDS_CLD_OPT_AT_START_TIME_ABB"));
const CalScheduleRepeat& CalScheduleRepeat::operator=( const CalScheduleRepeat& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
unitType = obj.unitType;
unitInterval = obj.unitInterval;
unitInfo = obj.unitInfo;
void CalScheduleRepeat::getString(std::string& text) const
{
- switch(unitType)
- {
+ switch(unitType) {
default:
//case CalScheduleRepeat::UnitType::ONE_TIME:
// return "One-time event";
if (!isWeek) {
char monthText[DATE_BUFFER] = {0};
if(isMonth) {
- switch(unitInfo.monthly.type)
- {
+ switch(unitInfo.monthly.type) {
default:
case CalScheduleRepeat::MONTHDAY:
break;
snprintf(textDate, sizeof(textDate),"%d/%d/%d", untilInfo.date.mday, untilInfo.date.month, untilInfo.date.year);
snprintf(textUntilDate, sizeof(textUntilDate), _L_("IDS_CLD_BODY_UNTIL_PS_LC"), textDate);
- switch(untilType)
- {
+ switch(untilType) {
default:
case CalScheduleRepeat::UntilType::FOREVER:
snprintf(buffer, sizeof(buffer),"%s", textUntilType);
void CalScheduleRepeat::getRepeatString(const Date date, const char* timezone, std::string& text) const
{
- switch(unitType)
- {
+ switch(unitType) {
default:
case CalScheduleRepeat::UnitType::ONE_TIME:
getItemString(date, timezone, text, _L_("IDS_CLD_OPT_NEVER"), NULL, false, false, true);
{
char buffer[SCHEDULE_BUFFER] = {0};
WDEBUG("Monthly[%d/%d/%d", date.year, date.month, date.mday);
- if (type == CalScheduleRepeat::MonthlyType::WEEKDAY)
- {
+ if (type == CalScheduleRepeat::MonthlyType::WEEKDAY) {
CalDateTime start(date.year, date.month, date.mday);
int weekNum = CalLocaleManager::getInstance().getDayOfWeekInMonth(timezone, start.getUtimeFromTm());
std::string text;
snprintf(buffer, sizeof(buffer), _L_("IDS_CLD_OPT_EVERY_FIFTH_PS_ABB"), text.c_str());
break;
}
- }
- else
- {
+ } else {
// ex) On day 14
snprintf(buffer, sizeof(buffer), _L_("IDS_CLD_OPT_ON_DAY_PD"), date.mday);
}
void CalScheduleRepeat::print() const
{
WDEBUG("unitInterval[%d]",unitInterval);
- switch(unitType)
- {
+ switch(unitType) {
default:
case CalScheduleRepeat::UnitType::DAY:
WDEBUG("DAY");
break;
}
- switch(untilType)
- {
+ switch(untilType) {
case CalScheduleRepeat::UntilType::FOREVER:
WDEBUG("FOREVER");
break;
WENTER();
bool check = false;
- if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_FIRST_DAY_OF_WEEK_KEY, &check))
- {
- if (check)
- {
+ if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_FIRST_DAY_OF_WEEK_KEY, &check)) {
+ if (check) {
WDEBUG(CAL_PREFERENCE_EXISTS, CAL_SETTING_FIRST_DAY_OF_WEEK_KEY);
- }
- else
- {
+ } else {
WDEBUG(CAL_PREFERENCE_DOES_NOT_EXIST, CAL_SETTING_FIRST_DAY_OF_WEEK_KEY);
setFirstDayOfWeek(CAL_SETTING_FIRST_DAY_OF_WEEK_DEFAULT);
}
- }
- else
- {
+ } else {
WERROR(CAL_PREFERENCE_READ_ERROR, CAL_SETTING_FIRST_DAY_OF_WEEK_KEY);
}
- if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_TIME_ZONE_KEY, &check))
- {
- if (check)
- {
+ if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_TIME_ZONE_KEY, &check)) {
+ if (check) {
WDEBUG(CAL_PREFERENCE_EXISTS, CAL_SETTING_TIME_ZONE_KEY);
- }
- else
- {
+ } else {
WDEBUG(CAL_PREFERENCE_DOES_NOT_EXIST, CAL_SETTING_TIME_ZONE_KEY);
setTimeZone(CAL_SETTING_TIME_ZONE_DEFAULT);
}
- }
- else
- {
+ } else {
WERROR(CAL_PREFERENCE_READ_ERROR, CAL_SETTING_TIME_ZONE_KEY);
}
- if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_SELECT_ALERT_TYPE_KEY, &check))
- {
- if (check)
- {
+ if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_SELECT_ALERT_TYPE_KEY, &check)) {
+ if (check) {
WDEBUG(CAL_PREFERENCE_EXISTS, CAL_SETTING_SELECT_ALERT_TYPE_KEY);
- }
- else
- {
+ } else {
WDEBUG(CAL_PREFERENCE_DOES_NOT_EXIST, CAL_SETTING_SELECT_ALERT_TYPE_KEY);
setAlertType(CAL_SETTING_SELECT_ALERT_TYPE_DEFAULT);
}
- }
- else
- {
+ } else {
WERROR(CAL_PREFERENCE_READ_ERROR, CAL_SETTING_SELECT_ALERT_TYPE_KEY);
}
- if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_LOCK_TIME_ZONE_KEY, &check))
- {
- if (check)
- {
+ if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_LOCK_TIME_ZONE_KEY, &check)) {
+ if (check) {
WDEBUG(CAL_PREFERENCE_EXISTS, CAL_SETTING_LOCK_TIME_ZONE_KEY);
- }
- else
- {
+ } else {
WDEBUG(CAL_PREFERENCE_DOES_NOT_EXIST, CAL_SETTING_LOCK_TIME_ZONE_KEY);
setLockTimeZone(CAL_SETTING_LOCK_TIME_ZONE_DEFAULT);
}
- }
- else
- {
+ } else {
WERROR(CAL_PREFERENCE_READ_ERROR, CAL_SETTING_LOCK_TIME_ZONE_KEY);
}
- if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_LAST_USED_CALENDAR_KEY, &check))
- {
- if (check)
- {
+ if (PREFERENCE_ERROR_NONE == preference_is_existing(CAL_SETTING_LAST_USED_CALENDAR_KEY, &check)) {
+ if (check) {
WDEBUG(CAL_PREFERENCE_EXISTS, CAL_SETTING_LAST_USED_CALENDAR_KEY);
- }
- else
- {
+ } else {
WDEBUG(CAL_PREFERENCE_DOES_NOT_EXIST, CAL_SETTING_LAST_USED_CALENDAR_KEY);
setLastUsedCalendar(CAL_SETTING_LAST_USED_CALENDAR_DEFAULT);
}
- }
- else
- {
+ } else {
WERROR(CAL_PREFERENCE_READ_ERROR, CAL_SETTING_LAST_USED_CALENDAR_KEY);
}
WENTER();
CalEvent::Type* type = (CalEvent::Type*)&userData;
- if (*type == CalEvent::TIME_CHANGED)
- {
+ if (*type == CalEvent::TIME_CHANGED) {
bool isLockTimeZone = CalSettingsManager::getInstance().getLockTimeZone();
- if (isLockTimeZone == false)
- {
+ if (isLockTimeZone == false) {
return;
}
}
// Indicates whether the 24-hour clock is used. If the value is false, the 12-hour clock is used
//TODO: why set function using get function. Where is used bool parameter __isHour24?
int error = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &__isHour24);
- if(error != SYSTEM_SETTINGS_ERROR_NONE)
- {
+ if(error != SYSTEM_SETTINGS_ERROR_NONE) {
WERROR("get SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR [%d]", error);
}
bool isLockTimeZone = getLockTimeZone();
std::string timeZone;
std::string localeTimeZone;
- if (isLockTimeZone == false)
- {
+ if (isLockTimeZone == false) {
getDeviceTimeZone(timeZone);
- }
- else
- {
+ } else {
getTimeZone(timeZone);
}
CalLocaleManager::getInstance().getTimeZone(localeTimeZone);
- if (timeZone.compare(localeTimeZone) != 0)
- {
+ if (timeZone.compare(localeTimeZone) != 0) {
CalLocaleManager::getInstance().setTimeZone(timeZone);
}
WENTER();
int value = CAL_SETTING_FIRST_DAY_OF_WEEK_DEFAULT;
int error = preference_get_int(CAL_SETTING_FIRST_DAY_OF_WEEK_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_get_int is failed(%x)", error);
return CAL_SETTING_FIRST_DAY_OF_WEEK_DEFAULT;
}
int error = 0;
error = preference_get_int(CAL_SETTING_LOCK_TIME_ZONE_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_get_int is failed (%x)", error);
return CAL_SETTING_LOCK_TIME_ZONE_DEFAULT;
- }
- else
- {
+ } else {
return (value != 0) ? true : false;
}
WLEAVE();
bool isLockTimeZone = getLockTimeZone();
int error = preference_get_string(CAL_SETTING_TIME_ZONE_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0 || isLockTimeZone == false)
- {
+ if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0 || isLockTimeZone == false) {
std::string deviceTz;
getDeviceTimeZone(deviceTz);
setTimeZone(deviceTz);
timezone = deviceTz;
- }
- else
- {
+ } else {
timezone = value;
}
- if (value)
- {
+ if (value) {
free(value);
value = NULL;
}
int error = 0;
error = preference_get_int(CAL_SETTING_SELECT_ALERT_TYPE_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_get_int is failed(%x)", error);
return CAL_SETTING_SELECT_ALERT_TYPE_DEFAULT;
}
__alertSound = std::string();
int error = preference_get_string(CAL_SETTING_NOTIFICATION_SOUND_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0)
- {
+ if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0) {
error = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, &value);
WDEBUG("get default ringtone(%s)", value);
- if (error != SYSTEM_SETTINGS_ERROR_NONE)
- {
+ if (error != SYSTEM_SETTINGS_ERROR_NONE) {
WERROR("CalSettingsManager::getAlertSound fail");
__alertSound = CAL_SETTING_NOTIFICATION_SILENT;
- }
- else
+ } else
__alertSound = value;
- }
- else
- {
+ } else {
__alertSound = value;
}
int error = 0;
error = preference_get_int(CAL_SETTING_LAST_USED_CALENDAR_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_get_int is failed(%x)", error);
return CAL_SETTING_LAST_USED_CALENDAR_DEFAULT;
}
int error = 0;
error = preference_set_int(CAL_SETTING_FIRST_DAY_OF_WEEK_KEY, type);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_set_int is failed(%x)", error);
}
}
int value = isOn ? 1 : 0;
error = preference_set_int(CAL_SETTING_LOCK_TIME_ZONE_KEY, value);
- if (error != PREFERENCE_ERROR_NONE)
- {
+ if (error != PREFERENCE_ERROR_NONE) {
WERROR("preference_set_int is failed(%x)", error);
}
- if (isOn)
- {
+ if (isOn) {
char *value = NULL;
int error = preference_get_string(CAL_SETTING_TIME_ZONE_KEY, &value);
- if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0)
- {
+ if (error != PREFERENCE_ERROR_NONE || value == NULL || strlen(value) == 0) {
// this is first set
std::string deviceTz;
getDeviceTimeZone(deviceTz);
void CalSimpleListProvider::prefetch(bool fillBothBuffers)
{
__fetcher.prefetch(fillBothBuffers);
- if (!__currentSchedule)
- {
+ if (!__currentSchedule) {
loadNext();
}
}
{
calendar_record_h record = __fetcher.getNext();
- if (record == NULL)
- {
+ if (record == NULL) {
__currentSchedule = nullptr;
return;
}
{
int error = I18N_ERROR_NONE;
error = i18n_timezone_create(&__timezone, tz.c_str());
- if (error != I18N_ERROR_NONE)
- {
+ if (error != I18N_ERROR_NONE) {
WERROR("i18n_timezone_create error");
throw std::runtime_error("i18n_timezone_create error");
}
char *tzname = NULL;
int error = I18N_ERROR_NONE;
error = i18n_timezone_get_display_name(__timezone, &tzname);
- if (error != I18N_ERROR_NONE)
- {
+ if (error != I18N_ERROR_NONE) {
WERROR("i18n_timezone_get_display_name error");
free(tzname);
- }
- else
- {
+ } else {
tzEasName = tzname;
}
std::string tz_offset = __getTzOffset(__offset);
std::string tz_name = __getTzEasName();
- if (__tz.find(TIMEZONE_UNKNOWN) == std::string::npos)
- {
+ if (__tz.find(TIMEZONE_UNKNOWN) == std::string::npos) {
snprintf(timezone, TIMEZONE_LABEL_BUFFER, "(%s) %s", tz_offset.c_str(), tz_name.c_str());
- }
- else
- {
+ } else {
snprintf(timezone, TIMEZONE_LABEL_BUFFER, "(%s)", tz_offset.c_str());
}
return timezone;
sqlite3_stmt *stmt = NULL;
int ret = 0;
- do
- {
+ do {
ret = sqlite3_open(CAL_WORLDCLOCK_DB_FILE, &db);
if (ret != SQLITE_OK) {
WERROR("sqlite3_open(%s) is failed(%d)", CAL_WORLDCLOCK_DB_FILE, ret);
int timezone_offset_hour = timezone_offset / TIME_MINUTES_IN_HOUR;
int timezone_offset_minute = timezone_offset % TIME_MINUTES_IN_HOUR;
- if (0 <= timezone_offset_hour)
- {
+ if (0 <= timezone_offset_hour) {
snprintf(offset_hour, sizeof(offset_hour), "+%d", timezone_offset_hour);
- }
- else
- {
+ } else {
snprintf(offset_hour, sizeof(offset_hour), "%d", timezone_offset_hour);
}
char offset[offset_buffer];
- if (timezone_offset_minute)
- {
+ if (timezone_offset_minute) {
snprintf(offset, sizeof(offset), "GMT%s:%d", offset_hour, timezone_offset_minute);
- }
- else
- {
+ } else {
snprintf(offset, sizeof(offset), "GMT%s", offset_hour);
}
snprintf(query, QUERY_DB_BUFFER, CAL_WORLDCLOCK_DB_TIMEZONE_QUERY, offset);
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK)
- {
+ if (ret != SQLITE_OK) {
WERROR("sqlite3_prepare_v2(%s) is failed(%d)", query, ret);
break;
}
ret = sqlite3_step(stmt);
if (ret != SQLITE_ROW
&& ret != SQLITE_OK
- && ret != SQLITE_DONE)
- {
+ && ret != SQLITE_DONE) {
WERROR("sqlite3_step is failed(%d) : %s", ret, sqlite3_errmsg(db));
break;
}
}
while (0);
- if (stmt)
- {
+ if (stmt) {
sqlite3_finalize(stmt);
}
- if (db)
- {
+ if (db) {
sqlite3_close(db);
}
return timeZone;
const CalTimeZone& CalTimeZone::operator=(const CalTimeZone& obj)
{
- if (this != &obj)
- {
+ if (this != &obj) {
__pv = obj.__pv;
}
return *this;
std::string CalTimeZone::getString(LabelType typeFormat) const
{
- switch (typeFormat)
- {
+ switch (typeFormat) {
case TIMEZONE_TIZEN_FORMAT:
return __pv->getTzDatabaseName();
break;
char* viewParam = NULL;
app_control_get_extra_data(request, CAL_APPSVC_PARAM_VIEW, &viewParam);
- if (viewParam)
- {
- if (!strcmp(viewParam, CAL_APPSVC_PARAM_VIEW_MAIN))
- {
+ if (viewParam) {
+ if (!strcmp(viewParam, CAL_APPSVC_PARAM_VIEW_MAIN)) {
__showMain(request, firstLaunch);
- }
- else if (!strcmp(viewParam, CAL_APPSVC_PARAM_VIEW_DETAIL))
- {
+ } else if (!strcmp(viewParam, CAL_APPSVC_PARAM_VIEW_DETAIL)) {
__showDetail(request);
- }
- else
- {
+ } else {
WASSERT(0);
}
free(viewParam);
- }
- else
- {
- if(firstLaunch)
- {
+ } else {
+ if(firstLaunch) {
char* dateStringParam = NULL;
app_control_get_extra_data(request, CAL_APPSVC_PARAM_DATE, &dateStringParam);
- if(dateStringParam)
- {
+ if(dateStringParam) {
CalDate date(dateStringParam);
free(dateStringParam);
naviframe.push(new CalMainView(date));
- }
- else
- {
+ } else {
naviframe.push(new CalMainView(CalDate()));
}
- }
- else
- {
+ } else {
CalEventManager::getInstance().resume();
CalEvent event(CalEvent::APP_RESUMED, CalEvent::REMOTE);
CalNaviframe& naviframe = *(CalNaviframe*)getWindow()->getBaseUiObject();
CalMainView* mainView = NULL;
- if(!firstLaunch)
- {
+ if(!firstLaunch) {
WView* topView = naviframe.getTopView();
- if(!topView || !strcmp(topView->getClassName(), "CalMainView"))
- {
+ if(!topView || !strcmp(topView->getClassName(), "CalMainView")) {
mainView = (CalMainView*)topView;
- }
- else
- {
+ } else {
WDEBUG("All stacked views will be destroyed");
naviframe.destroyAllViews();
CalEventManager::getInstance().clear();
char* dateStringParam = NULL;
app_control_get_extra_data(request, CAL_APPSVC_PARAM_DATE, &dateStringParam);
- if(dateStringParam)
- {
+ if(dateStringParam) {
CalDate date(dateStringParam);
WDEBUG("%s", date.dump().c_str());
free(dateStringParam);
- if (firstLaunch)
- {
+ if (firstLaunch) {
mainView = new CalMainView(date);
naviframe.push(mainView);
mainView->focus(date);
- }
- else
- {
- if(!mainView)
- {
+ } else {
+ if(!mainView) {
WERROR("mainView is null");
elm_exit();
- }
- else
- {
+ } else {
mainView->focus(date);
}
}
- }
- else if(firstLaunch)
- {
+ } else if(firstLaunch) {
naviframe.push(new CalMainView(CalDate()));
}
}
char* eventDateParam = NULL;
app_control_get_extra_data(request, CAL_APPSVC_PARAM_DATE, &eventDateParam);
std::shared_ptr<CalSchedule> schedule;
- if(eventDateParam)
- {
+ if(eventDateParam) {
time_t timeFromParam = (time_t)atoll(eventDateParam);
CalDateTime eventDate(*localtime(&timeFromParam));
schedule = CalDataManager::getInstance().getInstanceSchedule(atoi(eventIdParam), eventDate);
- }
- else
- {
+ } else {
schedule = CalDataManager::getInstance().getSchedule(atoi(eventIdParam));
}
{
destroyPopup();
- if(getNaviItem())
- {
+ if(getNaviItem()) {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", _L_("IDS_CLD_OPT_MANAGE_CALENDARS_ABB"));
}
CalBookManager::getInstance().getBooks(__localBookMap);
// My calendar books
- for(auto it = __localBookMap.begin(); it != __localBookMap.end(); ++it)
- {
+ for(auto it = __localBookMap.begin(); it != __localBookMap.end(); ++it) {
auto node = it->second;
- if(node && node->getStoreType() != CALENDAR_BOOK_TYPE_EVENT)
- {
+ if(node && node->getStoreType() != CALENDAR_BOOK_TYPE_EVENT) {
continue;
}
- if(node->getIndex() != DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID)
- {
+ if(node->getIndex() != DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
CalDialogBookLocalItem* item = new CalDialogBookLocalItem(CalDialogBookLocalItem::LocalBookChange, node);
item->setSelectCb([this] (const std::shared_ptr<CalBook>& book) {
CalBookManager::getInstance().updateBook(book);
}
// My birthday books
- for(auto it = __localBookMap.begin(); it != __localBookMap.end(); ++it)
- {
+ for(auto it = __localBookMap.begin(); it != __localBookMap.end(); ++it) {
auto node = it->second;
WASSERT(node->getStoreType() == CALENDAR_BOOK_TYPE_EVENT);
- if(node->getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID)
- {
+ if(node->getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
CalDialogBookLocalItem* item = new CalDialogBookLocalItem(CalDialogBookLocalItem::LocalBookChange,node);
item->setSelectCb([this] (const std::shared_ptr<CalBook>& book) {
CalBookManager::getInstance().updateBook(book);
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::APP_PAUSED:
case CalEvent::APP_RESUMED:
case CalEvent::DB_CHANGED:
case CalEvent::BOOK_DB_CHANGED:
case CalEvent::TIME_CHANGED:
case CalEvent::SETTING_CHANGED:
- if(event.source == CalEvent::REMOTE || getNaviItem() != elm_naviframe_top_item_get(getNaviframe()->getEvasObj()))
- {
+ if(event.source == CalEvent::REMOTE || getNaviItem() != elm_naviframe_top_item_get(getNaviframe()->getEvasObj())) {
__update();
}
break;
{
WENTER();
static Elm_Genlist_Item_Class itc = {}; // Implicitly 0-init in C++
- if(__item_mode == LocalBookDisplay)
- {
+ if(__item_mode == LocalBookDisplay) {
itc.item_style = "1text.1colorbar";
- }
- else
- {
+ } else {
itc.item_style = "1text.1colorbar.1check";
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
- if(strcmp(part, "elm.text") == 0)
- {
+ if(strcmp(part, "elm.text") == 0) {
CalDialogBookLocalItem* self = (CalDialogBookLocalItem*)data;
- if(self->__book->getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID)
- {
+ if(self->__book->getIndex() == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
return strdup(_L_("IDS_CLD_BODY_CONTACTS_BIRTHDAYS_ABB"));
- }
- else if(self->__book->getIndex() == DEFAULT_EVENT_CALENDAR_BOOK_ID)
- {
+ } else if(self->__book->getIndex() == DEFAULT_EVENT_CALENDAR_BOOK_ID) {
return strdup(_L_("IDS_CLD_OPT_MY_CALENDAR_ABB"));
- }
- else
- {
+ } else {
return elm_entry_utf8_to_markup(self->__book->getName());
}
}
itc.func.content_get = [](void *data, Evas_Object *obj, const char *part)->Evas_Object*
{
- if(!strcmp(part, "elm.swallow.checkbox"))
- {
+ if(!strcmp(part, "elm.swallow.checkbox")) {
CalDialogBookLocalItem *item = (CalDialogBookLocalItem *)data;
- if(item->__item_mode == LocalBookDisplay)
- {
+ if(item->__item_mode == LocalBookDisplay) {
return NULL;
- }
- else if(item->__item_mode == LocalBookChange)
- {
+ } else if(item->__item_mode == LocalBookChange) {
Evas_Object *check = elm_check_add(obj);
- if(item->__book->getVisibility())
- {
+ if(item->__book->getVisibility()) {
elm_check_state_set(check, EINA_TRUE);
- }
- else
- {
+ } else {
elm_check_state_set(check, EINA_FALSE);
}
evas_object_propagate_events_set(check, EINA_FALSE);
}, item);
item->__check = check;
return check;
- }
- else if (item->__item_mode == LocalBookDelete)
- {
+ } else if (item->__item_mode == LocalBookDelete) {
Evas_Object *check = elm_check_add(obj);
elm_check_state_set(check, EINA_FALSE);
evas_object_propagate_events_set(check, EINA_FALSE);
item->__check = check;
return check;
}
- }
- else if(!strcmp(part, "elm.swallow.color.bar"))
- {
+ } else if(!strcmp(part, "elm.swallow.color.bar")) {
CalDialogBookLocalItem *item = (CalDialogBookLocalItem *)data;
if (item->__item_mode == LocalBookDisplay || item->__item_mode == LocalBookChange
- || item->__item_mode == LocalBookDelete || item->__item_mode == LocalBookOnlySelect)
- {
+ || item->__item_mode == LocalBookDelete || item->__item_mode == LocalBookOnlySelect) {
Evas_Object* icon = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
void CalDialogBookLocalItem::onSelect()
{
- if(__item_mode == LocalBookDisplay)
- {
- if (__selectCb)
- {
+ if(__item_mode == LocalBookDisplay) {
+ if (__selectCb) {
__selectCb(__book);
}
- }
- else if(__item_mode == LocalBookChange)
- {
+ } else if(__item_mode == LocalBookChange) {
__book->setVisibility(!(__book->getVisibility()));
- if(__book->getVisibility())
- {
+ if(__book->getVisibility()) {
elm_check_state_set(__check, EINA_TRUE);
- }
- else
- {
+ } else {
elm_check_state_set(__check, EINA_FALSE);
}
- if (__selectCb)
- {
+ if (__selectCb) {
__selectCb(__book);
}
- }
- else if(__item_mode == LocalBookOnlySelect)
- {
- if (__selectCb)
- {
+ } else if(__item_mode == LocalBookOnlySelect) {
+ if (__selectCb) {
__selectCb(__book);
}
- }
- else if(__item_mode == LocalBookDelete)
- {
- if (__deleteSelectCb)
- {
+ } else if(__item_mode == LocalBookDelete) {
+ if (__deleteSelectCb) {
__deleteSelectCb(this);
}
}
void CalDialogBookLocalItem::onCheckboxCb()
{
- if(__checkboxCb)
- {
+ if(__checkboxCb) {
__checkboxCb(this->getItemCheckState());
}
}
bool CalDialogBookLocalItem::getItemCheckState()
{
- if(__check)
- {
+ if(__check) {
return elm_check_state_get(__check);
}
void CalDialogBookLocalItem::setItemCheckState(bool state)
{
- if(__check)
- {
+ if(__check) {
elm_check_state_set(__check, state);
}
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogSimpleTitleItem *item = (CalDialogSimpleTitleItem*)data;
- if (0 == strcmp(part, "elm.text"))
- {
+ if (0 == strcmp(part, "elm.text")) {
return g_strdup(_L_G_(item->__title));
}
return NULL;
CalFilterView::~CalFilterView()
{
- if (__notificationTimer)
- {
+ if (__notificationTimer) {
ecore_timer_del(__notificationTimer);
__notificationTimer = nullptr;
}
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_layout_file_set(layout, CalPath::getPath(CAL_EDJE).c_str(), "CalFilterView");
- if(isBackButtonVisibile())
- {
+ if(isBackButtonVisibile()) {
Evas_Object *buttonBack = elm_button_add(layout);
elm_object_style_set(buttonBack, "naviframe/back_btn/default");
evas_object_size_hint_weight_set(buttonBack, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
void CalFilterView::onPushed(Elm_Object_Item *naviItem)
{
WENTER();
- if(!__backButtonVisibility)
- {
+ if(!__backButtonVisibility) {
WDEBUG("Hide backButton");
elm_layout_signal_emit(getEvasObj(), "searchbar,hide", "");
}
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::DB_CHANGED:
case CalEvent::TIME_CHANGED:
case CalEvent::LANGUAGE_CHANGED:
__deleteListModels();
- if (!__isNoContents)
- {
+ if (!__isNoContents) {
evas_object_del(__noContents);
}
}
{
WENTER();
- if (__list)
- {
+ if (__list) {
delete __list;
__list = NULL;
}
void CalFilterView::showContent()
{
WENTER();
- if (__list->isEmpty())
- {
- if (!__isNoContents)
- {
- if (!__noContents)
- {
+ if (__list->isEmpty()) {
+ if (!__isNoContents) {
+ if (!__noContents) {
__noContents = createNoContent();
}
elm_object_part_content_unset(getEvasObj(), "elm.swallow.content");
evas_object_hide(__list->getEvasObj());
__isNoContents = true;
}
- }
- else
- {
- if (__isNoContents)
- {
+ } else {
+ if (__isNoContents) {
elm_object_part_content_unset(getEvasObj(), "elm.swallow.content");
}
elm_object_part_content_set(getEvasObj(), "elm.swallow.content", __list->getEvasObj());
searchBarEntry->setChangeCallback([this] (const char* text)->void
{
WDEBUG("Search text: [%p] [%s]", text, text);
- if(text && strcasecmp(text, __searchText.c_str()))
- {
+ if(text && strcasecmp(text, __searchText.c_str())) {
__searchText = text;
WDEBUG("Update list");
updateList();
searchBarEntry->setEntryMaxLenReachCallback([this]
{
- if (__notificationTimer)
- {
+ if (__notificationTimer) {
return;
}
void CalFilterView::updateList()
{
WENTER();
- if(__list)
- {
+ if(__list) {
__deleteListModels();
__list->updateSearchText(__searchText.c_str());
void CalFilterView::setFocusToSearchEntry()
{
WENTER();
- if(__searchBarEntry)
- {
+ if(__searchBarEntry) {
__searchBarEntry->setFocusToEntry();
}
WLEAVE();
void CalFilterView::__deleteListModels()
{
- if(__forwardModel)
- {
+ if(__forwardModel) {
delete __forwardModel;
__forwardModel = NULL;
}
- if(__backwardModel)
- {
+ if(__backwardModel) {
delete __backwardModel;
__backwardModel = NULL;
}
elm_object_part_content_set(layout, "elm.swallow.content", __dateTime);
evas_object_show(layout);
- if (CalSettingsManager::getInstance().isHour24())
- {
+ if (CalSettingsManager::getInstance().isHour24()) {
elm_object_style_set(__dateTime, "time_layout_24hr");
elm_datetime_format_set(__dateTime, "%d/%b/%Y %H:%M");
- }
- else
- {
+ } else {
elm_object_style_set(__dateTime, "time_layout");
elm_datetime_format_set(__dateTime, "%d/%b/%Y %I:%M %p");
}
elm_datetime_value_set(__dateTime, &time);
- if(__isRepeat)
- {
+ if(__isRepeat) {
time.tm_hour = 0;
time.tm_min = 0;
elm_datetime_value_min_set(__dateTime, &time);
setTextTranslatable(CALENDAR);
elm_object_part_text_set(parent, "title,text", __title.c_str());
addButton("IDS_CLD_BUTTON_CANCEL", NULL);
- addButton("IDS_CLD_BUTTON_SET", [this](bool* destroyPopup)
- {
+ addButton("IDS_CLD_BUTTON_SET", [this](bool* destroyPopup) {
WHIT();
struct tm time;
elm_datetime_value_get(__dateTime, &time);
CalDateTime newTime;
newTime.set(time);
- if(__changedCb)
- {
+ if(__changedCb) {
__changedCb(newTime);
}
void CalUnderlineEditField::setText(const char* text)
{
- if (__entry)
- {
+ if (__entry) {
elm_entry_entry_set(__entry, text);
}
}
void CalUnderlineEditField::setGuideText(const char* text, int font)
{
- if (__entry)
- {
- if(font)
- {
+ if (__entry) {
+ if(font) {
std::stringstream ss;
ss << "<p font_size=" << font << ">" << _L_(text) << "</p>";
elm_object_part_text_set(__entry, "elm.guide", ss.str().c_str());
- }
- else
- {
+ } else {
elm_object_part_text_set(__entry, "elm.guide", _L_(text));
}
}
void CalUnderlineEditField::setFontSize(int size)
{
- if (!__entry)
- {
+ if (!__entry) {
return;
}
const char* CalUnderlineEditField::getText()
{
- if (!__entry)
- {
+ if (!__entry) {
return NULL;
}
const char* CalUnderlineEditField::getGuideText()
{
- if (!__entry)
- {
+ if (!__entry) {
return NULL;
}
void CalUnderlineEditField::setFocusToEntry(bool showKeypadIntentionally)
{
- if (__entry)
- {
- if (showKeypadIntentionally)
- {
+ if (__entry) {
+ if (showKeypadIntentionally) {
elm_entry_input_panel_show_on_demand_set(__entry, EINA_FALSE);
}
void CalUnderlineEditField::setEntryReturnKeyType(ReturnKeyType type)
{
- if (__multiLine)
- {
+ if (__multiLine) {
return;
}
- if (__entry)
- {
- if (type == DONE)
- {
+ if (__entry) {
+ if (type == DONE) {
elm_entry_input_panel_return_key_type_set(__entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
- }
- else
- {
+ } else {
elm_entry_input_panel_return_key_type_set(__entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_NEXT);
}
}
void CalUnderlineEditField::setEntryMaxLenReachCallback(std::function<void ()> maxLenReachCallback, unsigned int maxLength)
{
- if (__entry)
- {
+ if (__entry) {
static Elm_Entry_Filter_Limit_Size limit_filter_data = {0};
limit_filter_data.max_char_count = maxLength;
elm_object_focus_allow_set(button, EINA_FALSE);
elm_object_part_content_set(__layout, "elm.swallow.button", button);
- evas_object_smart_callback_add(button, "clicked", [](void *data, Evas_Object *obj, void *event_info)
- {
+ evas_object_smart_callback_add(button, "clicked", [](void *data, Evas_Object *obj, void *event_info) {
elm_entry_entry_set((Evas_Object*)data, "");
elm_object_focus_set((Evas_Object*)data, EINA_TRUE);
},
__entry);
- auto entryChangeCallback = [](void* data, Evas_Object* obj, void* event_info)
- {
+ auto entryChangeCallback = [](void* data, Evas_Object* obj, void* event_info) {
CalUnderlineEditField* self = (CalUnderlineEditField*)data;
char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(obj));
- if (self->__changeCallback)
- {
+ if (self->__changeCallback) {
self->__changeCallback(text);
}
free(text);
- if (elm_entry_is_empty(obj))
- {
+ if (elm_entry_is_empty(obj)) {
elm_object_signal_emit(self->__layout, "elm,action,hide,button", "");
- }
- else
- {
+ } else {
elm_object_signal_emit(self->__layout, "elm,action,show,button", "");
}
};
evas_object_smart_callback_add(__entry, "changed", entryChangeCallback, this);
evas_object_smart_callback_add(__entry, "preedit,changed", entryChangeCallback, this);
- evas_object_smart_callback_add(__entry, "activated", [](void *data, Evas_Object *obj, void *event_info)
- {
+ evas_object_smart_callback_add(__entry, "activated", [](void *data, Evas_Object *obj, void *event_info) {
CalUnderlineEditField* self = (CalUnderlineEditField*)data;
- if (self->__entryCompleteCallback)
- {
+ if (self->__entryCompleteCallback) {
self->__entryCompleteCallback();
}
- if (ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE == elm_entry_input_panel_return_key_type_get(obj))
- {
+ if (ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE == elm_entry_input_panel_return_key_type_get(obj)) {
elm_entry_input_panel_hide(obj);
}
},
this);
- evas_object_smart_callback_add(__entry, "maxlength,reached", [](void *data, Evas_Object *obj, void *event_info)
- {
+ evas_object_smart_callback_add(__entry, "maxlength,reached", [](void *data, Evas_Object *obj, void *event_info) {
CalUnderlineEditField* self = (CalUnderlineEditField*)data;
- if (self->__maxLenReachCallback)
- {
+ if (self->__maxLenReachCallback) {
self->__maxLenReachCallback();
}
},
{
if (0 == strcmp(part, "elm.text.title"))
return g_strdup(_L_("IDS_CLD_BUTTON_NOTES_ABB"));
- else if (0 == strcmp(part, "elm.text.multiline"))
- {
+ else if (0 == strcmp(part, "elm.text.multiline")) {
CalDialogDetailDescriptionItem *item = (CalDialogDetailDescriptionItem*)data;
return g_strdup(item->__description);
}
itc.func.text_get = [](void *data, Evas_Object *obj, const char *part)->char*
{
CalDialogDetailEventTimeItem *item = (CalDialogDetailEventTimeItem*)data;
- if (!strcmp(part, "elm.text.multiline"))
- {
+ if (!strcmp(part, "elm.text.multiline")) {
std::string timeText;
item->__schedule->getFromToDisplayString(timeText);
return strdup(timeText.c_str());
CalDialogDetailReminderItem *item = (CalDialogDetailReminderItem*)data;
if (0 == strcmp(part, "elm.text.title")) {
return g_strdup(_L_("IDS_CLD_BUTTON_REMINDER_ABB"));
- }
- else if (0 == strcmp(part, "elm.text.multiline")) {
+ } else if (0 == strcmp(part, "elm.text.multiline")) {
std::string strText;
std::string strResult;
for (auto it = item->__reminders.begin(); it != item->__reminders.end(); ++it) {
setTextTranslatable(CALENDAR);
elm_object_part_text_set(parent, "title,text", _L_("IDS_CLD_HEADER_SET_DATE"));
addButton("IDS_CLD_BUTTON_CANCEL", NULL);
- addButton("IDS_CLD_BUTTON_SET", [this](bool* destroyPopup)
- {
- if (__changedCb)
- {
+ addButton("IDS_CLD_BUTTON_SET", [this](bool* destroyPopup) {
+ if (__changedCb) {
struct tm time;
elm_datetime_value_get(__dateTime, &time);
__dateInitial.set(&time);
__isAllDay(false),
__isStartSelected(true)
{
- if(startDateTime.getHour() == 0 && startDateTime.getMinute() == 0)
- {
+ if(startDateTime.getHour() == 0 && startDateTime.getMinute() == 0) {
struct tm tmStart;
struct tm tmEnd;
startDateTime.getTmFromUtime(&tmStart);
double seconds = difftime(mktime(&tmEnd), mktime(&tmStart));
double days = seconds/(60 * 60 * 24.0);
- if((days > 0.0 && !(days - floor(days) > 0.0)) || __end == __start)
- {
+ if((days > 0.0 && !(days - floor(days) > 0.0)) || __end == __start) {
__isAllDay = true;
}
}
{
WENTER();
CalDialogEditDateTimeItem* item = (CalDialogEditDateTimeItem*)data;
- if (!strcmp(part, "start_datetime"))
- {
+ if (!strcmp(part, "start_datetime")) {
return item->__startDateTimeBox = item->onCreateDateTime(obj, true);
- }
- else if (!strcmp(part, "end_datetime"))
- {
+ } else if (!strcmp(part, "end_datetime")) {
return item->__endDateTimeBox = item->onCreateDateTime(obj, false);
- }
- else if (!strcmp(part, "all_day_check"))
- {
+ } else if (!strcmp(part, "all_day_check")) {
return item->__allDayCheckBox = item->onCreateAllDayCheckBox(obj);
}
char temp[FORMAT_BUFFER] = {0};
CalDialogEditDateTimeItem* item = (CalDialogEditDateTimeItem*)data;
- if (!strcmp(part, "start_title"))
- {
+ if (!strcmp(part, "start_title")) {
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_BODY_START_M_DATE"));
return strdup(temp);
- }
- else if (!strcmp(part, "end_title"))
- {
+ } else if (!strcmp(part, "end_title")) {
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_BODY_END_M_DATE"));
return strdup(temp);
- }
- else if (!strcmp(part, "all_day_title"))
- {
+ } else if (!strcmp(part, "all_day_title")) {
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_OPT_ALL_DAY_ABB2"));
return strdup(temp);
}
void CalDialogEditDateTimeItem::getDateTime(CalDateTime* startDateTime, CalDateTime* endDateTime, Eina_Bool* allDay)
{
- if(startDateTime)
- {
+ if(startDateTime) {
*startDateTime = __start;
}
- if(endDateTime)
- {
+ if(endDateTime) {
*endDateTime = __end;
}
- if(allDay)
- {
+ if(allDay) {
*allDay = __isAllDay;
}
}
void CalDialogEditDateTimeItem::__onDateButtonClicked(void* data, Evas_Object* obj, void* event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if (self->__dateButtonClickedCb)
- {
+ if (self->__dateButtonClickedCb) {
self->__dateButtonClickedCb(obj);
}
}
void CalDialogEditDateTimeItem::__onTimeButtonClicked(void* data, Evas_Object* obj, void* event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if (self->__timeButtonClickedCb)
- {
+ if (self->__timeButtonClickedCb) {
self->__timeButtonClickedCb(obj);
}
}
void CalDialogEditDateTimeItem::__onStartDateClicked(void *data, Evas_Object *obj, void *event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if(self)
- {
+ if(self) {
self->__isStartSelected = true;
- if(self->__dateButtonClickedCb)
- {
+ if(self->__dateButtonClickedCb) {
self->__dateButtonClickedCb(obj);
}
}
void CalDialogEditDateTimeItem::__onEndDateClicked(void *data, Evas_Object *obj, void *event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if(self)
- {
+ if(self) {
self->__isStartSelected = false;
- if(self->__dateButtonClickedCb)
- {
+ if(self->__dateButtonClickedCb) {
self->__dateButtonClickedCb(obj);
}
}
void CalDialogEditDateTimeItem::__onStartTimeClicked(void *data, Evas_Object *obj, void *event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if(self)
- {
+ if(self) {
self->__isStartSelected = true;
- if (self->__timeButtonClickedCb)
- {
+ if (self->__timeButtonClickedCb) {
self->__timeButtonClickedCb(obj);
}
}
void CalDialogEditDateTimeItem::__onEndTimeClicked(void *data, Evas_Object *obj, void *event_info)
{
CalDialogEditDateTimeItem* self = static_cast<CalDialogEditDateTimeItem*>(data);
- if(self)
- {
+ if(self) {
self->__isStartSelected = false;
- if (self->__timeButtonClickedCb)
- {
+ if (self->__timeButtonClickedCb) {
self->__timeButtonClickedCb(obj);
}
}
WENTER();
std::string strTime;
std::string strDate;
- if (start)
- {
+ if (start) {
__start.getTimeString(strTime);
__start.getDateString(strDate);
- }
- else
- {
+ } else {
__end.getTimeString(strTime);
__end.getDateString(strDate);
}
evas_object_show(dateBtn);
int fontSize = getSystemFontSize();
- if(fontSize > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(fontSize > TEXT_ITEM_DEFAULT_SIZE) {
fontSize = TEXT_ITEM_DEFAULT_SIZE;
}
elm_object_text_set(dateBtn, temp);
- if (!__isAllDay)
- {
+ if (!__isAllDay) {
Evas_Object* timeBtn = elm_button_add(layout);
evas_object_size_hint_align_set(timeBtn, EVAS_HINT_FILL, EVAS_HINT_FILL);
Evas_Smart_Cb timeCB = start ? __onStartTimeClicked : __onEndTimeClicked;
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, fontSize, strTime.c_str());
elm_object_text_set(timeBtn, temp);
- if (start)
- {
+ if (start) {
__timeStartButton = timeBtn;
- }
- else
- {
+ } else {
__timeEndButton = timeBtn;
}
}
item->__end.setAllDay(isAllDay);
item->__isAllDay= isAllDay;
- if (item->__changedCb)
- {
+ if (item->__changedCb) {
item->__changedCb(item->__start, item->__end);
}
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditMoreItem* item = (CalDialogEditMoreItem*) data;
- if (!strcmp(part, "button1"))
- {
+ if (!strcmp(part, "button1")) {
return item->__button1 = item->onCreateIcon(obj, CalPath::getPath("icon_button_location.png", CalPath::IMAGE).c_str(), LOCATION);
- }
- else if (!strcmp(part, "button3"))
- {
+ } else if (!strcmp(part, "button3")) {
return item->__button3 = item->onCreateIcon(obj, CalPath::getPath("icon_button_repeat.png", CalPath::IMAGE).c_str(), REPEAT);
- }
- else if (!strcmp(part, "button2"))
- {
+ } else if (!strcmp(part, "button2")) {
return item->__button2 = item->onCreateIcon(obj, CalPath::getPath("icon_button_reminder.png", CalPath::IMAGE).c_str(), REMINDER);
- }
- else if (!strcmp(part, "button4"))
- {
+ } else if (!strcmp(part, "button4")) {
return item->__button4 = item->onCreateIcon(obj, CalPath::getPath("icon_button_more.png", CalPath::IMAGE).c_str(), MORE);
- }
- else
- {
+ } else {
return NULL;
}
};
//evas_object_data_set(image, "buttonType", buttonType);
bool result = (EINA_TRUE == elm_image_file_set(image, icon_name, NULL));
- if (!result)
- {
+ if (!result) {
ERR("error with elm_image_file_set, image path %s", icon_name);
}
evas_object_size_hint_weight_set(image, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditMoreMenuItem *item = (CalDialogEditMoreMenuItem*)data;
- if (0 == strcmp("elm.text", part))
- {
+ if (0 == strcmp("elm.text", part)) {
return g_strdup(item->__text);
}
return NULL;
:CalDialogControl::Item(sortIndex),
__selectCb(nullptr)
{
- if(subText)
- {
+ if(subText) {
int fontSize = getSystemFontSize();
- if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE) {
std::stringstream ss;
ss << "<p font_size=" << fontSize << ">" << subText << "</p>";
__subText = ss.str();
- }
- else
- {
+ } else {
__subText = subText;
}
}
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditOneTextRemoveIconItem* item = (CalDialogEditOneTextRemoveIconItem*)data;
- if(!strcmp(part, "elm.swallow.end"))
- {
+ if(!strcmp(part, "elm.swallow.end")) {
Evas_Object* box = elm_box_add(obj);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditOneTextRemoveIconItem* item = (CalDialogEditOneTextRemoveIconItem*)data;
- if(!strcmp(part, "elm.text") && !item->__subText.empty())
- {
+ if(!strcmp(part, "elm.text") && !item->__subText.empty()) {
return strdup(_L_(item->__subText.c_str()));
}
void CalDialogEditOneTextRemoveIconItem::setSubText(const char* text)
{
- if(text)
- {
+ if(text) {
__subText = text;
}
}
void CalDialogEditOneTextRemoveIconItem::onSelect()
{
WENTER();
- if(__selectCb)
- {
+ if(__selectCb) {
__selectCb();
}
}
__editField = new CalUnderlineEditField(__multiLine);
__editField->create(parent, NULL);
- if (__onCreateEditField)
- {
+ if (__onCreateEditField) {
__onCreateEditField(__editField);
}
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditOptionalTextFieldItem* item = (CalDialogEditOptionalTextFieldItem*)data;
- if (!strcmp(part, "elm.icon.entry"))
- {
+ if (!strcmp(part, "elm.icon.entry")) {
return item->createEntry(obj);
- }
- else if (!strcmp(part, "elm.icon"))
- {
+ } else if (!strcmp(part, "elm.icon")) {
return item->createRemoveButton(obj);
}
elm_radio_value_set(radio, item->__radioIndex);
evas_object_smart_callback_add(radio, "changed",
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
CalDialogEditReminderRadioItem *item = (CalDialogEditReminderRadioItem*)data;
if (item->__radioIndex == elm_radio_value_get(obj) && item->__changeCb) {
item->__changeCb(item->__reminder);
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatMonthUnitItem *item = (CalDialogEditRepeatMonthUnitItem*) data;
- if (0 == strcmp("elm.text", part))
- {
+ if (0 == strcmp("elm.text", part)) {
std::string text;
CalScheduleRepeat::Date date;
const char* tz = item->__timezone.c_str();
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatRadioItem *item = (CalDialogEditRepeatRadioItem*) data;
- if (0 == strcmp("elm.text", part))
- {
+ if (0 == strcmp("elm.text", part)) {
std::string repeatText;
CalScheduleRepeat repeat;
repeat.unitType = item->__repeatType;
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditRepeatRadioItem *item = (CalDialogEditRepeatRadioItem*)data;
- if (0 == strcmp("elm.swallow.end", part))
- {
+ if (0 == strcmp("elm.swallow.end", part)) {
Evas_Object *radio_main = (Evas_Object *)evas_object_data_get(obj, "radio_main");
c_retv_if(NULL == radio_main, NULL);
elm_radio_value_set(radio, item->__radioIndex);
evas_object_smart_callback_add(radio, "changed",
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
CalDialogEditRepeatRadioItem *item = (CalDialogEditRepeatRadioItem*)data;
if (item->__radioIndex == elm_radio_value_get(obj)) {
item->__changeCb(item->__repeatType);
, __unitType(unitType)
, __button(NULL)
{
- if (repeat.unitType == unitType)
- {
+ if (repeat.unitType == unitType) {
__unitInterval = repeat.unitInterval;
- }
- else
- {
+ } else {
__unitInterval = 0;
}
}
__unitInterval = repeat.unitInterval;
int times = 1;
- if (repeat.unitInterval)
- {
+ if (repeat.unitInterval) {
times = repeat.unitInterval;
}
{
static Elm_Genlist_Item_Class itc = {};
- if (CalLocaleManager::getInstance().isRTL())
- {
+ if (CalLocaleManager::getInstance().isRTL()) {
itc.item_style = "CalDialogEditRepeatUnitItemRTL";
- }
- else
- {
+ } else {
itc.item_style = "CalDialogEditRepeatUnitItem";
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatUnitItem *item = (CalDialogEditRepeatUnitItem*)data;
- if (0 == strcmp("elm.text.left", part))
- {
+ if (0 == strcmp("elm.text.left", part)) {
char temp[FORMAT_BUFFER] = {0};
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_OPT_EVERY"));
return strdup(temp);
- }
- else if (0 == strcmp("elm.text.right", part))
- {
+ } else if (0 == strcmp("elm.text.right", part)) {
int form = item->__unitInterval == 1 ? SINGULAR : PLURAL;
- switch (item->__unitType)
- {
+ switch (item->__unitType) {
case CalScheduleRepeat::DAY:
return strdup(_L_(unitLabels[DAY_LABEL][form]));
case CalScheduleRepeat::WEEK:
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditRepeatUnitItem *item = (CalDialogEditRepeatUnitItem*)data;
- if (0 == strcmp("elm.swallow.unit", part))
- {
+ if (0 == strcmp("elm.swallow.unit", part)) {
Evas_Object *button = elm_button_add(obj);
evas_object_propagate_events_set(button, EINA_FALSE);
evas_object_size_hint_min_set(button, ELM_SCALE_SIZE(60), ELM_SCALE_SIZE(60));
evas_object_smart_callback_add(button, "clicked",
- [](void* data, Evas_Object* obj, void* event_info)
- {
+ [](void* data, Evas_Object* obj, void* event_info) {
CalDialogEditRepeatUnitItem *item = (CalDialogEditRepeatUnitItem*)data;
- if(item->__dateButtonClickedCb)
- {
+ if(item->__dateButtonClickedCb) {
item->__dateButtonClickedCb();
}
}, item
);
int times = 1;
- if (item->__unitInterval)
- {
+ if (item->__unitInterval) {
times = item->__unitInterval;
}
, __radio(NULL)
, __button(NULL)
{
- if (repeat.untilType == CalScheduleRepeat::DUE_DATE)
- {
+ if (repeat.untilType == CalScheduleRepeat::DUE_DATE) {
__untilInfo.date = repeat.untilInfo.date;
__dateTime.set(__untilInfo.date.year, __untilInfo.date.month, __untilInfo.date.mday);
- }
- else
- {
- if (repeat.unitType == CalScheduleRepeat::DAY)
- {
+ } else {
+ if (repeat.unitType == CalScheduleRepeat::DAY) {
__dateTime.addDays(7);
- }
- else if (repeat.unitType == CalScheduleRepeat::WEEK)
- {
+ } else if (repeat.unitType == CalScheduleRepeat::WEEK) {
__dateTime.addMonths(1);
- }
- else if (repeat.unitType == CalScheduleRepeat::MONTH)
- {
+ } else if (repeat.unitType == CalScheduleRepeat::MONTH) {
__dateTime.addYears(1);
- }
- else if (repeat.unitType == CalScheduleRepeat::YEAR)
- {
+ } else if (repeat.unitType == CalScheduleRepeat::YEAR) {
__dateTime.addYears(5);
}
void CalDialogEditRepeatUntilDueDateItem::__onDateButtonClicked(void *data, Evas_Object *obj, void *event_info)
{
CalDialogEditRepeatUntilDueDateItem* item = static_cast<CalDialogEditRepeatUntilDueDateItem*>(data);
- if(item)
- {
+ if(item) {
item->__dateButtonClickedCb(obj);
elm_radio_value_set(item->__radio, item->__radioIndex);
std::string dateString;
__dateTime.getDateString(dateString);
- if(!dateString.empty())
- {
+ if(!dateString.empty()) {
int fontSize = getSystemFontSize();
- if(fontSize > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(fontSize > TEXT_ITEM_DEFAULT_SIZE) {
fontSize = TEXT_ITEM_DEFAULT_SIZE;
}
{
static Elm_Genlist_Item_Class itc = {}; // Implicitly 0-init in C++
- if (CalLocaleManager::getInstance().isRTL())
- {
+ if (CalLocaleManager::getInstance().isRTL()) {
itc.item_style = "CalDialogEditRepeatUntilDueDateItemRTL";
- }
- else
- {
+ } else {
itc.item_style = "CalDialogEditRepeatUntilDueDateItem";
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatUntilDueDateItem *item = (CalDialogEditRepeatUntilDueDateItem*)data;
- if (!strcmp("elm.text", part))
- {
+ if (!strcmp("elm.text", part)) {
char temp[FORMAT_BUFFER] = {0};
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), "~");
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditRepeatUntilDueDateItem *item = (CalDialogEditRepeatUntilDueDateItem*)data;
- if (!strcmp("elm.swallow.date", part))
- {
+ if (!strcmp("elm.swallow.date", part)) {
Evas_Object *button = elm_button_add(obj);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
std::string dateString;
item->__dateTime.getDateString(dateString);
- if(!dateString.empty())
- {
+ if(!dateString.empty()) {
int fontSize = item->getSystemFontSize();
- if(fontSize > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(fontSize > TEXT_ITEM_DEFAULT_SIZE) {
fontSize = TEXT_ITEM_DEFAULT_SIZE;
}
item->__button = button;
return button;
- }
- else if (!strcmp("elm.icon.right", part))
- {
+ } else if (!strcmp("elm.icon.right", part)) {
Evas_Object *radio_main = (Evas_Object *)evas_object_data_get(obj, "radio_main");
c_retv_if(NULL == radio_main, NULL);
evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(radio, "changed", [](void *data, Evas_Object *obj, void *event_info)->void {
CalDialogEditRepeatUntilDueDateItem *item = (CalDialogEditRepeatUntilDueDateItem *)data;
- if (item->__radioIndex == elm_radio_value_get(obj) && item->__changedCb)
- {
+ if (item->__radioIndex == elm_radio_value_get(obj) && item->__changedCb) {
item->__changedCb(CalScheduleRepeat::DUE_DATE, item->__untilInfo);
}
}, item
elm_radio_state_value_set(radio, item->__radioIndex);
elm_radio_group_add(radio, radio_main);
- if (item->__repeat.untilType == CalScheduleRepeat::DUE_DATE)
- {
+ if (item->__repeat.untilType == CalScheduleRepeat::DUE_DATE) {
elm_radio_value_set(radio, item->__radioIndex);
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatUntilForeverItem *item = (CalDialogEditRepeatUntilForeverItem*)data;
- if (0 == strcmp("elm.text", part))
- {
+ if (0 == strcmp("elm.text", part)) {
char temp[FORMAT_BUFFER] = {0};
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_OPT_FOREVER"));
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditRepeatUntilForeverItem *item = (CalDialogEditRepeatUntilForeverItem*)data;
- if (0 == strcmp("elm.swallow.end", part))
- {
+ if (0 == strcmp("elm.swallow.end", part)) {
Evas_Object *radio_main = (Evas_Object *)evas_object_data_get(obj, "radio_main");
c_retv_if(NULL == radio_main, NULL);
, __radio(NULL)
, __button(NULL)
{
- if (repeat.untilType == CalScheduleRepeat::TIMES)
- {
+ if (repeat.untilType == CalScheduleRepeat::TIMES) {
__untilInfo.times = repeat.untilInfo.times;
- }
- else
- {
+ } else {
__untilInfo.times = DEFAULT_VALUE;
}
}
__untilInfo.times = repeat.untilInfo.times;
int times = DEFAULT_VALUE;
- if (__untilInfo.times)
- {
+ if (__untilInfo.times) {
times = __untilInfo.times;
}
{
static Elm_Genlist_Item_Class itc = {};
- if (CalLocaleManager::getInstance().isRTL())
- {
+ if (CalLocaleManager::getInstance().isRTL()) {
itc.item_style = "CalDialogEditRepeatUntilTimesItemRTL";
- }
- else
- {
+ } else {
itc.item_style = "CalDialogEditRepeatUntilTimesItem";
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditRepeatUntilTimesItem *item = (CalDialogEditRepeatUntilTimesItem*) data;
- if (0 == strcmp("elm.text", part))
- {
+ if (0 == strcmp("elm.text", part)) {
char temp[FORMAT_BUFFER] = {0};
snprintf(temp, sizeof(temp) - 1, LABEL_FORMAT, item->getSystemFontSize(), _L_("IDS_CLD_OPT_TIMES_LC"));
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditRepeatUntilTimesItem *item = (CalDialogEditRepeatUntilTimesItem*) data;
- if (0 == strcmp("elm.swallow.times", part))
- {
+ if (0 == strcmp("elm.swallow.times", part)) {
Evas_Object *button = elm_button_add(obj);
evas_object_propagate_events_set(button, EINA_FALSE);
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_radio_value_set(item->__radio, item->__radioIndex);
Evas_Object* radio = elm_radio_selected_object_get(item->__radio);
evas_object_smart_callback_call(radio, "changed", NULL);
- if(item->__dateButtonClickedCb)
- {
+ if(item->__dateButtonClickedCb) {
item->__dateButtonClickedCb(obj);
}
}, item
);
int times = DEFAULT_VALUE;
- if (item->__untilInfo.times)
- {
+ if (item->__untilInfo.times) {
times = item->__untilInfo.times;
}
item->__button = button;
return button;
- }
- else if (0 == strcmp("elm.icon.right", part))
- {
+ } else if (0 == strcmp("elm.icon.right", part)) {
Evas_Object *radio_main = (Evas_Object *)evas_object_data_get(obj, "radio_main");
c_retv_if(NULL == radio_main, NULL);
[](void *data, Evas_Object *obj, void *event_info)->void
{
CalDialogEditRepeatUntilTimesItem *item = (CalDialogEditRepeatUntilTimesItem *)data;
- if (item->__radioIndex == elm_radio_value_get(obj) && item->__changedCb)
- {
+ if (item->__radioIndex == elm_radio_value_get(obj) && item->__changedCb) {
item->__changedCb(CalScheduleRepeat::TIMES, item->__untilInfo);
}
}, item
elm_radio_state_value_set(radio, item->__radioIndex);
elm_radio_group_add(radio, radio_main);
- if (item->__repeat.untilType == CalScheduleRepeat::TIMES)
- {
+ if (item->__repeat.untilType == CalScheduleRepeat::TIMES) {
elm_radio_value_set(radio, item->__radioIndex);
}
Elm_Object_Item* item = Item::getElmObjectItem();
Evas_Object* genlist = elm_object_item_widget_get(item);
- if(genlist)
- {
+ if(genlist) {
Evas_Object *radio_main = (Evas_Object *)evas_object_data_get(genlist, "radio_main");
WPRET_M(!radio_main, "radio_main NULL");
CalDialogEditRepeatWeeklyUnitInfoItem *item = (CalDialogEditRepeatWeeklyUnitInfoItem*)data;
long long day = reinterpret_cast<long long>(evas_object_data_get(obj, "day"));
item->__unitInfo.weekly.selected[day] = elm_check_state_get(obj);
- if (item->__changedCb)
- {
+ if (item->__changedCb) {
item->__changedCb(item->__unitInfo);
}
}, item
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditTextFieldItem* item = (CalDialogEditTextFieldItem*)data;
- if (strcmp(part, "elm.swallow.content") == 0)
- {
+ if (strcmp(part, "elm.swallow.content") == 0) {
return item->createEntry(obj);
- }
- else
- {
+ } else {
return NULL;
}
};
evas_object_event_callback_add(__editField->getEvasObj(), EVAS_CALLBACK_DEL, onEditFieldDestroyed, this);
- if (__onCreateEditField)
- {
+ if (__onCreateEditField) {
__onCreateEditField(__editField);
}
void CalDialogEditTextFieldItem::onRealized()
{
- if (__onFocusSet)
- {
+ if (__onFocusSet) {
__onFocusSet(__editField);
__onFocusSet = nullptr;
}
:CalDialogControl::Item(sortIndex),
__selectCb(nullptr)
{
- if(mainText)
- {
+ if(mainText) {
__mainText = mainText;
}
- if(subText)
- {
+ if(subText) {
setSubText(subText);
}
}
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogEditTwoTextRemoveIconItem* item = (CalDialogEditTwoTextRemoveIconItem*)data;
- if(!strcmp(part, "elm.swallow.end"))
- {
+ if(!strcmp(part, "elm.swallow.end")) {
Evas_Object* button = elm_button_add(obj);
elm_object_style_set(button, "icon_expand_delete");
evas_object_propagate_events_set(button, EINA_FALSE);
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogEditTwoTextRemoveIconItem* item = (CalDialogEditTwoTextRemoveIconItem*)data;
- if(!strcmp(part, "elm.text.sub"))
- {
- if(!item->__mainText.empty())
- {
+ if(!strcmp(part, "elm.text.sub")) {
+ if(!item->__mainText.empty()) {
return strdup(_L_G_(item->__mainText.c_str()));
}
- }
- else if(!strcmp(part, "elm.text"))
- {
- if(!item->__subText.empty())
- {
+ } else if(!strcmp(part, "elm.text")) {
+ if(!item->__subText.empty()) {
return strdup(_L_G_(item->__subText.c_str()));
}
}
void CalDialogEditTwoTextRemoveIconItem::setMainText(const char* text)
{
- if(text)
- {
+ if(text) {
__mainText = text;
}
}
void CalDialogEditTwoTextRemoveIconItem::setSubText(const char* text)
{
- if(text)
- {
+ if(text) {
int fontSize = getSystemFontSize();
- if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE) {
std::stringstream ss;
ss << "<p font_size=" << fontSize << ">" << text << "</p>";
__subText = ss.str();
- }
- else
- {
+ } else {
__subText = text;
}
}
void CalDialogEditTwoTextRemoveIconItem::onSelect()
{
WENTER();
- if(__selectCb)
- {
+ if(__selectCb) {
__selectCb();
}
}
Elm_Object_Item* objectItem = NULL;
Evas_Object* genlist = getEvasObj();
WPRET_VM((genlist == NULL),NULL,"get fail");
- if (item == NULL)
- {
+ if (item == NULL) {
WERROR("item is NULL");
return NULL;
}
int sortIndex = item->getSortIndex();
WDEBUG("sortIndex:%d", sortIndex);
- if (sortIndex == 0)
- {
+ if (sortIndex == 0) {
WERROR("fail");
return NULL;
}
std::set<int>::iterator it=__sortedSet.find(sortIndex);
- if (it != __sortedSet.end())
- {
+ if (it != __sortedSet.end()) {
WERROR("already add");
return NULL;
}
Elm_Object_Item* curObj = NULL;
curObj = elm_genlist_first_item_get(genlist);
- if (curObj == NULL)
- {
+ if (curObj == NULL) {
objectItem = elm_genlist_item_append(genlist, item->getItemClassStatic(), item, NULL, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
CalDialogControl::Item* item = (CalDialogControl::Item*)data;
item->onSelect();
}, item);
- }
- else
- {
- do
- {
+ } else {
+ do {
Elm_Object_Item* nextObj = NULL;
CalDialogControl::Item* curItem = (CalDialogControl::Item*)elm_object_item_data_get(curObj);
CalDialogControl::Item* nextItem = NULL;
nextObj = elm_genlist_item_next_get(curObj);
- if (nextObj == NULL)
- {
- if (sortIndex > curIndex)
- {
+ if (nextObj == NULL) {
+ if (sortIndex > curIndex) {
objectItem = elm_genlist_item_append(genlist, item->getItemClassStatic(), item, NULL, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
CalDialogControl::Item* item = (CalDialogControl::Item*)data;
item->onSelect();
}, item);
- }
- else
- {
+ } else {
objectItem = elm_genlist_item_insert_before(genlist, item->getItemClassStatic(), item, NULL,
curObj, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
}, item);
}
break;
- }
- else
- {
+ } else {
nextItem = (CalDialogControl::Item*)elm_object_item_data_get(nextObj);
nextIndex = nextItem->getSortIndex();
- if (curIndex < sortIndex && sortIndex < nextIndex)
- {
+ if (curIndex < sortIndex && sortIndex < nextIndex) {
objectItem = elm_genlist_item_insert_after(genlist, item->getItemClassStatic(), item, NULL,
curObj, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
item->onSelect();
}, item);
break;
- }
- else if (curIndex > sortIndex)
- {
+ } else if (curIndex > sortIndex) {
objectItem = elm_genlist_item_insert_before(genlist, item->getItemClassStatic(), item, NULL,
curObj, ELM_GENLIST_ITEM_NONE,
- [](void *data, Evas_Object *obj, void *event_info)
- {
+ [](void *data, Evas_Object *obj, void *event_info) {
Elm_Object_Item* genlistItem = (Elm_Object_Item*) event_info;
elm_genlist_item_selected_set(genlistItem, EINA_FALSE);
{
WENTER();
const Elm_Object_Item* objectItem = item->getElmObjectItem();
- if (objectItem)
- {
+ if (objectItem) {
__sortedSet.erase(item->getSortIndex());
elm_object_item_del((Elm_Object_Item*)objectItem);
- }
- else
- {
+ } else {
WDEBUG("already remove or not yet add");
}
}
void CalEditField::setGuideText(const char* text, int font)
{
- if (__entry)
- {
- if(font)
- {
+ if (__entry) {
+ if(font) {
std::stringstream ss;
ss << "<p font_size=" << font << ">" << _L_(text) << "</p>";
elm_object_part_text_set(__entry, "elm.guide", ss.str().c_str());
- }
- else
- {
+ } else {
elm_object_part_text_set(__entry, "elm.guide", _L_(text));
}
}
void CalEditField::setFontSize(int size)
{
- if (!__entry)
- {
+ if (!__entry) {
return;
}
__reminder.unitType = CalScheduleReminder::MIN;
__reminder.unitValue = 10;
__reminder.isCustom = false;
- }
- else if (__reminder.unitType == CalScheduleReminder::NONE)
- {
+ } else if (__reminder.unitType == CalScheduleReminder::NONE) {
__radio_index = 1;
__reminder.isCustom = false;
- }
- else
- {
+ } else {
__reminder.isCustom = true;
int minuteValue = __reminder.getMinuteValue();
- switch(minuteValue)
- {
+ switch(minuteValue) {
case 0:
__reminder.unitType = CalScheduleReminder::MIN;
__reminder.unitValue = minuteValue;
elm_radio_value_set(radio_main, __radio_index);
- if(__reminder.isCustom)
- {
+ if(__reminder.isCustom) {
__addRadioItem(dialog, radio_main, radio_index, __reminder.unitType, __reminder.unitValue);
}
void CalEditReminderPopup::__addRadioItem(CalDialogControl *dialog, Evas_Object* radioObj, int& radioIndex, CalScheduleReminder::UnitType type, int unitValue)
{
bool setRadio = false;
- if (__isEditReminder && __reminder.unitType == type && __reminder.unitValue == unitValue)
- {
+ if (__isEditReminder && __reminder.unitType == type && __reminder.unitValue == unitValue) {
setRadio = true;
}
CalDialogEditReminderRadioItem* radioItem = new CalDialogEditReminderRadioItem(__reminder, radioIndex, type, unitValue, setRadio, type == CalScheduleReminder::NONE);
radioItem->setSelectCb([this, radioObj, radioIndex](void)->void{
- if (__radio_index == radioIndex)
- {
- if (__doneCb)
- {
+ if (__radio_index == radioIndex) {
+ if (__doneCb) {
__doneCb(__reminder, __radio_index);
}
}
);
__customItem->setRadioChangeCb([this](const CalScheduleReminder& reminder)->void{
- if (__customSelectedCb)
- {
+ if (__customSelectedCb) {
__radio_index = 10;
__customSelectedCb(__reminder, __radio_index);
}
int radioIndex = 1;
__dialog->add(new CalDialogEditRepeatMonthUnitItem(
- [this](CalScheduleRepeat::MonthlyType monthlyType)
- {
+ [this](CalScheduleRepeat::MonthlyType monthlyType) {
// TODO: Set date
__repeat.unitInfo.monthly.type = monthlyType;
}, __repeat, __startTime, __timezone, radioIndex++, CalScheduleRepeat::MONTHDAY)
);
__dialog->add(new CalDialogEditRepeatMonthUnitItem(
- [this](CalScheduleRepeat::MonthlyType monthlyType)
- {
+ [this](CalScheduleRepeat::MonthlyType monthlyType) {
// TODO: Set date
__repeat.unitInfo.monthly.type = monthlyType;
}, __repeat, __startTime, __timezone, radioIndex++, CalScheduleRepeat::WEEKDAY)
CalDialogEditRepeatRadioItem* CalEditRepeatPopup::__addRadioItem(Evas_Object *radio_main, int radio_index, CalScheduleRepeat::UnitType unitType)
{
return new CalDialogEditRepeatRadioItem(
- [radio_main, radio_index]()
- {
+ [radio_main, radio_index]() {
elm_radio_value_set(radio_main, radio_index);
Evas_Object *radio = elm_radio_selected_object_get(radio_main);
evas_object_smart_callback_call(radio, "changed", NULL);
},
- [this](const CalScheduleRepeat::UnitType repeatType)
- {
+ [this](const CalScheduleRepeat::UnitType repeatType) {
WDEBUG("repeat.unitType=%d", repeatType);
__repeatUnitType = repeatType;
__doneCb(__repeatUnitType);
static bool __isNoDaySelected(CalScheduleRepeat::UnitInfo unitInfo)
{
- for ( auto index = 0; index < 7; index++)
- {
+ for ( auto index = 0; index < 7; index++) {
if (unitInfo.weekly.selected[index])
return false;
}
__workingCopy = CalSchedule::makeDefaultSchedule();
const int bookId = CalSettingsManager::getInstance().getLastUsedCalendar();
- if (CalBookManager::getInstance().getBook(bookId))
- {
+ if (CalBookManager::getInstance().getBook(bookId)) {
__workingCopy->setBookId(bookId);
}
}
__workingCopy = CalSchedule::makeDefaultSchedule(focusedDate);
const int bookId = CalSettingsManager::getInstance().getLastUsedCalendar();
- if (CalBookManager::getInstance().getBook(bookId))
- {
+ if (CalBookManager::getInstance().getBook(bookId)) {
__workingCopy->setBookId(bookId);
}
__inputSchedule = schedule;
__mode = mode;
- switch(__mode)
- {
+ switch(__mode) {
case CREATE:
case EDIT_EXTERNAL:
__workingCopy = __inputSchedule;
}
bool isReadOnly = CalBookManager::getInstance().getBook(__workingCopy->getBookId())->isReadOnly();
- if( (__mode == CREATE && setLastUsedCalendar == true) || (__mode == COPY && isReadOnly))
- {
+ if( (__mode == CREATE && setLastUsedCalendar == true) || (__mode == COPY && isReadOnly)) {
const int bookId = CalSettingsManager::getInstance().getLastUsedCalendar();
- if (CalBookManager::getInstance().getBook(bookId))
- {
+ if (CalBookManager::getInstance().getBook(bookId)) {
__workingCopy->setBookId(bookId);
}
}
free(__currentParticipantKeyword);
- if (__idler)
- {
+ if (__idler) {
ecore_timer_del(__idler);
__idler = NULL;
}
repeat.print();
CalScheduleRepeat tmpRepeat(repeat);
tmpRepeat.setDefault(repeatUnitType,dateTime,timezone);
- switch (repeatUnitType)
- {
+ switch (repeatUnitType) {
case CalScheduleRepeat::DAY:
view = new CalEditRepeatDailyView(
tmpRepeat, dateTime, doneCb
break;
}
- if (!view)
- {
+ if (!view) {
return;
}
void CalEditView::__removeLocation()
{
- if(!__location)
- {
+ if(!__location) {
return;
}
void CalEditView::__onAddLocationField()
{
WENTER();
- if (__location)
- {
+ if (__location) {
return;
}
- __location = new CalDialogEditOptionalTextFieldItem(LOCATION, [this](CalUnderlineEditField* editField)
- {
+ __location = new CalDialogEditOptionalTextFieldItem(LOCATION, [this](CalUnderlineEditField* editField) {
std::string location;
__workingCopy->getDisplayLocation(-1, location);
editField->setText(location.c_str());
int fontSize = __location->getSystemFontSize();
- if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE) {
editField->setFontSize(fontSize);
editField->setGuideText(_L_G_("IDS_CLD_BUTTON_LOCATION_ABB"), fontSize);
- }
- else
- {
+ } else {
editField->setGuideText(_L_G_("IDS_CLD_BUTTON_LOCATION_ABB"), 0);
}
- editField->setChangeCallback([this](const char* text)
- {
+ editField->setChangeCallback([this](const char* text) {
WDEBUG("Location : %s", text);
__workingCopy->setLocation(text);
});
- editField->setCompleteCallback([this]()
- {
- if (__description)
- {
+ editField->setCompleteCallback([this]() {
+ if (__description) {
__description->getEditField()->setFocusToEntry();
- }
- else
- {
+ } else {
elm_object_focus_next(getNaviframe()->getEvasObj(), ELM_FOCUS_NEXT);
}
});
- editField->setEntryMaxLenReachCallback([this]()
- {
+ editField->setEntryMaxLenReachCallback([this]() {
char warningText[CAL_WARNING_MAX_LENGTH] = {0};
snprintf(warningText, sizeof(warningText)-1, _L_("IDS_CLD_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_HPD_REACHED"), CAL_EVENT_TITLE_MAX_CHAR_LIMIT);
notification_status_message_post(warningText);
editField->setEntryReturnKeyType(CalUnderlineEditField::DONE);
CalUnderlineEditField* titleEditField = __title->getEditField();
- if (titleEditField)
- {
+ if (titleEditField) {
titleEditField->setEntryReturnKeyType(CalUnderlineEditField::NEXT);
}
- if (__description == NULL)
- {
+ if (__description == NULL) {
editField->setEntryReturnKeyType(CalUnderlineEditField::DONE);
- }
- else
- {
+ } else {
editField->setEntryReturnKeyType(CalUnderlineEditField::NEXT);
}
});
__onAddLocationField();
__setFocusToField(__location);
- if (__more)
- {
+ if (__more) {
__more->setButtonDisable(CalDialogEditMoreItem::LOCATION, true);
}
}
void CalEditView::__removeRepeatItem()
{
- if(!__repeat)
- {
+ if(!__repeat) {
return;
}
);
Elm_Object_Item* itemOjbect = __dialog->add(__repeat);
- if (__mode == EDIT_INSTANCE)
- {
+ if (__mode == EDIT_INSTANCE) {
elm_object_item_disabled_set(itemOjbect, EINA_TRUE);
}
- if (__more)
- {
+ if (__more) {
__more->setButtonDisable(CalDialogEditMoreItem::REPEAT, true);
}
}
CalScheduleReminder reminder;
const int count = __workingCopy->getRemindersCount();
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
__workingCopy->getReminder(i, reminder);
- if(reminder.getMinuteValue() == reminderInterval)
- {
+ if(reminder.getMinuteValue() == reminderInterval) {
break;
}
}
void CalEditView::__addReminder(const CalScheduleReminder& reminder)
{
bool needToAdd = true;
- for(int i = 0; i < MAX_REMINDER_COUNT; i++)
- {
+ for(int i = 0; i < MAX_REMINDER_COUNT; i++) {
CalScheduleReminder existReminder;
__workingCopy->getReminder(i, existReminder);
- if(existReminder.unitType != CalScheduleReminder::NONE && existReminder.getMinuteValue() == reminder.getMinuteValue())
- {
+ if(existReminder.unitType != CalScheduleReminder::NONE && existReminder.getMinuteValue() == reminder.getMinuteValue()) {
needToAdd = false;
break;
}
}
- if(needToAdd)
- {
+ if(needToAdd) {
__removeAllReminderItems();
__workingCopy->addReminder(reminder);
__addAllReminderItems();
const int count = __workingCopy->getRemindersCount();
WDEBUG("Count: %d", count);
- if(!count)
- {
- if(__reminderTitleItem)
- {
+ if(!count) {
+ if(__reminderTitleItem) {
__removeReminderTitleItem();
}
memset(__reminderItems, 0, sizeof(__reminderItems));
std::set<CalScheduleReminder> reminders;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
CalScheduleReminder reminder;
__workingCopy->getReminder(i, reminder);
reminders.insert(reminder);
}
int reminderIndex = 0;
- for(auto it = reminders.begin(); it != reminders.end() && reminderIndex < MAX_REMINDER_COUNT; ++it)
- {
+ for(auto it = reminders.begin(); it != reminders.end() && reminderIndex < MAX_REMINDER_COUNT; ++it) {
__reminderItems[reminderIndex] = __createReminderItem((*it), reminderIndex + REMINDER1);
- if(__reminderItems[reminderIndex])
- {
+ if(__reminderItems[reminderIndex]) {
__reminderItems[reminderIndex]->setCustomData((void*)(intptr_t)((*it).getMinuteValue()));
__dialog->add(__reminderItems[reminderIndex]);
++reminderIndex;
}
}
- if (__more)
- {
+ if (__more) {
__more->setButtonDisable(CalDialogEditMoreItem::REMINDER, count == MAX_REMINDER_COUNT);
}
}
WASSERT(count >= 0);
WDEBUG("Count: %d", count);
- for (int i = 0; i < MAX_REMINDER_COUNT; i++)
- {
- if (__reminderItems[i] == NULL)
- {
+ for (int i = 0; i < MAX_REMINDER_COUNT; i++) {
+ if (__reminderItems[i] == NULL) {
continue;
}
void CalEditView::__addReminderTitleItem()
{
- if (__reminderTitleItem)
- {
+ if (__reminderTitleItem) {
return;
}
void CalEditView::__removeReminderTitleItem()
{
- if (!__reminderTitleItem)
- {
+ if (!__reminderTitleItem) {
return;
}
CalScheduleReminder reminder;
const int count = __workingCopy->getRemindersCount();
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
__workingCopy->getReminder(i, reminder);
- if(reminder.getMinuteValue() == reminderInterval)
- {
+ if(reminder.getMinuteValue() == reminderInterval) {
reminderIndex = i;
break;
}
{
const int reminderIndex = __getReminderIndexFromInterval((intptr_t)(reminderItem->getCustomData()));
- if(reminder.unitType == CalScheduleReminder::NONE)
- {
+ if(reminder.unitType == CalScheduleReminder::NONE) {
__workingCopy->removeReminder(reminderIndex);
- }
- else
- {
+ } else {
__workingCopy->setReminder(reminderIndex, reminder);
}
WENTER();
const int count = __workingCopy->getRemindersCount();
- if (__more)
- {
+ if (__more) {
__more->setButtonDisable(CalDialogEditMoreItem::REMINDER, count == MAX_REMINDER_COUNT);
}
CalEditReminderPopup* popup = new CalEditReminderPopup(reminder, false);
popup->setDoneCb(
[this](const CalScheduleReminder& reminder, int radio_index) {
- if(radio_index > 1)
- {
+ if(radio_index > 1) {
__addReminder(reminder);
}
}
WENTER();
__isMoreShown = false;
- if(__more)
- {
+ if(__more) {
__more->setButtonDisable(CalDialogEditMoreItem::REMINDER, false);
}
void CalEditView::__resetAllEntryState(CalDialogControl::Item* item)
{
- if (!item)
- {
+ if (!item) {
return;
}
- if (item->getSortIndex() == LOCATION)
- {
- if (__description)
- {
+ if (item->getSortIndex() == LOCATION) {
+ if (__description) {
return;
- }
- else if (__title && __title->getEditField())
- {
+ } else if (__title && __title->getEditField()) {
__title->getEditField()->setEntryReturnKeyType(CalUnderlineEditField::DONE);
}
- }
- else if (item->getSortIndex() == DESCRIPTION)
- {
- if (__location)
- {
+ } else if (item->getSortIndex() == DESCRIPTION) {
+ if (__location) {
__location->getEditField()->setEntryReturnKeyType(CalUnderlineEditField::DONE);
- }
- else if (__title && __title->getEditField())
- {
+ } else if (__title && __title->getEditField()) {
__title->getEditField()->setEntryReturnKeyType(CalUnderlineEditField::DONE);
}
}
void CalEditView::__removeTimezoneItem()
{
- if(!__timezone)
- {
+ if(!__timezone) {
return;
}
void CalEditView::__onAddTimezoneField()
{
- if (__timezone)
- {
+ if (__timezone) {
return;
}
std::string tz;
std::string dT;
- if (!defaultTz || strlen(defaultTz) == 0)
- {
+ if (!defaultTz || strlen(defaultTz) == 0) {
tz.clear();
CalSettingsManager::getInstance().getCalendarTimeZone(tz);
- }
- else
- {
+ } else {
tz = defaultTz;
}
CalLocaleManager::getInstance().getDisplayTextTimeZone(tz, dT);
__timezone = new CalDialogEditTwoTextRemoveIconItem(TIMEZONE, _L_S_("IDS_CLD_HEADER_TIME_ZONE_ABB"), dT.c_str());
__timezone->setSelectCb(
- [this]()
- {
+ [this]() {
app_control_h service;
app_control_create(&service);
app_control_set_operation(service, APP_CONTROL_OPERATION_PICK);
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
CalAppControlLauncher::getInstance().sendLaunchRequest(service,
- [](app_control_h request, app_control_h reply, app_control_result_e result, void *data)
- {
+ [](app_control_h request, app_control_h reply, app_control_result_e result, void *data) {
CalEditView *self = (CalEditView *)data;
char* timezone = NULL;
void CalEditView::__removeDescription()
{
- if(!__description)
- {
+ if(!__description) {
return;
}
void CalEditView::__onAddDescriptionField()
{
WENTER();
- if (__description)
- {
+ if (__description) {
return;
}
__description = new CalDialogEditOptionalTextFieldItem(DESCRIPTION,
- [this](CalUnderlineEditField* editField)
- {
+ [this](CalUnderlineEditField* editField) {
std::string description;
__workingCopy->getDisplayDescription(description);
editField->setText(description.c_str());
int fontSize = __description->getSystemFontSize();
- if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE) {
editField->setFontSize(fontSize);
editField->setGuideText(_L_G_("IDS_CLD_BUTTON_NOTES_ABB"), fontSize);
- }
- else
- {
+ } else {
editField->setGuideText(_L_G_("IDS_CLD_BUTTON_NOTES_ABB"), 0);
}
- editField->setChangeCallback([this](const char* text)
- {
+ editField->setChangeCallback([this](const char* text) {
__workingCopy->setDescription(text);
});
- editField->setEntryMaxLenReachCallback([this]()
- {
+ editField->setEntryMaxLenReachCallback([this]() {
char warningText[CAL_WARNING_MAX_LENGTH] = {0};
snprintf(warningText, sizeof(warningText)-1, _L_("IDS_CLD_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_HPD_REACHED"), CAL_EVENT_TITLE_MAX_CHAR_LIMIT);
notification_status_message_post(warningText);
editField->setEntryReturnKeyType(CalUnderlineEditField::DONE);
- if (__location)
- {
+ if (__location) {
__location->getEditField()->setEntryReturnKeyType(CalUnderlineEditField::NEXT);
- }
- else if(__title && __title->getEditField())
- {
+ } else if(__title && __title->getEditField()) {
__title->getEditField()->setEntryReturnKeyType(CalUnderlineEditField::NEXT);
}
},
bool CalEditView::__isTitleChanged()
{
- switch(__mode)
- {
+ switch(__mode) {
case EDIT_INSTANCE:
case EDIT_THIS_AND_FURTURE:
case EDIT:
{
const char* before = __inputSchedule->getSummary();
const char* after = __workingCopy->getSummary();
- if (before && after && !strcmp(before, after))
- {
+ if (before && after && !strcmp(before, after)) {
return false;
- }
- else if (before == NULL && after == NULL)
- {
+ } else if (before == NULL && after == NULL) {
return false;
- }
- else
- {
+ } else {
return true;
}
}
case CREATE:
{
char *summary = elm_entry_utf8_to_markup(__workingCopy->getSummary());
- if (!summary)
- {
+ if (!summary) {
return false;
- }
- else if (!strcmp(summary, ""))
- {
+ } else if (!strcmp(summary, "")) {
free(summary);
return false;
- }
- else
- {
+ } else {
free(summary);
return true;
}
{
CalDateTime startTime;
__workingCopy->getStart(startTime);
- if(__more != NULL)
- {
+ if(__more != NULL) {
bool is_disabled = false;
- if (__description && (__timezone || (startTime.isAllDay() || (__time && __time->isAllDay())) ) )
- {
+ if (__description && (__timezone || (startTime.isAllDay() || (__time && __time->isAllDay())) ) ) {
is_disabled = true;
}
void CalEditView::__updateMoreItemButtonStatus()
{
//update location
- if (__location)
- {
+ if (__location) {
__more->setButtonDisable(CalDialogEditMoreItem::LOCATION, true);
- }
- else
- {
+ } else {
__more->setButtonDisable(CalDialogEditMoreItem::LOCATION, false);
}
__more->setButtonDisable(CalDialogEditMoreItem::REMINDER, count == MAX_REMINDER_COUNT);
//update repeat
- if (__repeat)
- {
+ if (__repeat) {
__more->setButtonDisable(CalDialogEditMoreItem::REPEAT, true);
- }
- else
- {
+ } else {
__more->setButtonDisable(CalDialogEditMoreItem::REPEAT, false);
}
}
CalDateTime startTime;
__workingCopy->getStart(startTime);
- if (__timezone || startTime.isAllDay() || __time->isAllDay())
- {
+ if (__timezone || startTime.isAllDay() || __time->isAllDay()) {
showTimezone = false;
}
__onAddDescriptionField();
if (__description) {
elm_genlist_item_bring_in((Elm_Object_Item*)__description->getElmObjectItem(), ELM_GENLIST_ITEM_SCROLLTO_TOP);
- if (__description->getEditField())
- {
+ if (__description->getEditField()) {
__setFocusToField(__description);
}
}
}
__updateMoreButtonStatus();
- if (type != CalDialogEditMoreMenuItem::DESCRIPTION)
- {
+ if (type != CalDialogEditMoreMenuItem::DESCRIPTION) {
Ecore_IMF_Context *ctx = ecore_imf_context_add(ecore_imf_context_default_id_get());
Ecore_IMF_Input_Panel_State imf_state = ecore_imf_context_input_panel_state_get(ctx);
ecore_imf_context_del(ctx);
- if (imf_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE)
- {
+ if (imf_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
ecore_imf_input_panel_hide();
}
}
void CalEditView::__addItemsForNoEmptyField()
{
const char* loc = __workingCopy->getLocation();
- if (loc && strlen(loc))
- {
+ if (loc && strlen(loc)) {
__onAddLocationButton();
}
CalScheduleRepeat repeat = __workingCopy->getRepeat();
- if (repeat.unitType != CalScheduleRepeat::ONE_TIME)
- {
+ if (repeat.unitType != CalScheduleRepeat::ONE_TIME) {
__addRepeat();
}
const char* desc = __workingCopy->getDescription();
- if (desc && strlen(desc))
- {
+ if (desc && strlen(desc)) {
__onAddDescriptionField();
}
const char* defaultTz = __workingCopy->getTimeZone();
std::string tz;
- if (defaultTz)
- {
+ if (defaultTz) {
CalSettingsManager::getInstance().getTimeZone(tz);
- if (tz.compare(defaultTz) != 0)
- {
+ if (tz.compare(defaultTz) != 0) {
__onAddTimezoneField();
}
}
//first, to check if the record is deleted in db;
std::shared_ptr<CalBook> book;
- switch(__mode)
- {
+ switch(__mode) {
case EDIT_INSTANCE:
case EDIT_THIS_AND_FURTURE:
case EDIT:
break;
case CREATE:
book = CalBookManager::getInstance().getBook(__workingCopy->getBookId());
- if (book == NULL)
- {
+ if (book == NULL) {
__workingCopy = CalSchedule::makeDefaultSchedule(__focusedDate);
}
break;
elm_genlist_item_update((Elm_Object_Item*)__title->getElmObjectItem());
//update "start time, end time, all day"
- if (__time)
- {
+ if (__time) {
__time->update();
}
//update more item
- if (__more)
- {
+ if (__more) {
bool disableLocation = false;
bool disableReminder = false;
bool disableRepeat = false;
bool disableMore = false;
- if (__location)
- {
+ if (__location) {
disableLocation= true;
}
int count = __workingCopy->getRemindersCount();
- if (count == MAX_REMINDER_COUNT)
- {
+ if (count == MAX_REMINDER_COUNT) {
disableReminder = true;
}
- if (__repeat)
- {
+ if (__repeat) {
disableRepeat = true;
}
- if (__description && __timezone)
- {
+ if (__description && __timezone) {
disableMore = true;
}
}
//update location
- if (__location)
- {
+ if (__location) {
elm_genlist_item_update((Elm_Object_Item*)__location->getElmObjectItem());
}
//update reminder title
- if (__reminderTitleItem)
- {
+ if (__reminderTitleItem) {
elm_genlist_item_update((Elm_Object_Item*)__reminderTitleItem->getElmObjectItem());
- for (int i = 0; i< MAX_REMINDER_COUNT; i++)
- {
- if (__reminderItems[i])
- {
+ for (int i = 0; i< MAX_REMINDER_COUNT; i++) {
+ if (__reminderItems[i]) {
CalScheduleReminder reminder;
__workingCopy->getReminder(i, reminder);
std::string reminderText;
}
//update repeat
- if (__repeat)
- {
+ if (__repeat) {
CalScheduleRepeat repeat = __workingCopy->getRepeat();
std::string repeatString;
std::string currentTz;
CalSettingsManager::getInstance().getCalendarTimeZone(currentTz);
- if (__timezone && __isChanged)
- {
- if (eventTz != currentTz)
- {
+ if (__timezone && __isChanged) {
+ if (eventTz != currentTz) {
__workingCopy->setTimeZone(currentTz.c_str());
eventTz = currentTz.c_str();
}
__timezone->setSubText(displayTimeZone.c_str());
elm_genlist_item_update((Elm_Object_Item*)__timezone->getElmObjectItem());
- }
- else
- {
- if (eventTz != currentTz)
- {
+ } else {
+ if (eventTz != currentTz) {
__onAddTimezoneField();
}
}
//update description
- if (__description)
- {
+ if (__description) {
elm_genlist_item_update((Elm_Object_Item*)__description->getElmObjectItem());
}
}
void CalEditView::__onAddTitleField()
{
- __title = new CalDialogEditTextFieldItem(TITLE, [this](CalUnderlineEditField* editField)
- {
+ __title = new CalDialogEditTextFieldItem(TITLE, [this](CalUnderlineEditField* editField) {
char *summary = NULL;
summary = elm_entry_utf8_to_markup(__workingCopy->getSummary());
summary = NULL;
int fontSize = __title->getSystemFontSize();
- if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE)
- {
+ if(abs(fontSize) > TEXT_ITEM_DEFAULT_SIZE) {
editField->setFontSize(fontSize);
editField->setGuideText(_L_G_("IDS_CLD_BODY_TITLE"), fontSize);
- }
- else
- {
+ } else {
editField->setGuideText(_L_G_("IDS_CLD_BODY_TITLE"), 0);
}
- editField->setChangeCallback([this](const char* text)
- {
+ editField->setChangeCallback([this](const char* text) {
__workingCopy->setSummary(text);
});
- editField->setEntryMaxLenReachCallback([this]()
- {
+ editField->setEntryMaxLenReachCallback([this]() {
char warningText[CAL_WARNING_MAX_LENGTH] = {0};
snprintf(warningText, sizeof(warningText)-1, _L_("IDS_CLD_TPOP_MAXIMUM_NUMBER_OF_CHARACTERS_HPD_REACHED"), CAL_EVENT_TITLE_MAX_CHAR_LIMIT);
notification_status_message_post(warningText);
});
- editField->setCompleteCallback([this]()
- {
- if (__location)
- {
+ editField->setCompleteCallback([this]() {
+ if (__location) {
__location->getEditField()->setFocusToEntry();
- }
- else if (__description)
- {
+ } else if (__description) {
__description->getEditField()->setFocusToEntry();
}
});
- if (__location || __description)
- {
+ if (__location || __description) {
editField->setEntryReturnKeyType(CalUnderlineEditField::NEXT);
- }
- else
- {
+ } else {
editField->setEntryReturnKeyType(CalUnderlineEditField::DONE);
}
}, [this](CalUnderlineEditField* editField) {
- if (__mode == CREATE)
- {
+ if (__mode == CREATE) {
editField->setFocusToEntry();
}
});
Eina_Bool allDay = EINA_TRUE;
__time->getDateTime(&startDateTime, &endDateTime, &allDay);
- if (allDay)
- {
- if(startDateTime > endDateTime)
- {
+ if (allDay) {
+ if(startDateTime > endDateTime) {
notification_status_message_post(_L_("IDS_CLD_TPOP_END_TIME_SHOULD_BE_LATER_THAN_START_TIME"));
endDateTime = startDateTime;
}
} else {
- if(startDateTime >= endDateTime)
- {
+ if(startDateTime >= endDateTime) {
notification_status_message_post(_L_("IDS_CLD_TPOP_END_TIME_SHOULD_BE_LATER_THAN_START_TIME"));
endDateTime = startDateTime;
endDateTime.addHours(1);
void CalEditView::__setFocusToField(CalDialogControl::Item *field)
{
- if(field == __location || field == __description)
- {
- __idler = ecore_idler_add([](void* data)
- {
+ if(field == __location || field == __description) {
+ __idler = ecore_idler_add([](void* data) {
CalDialogEditOptionalTextFieldItem *self = (CalDialogEditOptionalTextFieldItem*) data;
self->getEditField()->setFocusToEntry();
return ECORE_CALLBACK_CANCEL;
}, field);
- }
- else if(field == __title)
- {
- __idler = ecore_idler_add([](void* data)
- {
+ } else if(field == __title) {
+ __idler = ecore_idler_add([](void* data) {
CalDialogEditTextFieldItem *self = (CalDialogEditTextFieldItem*) data;
CalUnderlineEditField *editField = self->getEditField();
- if (editField)
- {
+ if (editField) {
self->getEditField()->setFocusToEntry();
}
return ECORE_CALLBACK_CANCEL;
__time->setChangeCb([this](CalDateTime &startDateTime, CalDateTime &endDateTime){
Eina_Bool isAllDay = EINA_TRUE;
__time->getDateTime(NULL, NULL, &isAllDay);
- if (__timezone && isAllDay)
- {
+ if (__timezone && isAllDay) {
WDEBUG("Remove timezone");
__dialog->remove(__timezone);
__timezone = NULL;
});
const char* tz = __workingCopy->getTimeZone();
- if (tz)
- {
+ if (tz) {
__time->setTimeZone(tz);
}
__workingCopy->getRemindersCount() >= MAX_REMINDER_COUNT
);
- if(__more)
- {
+ if(__more) {
__dialog->add(__more);
}
}
// add location and other fields on edit mode or create mode with extra params from appcontrol
__addItemsForNoEmptyField();
- if (__workingCopy->hasReminder())
- {
+ if (__workingCopy->hasReminder()) {
__addAllReminderItems();
}
{
WENTER();
- if (__mode == CREATE || __mode == COPY)
- {
+ if (__mode == CREATE || __mode == COPY) {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", _L_("IDS_CLD_OPT_CREATE"));
- }
- else
- {
+ } else {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", _L_("IDS_CLD_OPT_EDIT"));
}
pCalEditView->__isPrepareExit = true;
pCalEditView->__onSave();
pCalEditView->__isDiscard = true;
- if (((CalNaviframe*)pCalEditView->getNaviframe())->getTopView() == pCalEditView)
- {
+ if (((CalNaviframe*)pCalEditView->getNaviframe())->getTopView() == pCalEditView) {
pCalEditView->popOut();
- }
- else
- {
+ } else {
pCalEditView->destroy();
}
}, this
CalEditView* self = (CalEditView* )data;
self->__updateMoreItemButtonStatus();/*for location, reminder, repeat 3 buttons*/
self->__updateMoreButtonStatus(); /*for more button*/
- if (self->__title && self->__title->getEditField())
- {
+ if (self->__title && self->__title->getEditField()) {
self->__title->getEditField()->setFocusToEntry();
}
evas_object_smart_callback_del(self->getNaviframe()->getEvasObj(), "transition,finished", __onNaviframeTransitionFinished);
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::DB_CHANGED:
break;
case CalEvent::TIME_CHANGED:
case CalEvent::LANGUAGE_CHANGED:
case CalEvent::SETTING_CHANGED:
case CalEvent::CONTACTS_EMAIL_CHANGED:
- if (__mode == CREATE || __mode == COPY)
- {
+ if (__mode == CREATE || __mode == COPY) {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", _L_("IDS_CLD_OPT_CREATE"));
- }
- else
- {
+ } else {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", _L_("IDS_CLD_OPT_EDIT"));
}
elm_object_text_set(elm_object_item_part_content_get(getNaviItem(), "title_left_btn"), _L_("IDS_TPLATFORM_ACBUTTON_CANCEL_ABB"));
void CalEditView::__toastPopupWarning(const bool isOverlapped, const int ret)
{
- if (ret != 0)
- {
+ if (ret != 0) {
notification_status_message_post(_L_("IDS_CLD_TPOP_FAILED_TO_SAVE_EVENT_UNKNOWN_ERROR_OCCURRED"));
return;
}
- switch (__mode)
- {
+ switch (__mode) {
case EDIT:
case EDIT_INSTANCE:
case EDIT_THIS_AND_FURTURE:
break;
case CREATE:
case COPY:
- if (isOverlapped == true)
- {
+ if (isOverlapped == true) {
notification_status_message_post(_L_("IDS_CLD_TPOP_EVENT_OVERLAPS_WITH_ANOTHER_EVENT"));
- }
- else
- {
+ } else {
notification_status_message_post(_L_("IDS_CLD_TPOP_EVENT_SAVED"));
}
break;
bool isOverlapped = false;
int eventId = 0;
- if (__more)
- {
+ if (__more) {
elm_object_focus_set(__more->getButton(CalDialogEditMoreItem::MORE), true);/*to avoid keyboard is shown again*/
}
- if (__isChanged || __isTitleChanged() || __mode == CREATE || __mode == COPY)
- {
+ if (__isChanged || __isTitleChanged() || __mode == CREATE || __mode == COPY) {
const char *summary = __workingCopy->getSummary();
- if (!(summary && strlen(summary)))
- {
+ if (!(summary && strlen(summary))) {
__workingCopy->setSummary(_L_("IDS_CLD_MBODY_MY_EVENT"));
}
- if(__time->isAllDay())
- {
+ if(__time->isAllDay()) {
CalDateTime startDateTime, endDateTime;
Eina_Bool allDay = EINA_TRUE;
__time->getDateTime(&startDateTime, &endDateTime, &allDay);
__workingCopy->setStart(startDateTime);
__workingCopy->setEnd(endDateTime);
- }
- else
- {
+ } else {
struct tm time = {};
CalDateTime startDateTime;
__workingCopy->getStart(startDateTime);
__workingCopy->setEnd(endDateTime);
}
- switch(__mode)
- {
+ switch(__mode) {
case CREATE:
case COPY:
isOverlapped = CalDataManager::getInstance().isOverlapped(*__workingCopy);
break;
}
- if (!ret)
- {
+ if (!ret) {
__postProcessAddButtons();
}
__toastPopupWarning(isOverlapped, ret);
- if (__savedCb)
- {
+ if (__savedCb) {
__savedCb(eventId);
}
}
Ecore_IMF_Input_Panel_State imf_state = ecore_imf_context_input_panel_state_get(ctx);
ecore_imf_context_del(ctx);
- if (imf_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE)
- {
+ if (imf_state != ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
// Hide IME if it exists.
// When pop naviframe with the keypad shown, naviframe pop effect can be cracked. (the animation works for only upper side of composer)
// It's because keypad process and calendar process works asynchronously.
ecore_imf_input_panel_hide();
}
- if (__isDiscard)
- {
+ if (__isDiscard) {
return true;
}
- if(__isChanged || __isTitleChanged())
- {
+ if(__isChanged || __isTitleChanged()) {
WPopup *popup = new WPopup(
_L_("IDS_CLD_HEADER_DISCARD_CHANGES_ABB"),
_L_("IDS_CLD_POP_ALL_CHANGES_WILL_BE_DISCARDED"));
CalDateTime startInitialDate, startDateTime, endDateTime;
__time->getDateTime(&startDateTime, &endDateTime, &allDay);
- if(__time->isStartSelected())
- {
+ if(__time->isStartSelected()) {
startInitialDate = startDateTime;
- }
- else
- {
+ } else {
startInitialDate = endDateTime;
}
{
CalDateTime startInitialTime;
- if(__time->isStartSelected())
- {
+ if(__time->isStartSelected()) {
__workingCopy->getStart(startInitialTime);
- }
- else
- {
+ } else {
__workingCopy->getEnd(startInitialTime);
}
void CalEditView::__preProcessAddButtons()
{
- if (__mode != CREATE)
- {
+ if (__mode != CREATE) {
return;
}
- if (__model.isOn(CalEditModel::LOCATION))
- {
+ if (__model.isOn(CalEditModel::LOCATION)) {
__onAddLocationField();
}
- if (__model.isOn(CalEditModel::REMINDER))
- {
+ if (__model.isOn(CalEditModel::REMINDER)) {
__addReminderTitleItem();
__reminderItems[0] = __createReminderOffItem();
__dialog->add(__reminderItems[0]);
}
- if (__model.isOn(CalEditModel::REPEAT))
- {
+ if (__model.isOn(CalEditModel::REPEAT)) {
__addRepeatOff();
}
- if (__model.isOn(CalEditModel::DESCRIPTION))
- {
+ if (__model.isOn(CalEditModel::DESCRIPTION)) {
__onAddDescriptionField();
}
- if (__model.isOn(CalEditModel::TIME_ZONE))
- {
+ if (__model.isOn(CalEditModel::TIME_ZONE)) {
__onAddTimezoneField();
}
}
void CalEditView::__postProcessAddButtons()
{
- if (__mode != CREATE)
- {
+ if (__mode != CREATE) {
return;
}
Elm_Object_Item *it = __getFirstItem();
while (it) {
Item *item = (Item *)elm_object_item_data_get(it);
- if (item && item->isGroupTitle())
- {
+ if (item && item->isGroupTitle()) {
CalListGroupTitleItem *groupItem = (CalListGroupTitleItem *)item;
__selectedCount += groupItem->getSelectedItemsCount();
}
__updateTitle();
- if (__isCutomFocus)
- {
+ if (__isCutomFocus) {
__isCutomFocus = false;
__focusedDate = __customFocusDate;
getMonth(0).focus(__focusedDate.getMday());
- }
- else
- {
+ } else {
getMonth(0).focus(firstDayOfMonth);
}
__focusMonth(CalDate());
__focusList();
});
- if (__list && !__list->isEmpty())
- {
+ if (__list && !__list->isEmpty()) {
popup->appendItem(_L_("IDS_CLD_OPT_SEARCH"), [this]() {getNaviframe()->push(new CalSearchView());});
}
popup->appendItem(_L_("IDS_CLD_OPT_MANAGE_CALENDARS_ABB"), [this]() {getNaviframe()->push(new CalBookView);});
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::LANGUAGE_CHANGED:
case CalEvent::DB_CHANGED:
case CalEvent::SETTING_CHANGED:
case CalEvent::TIME_CHANGED:
case CalEvent::FIRST_DAY_OF_WEEK_CHANGED:
- if (__userInteractionInProgress())
- {
- if (!__updateTimer)
- {
+ if (__userInteractionInProgress()) {
+ if (!__updateTimer) {
__updateTimer = ecore_timer_add(1.0, [](void* data)->Eina_Bool {
CalMainView* self = (CalMainView*)data;
- if (self->__userInteractionInProgress())
- {
+ if (self->__userInteractionInProgress()) {
WDEBUG("Defer again!");
return ECORE_CALLBACK_RENEW;
}
return ECORE_CALLBACK_CANCEL;
}, this);
}
- }
- else
- {
- if (__updateTimer)
- {
+ } else {
+ if (__updateTimer) {
ecore_timer_del(__updateTimer);
__updateTimer = NULL;
}
*/
void CalMainView::__terminateUserInteraction()
{
- if (__monthSlideAnimator && __monthSlideAnimator->isActive())
- {
+ if (__monthSlideAnimator && __monthSlideAnimator->isActive()) {
__monthSlideAnimator->cancel(true);
}
- if (__listSlideAnimator && __listSlideAnimator->isActive())
- {
+ if (__listSlideAnimator && __listSlideAnimator->isActive()) {
__listSlideAnimator->cancel(true);
}
- if (__monthDragRecognizer && __monthDragRecognizer->isActive())
- {
+ if (__monthDragRecognizer && __monthDragRecognizer->isActive()) {
__monthDragRecognizer->terminate((Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(__mainViewLayout), "month/touch"));
}
- if (__listDragRecognizer && __listDragRecognizer->isActive())
- {
+ if (__listDragRecognizer && __listDragRecognizer->isActive()) {
__listDragRecognizer->terminate((Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(__mainViewLayout), "list/touch"));
}
}
__listIsBeingDragged = false;
}
__unblockTouch("__list.onScrollStop");
- if(topShowingGroupItem)
- {
+ if(topShowingGroupItem) {
const CalDate& topShowingDate = topShowingGroupItem->getDate();
__focusMonth(topShowingDate);
}
void CalMainView::__focusList()
{
TRACK_MODE_CHANGE_FLOW(__func__);
- if (!__list->scrollTo(__focusedDate))
- {
+ if (!__list->scrollTo(__focusedDate)) {
__createListControl();
- }
- else
- {
+ } else {
__terminateUserInteraction();
}
}
void CalMainView::__updateTitle()
{
setTitle(__focusedDate.getMonthString());
- if (getNaviItem())
- {
+ if (getNaviItem()) {
elm_object_item_part_text_set(getNaviItem(), "elm.text.title", getTitle());
}
}
*/
void CalMainView::__showNoContent(bool isShow)
{
- if (isShow)
- {
+ if (isShow) {
Evas_Object* noContents = elm_layout_add(__mainViewLayout);
elm_layout_theme_set(noContents, "layout", "nocontents", "default");
evas_object_size_hint_weight_set(noContents, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_layout_signal_emit(noContents, "align.center", "elm");
evas_object_show(noContents);
elm_object_part_content_set(__mainViewLayout, "list/no-events", noContents);
- }
- else
- {
+ } else {
evas_object_del(elm_object_part_content_unset(__mainViewLayout, "list/no-events"));
}
}
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::DB_CHANGED:
case CalEvent::TIME_CHANGED:
case CalEvent::LANGUAGE_CHANGED:
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogSettingsMultilSubItem *item = (CalDialogSettingsMultilSubItem*)data;
- if (0 == strcmp("elm.text.multiline", part))
- {
+ if (0 == strcmp("elm.text.multiline", part)) {
return g_strdup(_L_G_(item->__text));
}
return NULL;
, __selectCb(selectCb)
, __radioCb(nullptr)
{
- if(text)
- {
+ if(text) {
__text = strdup(text);
}
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogSettingsOneTextOneIconItem* item = (CalDialogSettingsOneTextOneIconItem*) data;
- if (!strcmp(part, "elm.text"))
- {
+ if (!strcmp(part, "elm.text")) {
return strdup(_L_G_(item->__text));
}
};
itc.func.content_get = [](void *data, Evas_Object *obj, const char *part)->Evas_Object*
{
- if (strcmp(part, "elm.swallow.end") == 0)
- {
+ if (strcmp(part, "elm.swallow.end") == 0) {
CalDialogSettingsOneTextOneIconItem *item = (CalDialogSettingsOneTextOneIconItem *) data;
Evas_Object *check = elm_check_add(obj);
evas_object_smart_callback_add(check, "changed", [](void *data, Evas_Object *obj, void *event_info) {
CalSettingsManager::getInstance().setLockTimeZone(!CalSettingsManager::getInstance().getLockTimeZone());
CalDialogSettingsOneTextOneIconItem *item = (CalDialogSettingsOneTextOneIconItem *)data;
- if (item && item->__radioCb)
- {
+ if (item && item->__radioCb) {
item->__radioCb();
}
}
void CalDialogSettingsOneTextOneIconItem::onSelect()
{
WENTER();
- if (__checkbox)
- {
+ if (__checkbox) {
elm_check_state_set(__checkbox, !elm_check_state_get(__checkbox));
}
- if (__selectCb)
- {
+ if (__selectCb) {
__selectCb();
}
}
void CalDialogSettingsOneTextOneIconItem::setText(const char* text)
{
- if(text)
- {
+ if(text) {
free(__text);
__text = strdup(text);
}
itc.func.text_get = [](void* data, Evas_Object* obj, const char* part)->char*
{
CalDialogSettingsRadioItem *item = (CalDialogSettingsRadioItem*)data;
- if (!strcmp("elm.text", part))
- {
- if (item->__type == SUB_LOCALE_DEFAULT)
- {
+ if (!strcmp("elm.text", part)) {
+ if (item->__type == SUB_LOCALE_DEFAULT) {
return strdup(_L_("IDS_CLD_OPT_LOCALE_DEFAULT_ABB"));
- }
- else if(item->__type == SUB_SATURDAY)
- {
+ } else if(item->__type == SUB_SATURDAY) {
return strdup(_L_("IDS_CLD_OPT_SATURDAY"));
- }
- else if (item->__type == SUB_SUNDAY)
- {
+ } else if (item->__type == SUB_SUNDAY) {
return strdup(_L_("IDS_CLD_OPT_SUNDAY"));
- }
- else if (item->__type == SUB_MONDAY)
- {
+ } else if (item->__type == SUB_MONDAY) {
return strdup(_L_("IDS_CLD_OPT_MONDAY"));
- }
- else if (item->__type == SUB_ALERTS)
- {
+ } else if (item->__type == SUB_ALERTS) {
return strdup(_L_("IDS_CLD_OPT_POP_UP_NOTIFICATIONS_ABB"));
- }
- else if (item->__type == SUB_NOTIFICATION)
- {
+ } else if (item->__type == SUB_NOTIFICATION) {
return strdup(_L_("IDS_CLD_OPT_STATUS_BAR_NOTIFICATIONS_ABB"));
- }
- else if (item->__type == SUB_OFF)
- {
+ } else if (item->__type == SUB_OFF) {
return strdup(_L_("IDS_CLD_OPT_NO_ALERTS"));
}
}
itc.func.content_get = [](void* data, Evas_Object* obj, const char* part)->Evas_Object*
{
CalDialogSettingsRadioItem *item = (CalDialogSettingsRadioItem*)data;
- if (!strcmp("elm.swallow.end", part))
- {
+ if (!strcmp("elm.swallow.end", part)) {
Evas_Object *radio_main = nullptr;
- if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY)
- {
+ if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY) {
radio_main = (Evas_Object *)evas_object_data_get(obj, "radio_firstday");
- }
- else
- {
+ } else {
radio_main = (Evas_Object *)evas_object_data_get(obj, "alert");
}
elm_radio_state_value_set(radio, item->__radioIndex);
elm_radio_group_add(radio, radio_main);
- if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY)
- {
+ if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY) {
int weekType = CalSettingsManager::getInstance().getFirstDayOfWeek();
if((weekType == CalSettingsManager::SUN && item->__type == SUB_SUNDAY) ||
(weekType == CalSettingsManager::MON && item->__type == SUB_MONDAY) ||
(weekType == CalSettingsManager::SAT && item->__type == SUB_SATURDAY) ||
- (weekType == CalSettingsManager::LOCALES && item->__type == SUB_LOCALE_DEFAULT))
- {
+ (weekType == CalSettingsManager::LOCALES && item->__type == SUB_LOCALE_DEFAULT)) {
elm_radio_value_set(radio, item->__radioIndex);
}
- }
- else
- {
+ } else {
CalSettingsManager::AlertType alertType;
alertType = CalSettingsManager::getInstance().getAlertType();
- if (alertType == (CalSettingsManager::AlertType)item->__radioIndex)
- {
+ if (alertType == (CalSettingsManager::AlertType)item->__radioIndex) {
elm_radio_value_set(radio, item->__radioIndex);
}
}
evas_object_smart_callback_add(radio, "changed", [](void *data, Evas_Object *obj, void *event_info) {
CalDialogSettingsRadioItem *item = (CalDialogSettingsRadioItem*)data;
- if (item->__radioIndex == elm_radio_value_get(obj))
- {
- if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY)
- {
- if (item->__radioIndex == 7)
- {
+ if (item->__radioIndex == elm_radio_value_get(obj)) {
+ if (item->__type >= CalDialogSettingsRadioItem::SUB_LOCALE_DEFAULT && item->__type <= CalDialogSettingsRadioItem::SUB_MONDAY) {
+ if (item->__radioIndex == 7) {
CalSettingsManager::getInstance().setFirstDayOfWeek(CalSettingsManager::LOCALES);
- }
- else if (item->__radioIndex == 6)
- {
+ } else if (item->__radioIndex == 6) {
CalSettingsManager::getInstance().setFirstDayOfWeek(CalSettingsManager::SAT);
- }
- else if (item->__radioIndex == 0)
- {
+ } else if (item->__radioIndex == 0) {
CalSettingsManager::getInstance().setFirstDayOfWeek(CalSettingsManager::SUN);
- }
- else if (item->__radioIndex == 1)
- {
+ } else if (item->__radioIndex == 1) {
CalSettingsManager::getInstance().setFirstDayOfWeek(CalSettingsManager::MON);
}
- }
- else
- {
+ } else {
CalSettingsManager::getInstance().setAlertType((CalSettingsManager::AlertType)item->__radioIndex);
}
}
- if (item->__radioCb)
- {
+ if (item->__radioCb) {
item->__radioCb();
}
}, item
void CalDialogSettingsRadioItem::onSelect()
{
- if(__selectCb)
- {
+ if(__selectCb) {
__selectCb();
}
}
CalDialogSettingsTwoTextItem* item = (CalDialogSettingsTwoTextItem*)data;
if (strcmp(part, "elm.text") == 0)
return strdup(_L_G_(item->__mainText));
- else if (strcmp(part, "elm.text.sub") == 0)
- {
- if (item->__type == CalDialogSettingsTwoTextItem::SUB_FIRST_DAY_OF_WEEK)
- {
+ else if (strcmp(part, "elm.text.sub") == 0) {
+ if (item->__type == CalDialogSettingsTwoTextItem::SUB_FIRST_DAY_OF_WEEK) {
int result = CalSettingsManager::getInstance().getFirstDayOfWeek();
if (result == CalSettingsManager::LOCALES)
return strdup(_L_("IDS_CLD_OPT_LOCALE_DEFAULT_ABB"));
return strdup(_L_("IDS_CLD_OPT_SUNDAY"));
else if (result == CalSettingsManager::MON)
return strdup(_L_("IDS_CLD_OPT_MONDAY"));
- }
- else if (item->__type == CalDialogSettingsTwoTextItem::SUB_TIME_ZONE ||
+ } else if (item->__type == CalDialogSettingsTwoTextItem::SUB_TIME_ZONE ||
item->__type == CalDialogSettingsTwoTextItem::SUB_REMINDER_TYPE ||
item->__type == CalDialogSettingsTwoTextItem::SUB_NOTIFICATION_SOUND)
return strdup(_L_G_(item->__subText));
- else if (item->__type == CalDialogSettingsTwoTextItem::SUB_ALERT_TYPE)
- {
+ else if (item->__type == CalDialogSettingsTwoTextItem::SUB_ALERT_TYPE) {
int result = CalSettingsManager::getInstance().getAlertType();
if (result == CalSettingsManager::ALERT)
return strdup(_L_("IDS_CLD_OPT_POP_UP_NOTIFICATIONS_ABB"));
app_control_set_app_id(service, PKG_3DPARTIES_WORLDCLOCK);
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
CalAppControlLauncher::getInstance().sendLaunchRequest(service,
- [](app_control_h request, app_control_h reply, app_control_result_e result, void* data)
- {
+ [](app_control_h request, app_control_h reply, app_control_result_e result, void* data) {
WHIT();
CalSettingsView *self = (CalSettingsView *)data;
const char *ringtone_file = CalSettingsManager::getInstance().getAlertSound();
- if(!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT))
- {
+ if(!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT)) {
app_control_add_extra_data(service, CAL_APPSETT_PARAM_MARKED_MODE, CAL_APPSETT_PARAM_MARKED_MODE_DEFAULT);
- }
- else
- {
+ } else {
app_control_add_extra_data(service, CAL_APPSETT_PARAM_MARKED_MODE, ringtone_file);
}
app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_GROUP);
CalAppControlLauncher::getInstance().sendLaunchRequest(service,
- [](app_control_h request, app_control_h reply, app_control_result_e result, void* data)
- {
+ [](app_control_h request, app_control_h reply, app_control_result_e result, void* data) {
CalSettingsView *self = (CalSettingsView *)data;
char* ringtone = NULL;
int error = 0;
error = app_control_get_extra_data(reply, APP_CONTROL_SETTING_RINGTONE_KEY_RESULT, &ringtone);
- if (error != APP_CONTROL_ERROR_NONE)
- {
+ if (error != APP_CONTROL_ERROR_NONE) {
WERROR("get extra data by key result is failed(%x)", error);
return;
}
- if (ringtone == NULL)
- {
+ if (ringtone == NULL) {
WERROR("get extra data by key result return rington NULL");
return;
}
std::string displayText;
self->__getAlertDisplayText(ringtone, displayText);
- if (!strcmp(ringtone, CAL_SETTING_NOTIFICATION_SILENT))
- {
+ if (!strcmp(ringtone, CAL_SETTING_NOTIFICATION_SILENT)) {
self->__noti_sound_item->setSubText(_L_S_("IDS_CLD_OPT_NONE"));
CalSettingsManager::getInstance().setAlertSound(CAL_SETTING_NOTIFICATION_SILENT);
- }
- else if (!strcmp(ringtone, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT))
- {
+ } else if (!strcmp(ringtone, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT)) {
self->__noti_sound_item->setSubText(_L_S_("IDS_COM_BODY_DEFAULT"));
CalSettingsManager::getInstance().setAlertSound(CAL_SETTING_NOTIFICATION_SOUND_DEFAULT);
- }
- else
- {
+ } else {
self->__noti_sound_item->setSubText(displayText.c_str());
CalSettingsManager::getInstance().setAlertSound(ringtone);
}
*/
void CalSettingsView::onSelect(CalSettingsView::SettingSelectType settingType)
{
- switch(settingType)
- {
+ switch(settingType) {
case SETTING_FIRST_DAY_OF_WEEK_SELECT://first day of week
onCreateFirstdayPopup();
break;
);
const char *ringtone_file = CalSettingsManager::getInstance().getAlertSound();
- if (ringtone_file)
- {
+ if (ringtone_file) {
displayText.clear();
- if (!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SILENT))
- {
+ if (!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SILENT)) {
displayText = _L_S_("IDS_CLD_OPT_NONE");
- }
- else if (!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT))
- {
+ } else if (!strcmp(ringtone_file, CAL_SETTING_NOTIFICATION_SOUND_DEFAULT)) {
displayText = _L_S_("IDS_COM_BODY_DEFAULT");
- }
- else
- {
+ } else {
__getAlertDisplayText(ringtone_file, displayText);
}
- }
- else
- {
+ } else {
WERROR("fail");
displayText = _L_S_("IDS_CLD_OPT_NONE");
}
CalSettingsManager::getInstance().getTimeZone(tz);
CalLocaleManager::getInstance().getDisplayTextTimeZone(tz, dT);
- if(__time_zone_item)
- {
+ if(__time_zone_item) {
__time_zone_item->setSubText(dT.c_str());
}
{
WENTER();
WDEBUG("type = %u, source = %u", event.type, event.source);
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::DB_CHANGED:
case CalEvent::APP_PAUSED:
case CalEvent::APP_RESUMED:
{
metadata_extractor_h metadata = NULL;
int ret = metadata_extractor_create(&metadata);
- if(ret == METADATA_EXTRACTOR_ERROR_NONE && metadata)
- {
+ if(ret == METADATA_EXTRACTOR_ERROR_NONE && metadata) {
ret = metadata_extractor_set_path(metadata, ringtone);
- if(ret == METADATA_EXTRACTOR_ERROR_NONE)
- {
+ if(ret == METADATA_EXTRACTOR_ERROR_NONE) {
char *title = NULL;
ret = metadata_extractor_get_metadata(metadata, METADATA_TITLE, &title);
metadata_extractor_destroy(metadata);
- if(title)
- {
+ if(title) {
displayText = title;
free(title);
return ;
- }
- else
+ } else
WDEBUG("metadata title is null");
- }
- else
- {
+ } else {
WDEBUG("metadata title get NULL");
metadata_extractor_destroy(metadata);
}
- }
- else
- {
+ } else {
WDEBUG("metadata title get NULL");
}
unsigned foundDot = tmp.find_last_of(".");
unsigned foundName = tmp.find_last_of("/\\");
- if (foundDot != tmp.npos && foundName != tmp.npos)
- {
+ if (foundDot != tmp.npos && foundName != tmp.npos) {
displayText = tmp.substr(foundName+1, (foundDot-foundName-1));
- }
- else
- {
+ } else {
displayText = tmp;
}
}
void CalWidget::create(widget_context_h context, bundle *content, int w, int h)
{
- if (content)
- {
+ if (content) {
// Recover the previous status with the bundle object
}
// Window
int ret = widget_app_get_elm_win(context, &__window);
- if (ret == WIDGET_ERROR_NONE)
- {
+ if (ret == WIDGET_ERROR_NONE) {
evas_object_resize(__window, w, h);
evas_object_color_set(__window, 255, 255, 255, 0);
evas_object_show(__conform);
evas_object_show(__window);
- }
- else
- {
+ } else {
WERROR("failed to get window. err = %d", ret);
}
}
void CalWidget::destroy(widget_app_destroy_type_e reason)
{
- if(__monthCalendar)
- {
+ if(__monthCalendar) {
__monthCalendar->destroy();
__monthCalendar = NULL;
}
elm_box_homogeneous_set(boxTop, EINA_FALSE);
__addBoxButton(boxTop, "IDS_CLD_ACBUTTON_CREATE_ABB",
- [](void* data, Evas_Object* obj, void* event_info)
- {
+ [](void* data, Evas_Object* obj, void* event_info) {
CalWidget* self = (CalWidget*)data;
self->__AddEvent();
}
);
__buttonToday = __addBoxButton(boxTop, "IDS_CLD_ACBUTTON_TODAY",
- [](void* data, Evas_Object* obj, void* event_info)
- {
+ [](void* data, Evas_Object* obj, void* event_info) {
CalWidget* self = (CalWidget*)data;
self->__focusToday();
}
__monthCalendar->create(layout, NULL);
__monthCalendar->resetByBound();
__monthCalendar->focus(__dateTime.getMday());
- __monthCalendar->setScrollCb([this]() { }, [this](int dir)
- {
- if (dir == 0)
- {
+ __monthCalendar->setScrollCb([this]() { }, [this](int dir) {
+ if (dir == 0) {
return;
}
- if (dir > 0)
- {
+ if (dir > 0) {
__dateTime.incrementMonth();
- }
- else
- {
+ } else {
__dateTime.decrementMonth();
}
- if(__isCutomFocus)
- {
+ if(__isCutomFocus) {
__isCutomFocus = false;
__dateTime = __customFocusDate;
__monthCalendar->focus(__dateTime.getMday());
- }
- else
- {
+ } else {
__monthCalendar->focus(1);
}
- if(__dateTime < __lowerBound)
- {
+ if(__dateTime < __lowerBound) {
__dateTime = __lowerBound;
- }
- else if(__dateTime > __upperBound)
- {
+ } else if(__dateTime > __upperBound) {
__dateTime = __upperBound;
}
__monthCalendar->resetByBound();
});
- __monthCalendar->setTapCellCb([this](int i, int j)
- {
+ __monthCalendar->setTapCellCb([this](int i, int j) {
CalDate newFocusDate;
__monthCalendar->getDate(i, j, newFocusDate);
- if(newFocusDate < __lowerBound || newFocusDate > __upperBound)
- {
+ if(newFocusDate < __lowerBound || newFocusDate > __upperBound) {
WDEBUG("Invalid date %s", newFocusDate.getString());
return;
}
- if (newFocusDate.getMonth() == __dateTime.getMonth())
- {
+ if (newFocusDate.getMonth() == __dateTime.getMonth()) {
__dateTime = newFocusDate;
__monthCalendar->focus(newFocusDate.getMday());
- }
- else
- {
+ } else {
__isCutomFocus = true;
__customFocusDate = newFocusDate;
- if(!__monthCalendar->slide(newFocusDate > __dateTime ? 1 : -1))
- {
+ if(!__monthCalendar->slide(newFocusDate > __dateTime ? 1 : -1)) {
__isCutomFocus = false;
}
return;
}
- if (__timer)
- {
+ if (__timer) {
ecore_timer_del(__timer);
}
int CalWidget::__getFirstDayOfWeek()
{
int result = CalSettingsManager::getInstance().getFirstDayOfWeek();
- if (result == CalSettingsManager::LOCALES)
- {
+ if (result == CalSettingsManager::LOCALES) {
return CalLocaleManager::getInstance().getLocaleFirstDayOfWeek();
}
} else {
app_control_h service = NULL;
app_control_create(&service);
- if(service)
- {
+ if(service) {
app_control_add_extra_data(service, CAL_APPSVC_PARAM_VIEW, CAL_APPSVC_PARAM_VIEW_MAIN);
app_control_add_extra_data(service, CAL_APPSVC_PARAM_DATE, widget->__dateTime.getUnixTimeString());
app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN);
{
app_control_h service = NULL;
app_control_create(&service);
- if(service)
- {
+ if(service) {
app_control_set_operation(service, APP_CONTROL_OPERATION_ADD);
app_control_set_mime(service, APP_CONTROL_MIME_CALENDAR);
if (dateTime) {
int month = __originDate.getMonth();
__monthCalendar->getMonth(year, month);
- if (month != __originDate.getMonth())
- {
+ if (month != __originDate.getMonth()) {
__dateTime = __originDate;
__monthCalendar->reset(__getFirstDayOfWeek(), __originDate.getYear(), __originDate.getMonth());
__displayCurrentDate();
- }
- else if (year != __originDate.getYear())
- {
+ } else if (year != __originDate.getYear()) {
__dateTime = __originDate;
__setMonthLabel();
}
c_retm_if(!__monthCalendar, "__monthCalendar is null onEvent()");
- switch (event.type)
- {
+ switch (event.type) {
case CalEvent::LANGUAGE_CHANGED:
__setMonthLabel();
break;
namespace
{
- inline CalWidget *getWidget(widget_context_h context)
- {
+ inline CalWidget *getWidget(widget_context_h context) {
void *tag = NULL;
widget_app_context_get_tag(context, &tag);
return static_cast<CalWidget*>(tag);
ops.terminate = CalWidgetApp::onAppTerminate;
result = widget_app_main(argc, argv, &ops, NULL);
- if (result != WIDGET_ERROR_NONE)
- {
+ if (result != WIDGET_ERROR_NONE) {
WERROR("widget_app_main() is failed. err = %d", result);
}
int CalWidgetApp::onWidgetCreate(widget_context_h context, bundle *content, int w, int h, void *data)
{
CalWidget *widget = new CalWidget();
- if (!widget)
- {
+ if (!widget) {
return WIDGET_ERROR_OUT_OF_MEMORY;
}
int CalWidgetApp::onWidgetDestroy(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *data)
{
CalWidget *widget = getWidget(context);
- if(widget)
- {
+ if(widget) {
widget->destroy(reason);
delete widget;
}
int CalWidgetApp::onWidgetResize(widget_context_h context, int w, int h, void *data)
{
CalWidget *widget = getWidget(context);
- if(widget)
- {
+ if(widget) {
widget->resize(w, h);
}