29
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: The CVIMPSTStorageActiveHandler class handles the waiting functionality
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "cvimpststorageactivehandler.h"
|
|
21 |
#include "mvimpststorageactiveobserver.h"
|
|
22 |
|
|
23 |
#include "uiservicetabtracer.h"
|
|
24 |
#include <e32base.h>
|
|
25 |
|
|
26 |
// CONSTANTS
|
|
27 |
const TInt KTimeToWaitBeforeRefresh( 1000000 ); // 1 seconds in microseconds
|
|
28 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// CVIMPSTStorageActiveHandler::CVIMPSTStorageActiveHandler
|
|
32 |
// C++ default constructor can NOT contain any code, that
|
|
33 |
// might leave.
|
|
34 |
// -----------------------------------------------------------------------------
|
|
35 |
//
|
|
36 |
CVIMPSTStorageActiveHandler::CVIMPSTStorageActiveHandler( MVIMPSTStorageActiveObserver* aObserver ) :
|
|
37 |
CTimer( EPriorityIdle ),
|
|
38 |
iObserver( aObserver )
|
|
39 |
{
|
|
40 |
CActiveScheduler::Add( this );
|
|
41 |
}
|
|
42 |
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
// CVIMPSTStorageActiveHandler::ConstructL
|
|
45 |
// Symbian 2nd phase constructor can leave.
|
|
46 |
// -----------------------------------------------------------------------------
|
|
47 |
//
|
|
48 |
void CVIMPSTStorageActiveHandler::ConstructL()
|
|
49 |
{
|
|
50 |
// the base class must be constructed explicitely
|
|
51 |
CTimer::ConstructL();
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// CVIMPSTStorageActiveHandler::NewL
|
|
56 |
// Two-phased constructor.
|
|
57 |
// -----------------------------------------------------------------------------
|
|
58 |
//
|
|
59 |
CVIMPSTStorageActiveHandler* CVIMPSTStorageActiveHandler::NewL(
|
|
60 |
MVIMPSTStorageActiveObserver* aObserver )
|
|
61 |
{
|
|
62 |
TRACER_AUTO;
|
|
63 |
CVIMPSTStorageActiveHandler* self = new( ELeave ) CVIMPSTStorageActiveHandler( aObserver );
|
|
64 |
CleanupStack::PushL( self );
|
|
65 |
self->ConstructL();
|
|
66 |
CleanupStack::Pop( self );
|
|
67 |
return self;
|
|
68 |
}
|
|
69 |
|
|
70 |
// Destructor
|
|
71 |
CVIMPSTStorageActiveHandler::~CVIMPSTStorageActiveHandler()
|
|
72 |
{
|
|
73 |
Cancel();
|
|
74 |
}
|
|
75 |
|
|
76 |
// -----------------------------------------------------------------------------
|
|
77 |
// CVIMPSTStorageActiveHandler::Start
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
|
|
80 |
void CVIMPSTStorageActiveHandler::IssueRequest(TVIMPSTEnums::TVIMPSTStorgaeEventType aType,
|
|
81 |
MVIMPSTStorageContactList *aList,
|
|
82 |
MVIMPSTStorageContact* aContact,
|
|
83 |
TInt aContactIndex )
|
|
84 |
{
|
|
85 |
TRACER_AUTO;
|
|
86 |
|
|
87 |
if( IsActive() )
|
|
88 |
{
|
|
89 |
Cancel();
|
|
90 |
}
|
|
91 |
TTimeIntervalMicroSeconds32 waittime( KTimeToWaitBeforeRefresh );
|
|
92 |
CTimer::After( waittime );
|
|
93 |
|
|
94 |
iEventType = aType ;
|
|
95 |
iList = aList ;
|
|
96 |
iContact = aContact ;
|
|
97 |
iContactIndex = aContactIndex;
|
|
98 |
}
|
|
99 |
|
|
100 |
// -----------------------------------------------------------------------------
|
|
101 |
// CVIMPSTStorageActiveHandler::RunL
|
|
102 |
// Derived from CActive
|
|
103 |
// -----------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
void CVIMPSTStorageActiveHandler::RunL()
|
|
106 |
{
|
|
107 |
TRACER_AUTO;
|
|
108 |
if( iObserver )
|
|
109 |
{
|
|
110 |
TRACE( "send notification" );
|
|
111 |
TInt status( iStatus.Int() );
|
|
112 |
if( status != KErrCancel )
|
|
113 |
{
|
|
114 |
iObserver->HandleDelayedNotificationL(iEventType,
|
|
115 |
iList ,
|
|
116 |
iContact,
|
|
117 |
iContactIndex );
|
|
118 |
}
|
|
119 |
|
|
120 |
|
|
121 |
TRACE( " notification sent" );
|
|
122 |
}
|
|
123 |
}
|
|
124 |
|
|
125 |
// ---------------------------------------------------------
|
|
126 |
// CVIMPSTStorageActiveHandler::RunError
|
|
127 |
// Derived from CActive
|
|
128 |
// ---------------------------------------------------------
|
|
129 |
//
|
|
130 |
TInt CVIMPSTStorageActiveHandler::RunError( TInt aError )
|
|
131 |
{
|
|
132 |
TRACER_AUTO;
|
|
133 |
if( iObserver )
|
|
134 |
{
|
|
135 |
TRAP_IGNORE( iObserver->HandleDelayedNotificationL(iEventType,
|
|
136 |
iList ,
|
|
137 |
iContact,
|
|
138 |
iContactIndex ) );
|
|
139 |
}
|
|
140 |
return aError;
|
|
141 |
}
|
|
142 |
// ---------------------------------------------------------
|
|
143 |
// CVIMPSTStorageActiveHandler::DoCancel
|
|
144 |
// Derived from CActive
|
|
145 |
// ---------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CVIMPSTStorageActiveHandler::DoCancel()
|
|
148 |
{
|
|
149 |
CTimer::DoCancel();// not required
|
|
150 |
}
|
|
151 |
|
|
152 |
// End of File
|