alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp
author hgs
Mon, 06 Sep 2010 10:12:45 +0530
changeset 70 a5ed90760192
parent 55 2c54b51f39c4
child 81 ce92091cbd61
permissions -rw-r--r--
201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
45
hgs
parents: 23
diff changeset
    14
* Description:
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
// alarmalertwidget.cpp
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
// System includes
45
hgs
parents: 23
diff changeset
    20
#include <hbsymbianvariant.h>
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
// User includes
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include "alarmalertwidget.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
#include "alarmalert.h"
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#include "alarmalertobserver.h"
55
hgs
parents: 45
diff changeset
    26
#include "OstTraceDefinitions.h"
hgs
parents: 45
diff changeset
    27
#ifdef OST_TRACE_COMPILER_IN_USE
hgs
parents: 45
diff changeset
    28
#include "alarmalertwidgetTraces.h"
hgs
parents: 45
diff changeset
    29
#endif
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
45
hgs
parents: 23
diff changeset
    31
// Constants.
hgs
parents: 23
diff changeset
    32
const TInt KMaxlength=30;
hgs
parents: 23
diff changeset
    33
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
// AlarmAlertWidget::AlarmAlertWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
AlarmAlertWidget::AlarmAlertWidget(AlarmAlertObserver *observer) :
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
    mObserver(observer)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
{
55
hgs
parents: 45
diff changeset
    42
	OstTraceFunctionEntry0( ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
hgs
parents: 45
diff changeset
    43
	OstTraceFunctionExit0( ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
// AlarmAlertWidget::~AlarmAlertWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
AlarmAlertWidget::~AlarmAlertWidget()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
{
55
hgs
parents: 45
diff changeset
    53
	OstTraceFunctionEntry0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
45
hgs
parents: 23
diff changeset
    54
	// Cleanup
hgs
parents: 23
diff changeset
    55
	
hgs
parents: 23
diff changeset
    56
	if (mAlarmSubject) {
hgs
parents: 23
diff changeset
    57
		delete mAlarmSubject;
hgs
parents: 23
diff changeset
    58
	}
hgs
parents: 23
diff changeset
    59
hgs
parents: 23
diff changeset
    60
	if (mLocation) {
hgs
parents: 23
diff changeset
    61
		delete mLocation;
hgs
parents: 23
diff changeset
    62
	}
hgs
parents: 23
diff changeset
    63
hgs
parents: 23
diff changeset
    64
	if (mAlarmTime) {
hgs
parents: 23
diff changeset
    65
		delete mAlarmTime;
hgs
parents: 23
diff changeset
    66
	}
hgs
parents: 23
diff changeset
    67
	
hgs
parents: 23
diff changeset
    68
	if (mAlarmDate) {
hgs
parents: 23
diff changeset
    69
        delete mAlarmDate;
hgs
parents: 23
diff changeset
    70
	}
hgs
parents: 23
diff changeset
    71
hgs
parents: 23
diff changeset
    72
	if (mAlarmAlertType) {
hgs
parents: 23
diff changeset
    73
		delete mAlarmAlertType;
hgs
parents: 23
diff changeset
    74
	}
hgs
parents: 23
diff changeset
    75
hgs
parents: 23
diff changeset
    76
	if (mCanSnooze) {
hgs
parents: 23
diff changeset
    77
		delete mCanSnooze;
hgs
parents: 23
diff changeset
    78
	}
hgs
parents: 23
diff changeset
    79
hgs
parents: 23
diff changeset
    80
	if (mIsSilent) {
hgs
parents: 23
diff changeset
    81
		delete mIsSilent;
hgs
parents: 23
diff changeset
    82
	}
hgs
parents: 23
diff changeset
    83
hgs
parents: 23
diff changeset
    84
	if (mIsTimedAlarm) {
hgs
parents: 23
diff changeset
    85
		delete mIsTimedAlarm;
hgs
parents: 23
diff changeset
    86
	}
hgs
parents: 23
diff changeset
    87
hgs
parents: 23
diff changeset
    88
	if (mVariantMap) {
hgs
parents: 23
diff changeset
    89
		delete mVariantMap;
hgs
parents: 23
diff changeset
    90
	}
hgs
parents: 23
diff changeset
    91
hgs
parents: 23
diff changeset
    92
	if (mDeviceDialog) {
hgs
parents: 23
diff changeset
    93
		delete mDeviceDialog;
hgs
parents: 23
diff changeset
    94
	}
55
hgs
parents: 45
diff changeset
    95
	OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
// AlarmAlertWidget::ShowAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
bool AlarmAlertWidget::showAlarmDialog(SAlarmInfo *alarmInfo)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
{
55
hgs
parents: 45
diff changeset
   105
	OstTraceFunctionEntry0( ALARMALERTWIDGET_SHOWALARMDIALOG_ENTRY );
45
hgs
parents: 23
diff changeset
   106
	// Get the alarm date and time
hgs
parents: 23
diff changeset
   107
    TBuf<KMaxlength> timeString;
hgs
parents: 23
diff changeset
   108
    TBuf<KMaxlength> dateString;
hgs
parents: 23
diff changeset
   109
    
hgs
parents: 23
diff changeset
   110
    TBuf<KMaxlength> timeFormat(_L("%-B%:0%J%:1%T%:3%+B"));
hgs
parents: 23
diff changeset
   111
    TBuf<KMaxlength> dateFormat;
hgs
parents: 23
diff changeset
   112
    TLocale locale;
hgs
parents: 23
diff changeset
   113
    switch (locale.DateFormat()) {
hgs
parents: 23
diff changeset
   114
        case EDateEuropean:
hgs
parents: 23
diff changeset
   115
            dateFormat.Copy(_L("%F%/0%D%/1%M%/2%Y%/3"));
hgs
parents: 23
diff changeset
   116
            break;
hgs
parents: 23
diff changeset
   117
        case EDateAmerican:
hgs
parents: 23
diff changeset
   118
            dateFormat.Copy(_L("%F%/0%M%/1%D%/2%Y%/3"));
hgs
parents: 23
diff changeset
   119
            break;
hgs
parents: 23
diff changeset
   120
        case EDateJapanese:
hgs
parents: 23
diff changeset
   121
            dateFormat.Copy(_L("%F%/0%Y%/1%M%/2%D%/3"));
hgs
parents: 23
diff changeset
   122
            break;
hgs
parents: 23
diff changeset
   123
        default:
hgs
parents: 23
diff changeset
   124
            // Nothing yet.
hgs
parents: 23
diff changeset
   125
            break;
hgs
parents: 23
diff changeset
   126
        }
hgs
parents: 23
diff changeset
   127
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
	
45
hgs
parents: 23
diff changeset
   129
	alarmInfo->iTime.FormatL(timeString, timeFormat);
70
hgs
parents: 55
diff changeset
   130
	alarmInfo->iDate.FormatL(dateString, dateFormat); 
45
hgs
parents: 23
diff changeset
   131
hgs
parents: 23
diff changeset
   132
	// Create a session with the device dialog server
hgs
parents: 23
diff changeset
   133
    mDeviceDialog = CHbDeviceDialogSymbian::NewL();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
	
45
hgs
parents: 23
diff changeset
   135
hgs
parents: 23
diff changeset
   136
    // Package the different parameters to send
hgs
parents: 23
diff changeset
   137
	mVariantMap = CHbSymbianVariantMap::NewL();
hgs
parents: 23
diff changeset
   138
hgs
parents: 23
diff changeset
   139
	// Get the subject of the alarm (description for clock alarms
hgs
parents: 23
diff changeset
   140
	// and subject for calendar alarms)
hgs
parents: 23
diff changeset
   141
	mAlarmSubject = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   142
			alarmInfo->iSubject, CHbSymbianVariant::EDes );
hgs
parents: 23
diff changeset
   143
	mVariantMap->Add(alarmSubjectSymbian, mAlarmSubject);
hgs
parents: 23
diff changeset
   144
hgs
parents: 23
diff changeset
   145
	// Get the location (for calendar alarms)
hgs
parents: 23
diff changeset
   146
	mLocation = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   147
			alarmInfo->iLocation, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   148
	mVariantMap->Add(alarmLocationSymbian, mLocation);
hgs
parents: 23
diff changeset
   149
hgs
parents: 23
diff changeset
   150
	mAlarmTime = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   151
	        &timeString, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   152
	mVariantMap->Add(alarmTimeSymbian, mAlarmTime);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
	
45
hgs
parents: 23
diff changeset
   154
	mAlarmDate = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   155
	        &dateString, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   156
	mVariantMap->Add(alarmDateSymbian, mAlarmDate);
hgs
parents: 23
diff changeset
   157
	    
hgs
parents: 23
diff changeset
   158
	mIsSilent = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   159
			&alarmInfo->iIsSilent, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   160
	mVariantMap->Add(alarmRingingTypeSymbian, mIsSilent);
hgs
parents: 23
diff changeset
   161
hgs
parents: 23
diff changeset
   162
	mCanSnooze = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   163
			&alarmInfo->iCanSnooze, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   164
	mVariantMap->Add(alarmCanSnoozeSymbain, mCanSnooze);
hgs
parents: 23
diff changeset
   165
hgs
parents: 23
diff changeset
   166
	mAlarmAlertType = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   167
			&alarmInfo->iAlarmAlertType, CHbSymbianVariant::EInt);
hgs
parents: 23
diff changeset
   168
	mVariantMap->Add(alarmTypeSymbian, mAlarmAlertType);
hgs
parents: 23
diff changeset
   169
hgs
parents: 23
diff changeset
   170
	mIsTimedAlarm = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   171
			&alarmInfo->iIsTimed, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   172
	mVariantMap->Add(alarmIsTimedSymbian, mIsTimedAlarm);
hgs
parents: 23
diff changeset
   173
hgs
parents: 23
diff changeset
   174
	// Package the different parameters to send
hgs
parents: 23
diff changeset
   175
	return mDeviceDialog->Show(ALARM_ALERT_PLUGIN_SYMBIAN, *mVariantMap, this);
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   176
	
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   177
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   178
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   179
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   180
// AlarmAlertWidget::DismissAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   183
//
45
hgs
parents: 23
diff changeset
   184
void AlarmAlertWidget::dismissAlarmDialog()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   185
{
55
hgs
parents: 45
diff changeset
   186
    OstTraceFunctionEntry0( ALARMALERTWIDGET_DISMISSALARMDIALOG_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   187
    // Dismiss the dialog
45
hgs
parents: 23
diff changeset
   188
    mDeviceDialog->Cancel();
55
hgs
parents: 45
diff changeset
   189
    OstTraceFunctionExit0( ALARMALERTWIDGET_DISMISSALARMDIALOG_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   190
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   191
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   192
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
// AlarmAlertWidget::UpdateAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   195
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   196
//
45
hgs
parents: 23
diff changeset
   197
bool AlarmAlertWidget::updateAlarmDialog(SAlarmInfo* /*alarmInfo*/)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   198
{
55
hgs
parents: 45
diff changeset
   199
    OstTraceFunctionEntry0( ALARMALERTWIDGET_UPDATEALARMDIALOG_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   200
    // Update the dialog with any new information
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
    // TODO: Pass the updated information sent by the observer
45
hgs
parents: 23
diff changeset
   202
    /*CHbSymbianVariantMap params;
hgs
parents: 23
diff changeset
   203
    mDeviceDialog->Update(params);*/
55
hgs
parents: 45
diff changeset
   204
    OstTraceFunctionExit0( ALARMALERTWIDGET_UPDATEALARMDIALOG_EXIT );
45
hgs
parents: 23
diff changeset
   205
    return false;
hgs
parents: 23
diff changeset
   206
}
hgs
parents: 23
diff changeset
   207
hgs
parents: 23
diff changeset
   208
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   209
// AlarmAlertWidget::DataReceived
hgs
parents: 23
diff changeset
   210
// rest of the details are commented in the header
hgs
parents: 23
diff changeset
   211
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   212
//
hgs
parents: 23
diff changeset
   213
void AlarmAlertWidget::DataReceived(CHbSymbianVariantMap& aData)
hgs
parents: 23
diff changeset
   214
{
55
hgs
parents: 45
diff changeset
   215
    OstTraceFunctionEntry0( ALARMALERTWIDGET_DATARECEIVED_ENTRY );
45
hgs
parents: 23
diff changeset
   216
    if (!aData.Keys().MdcaCount()) {
55
hgs
parents: 45
diff changeset
   217
        OstTraceFunctionExit0( ALARMALERTWIDGET_DATARECEIVED_EXIT );
45
hgs
parents: 23
diff changeset
   218
        return;
hgs
parents: 23
diff changeset
   219
    }
hgs
parents: 23
diff changeset
   220
    
hgs
parents: 23
diff changeset
   221
    triggerAction(aData.Get(alarmCommandSymbian));
55
hgs
parents: 45
diff changeset
   222
    OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_DATARECEIVED_EXIT );
45
hgs
parents: 23
diff changeset
   223
}
hgs
parents: 23
diff changeset
   224
hgs
parents: 23
diff changeset
   225
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   226
// AlarmAlertWidget::DeviceDialogClosed
hgs
parents: 23
diff changeset
   227
// rest of the details are commented in the header
hgs
parents: 23
diff changeset
   228
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   229
//
hgs
parents: 23
diff changeset
   230
void AlarmAlertWidget::DeviceDialogClosed(TInt /*aCompletionCode*/)
hgs
parents: 23
diff changeset
   231
{
55
hgs
parents: 45
diff changeset
   232
  OstTraceFunctionEntry0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_ENTRY );
45
hgs
parents: 23
diff changeset
   233
  
55
hgs
parents: 45
diff changeset
   234
  OstTraceFunctionExit0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   235
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   236
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   237
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
// AlarmAlertWidget::triggerAction
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
// rest of the details are commented in the header
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   240
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   241
//
45
hgs
parents: 23
diff changeset
   242
void AlarmAlertWidget::triggerAction(const CHbSymbianVariant* source)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   243
{
55
hgs
parents: 45
diff changeset
   244
       OstTraceFunctionEntry0( ALARMALERTWIDGET_TRIGGERACTION_ENTRY );
45
hgs
parents: 23
diff changeset
   245
       AlarmCommand command(AlarmCmdLast);
hgs
parents: 23
diff changeset
   246
       
hgs
parents: 23
diff changeset
   247
       if (*source->Value<TInt>() == Stop) {    
hgs
parents: 23
diff changeset
   248
       command = AlarmStop;    
hgs
parents: 23
diff changeset
   249
       } else if (*source->Value<TInt>() == Snooze) {
hgs
parents: 23
diff changeset
   250
       command = AlarmSnooze;
hgs
parents: 23
diff changeset
   251
       } else if (*source->Value<TInt>() == Silence) {
hgs
parents: 23
diff changeset
   252
       command = AlarmSilence;
hgs
parents: 23
diff changeset
   253
       } else if (*source->Value<TInt>() == Shown) {
hgs
parents: 23
diff changeset
   254
       command = AlarmShown;
hgs
parents: 23
diff changeset
   255
       mObserver->alertDisplayed(command);
55
hgs
parents: 45
diff changeset
   256
       OstTraceFunctionExit0( ALARMALERTWIDGET_TRIGGERACTION_EXIT );
45
hgs
parents: 23
diff changeset
   257
       return;
hgs
parents: 23
diff changeset
   258
       } else {
hgs
parents: 23
diff changeset
   259
       command = AlarmCmdLast;
hgs
parents: 23
diff changeset
   260
       }
hgs
parents: 23
diff changeset
   261
       
hgs
parents: 23
diff changeset
   262
       if (command != AlarmCmdLast) {
hgs
parents: 23
diff changeset
   263
       // Notify the observer with the command
hgs
parents: 23
diff changeset
   264
       mObserver->alertCompleted(command);
hgs
parents: 23
diff changeset
   265
       }
55
hgs
parents: 45
diff changeset
   266
       OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_TRIGGERACTION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   267
}
45
hgs
parents: 23
diff changeset
   268
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   269
// End of file  --Don't remove this.