|
1 /* |
|
2 * Copyright (c) 2005 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: Postcard query waiter for global msg query |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef POSTCARDQUERYWAITER_H |
|
21 #define POSTCARDQUERYWAITER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 |
|
28 // CLASS DECLARATION |
|
29 |
|
30 // Interface class for the PostcardQueryWaiter class |
|
31 // This function is used when user has reacted to the query. |
|
32 class MPostcardQueryWaiterCallback |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Callback function called when query is answered. |
|
38 * @since 3.0 |
|
39 * @param aResult The button user pushed |
|
40 */ |
|
41 virtual void QueryWaiterCallbackL( TInt aResult ) = 0; |
|
42 |
|
43 /** |
|
44 * Callback function called when QueryWaiterCallbackL() leaves. |
|
45 * Should perform cleanup. After QueryWaiterCallbackError has |
|
46 * been called the error is probagated to active scheduler. |
|
47 * @since 3.2 |
|
48 */ |
|
49 virtual void QueryWaiterCallbackError() = 0; |
|
50 |
|
51 }; |
|
52 |
|
53 /** |
|
54 * Common utility class for Postcard global message queries |
|
55 * @lib postcard.exe |
|
56 * @since 3.0 |
|
57 */ |
|
58 class CPostcardQueryWaiter : public CActive |
|
59 { |
|
60 public: |
|
61 CPostcardQueryWaiter( MPostcardQueryWaiterCallback* aCallback ) |
|
62 : CActive( EPriorityStandard ), iCallback( aCallback ) |
|
63 { CActiveScheduler::Add( this ); } |
|
64 public: |
|
65 // Deletes itself when the RunL is called. |
|
66 void SetActiveD() { SetActive(); } |
|
67 protected: |
|
68 void RunL() { |
|
69 // First call callback function |
|
70 iCallback->QueryWaiterCallbackL( iStatus.Int() ); |
|
71 // And delete itself. |
|
72 delete this; } |
|
73 void DoCancel() {} |
|
74 TInt RunError(TInt aError) { |
|
75 iCallback->QueryWaiterCallbackError(); |
|
76 delete this; |
|
77 return aError; |
|
78 } |
|
79 private: |
|
80 |
|
81 MPostcardQueryWaiterCallback* iCallback; |
|
82 }; |
|
83 |
|
84 |
|
85 #endif // POSTCARDQUERYWAITER |
|
86 |
|
87 // End of file |