alarmui/alarmalertwidget/alarmalertinterface/src/alarmalertwidget.cpp
author hgs
Tue, 05 Oct 2010 14:14:48 +0530
changeset 82 dcd0ca396fa1
parent 81 ce92091cbd61
child 83 5aadd1120515
permissions -rw-r--r--
201039_01
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) :
81
hgs
parents: 70
diff changeset
    40
    mObserver(observer),
hgs
parents: 70
diff changeset
    41
    mDeviceDialog(NULL)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
{
55
hgs
parents: 45
diff changeset
    43
	OstTraceFunctionEntry0( ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
hgs
parents: 45
diff changeset
    44
	OstTraceFunctionExit0( ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
18
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
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
// AlarmAlertWidget::~AlarmAlertWidget
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// 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
    50
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
AlarmAlertWidget::~AlarmAlertWidget()
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
{
55
hgs
parents: 45
diff changeset
    54
	OstTraceFunctionEntry0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_ENTRY );
45
hgs
parents: 23
diff changeset
    55
	// Cleanup
hgs
parents: 23
diff changeset
    56
	
hgs
parents: 23
diff changeset
    57
	if (mAlarmSubject) {
hgs
parents: 23
diff changeset
    58
		delete mAlarmSubject;
hgs
parents: 23
diff changeset
    59
	}
hgs
parents: 23
diff changeset
    60
hgs
parents: 23
diff changeset
    61
	if (mLocation) {
hgs
parents: 23
diff changeset
    62
		delete mLocation;
hgs
parents: 23
diff changeset
    63
	}
hgs
parents: 23
diff changeset
    64
hgs
parents: 23
diff changeset
    65
	if (mAlarmTime) {
hgs
parents: 23
diff changeset
    66
		delete mAlarmTime;
hgs
parents: 23
diff changeset
    67
	}
hgs
parents: 23
diff changeset
    68
	
hgs
parents: 23
diff changeset
    69
	if (mAlarmDate) {
hgs
parents: 23
diff changeset
    70
        delete mAlarmDate;
hgs
parents: 23
diff changeset
    71
	}
hgs
parents: 23
diff changeset
    72
hgs
parents: 23
diff changeset
    73
	if (mAlarmAlertType) {
hgs
parents: 23
diff changeset
    74
		delete mAlarmAlertType;
hgs
parents: 23
diff changeset
    75
	}
hgs
parents: 23
diff changeset
    76
hgs
parents: 23
diff changeset
    77
	if (mCanSnooze) {
hgs
parents: 23
diff changeset
    78
		delete mCanSnooze;
hgs
parents: 23
diff changeset
    79
	}
hgs
parents: 23
diff changeset
    80
hgs
parents: 23
diff changeset
    81
	if (mIsSilent) {
hgs
parents: 23
diff changeset
    82
		delete mIsSilent;
hgs
parents: 23
diff changeset
    83
	}
hgs
parents: 23
diff changeset
    84
hgs
parents: 23
diff changeset
    85
	if (mIsTimedAlarm) {
hgs
parents: 23
diff changeset
    86
		delete mIsTimedAlarm;
hgs
parents: 23
diff changeset
    87
	}
hgs
parents: 23
diff changeset
    88
hgs
parents: 23
diff changeset
    89
	if (mVariantMap) {
hgs
parents: 23
diff changeset
    90
		delete mVariantMap;
hgs
parents: 23
diff changeset
    91
	}
hgs
parents: 23
diff changeset
    92
hgs
parents: 23
diff changeset
    93
	if (mDeviceDialog) {
hgs
parents: 23
diff changeset
    94
		delete mDeviceDialog;
hgs
parents: 23
diff changeset
    95
	}
55
hgs
parents: 45
diff changeset
    96
	OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_ALARMALERTWIDGET_EXIT );
18
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
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
// AlarmAlertWidget::ShowAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
// 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
   102
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
//
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
bool AlarmAlertWidget::showAlarmDialog(SAlarmInfo *alarmInfo)
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
{
55
hgs
parents: 45
diff changeset
   106
	OstTraceFunctionEntry0( ALARMALERTWIDGET_SHOWALARMDIALOG_ENTRY );
45
hgs
parents: 23
diff changeset
   107
	// Get the alarm date and time
hgs
parents: 23
diff changeset
   108
    TBuf<KMaxlength> timeString;
hgs
parents: 23
diff changeset
   109
    TBuf<KMaxlength> dateString;
hgs
parents: 23
diff changeset
   110
    
hgs
parents: 23
diff changeset
   111
    TBuf<KMaxlength> timeFormat(_L("%-B%:0%J%:1%T%:3%+B"));
hgs
parents: 23
diff changeset
   112
    TBuf<KMaxlength> dateFormat;
hgs
parents: 23
diff changeset
   113
    TLocale locale;
hgs
parents: 23
diff changeset
   114
    switch (locale.DateFormat()) {
hgs
parents: 23
diff changeset
   115
        case EDateEuropean:
hgs
parents: 23
diff changeset
   116
            dateFormat.Copy(_L("%F%/0%D%/1%M%/2%Y%/3"));
hgs
parents: 23
diff changeset
   117
            break;
hgs
parents: 23
diff changeset
   118
        case EDateAmerican:
hgs
parents: 23
diff changeset
   119
            dateFormat.Copy(_L("%F%/0%M%/1%D%/2%Y%/3"));
hgs
parents: 23
diff changeset
   120
            break;
hgs
parents: 23
diff changeset
   121
        case EDateJapanese:
hgs
parents: 23
diff changeset
   122
            dateFormat.Copy(_L("%F%/0%Y%/1%M%/2%D%/3"));
hgs
parents: 23
diff changeset
   123
            break;
hgs
parents: 23
diff changeset
   124
        default:
hgs
parents: 23
diff changeset
   125
            // Nothing yet.
hgs
parents: 23
diff changeset
   126
            break;
hgs
parents: 23
diff changeset
   127
        }
hgs
parents: 23
diff changeset
   128
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
	
45
hgs
parents: 23
diff changeset
   130
	alarmInfo->iTime.FormatL(timeString, timeFormat);
70
hgs
parents: 55
diff changeset
   131
	alarmInfo->iDate.FormatL(dateString, dateFormat); 
45
hgs
parents: 23
diff changeset
   132
hgs
parents: 23
diff changeset
   133
	// Create a session with the device dialog server
hgs
parents: 23
diff changeset
   134
    mDeviceDialog = CHbDeviceDialogSymbian::NewL();
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
	
45
hgs
parents: 23
diff changeset
   136
hgs
parents: 23
diff changeset
   137
    // Package the different parameters to send
hgs
parents: 23
diff changeset
   138
	mVariantMap = CHbSymbianVariantMap::NewL();
hgs
parents: 23
diff changeset
   139
hgs
parents: 23
diff changeset
   140
	// Get the subject of the alarm (description for clock alarms
hgs
parents: 23
diff changeset
   141
	// and subject for calendar alarms)
hgs
parents: 23
diff changeset
   142
	mAlarmSubject = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   143
			alarmInfo->iSubject, CHbSymbianVariant::EDes );
hgs
parents: 23
diff changeset
   144
	mVariantMap->Add(alarmSubjectSymbian, mAlarmSubject);
hgs
parents: 23
diff changeset
   145
hgs
parents: 23
diff changeset
   146
	// Get the location (for calendar alarms)
hgs
parents: 23
diff changeset
   147
	mLocation = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   148
			alarmInfo->iLocation, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   149
	mVariantMap->Add(alarmLocationSymbian, mLocation);
hgs
parents: 23
diff changeset
   150
hgs
parents: 23
diff changeset
   151
	mAlarmTime = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   152
	        &timeString, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   153
	mVariantMap->Add(alarmTimeSymbian, mAlarmTime);
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
	
45
hgs
parents: 23
diff changeset
   155
	mAlarmDate = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   156
	        &dateString, CHbSymbianVariant::EDes);
hgs
parents: 23
diff changeset
   157
	mVariantMap->Add(alarmDateSymbian, mAlarmDate);
hgs
parents: 23
diff changeset
   158
	    
hgs
parents: 23
diff changeset
   159
	mIsSilent = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   160
			&alarmInfo->iIsSilent, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   161
	mVariantMap->Add(alarmRingingTypeSymbian, mIsSilent);
hgs
parents: 23
diff changeset
   162
hgs
parents: 23
diff changeset
   163
	mCanSnooze = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   164
			&alarmInfo->iCanSnooze, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   165
	mVariantMap->Add(alarmCanSnoozeSymbain, mCanSnooze);
hgs
parents: 23
diff changeset
   166
hgs
parents: 23
diff changeset
   167
	mAlarmAlertType = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   168
			&alarmInfo->iAlarmAlertType, CHbSymbianVariant::EInt);
hgs
parents: 23
diff changeset
   169
	mVariantMap->Add(alarmTypeSymbian, mAlarmAlertType);
hgs
parents: 23
diff changeset
   170
hgs
parents: 23
diff changeset
   171
	mIsTimedAlarm = CHbSymbianVariant::NewL(
hgs
parents: 23
diff changeset
   172
			&alarmInfo->iIsTimed, CHbSymbianVariant::EBool);
hgs
parents: 23
diff changeset
   173
	mVariantMap->Add(alarmIsTimedSymbian, mIsTimedAlarm);
hgs
parents: 23
diff changeset
   174
hgs
parents: 23
diff changeset
   175
	// Package the different parameters to send
hgs
parents: 23
diff changeset
   176
	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
   177
	
18
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
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   181
// AlarmAlertWidget::DismissAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   182
// 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
   183
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   184
//
45
hgs
parents: 23
diff changeset
   185
void AlarmAlertWidget::dismissAlarmDialog()
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   186
{
55
hgs
parents: 45
diff changeset
   187
    OstTraceFunctionEntry0( ALARMALERTWIDGET_DISMISSALARMDIALOG_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   188
    // Dismiss the dialog
81
hgs
parents: 70
diff changeset
   189
    if(mDeviceDialog) {
hgs
parents: 70
diff changeset
   190
		mDeviceDialog->Cancel();
hgs
parents: 70
diff changeset
   191
    }
55
hgs
parents: 45
diff changeset
   192
    OstTraceFunctionExit0( ALARMALERTWIDGET_DISMISSALARMDIALOG_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   193
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   194
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
// AlarmAlertWidget::UpdateAlarmDialog
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   197
// 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
   198
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   199
//
45
hgs
parents: 23
diff changeset
   200
bool AlarmAlertWidget::updateAlarmDialog(SAlarmInfo* /*alarmInfo*/)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   201
{
55
hgs
parents: 45
diff changeset
   202
    OstTraceFunctionEntry0( ALARMALERTWIDGET_UPDATEALARMDIALOG_ENTRY );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    // Update the dialog with any new information
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
    // TODO: Pass the updated information sent by the observer
45
hgs
parents: 23
diff changeset
   205
    /*CHbSymbianVariantMap params;
hgs
parents: 23
diff changeset
   206
    mDeviceDialog->Update(params);*/
55
hgs
parents: 45
diff changeset
   207
    OstTraceFunctionExit0( ALARMALERTWIDGET_UPDATEALARMDIALOG_EXIT );
45
hgs
parents: 23
diff changeset
   208
    return false;
hgs
parents: 23
diff changeset
   209
}
hgs
parents: 23
diff changeset
   210
hgs
parents: 23
diff changeset
   211
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   212
// AlarmAlertWidget::DataReceived
hgs
parents: 23
diff changeset
   213
// rest of the details are commented in the header
hgs
parents: 23
diff changeset
   214
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   215
//
hgs
parents: 23
diff changeset
   216
void AlarmAlertWidget::DataReceived(CHbSymbianVariantMap& aData)
hgs
parents: 23
diff changeset
   217
{
55
hgs
parents: 45
diff changeset
   218
    OstTraceFunctionEntry0( ALARMALERTWIDGET_DATARECEIVED_ENTRY );
45
hgs
parents: 23
diff changeset
   219
    if (!aData.Keys().MdcaCount()) {
55
hgs
parents: 45
diff changeset
   220
        OstTraceFunctionExit0( ALARMALERTWIDGET_DATARECEIVED_EXIT );
45
hgs
parents: 23
diff changeset
   221
        return;
hgs
parents: 23
diff changeset
   222
    }
hgs
parents: 23
diff changeset
   223
    
hgs
parents: 23
diff changeset
   224
    triggerAction(aData.Get(alarmCommandSymbian));
55
hgs
parents: 45
diff changeset
   225
    OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_DATARECEIVED_EXIT );
45
hgs
parents: 23
diff changeset
   226
}
hgs
parents: 23
diff changeset
   227
hgs
parents: 23
diff changeset
   228
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   229
// AlarmAlertWidget::DeviceDialogClosed
hgs
parents: 23
diff changeset
   230
// rest of the details are commented in the header
hgs
parents: 23
diff changeset
   231
// ---------------------------------------------------------
hgs
parents: 23
diff changeset
   232
//
hgs
parents: 23
diff changeset
   233
void AlarmAlertWidget::DeviceDialogClosed(TInt /*aCompletionCode*/)
hgs
parents: 23
diff changeset
   234
{
55
hgs
parents: 45
diff changeset
   235
  OstTraceFunctionEntry0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_ENTRY );
45
hgs
parents: 23
diff changeset
   236
  
55
hgs
parents: 45
diff changeset
   237
  OstTraceFunctionExit0( ALARMALERTWIDGET_DEVICEDIALOGCLOSED_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   238
}
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   239
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
// AlarmAlertWidget::triggerAction
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   242
// 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
   243
// ---------------------------------------------------------
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   244
//
45
hgs
parents: 23
diff changeset
   245
void AlarmAlertWidget::triggerAction(const CHbSymbianVariant* source)
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   246
{
55
hgs
parents: 45
diff changeset
   247
       OstTraceFunctionEntry0( ALARMALERTWIDGET_TRIGGERACTION_ENTRY );
45
hgs
parents: 23
diff changeset
   248
       AlarmCommand command(AlarmCmdLast);
hgs
parents: 23
diff changeset
   249
       
hgs
parents: 23
diff changeset
   250
       if (*source->Value<TInt>() == Stop) {    
hgs
parents: 23
diff changeset
   251
       command = AlarmStop;    
hgs
parents: 23
diff changeset
   252
       } else if (*source->Value<TInt>() == Snooze) {
hgs
parents: 23
diff changeset
   253
       command = AlarmSnooze;
hgs
parents: 23
diff changeset
   254
       } else if (*source->Value<TInt>() == Silence) {
hgs
parents: 23
diff changeset
   255
       command = AlarmSilence;
hgs
parents: 23
diff changeset
   256
       } else if (*source->Value<TInt>() == Shown) {
hgs
parents: 23
diff changeset
   257
       command = AlarmShown;
hgs
parents: 23
diff changeset
   258
       mObserver->alertDisplayed(command);
55
hgs
parents: 45
diff changeset
   259
       OstTraceFunctionExit0( ALARMALERTWIDGET_TRIGGERACTION_EXIT );
45
hgs
parents: 23
diff changeset
   260
       return;
hgs
parents: 23
diff changeset
   261
       } else {
hgs
parents: 23
diff changeset
   262
       command = AlarmCmdLast;
hgs
parents: 23
diff changeset
   263
       }
hgs
parents: 23
diff changeset
   264
       
hgs
parents: 23
diff changeset
   265
       if (command != AlarmCmdLast) {
hgs
parents: 23
diff changeset
   266
       // Notify the observer with the command
hgs
parents: 23
diff changeset
   267
       mObserver->alertCompleted(command);
hgs
parents: 23
diff changeset
   268
       }
55
hgs
parents: 45
diff changeset
   269
       OstTraceFunctionExit0( DUP1_ALARMALERTWIDGET_TRIGGERACTION_EXIT );
18
c198609911f9 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   270
}
45
hgs
parents: 23
diff changeset
   271
23
fd30d51f876b Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 18
diff changeset
   272
// End of file  --Don't remove this.