|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * CGlobalQueryObserver implementation |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 // INCLUDES |
|
21 #include <eikenv.h> |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "globalqueryobserver.h" |
|
25 |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ========================================= |
|
28 |
|
29 // ---------------------------------------------------------------------------- |
|
30 // CGlobalQueryObserver::NewL() |
|
31 // Two-phased constructor. |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 CGlobalQueryObserver* |
|
35 CGlobalQueryObserver::NewL(MGlobalQueryClient* aClient, const TBool aIgnoreResponse) |
|
36 { |
|
37 CGlobalQueryObserver* self = |
|
38 new ( ELeave ) CGlobalQueryObserver(aClient, aIgnoreResponse); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 CleanupStack::Pop(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // CGlobalQueryObserver::~CGlobalQueryObserver() |
|
48 // Destructor. |
|
49 // ---------------------------------------------------------------------------- |
|
50 // |
|
51 CGlobalQueryObserver::~CGlobalQueryObserver() |
|
52 { |
|
53 Cancel(); |
|
54 } |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // CGlobalQueryObserver::Start() |
|
58 // Start the activator. |
|
59 // ---------------------------------------------------------------------------- |
|
60 // |
|
61 void CGlobalQueryObserver::Start() |
|
62 { |
|
63 SetActive(); |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // CGlobalQueryObserver::CGlobalQueryObserver() |
|
68 // C++ default constructor. |
|
69 // ---------------------------------------------------------------------------- |
|
70 // |
|
71 CGlobalQueryObserver::CGlobalQueryObserver(MGlobalQueryClient* aClient, const TBool aIgnoreResponse) : |
|
72 CActive( EActivePriorityDefault ), |
|
73 iClient( aClient ), |
|
74 iIgnoreResponse( aIgnoreResponse ) |
|
75 { |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CGlobalQueryObserver::ConstructL() |
|
80 // Symbian default constructor can leave. |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 void CGlobalQueryObserver::ConstructL() |
|
84 { |
|
85 CActiveScheduler::Add( this ); |
|
86 } |
|
87 |
|
88 // ---------------------------------------------------------------------------- |
|
89 // CGlobalQueryObserver::RunL() |
|
90 // Handle an event. |
|
91 // ---------------------------------------------------------------------------- |
|
92 // |
|
93 void CGlobalQueryObserver::RunL() |
|
94 { |
|
95 Cancel(); |
|
96 if ( !iIgnoreResponse ) |
|
97 { |
|
98 iClient->HandleGlobalQueryResponseL( iStatus.Int() ); |
|
99 } |
|
100 } |
|
101 |
|
102 // ---------------------------------------------------------------------------- |
|
103 // CGlobalQueryObserver::DoCancel() |
|
104 // Implement the Cancel protocol. |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 void CGlobalQueryObserver::DoCancel() |
|
108 { |
|
109 } |