alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp
changeset 55 2c54b51f39c4
parent 45 b6db4fd4947b
child 70 a5ed90760192
equal deleted inserted replaced
51:0b38fc5b94c6 55:2c54b51f39c4
    21 
    21 
    22 // User includes
    22 // User includes
    23 #include "alarmalertwidget.h"
    23 #include "alarmalertwidget.h"
    24 #include "alarmalert.h"
    24 #include "alarmalert.h"
    25 #include "alarmalertobserver.h"
    25 #include "alarmalertobserver.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "alarmalertwidgetTraces.h"
       
    29 #endif
    26 
    30 
    27 // Constants.
    31 // Constants.
    28 const TInt KMaxlength=30;
    32 const TInt KMaxlength=30;
    29 
    33 
    30 // ---------------------------------------------------------
    34 // ---------------------------------------------------------
    33 // ---------------------------------------------------------
    37 // ---------------------------------------------------------
    34 //
    38 //
    35 AlarmAlertWidget::AlarmAlertWidget(AlarmAlertObserver *observer) :
    39 AlarmAlertWidget::AlarmAlertWidget(AlarmAlertObserver *observer) :
    36     mObserver(observer)
    40     mObserver(observer)
    37 {
    41 {
       
    42 	OstTraceFunctionEntry0( ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
       
    43 	OstTraceFunctionExit0( ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
    38 }
    44 }
    39 
    45 
    40 // ---------------------------------------------------------
    46 // ---------------------------------------------------------
    41 // AlarmAlertWidget::~AlarmAlertWidget
    47 // AlarmAlertWidget::~AlarmAlertWidget
    42 // rest of the details are commented in the header
    48 // rest of the details are commented in the header
    43 // ---------------------------------------------------------
    49 // ---------------------------------------------------------
    44 //
    50 //
    45 AlarmAlertWidget::~AlarmAlertWidget()
    51 AlarmAlertWidget::~AlarmAlertWidget()
    46 {
    52 {
       
    53 	OstTraceFunctionEntry0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
    47 	// Cleanup
    54 	// Cleanup
    48 	
    55 	
    49 	if (mAlarmSubject) {
    56 	if (mAlarmSubject) {
    50 		delete mAlarmSubject;
    57 		delete mAlarmSubject;
    51 	}
    58 	}
    83 	}
    90 	}
    84 
    91 
    85 	if (mDeviceDialog) {
    92 	if (mDeviceDialog) {
    86 		delete mDeviceDialog;
    93 		delete mDeviceDialog;
    87 	}
    94 	}
       
    95 	OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
    88 }
    96 }
    89 
    97 
    90 // ---------------------------------------------------------
    98 // ---------------------------------------------------------
    91 // AlarmAlertWidget::ShowAlarmDialog
    99 // AlarmAlertWidget::ShowAlarmDialog
    92 // rest of the details are commented in the header
   100 // rest of the details are commented in the header
    93 // ---------------------------------------------------------
   101 // ---------------------------------------------------------
    94 //
   102 //
    95 bool AlarmAlertWidget::showAlarmDialog(SAlarmInfo *alarmInfo)
   103 bool AlarmAlertWidget::showAlarmDialog(SAlarmInfo *alarmInfo)
    96 {
   104 {
       
   105 	OstTraceFunctionEntry0( ALARMALERTWIDGET_SHOWALARMDIALOG_ENTRY );
    97 	// Get the alarm date and time
   106 	// Get the alarm date and time
    98     TBuf<KMaxlength> timeString;
   107     TBuf<KMaxlength> timeString;
    99     TBuf<KMaxlength> dateString;
   108     TBuf<KMaxlength> dateString;
   100     
   109     
   101     TBuf<KMaxlength> timeFormat(_L("%-B%:0%J%:1%T%:3%+B"));
   110     TBuf<KMaxlength> timeFormat(_L("%-B%:0%J%:1%T%:3%+B"));
   172 // rest of the details are commented in the header
   181 // rest of the details are commented in the header
   173 // ---------------------------------------------------------
   182 // ---------------------------------------------------------
   174 //
   183 //
   175 void AlarmAlertWidget::dismissAlarmDialog()
   184 void AlarmAlertWidget::dismissAlarmDialog()
   176 {
   185 {
       
   186     OstTraceFunctionEntry0( ALARMALERTWIDGET_DISMISSALARMDIALOG_ENTRY );
   177     // Dismiss the dialog
   187     // Dismiss the dialog
   178     mDeviceDialog->Cancel();
   188     mDeviceDialog->Cancel();
       
   189     OstTraceFunctionExit0( ALARMALERTWIDGET_DISMISSALARMDIALOG_EXIT );
   179 }
   190 }
   180 
   191 
   181 // ---------------------------------------------------------
   192 // ---------------------------------------------------------
   182 // AlarmAlertWidget::UpdateAlarmDialog
   193 // AlarmAlertWidget::UpdateAlarmDialog
   183 // rest of the details are commented in the header
   194 // rest of the details are commented in the header
   184 // ---------------------------------------------------------
   195 // ---------------------------------------------------------
   185 //
   196 //
   186 bool AlarmAlertWidget::updateAlarmDialog(SAlarmInfo* /*alarmInfo*/)
   197 bool AlarmAlertWidget::updateAlarmDialog(SAlarmInfo* /*alarmInfo*/)
   187 {
   198 {
       
   199     OstTraceFunctionEntry0( ALARMALERTWIDGET_UPDATEALARMDIALOG_ENTRY );
   188     // Update the dialog with any new information
   200     // Update the dialog with any new information
   189     // TODO: Pass the updated information sent by the observer
   201     // TODO: Pass the updated information sent by the observer
   190     /*CHbSymbianVariantMap params;
   202     /*CHbSymbianVariantMap params;
   191     mDeviceDialog->Update(params);*/
   203     mDeviceDialog->Update(params);*/
       
   204     OstTraceFunctionExit0( ALARMALERTWIDGET_UPDATEALARMDIALOG_EXIT );
   192     return false;
   205     return false;
   193 }
   206 }
   194 
   207 
   195 // ---------------------------------------------------------
   208 // ---------------------------------------------------------
   196 // AlarmAlertWidget::DataReceived
   209 // AlarmAlertWidget::DataReceived
   197 // rest of the details are commented in the header
   210 // rest of the details are commented in the header
   198 // ---------------------------------------------------------
   211 // ---------------------------------------------------------
   199 //
   212 //
   200 void AlarmAlertWidget::DataReceived(CHbSymbianVariantMap& aData)
   213 void AlarmAlertWidget::DataReceived(CHbSymbianVariantMap& aData)
   201 {
   214 {
       
   215     OstTraceFunctionEntry0( ALARMALERTWIDGET_DATARECEIVED_ENTRY );
   202     if (!aData.Keys().MdcaCount()) {
   216     if (!aData.Keys().MdcaCount()) {
       
   217         OstTraceFunctionExit0( ALARMALERTWIDGET_DATARECEIVED_EXIT );
   203         return;
   218         return;
   204     }
   219     }
   205     
   220     
   206     triggerAction(aData.Get(alarmCommandSymbian));
   221     triggerAction(aData.Get(alarmCommandSymbian));
       
   222     OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_DATARECEIVED_EXIT );
   207 }
   223 }
   208 
   224 
   209 // ---------------------------------------------------------
   225 // ---------------------------------------------------------
   210 // AlarmAlertWidget::DeviceDialogClosed
   226 // AlarmAlertWidget::DeviceDialogClosed
   211 // rest of the details are commented in the header
   227 // rest of the details are commented in the header
   212 // ---------------------------------------------------------
   228 // ---------------------------------------------------------
   213 //
   229 //
   214 void AlarmAlertWidget::DeviceDialogClosed(TInt /*aCompletionCode*/)
   230 void AlarmAlertWidget::DeviceDialogClosed(TInt /*aCompletionCode*/)
   215 {
   231 {
       
   232   OstTraceFunctionEntry0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_ENTRY );
   216   
   233   
       
   234   OstTraceFunctionExit0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_EXIT );
   217 }
   235 }
   218 
   236 
   219 // ---------------------------------------------------------
   237 // ---------------------------------------------------------
   220 // AlarmAlertWidget::triggerAction
   238 // AlarmAlertWidget::triggerAction
   221 // rest of the details are commented in the header
   239 // rest of the details are commented in the header
   222 // ---------------------------------------------------------
   240 // ---------------------------------------------------------
   223 //
   241 //
   224 void AlarmAlertWidget::triggerAction(const CHbSymbianVariant* source)
   242 void AlarmAlertWidget::triggerAction(const CHbSymbianVariant* source)
   225 {
   243 {
       
   244        OstTraceFunctionEntry0( ALARMALERTWIDGET_TRIGGERACTION_ENTRY );
   226        AlarmCommand command(AlarmCmdLast);
   245        AlarmCommand command(AlarmCmdLast);
   227        
   246        
   228        if (*source->Value<TInt>() == Stop) {    
   247        if (*source->Value<TInt>() == Stop) {    
   229        command = AlarmStop;    
   248        command = AlarmStop;    
   230        } else if (*source->Value<TInt>() == Snooze) {
   249        } else if (*source->Value<TInt>() == Snooze) {
   232        } else if (*source->Value<TInt>() == Silence) {
   251        } else if (*source->Value<TInt>() == Silence) {
   233        command = AlarmSilence;
   252        command = AlarmSilence;
   234        } else if (*source->Value<TInt>() == Shown) {
   253        } else if (*source->Value<TInt>() == Shown) {
   235        command = AlarmShown;
   254        command = AlarmShown;
   236        mObserver->alertDisplayed(command);
   255        mObserver->alertDisplayed(command);
       
   256        OstTraceFunctionExit0( ALARMALERTWIDGET_TRIGGERACTION_EXIT );
   237        return;
   257        return;
   238        } else {
   258        } else {
   239        command = AlarmCmdLast;
   259        command = AlarmCmdLast;
   240        }
   260        }
   241        
   261        
   242        if (command != AlarmCmdLast) {
   262        if (command != AlarmCmdLast) {
   243        // Notify the observer with the command
   263        // Notify the observer with the command
   244        mObserver->alertCompleted(command);
   264        mObserver->alertCompleted(command);
   245        }
   265        }
       
   266        OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_TRIGGERACTION_EXIT );
   246 }
   267 }
   247 
   268 
   248 // End of file  --Don't remove this.
   269 // End of file  --Don't remove this.