|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include <memspyui.rsg> |
|
18 |
|
19 #include "MemSpyAsyncTracker.h" |
|
20 |
|
21 CMemSpyAsyncTracker::CMemSpyAsyncTracker(RMemSpySession& aSession, void (RMemSpySession::*function)(TRequestStatus&)) : |
|
22 CActive(EPriorityIdle), |
|
23 iFunction(function), |
|
24 iSession(aSession) |
|
25 { |
|
26 CActiveScheduler::Add(this); |
|
27 } |
|
28 |
|
29 CMemSpyAsyncTracker::~CMemSpyAsyncTracker() |
|
30 { |
|
31 delete iWaitNote; |
|
32 } |
|
33 |
|
34 void CMemSpyAsyncTracker::RunL() |
|
35 { |
|
36 // If an error occurred handle it in RunError(). |
|
37 User::LeaveIfError(iStatus.Int()); |
|
38 |
|
39 // Operation has finished successfully |
|
40 iWaitNote->DialogDismissedL(0); |
|
41 |
|
42 delete this; |
|
43 } |
|
44 |
|
45 void CMemSpyAsyncTracker::DoCancel() |
|
46 { |
|
47 // nothing to do here |
|
48 } |
|
49 |
|
50 TInt CMemSpyAsyncTracker::RunError(TInt aError) |
|
51 { |
|
52 return KErrNone; |
|
53 } |
|
54 |
|
55 void CMemSpyAsyncTracker::StartL() |
|
56 { |
|
57 (iSession.*iFunction)(iStatus); |
|
58 |
|
59 SetActive(); |
|
60 |
|
61 iWaitNote = new (ELeave) CMemSpyWaitNote; |
|
62 |
|
63 iWaitNote->StartWaitNoteL(); |
|
64 } |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 CMemSpyWaitNote::~CMemSpyWaitNote() |
|
77 { |
|
78 delete iWaitDialog; |
|
79 } |
|
80 |
|
81 void CMemSpyWaitNote::StartWaitNoteL() |
|
82 { |
|
83 iWaitDialog = new (ELeave) CAknWaitDialog((REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), ETrue); |
|
84 iWaitDialog->PrepareLC( R_MEMSPY_WAIT_NOTE ); |
|
85 iWaitDialog->SetCallback(this); |
|
86 iWaitDialog->RunLD(); |
|
87 } |
|
88 |
|
89 void CMemSpyWaitNote::DialogDismissedL(TInt aButtonId) |
|
90 { |
|
91 iWaitDialog->ProcessFinishedL(); |
|
92 } |