|
1 /* |
|
2 * Copyright (c) 2004-2006 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 * CMmsViewerOperation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __MMSVIEWEROPERATION_H |
|
23 #define __MMSVIEWEROPERATION_H |
|
24 |
|
25 // INCLUDES |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <f32file.h> |
|
29 |
|
30 #include "UniMmsViewerDocument.h" |
|
31 |
|
32 // CONSTANTS |
|
33 //#define CANCEL_TEST_CODE 1 |
|
34 |
|
35 // MACROS |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 // Cancel test code |
|
39 #ifdef CANCEL_TEST_CODE |
|
40 class CHighOperation; |
|
41 #endif |
|
42 |
|
43 // DATA TYPES |
|
44 |
|
45 enum TMmsViewerOperationType |
|
46 { |
|
47 EMmsViewerOperationChangeSlide, |
|
48 EMmsViewerOperationLaunch, |
|
49 EMmsViewerOperationReadReport |
|
50 }; |
|
51 |
|
52 enum TMmsViewerOperationEvent |
|
53 { |
|
54 EMmsViewerOperationComplete, |
|
55 EMmsViewerOperationError, |
|
56 EMmsViewerOperationCancel |
|
57 }; |
|
58 |
|
59 |
|
60 // FUNCTION PROTOTYPES |
|
61 |
|
62 // CLASS DECLARATION |
|
63 |
|
64 class MMmsViewerOperationObserver |
|
65 { |
|
66 public: |
|
67 virtual void ViewerOperationEvent( |
|
68 TMmsViewerOperationType aOperation, |
|
69 TMmsViewerOperationEvent aEvent, |
|
70 TInt aError ) = 0; |
|
71 }; |
|
72 |
|
73 /** |
|
74 * CMmsViewerOperation |
|
75 * |
|
76 * @lib mmsViewer.app |
|
77 * @since 3.0 |
|
78 */ |
|
79 class CMmsViewerOperation : public CActive |
|
80 { |
|
81 public: // New methods |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 * |
|
86 * @since 3.0 |
|
87 */ |
|
88 virtual ~CMmsViewerOperation(); |
|
89 |
|
90 protected: |
|
91 |
|
92 /** |
|
93 * Constructor. |
|
94 * |
|
95 * @since 3.0 |
|
96 */ |
|
97 CMmsViewerOperation( |
|
98 MMmsViewerOperationObserver& aObserver, |
|
99 CMmsViewerDocument& aDocument, |
|
100 RFs& aFs ); |
|
101 |
|
102 /** |
|
103 * CompleteSelf |
|
104 * Sets active and completes |
|
105 * |
|
106 * @since 3.0 |
|
107 */ |
|
108 void CompleteSelf( TInt aError ); |
|
109 |
|
110 /** |
|
111 * SetActiveNoCompleteSelf |
|
112 * Sets active and but does not complete |
|
113 * |
|
114 * @since 3.1 |
|
115 */ |
|
116 void SetActiveNoCompleteSelf( ); |
|
117 |
|
118 /** |
|
119 * SetActiveNoCompleteSelf |
|
120 * Completes earlier activated operation |
|
121 * |
|
122 * @since 3.1 |
|
123 */ |
|
124 void CompleteActiveSelf( TInt aError ); |
|
125 /** |
|
126 * IsCompleted |
|
127 * Checks whether active operation is completed |
|
128 * |
|
129 * @since 3.1 |
|
130 */ |
|
131 TBool IsCompleted( ); |
|
132 |
|
133 #ifdef CANCEL_TEST_CODE |
|
134 /** |
|
135 * |
|
136 * Usually active objects runs with priority EPriorityStandard |
|
137 * @param aUseRandomCancel indicates how often Cancel is called. Use value 0...100: |
|
138 * 0: never |
|
139 * 1: with probability of 1% |
|
140 * ...100: with probability of 100%. |
|
141 * >100: runs with priority EPriorityStandard+1 and Cancels immediately. |
|
142 * if aUseRandomCancel <= 100, active objects runs until it is cancelled |
|
143 */ |
|
144 void LaunchCancelTest( TInt aUseRandomCancel = 100); |
|
145 void CancelCancelTest( ); |
|
146 #endif |
|
147 |
|
148 protected: // data |
|
149 |
|
150 MMmsViewerOperationObserver& iObserver; |
|
151 CMmsViewerDocument& iDocument; |
|
152 RFs& iFs; |
|
153 TInt iNextState; |
|
154 #ifdef CANCEL_TEST_CODE |
|
155 // Cancel test code |
|
156 CHighOperation* iHighOp; |
|
157 #endif |
|
158 |
|
159 }; |
|
160 |
|
161 #endif // __MMSVIEWEROPERATION_H |