3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.1 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file ClkAlarmRingingForm.cpp
20 * @brief Used to define AlarmRingingForm
24 #include <FAppUiApp.h>
29 #include <FTelCallInfo.h>
32 #include "ClkAlarmPresentationModel.h"
33 #include "ClkAlarmRingingForm.h"
34 #include "ClkClockApp.h"
35 #include "ClkCommonLib.h"
36 #include "ClkSceneRegister.h"
39 using namespace Tizen::App;
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Collection;
42 using namespace Tizen::Base::Runtime;
43 using namespace Tizen::Graphics;
44 using namespace Tizen::Io;
45 using namespace Tizen::Media;
46 using namespace Tizen::Shell;
47 using namespace Tizen::System;
48 using namespace Tizen::Telephony;
49 using namespace Tizen::Ui;
50 using namespace Tizen::Ui::Controls;
51 using namespace Tizen::Ui::Scenes;
53 static const int IDA_TABBAR_ITEM1_SNOOZE = 100;
54 static const int IDA_TABBAR_ITEM1_STOP = 101;
55 const RequestId REQUEST_ID_SETZORDER = 10000;
56 const RequestId REQUEST_ID_NEXTSCENEEXIST = 10001;
58 AlarmRingingForm::AlarmRingingForm()
61 __nextSceneExist(false),
63 __pAlarmTimeLabel(null),
64 __pAlarmTitleLabel(null),
66 __pCurrentTimeLabel(null),
68 __pSnoozeButton(null),
77 AlarmRingingForm::~AlarmRingingForm()
80 if ( __pTimer != null)
85 if (__pPlayer != null)
90 if (__pVibrator != null)
98 AlarmRingingForm::Initialize()
100 Form::Construct(L"IDL_ALARM_RINGING_FORM");
105 AlarmRingingForm::OnInitializing(void)
107 result r = E_FAILURE;
109 SettingInfo::GetValue(L"http://tizen.org/setting/locale.time.format.24hour", is24HourFormat);
111 PowerManager::AddScreenEventListener(*this);
112 AddOrientationEventListener(*this);
113 SceneManager* pSceneManager = SceneManager::GetInstance();
115 if (pSceneManager != null)
117 r = pSceneManager->AddSceneEventListener(IDSCN_ALARM_RINGING, *this);
121 AppLogException("OnInitialized failed with %s", GetErrorMessage(r));
126 __pSnoozeButton = static_cast< Button* >(GetControl("IDC_BUTTON1"));
128 if (__pSnoozeButton != null)
130 __pSnoozeButton->SetActionId(IDA_TABBAR_ITEM1_SNOOZE);
131 __pSnoozeButton->AddActionEventListener(*this);
134 __pStopButton = static_cast< Button* >(GetControl("IDC_BUTTON2"));
136 if (__pStopButton != null)
138 __pStopButton->SetActionId(IDA_TABBAR_ITEM1_STOP);
139 __pStopButton->AddActionEventListener(*this);
142 __pClockLabel = static_cast< Label* >(GetControl("IDC_LABEL1"));
143 __pCurrentTimeLabel = static_cast< Label* >(GetControl("IDC_LABEL2"));
144 __pAlarmTimeLabel = static_cast< Label* >(GetControl("IDC_LABEL3"));
145 __pAlarmTitleLabel = static_cast< Label* >(GetControl("IDC_LABEL4"));
148 __pTimer = new (std::nothrow) Timer();
150 if (__pTimer == null)
155 __callManager.Construct(*this);
157 r = __pTimer->Construct(*this);
163 AlarmRingingForm::OnTerminating(void)
165 PowerManager::RemoveScreenEventListener(*this);
169 AlarmRingingForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
172 String alarmTimeString = L"";
173 String alarmTonePath;
177 bool snoozeOn = false;
179 //PowerManager::AddScreenEventListener(*this);
180 if (__nextSceneExist && __timerExpired)
182 SendUserEvent(REQUEST_ID_NEXTSCENEEXIST, null);
186 if (__nextSceneExist && !__timerExpired)
190 __nextSceneExist = false;
194 __pAlarm = dynamic_cast<AlarmData*>(pArgs->GetAt(0));
196 if ( __pAlarm == null )
201 snoozeOn = __pAlarm->GetSnoozeOn();
203 if (snoozeOn && __pAlarm->GetSnoozeRepeatCount() != 0)
205 alarmTime = __pAlarm->GetAlarmTime();
206 AppLog("alarmTime = %ls", alarmTime.ToString().GetPointer());
209 hours = alarmTime.GetHour();
213 alarmTimeString.Append(L"0");
216 alarmTimeString.Append(hours);
220 hours = alarmTime.GetHour() % 12;
224 alarmTimeString.Append("12");
230 alarmTimeString.Append(L"0");
233 alarmTimeString.Append(hours%12);
237 alarmTimeString.Append(":");
239 if (alarmTime.GetMinute() < 10)
241 alarmTimeString.Append(L"0");
244 alarmTimeString.Append(alarmTime.GetMinute());
245 alarmTimeString.Append(" ");
247 if (is24HourFormat == false)
249 if (alarmTime.GetHour() >= 12)
251 alarmTimeString.Append("PM");
255 alarmTimeString.Append("AM");
260 __pAlarmTimeLabel->SetText(alarmTimeString);
264 __pAlarmTimeLabel->SetShowState(false);
265 __pSnoozeButton->SetShowState(false);
266 __pAlarmTitleLabel->SetBounds(Rectangle(__pAlarmTimeLabel->GetX(),__pAlarmTimeLabel->GetY(),__pAlarmTitleLabel->GetWidth(),__pAlarmTitleLabel->GetHeight()));
268 if (GetOrientation() == ORIENTATION_LANDSCAPE || GetOrientation() == ORIENTATION_LANDSCAPE_REVERSE)
277 __pStopButton->SetBounds(Rectangle(buttonGap,__pStopButton->GetY(),GetClientAreaBounds().width - 2 * buttonGap, __pStopButton->GetHeight()));
280 __pAlarmTitleLabel->SetText(__pAlarm->GetAlarmName());
282 alarmVolume = __pAlarm->GetRingVolume();
283 alarmTonePath = __pAlarm->GetRingTone();
285 if (__pAlarm->GetRingType() == ALARM_TYPE_MELODY)
287 StartAudio(alarmTonePath,alarmVolume);
289 else if(__pAlarm->GetRingType() == ALARM_TYPE_VIBRATION)
293 else if (__pAlarm->GetRingType() == ALARM_TYPE_MELODY_AND_VIBRATION)
295 StartAudio(alarmTonePath,alarmVolume);
305 SendUserEvent(REQUEST_ID_SETZORDER, null);
310 AlarmRingingForm::OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs)
312 result r = E_FAILURE;
314 if (requestId == REQUEST_ID_SETZORDER)
316 AppLog("the z-order is set");
317 Frame* pFrame = UiApp::GetInstance()->GetFrame(L"Clock");
321 if (LockManager::GetInstance()->IsLocked())
323 pFrame->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_HIGH);
325 //pFrame->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_HIGH);
327 //pFrame->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_NORMAL);
331 else if (requestId == REQUEST_ID_NEXTSCENEEXIST)
333 r = SceneManager::GetInstance()->GoBackward(BackwardSceneTransition());
334 if( r == E_UNDERFLOW)
336 UiApp::GetInstance()->Terminate();
343 AlarmRingingForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
345 if (nextSceneId == IDSCN_TIMER_RINGING || nextSceneId == IDSCN_TIMER_RINGING_LOCK)
347 __nextSceneExist = true;
350 Frame* pFrame = UiApp::GetInstance()->GetFrame(L"Clock");
354 pFrame->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_NORMAL);
357 if(__pPlayer != null)
359 if (__nextSceneExist == true)
369 if(__pVibrator != null)
374 /* if(__pTimer != null)
381 AlarmRingingForm::OnActionPerformed(const Control& source, int actionId)
383 result r = E_SUCCESS;
384 SceneManager* pSceneManager = null;
386 int snoozeRepeatCount = 0;
387 AlarmData* pAlarm = null;
388 ArrayList* alarmList = null;
389 DateTime currentTime;
391 AlarmPresentationModel* pAlarmPresentationModel = AlarmPresentationModel::GetInstance();
392 DataServiceProvider* pDataServiceProvider = DataServiceProvider::GetInstance();
401 case IDA_TABBAR_ITEM1_STOP:
403 pAlarmPresentationModel->GetAlarmCount(count);
404 alarmList = new (std::nothrow) ArrayList();
406 if (alarmList == null)
411 alarmList->Construct();
412 pAlarmPresentationModel->GetAlarm(0,count,*alarmList);
413 alarmCount = alarmList->GetCount();
415 for (count = 0; count < alarmCount; count++)
417 pAlarm = dynamic_cast< AlarmData* >(alarmList->GetAt(count));
419 if ( pAlarm != null && __pAlarm != null && pAlarm->GetAlarmId() == __pAlarm->GetAlarmId())
421 pAlarm->SetSnoozeRepeatCount(-1);
423 if(!pAlarm->GetRepeatFlags().Contains(L"1"))
425 pAlarm->SetAlarmOnState(0);
428 r = pAlarmPresentationModel->SaveAlarm(*pAlarm);
430 if (r == E_STORAGE_FULL || r == E_INIT_FAILED || r == E_OUT_OF_MEMORY)
433 int modalMsgBoxResult;
434 String msg = CommonUtil::GetString("IDS_MEMORY_FULL");
435 r = msgBox.Construct(L"", msg, MSGBOX_STYLE_NONE, 3000);
436 AppLog("the result is %s", GetErrorMessage(r));
437 msgBox.ShowAndWait(modalMsgBoxResult);
445 /* ClockApp* pClock = static_cast<ClockApp*>(ClockApp::GetInstance());
446 if (pClock->activeAppId.GetLength() > 0 && pClock->activeAppId != ClockApp::GetInstance()->GetAppId())
448 AppManager::GetInstance()->LaunchApplication(pClock->activeAppId);
452 if (alarmList != null)
454 alarmList->RemoveAll();
458 pSceneManager = SceneManager::GetInstance();
460 if (pSceneManager != null)
462 r = pSceneManager->GoBackward(BackwardSceneTransition());
463 if( r == E_UNDERFLOW)
465 UiApp::GetInstance()->Terminate();
471 case IDA_TABBAR_ITEM1_SNOOZE:
473 DateTime nextAlarmTime;
474 pAlarmPresentationModel->GetAlarmCount(count);
475 alarmList = new (std::nothrow) ArrayList();
477 if (alarmList == null)
482 alarmList->Construct();
483 pAlarmPresentationModel->GetAlarm(0,count,*alarmList);
484 pDataServiceProvider->GetCurrentDateTime(currentTime);
485 alarmCount = alarmList->GetCount();
487 for (count = 0; count < alarmCount; count++)
489 pAlarm = dynamic_cast< AlarmData* >(alarmList->GetAt(count));
491 if ( pAlarm != null && pAlarm->GetAlarmId() == __pAlarm->GetAlarmId())
493 nextAlarmTime.SetValue(__pAlarm->GetAlarmTime());
494 pAlarm->SetLastRingingTime(nextAlarmTime);
495 snoozeRepeatCount = pAlarm->GetSnoozeRepeatCount();
496 pAlarm->SetSnoozeRepeatCount(snoozeRepeatCount - 1);
498 if (snoozeRepeatCount <= 0 && !pAlarm->GetRepeatFlags().Contains(L"1"))
500 pAlarm->SetAlarmOnState(0);
503 r = pAlarmPresentationModel->SaveAlarm(*pAlarm);
505 if (r == E_STORAGE_FULL || r == E_INIT_FAILED || r == E_OUT_OF_MEMORY)
508 int modalMsgBoxResult;
509 String msg = CommonUtil::GetString("IDS_MEMORY_FULL");
510 r = msgBox.Construct(L"", msg, MSGBOX_STYLE_NONE, 3000);
511 AppLog("the result is %s", GetErrorMessage(r));
512 msgBox.ShowAndWait(modalMsgBoxResult);
519 if (alarmList != null)
521 alarmList->RemoveAll();
526 pSceneManager = SceneManager::GetInstance();
528 if (pSceneManager != null)
530 r = pSceneManager->GoBackward(BackwardSceneTransition());
531 if( r == E_UNDERFLOW)
533 UiApp::GetInstance()->Terminate();
546 AlarmRingingForm::ShowClock()
548 result r = E_FAILURE;
551 Bitmap* pHourBitmap = null ;
552 Bitmap* pMinuteBitmap = null ;
553 Bitmap* pSecondBitmap = null ;
554 Bitmap* pClockBitmap = null;
555 Bitmap* pFinalBitmap = null;
556 Canvas* pCanvas = null;
557 DateTime currentTime;
558 String currentTimeString = L"";
559 int canvasWidth = 374;
560 int canvasHeight = 544;
561 String hourImagePath;
562 String minuteImagePath;
563 String secondImagePath;
564 Point centerPoint(51,94);
566 DataServiceProvider* pDataServiceProvider = DataServiceProvider::GetInstance();
567 pDataServiceProvider->GetCurrentDateTime(currentTime);
569 hourImagePath.Append(IDS_HOUR_IMAGE_PATH);
570 minuteImagePath.Append(IDS_MIN_IMAGE_PATH);
571 secondImagePath.Append(IDS_SEC_IMAGE_PATH);
573 if (__minutes != currentTime.GetMinute() || __hours != currentTime.GetHour())
577 hours = currentTime.GetHour();
581 currentTimeString.Append(L"0");
584 currentTimeString.Append(hours);
588 hours = currentTime.GetHour() % 12;
592 currentTimeString.Append("12");
598 currentTimeString.Append(L"0");
601 currentTimeString.Append(hours%12);
605 currentTimeString.Append(":");
607 if (currentTime.GetMinute() < 10)
609 currentTimeString.Append(L"0");
612 currentTimeString.Append(currentTime.GetMinute());
613 currentTimeString.Append(" ");
617 if (currentTime.GetHour() >= 12)
619 currentTimeString.Append("PM");
623 currentTimeString.Append("AM");
627 __pCurrentTimeLabel->SetText(currentTimeString);
630 __hours = currentTime.GetHour();
631 __minutes = currentTime.GetMinute();
632 seconds = currentTime.GetSecond();
634 pClockBitmap = AppResource::GetInstance()->GetBitmapN(IDB_ALARM_CLOCK);
636 if ((__hours % 12) < 10)
638 hourImagePath.Append(L"0");
641 hourImagePath.Append(__hours % 12);
645 hourImagePath.Append(L"_1.png");
647 else if (__minutes >= 12 && __minutes < 24)
649 hourImagePath.Append(L"_2.png");
651 else if (__minutes >= 24 && __minutes < 36)
653 hourImagePath.Append(L"_3.png");
655 else if (__minutes >= 36 && __minutes < 48)
657 hourImagePath.Append(L"_4.png");
659 else if (__minutes >= 48 && __minutes < 60)
661 hourImagePath.Append(L"_5.png");
666 minuteImagePath.Append(L"0");
669 minuteImagePath.Append(__minutes);
670 minuteImagePath.Append(L".png");
674 secondImagePath.Append(L"0");
677 secondImagePath.Append(seconds);
678 secondImagePath.Append(L".png");
680 AppLog("hourImagePath = %ls minuteImagePath = %ls secondImagePath = %ls", hourImagePath.GetPointer(), minuteImagePath.GetPointer(), secondImagePath.GetPointer());
681 pMinuteBitmap = AppResource::GetInstance()->GetBitmapN(minuteImagePath);
682 pHourBitmap = AppResource::GetInstance()->GetBitmapN(hourImagePath);
683 pSecondBitmap = AppResource::GetInstance()->GetBitmapN(secondImagePath);
685 pCanvas = new (std::nothrow) Canvas();
686 pCanvas->Construct(Rectangle(0,0,canvasWidth,canvasHeight));
687 r = pCanvas->DrawBitmap(Point(0,0),*pClockBitmap);
688 pCanvas->DrawBitmap(centerPoint,*pHourBitmap);
689 pCanvas->DrawBitmap(centerPoint,*pMinuteBitmap);
690 pCanvas->DrawBitmap(centerPoint,*pSecondBitmap);
692 pFinalBitmap = new (std::nothrow) Bitmap();
694 if (pFinalBitmap != null)
696 pFinalBitmap->Construct(*pCanvas,Rectangle(0,0,canvasWidth,canvasHeight));
700 __pClockLabel->SetBackgroundBitmap(*pFinalBitmap);
702 if (pClockBitmap != null)
708 if (pHourBitmap != null)
714 if (pMinuteBitmap != null)
716 delete pMinuteBitmap;
717 pMinuteBitmap = null;
720 if (pSecondBitmap != null)
722 delete pSecondBitmap;
723 pSecondBitmap = null;
726 if (pFinalBitmap != null)
735 AlarmRingingForm::OnTimerExpired(Timer& timer)
737 DateTime currentTime, alarmTime;
741 DataServiceProvider* pDataServiceProvider = DataServiceProvider::GetInstance();
742 pDataServiceProvider->GetCurrentDateTime(currentTime);
743 if (__pAlarm != null)
745 alarmTime = __pAlarm->GetAlarmTime();
746 alarmTime.AddMinutes(__pAlarm->GetSnoozeDuration() * (__pAlarm->GetSnoozeRepeat() - __pAlarm->GetSnoozeRepeatCount()));
748 seconds = currentTime.GetSecond() - alarmTime.GetSecond();
749 minutes = currentTime.GetMinute() - alarmTime.GetMinute();
752 seconds = seconds + 60;
755 if ( seconds == 0 && minutes == 1 )
758 AlarmPresentationModel* pAlarmPresentationModel = AlarmPresentationModel::GetInstance();
759 SceneManager* pSceneManager = null;
761 int snoozeRepeatCount = 0;
762 AlarmData* pAlarm = null;
763 ArrayList* alarmList = null;
764 result r = E_FAILURE;
766 __timerExpired = true;
767 pAlarmPresentationModel->GetAlarmCount(count);
768 alarmList = new (std::nothrow) ArrayList();
770 if (alarmList == null)
775 alarmList->Construct();
776 pAlarmPresentationModel->GetAlarm(0,count,*alarmList);
777 pDataServiceProvider->GetCurrentDateTime(currentTime);
778 alarmCount = alarmList->GetCount();
780 for (count = 0; count < alarmCount; count++)
782 pAlarm = dynamic_cast< AlarmData* >(alarmList->GetAt(count));
784 if ( pAlarm != null && __pAlarm != null && pAlarm->GetAlarmId() == __pAlarm->GetAlarmId())
786 pAlarm->SetLastRingingTime(__pAlarm->GetAlarmTime());
787 snoozeRepeatCount = pAlarm->GetSnoozeRepeatCount();
788 pAlarm->SetSnoozeRepeatCount(snoozeRepeatCount - 1);
789 AppLog("AlarmRingingForm::OnTimerExpired 1");
790 if ((snoozeRepeatCount <= 0 || !pAlarm->GetSnoozeOn()) && !pAlarm->GetRepeatFlags().Contains(L"1"))
792 AppLog("AlarmRingingForm::OnTimerExpired 2");
793 pAlarm->SetAlarmOnState(0);
796 r = pAlarmPresentationModel->SaveAlarm(*pAlarm);
798 if (r == E_STORAGE_FULL || r == E_INIT_FAILED || r == E_OUT_OF_MEMORY)
801 int modalMsgBoxResult;
802 String msg = CommonUtil::GetString("IDS_MEMORY_FULL");
803 r = msgBox.Construct(L"", msg, MSGBOX_STYLE_NONE, 3000);
804 AppLog("the result is %s", GetErrorMessage(r));
805 msgBox.ShowAndWait(modalMsgBoxResult);
812 if (alarmList != null)
814 alarmList->RemoveAll();
819 pSceneManager = SceneManager::GetInstance();
821 if (pSceneManager != null)
823 if (!__nextSceneExist)
825 r = pSceneManager->GoBackward(BackwardSceneTransition());
826 if( r == E_UNDERFLOW)
828 UiApp::GetInstance()->Terminate();
835 __timerExpired = false;
838 __pTimer->Start(1000); // to refresh list after 1 second ( 1000 milliseconds)
840 PowerManager::KeepScreenOnState(true,false);
848 AlarmRingingForm::StartAudio(String& path, int volume)
850 AppLog("AlarmRingingLockForm::StartAudio");
851 result r = E_SUCCESS;
852 Tizen::Media::Player player;
853 __pPlayer = new(std::nothrow) Player();
854 r = __pPlayer->Construct(*this);
858 AppLog("the result of construct is %s", GetErrorMessage(r));
863 if(File::IsFileExist(path) == false)
865 path = AlarmPresentationModel::GetInstance()->defaultAudioPath;
867 r = __pPlayer->OpenFile(path, false);
871 AppLog("the result of openfile is %s", GetErrorMessage(r));
875 __pPlayer->SetVolume(volume*100/15);
877 r = __pPlayer->SetLooping(true);
878 AppLog("the result is %s", GetErrorMessage(r));
880 __pPlayer->SetAudioStreamType(AUDIO_STREAM_TYPE_MEDIA);
881 r = __pPlayer->Play();
885 AppLog("the result of play is %s", GetErrorMessage(r));
893 AlarmRingingForm::StartVibrator(void)
895 AppLog("AlarmRingingForm::StartVibrator");
896 result r = E_SUCCESS;
897 __pVibrator = new(std::nothrow) Vibrator();
898 r = __pVibrator->Construct();
902 AppLog("the result of vibrator is %s", GetErrorMessage(r));
905 IntensityDurationVibrationPattern *pPattern = new IntensityDurationVibrationPattern();
906 pPattern->duration = 60000;
907 pPattern->intensity = 100;
909 r = __pVibrator->Start(pPattern,10);
911 AppLog("the value is %s", GetErrorMessage(r));
919 AlarmRingingForm::OnTelephonyCallStatusChangedN (CallStatus callStatus, CallInfo *pCallInfo)
921 AppLog("callStatus %d", callStatus);
922 Frame* pFrame = UiApp::GetInstance()->GetFrame(L"Clock");
924 if(callStatus == CALL_STATUS_RINGING)
928 pFrame->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_NORMAL);
934 AlarmRingingForm::OnSettingChanged(Tizen::Base::String& key)
936 int systemVolume = 0;
937 if ( key == L"http://tizen.org/setting/locale.time.format.24hour")
939 SettingInfo::GetValue(key, is24HourFormat);
942 if (key == L"http://tizen.org/setting/sound.media.volume" )
944 SettingInfo::GetValue(key, systemVolume);
950 AlarmRingingForm::OnOrientationChanged(const Control& source, OrientationStatus orientationStatus)
952 AppLog("OnOrientationChanged");
954 bool snoozeOn = false;
955 String alarmTimeString = L"";
959 snoozeOn = __pAlarm->GetSnoozeOn();
961 if (snoozeOn && __pAlarm->GetSnoozeRepeatCount() != 0)
963 alarmTime = __pAlarm->GetAlarmTime();
967 hours = alarmTime.GetHour();
971 alarmTimeString.Append(L"0");
974 alarmTimeString.Append(hours);
978 hours = alarmTime.GetHour() % 12;
982 alarmTimeString.Append("12");
988 alarmTimeString.Append(L"0");
991 alarmTimeString.Append(hours%12);
995 alarmTimeString.Append(":");
997 if (alarmTime.GetMinute() < 10)
999 alarmTimeString.Append(L"0");
1002 alarmTimeString.Append(alarmTime.GetMinute());
1003 alarmTimeString.Append(" ");
1005 if (is24HourFormat == false)
1007 if (alarmTime.GetHour() >= 12)
1009 alarmTimeString.Append("PM");
1013 alarmTimeString.Append("AM");
1018 __pAlarmTimeLabel->SetText(alarmTimeString);
1022 __pAlarmTimeLabel->SetShowState(false);
1023 __pSnoozeButton->SetShowState(false);
1024 __pAlarmTitleLabel->SetBounds(Rectangle(__pAlarmTimeLabel->GetX(),__pAlarmTimeLabel->GetY(),__pAlarmTitleLabel->GetWidth(),__pAlarmTitleLabel->GetHeight()));
1026 if (orientationStatus == ORIENTATION_STATUS_LANDSCAPE || orientationStatus == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
1034 __pStopButton->SetBounds(Rectangle(buttonGap,__pStopButton->GetY(),GetClientAreaBounds().width - 2 * buttonGap, __pStopButton->GetHeight()));
1041 AlarmRingingForm::OnScreenOff(void)
1043 AppLog("AlarmRingingForm::OnScreenOff");
1044 result r = E_SUCCESS;
1045 SceneManager* pSceneManager = null;
1046 ArrayList* alarmList = null;
1047 AlarmPresentationModel* pAlarmPresentationModel = AlarmPresentationModel::GetInstance();
1050 AlarmData* pAlarm = null;
1052 pAlarmPresentationModel->GetAlarmCount(count);
1053 alarmList = new (std::nothrow) ArrayList();
1055 if (alarmList == null)
1060 alarmList->Construct();
1061 pAlarmPresentationModel->GetAlarm(0,count,*alarmList);
1062 alarmCount = alarmList->GetCount();
1064 for (count = 0; count < alarmCount; count++)
1066 pAlarm = dynamic_cast< AlarmData* >(alarmList->GetAt(count));
1068 if ( pAlarm != null && __pAlarm != null && pAlarm->GetAlarmId() == __pAlarm->GetAlarmId())
1070 pAlarm->SetSnoozeRepeatCount(-1);
1072 if(!pAlarm->GetRepeatFlags().Contains(L"1"))
1074 pAlarm->SetAlarmOnState(0);
1077 r = pAlarmPresentationModel->SaveAlarm(*pAlarm);
1079 if (r == E_STORAGE_FULL || r == E_INIT_FAILED || r == E_OUT_OF_MEMORY)
1082 int modalMsgBoxResult;
1083 String msg = CommonUtil::GetString("IDS_MEMORY_FULL");
1084 r = msgBox.Construct(L"", msg, MSGBOX_STYLE_NONE, 3000);
1085 AppLog("the result is %s", GetErrorMessage(r));
1086 msgBox.ShowAndWait(modalMsgBoxResult);
1094 /* ClockApp* pClock = static_cast<ClockApp*>(ClockApp::GetInstance());
1095 if (pClock->activeAppId.GetLength() > 0 && pClock->activeAppId != ClockApp::GetInstance()->GetAppId())
1097 AppManager::GetInstance()->LaunchApplication(pClock->activeAppId);
1101 pSceneManager = SceneManager::GetInstance();
1103 if (pSceneManager != null)
1105 r = pSceneManager->GoBackward(BackwardSceneTransition());
1106 if( r == E_UNDERFLOW)
1108 UiApp::GetInstance()->Terminate();