1 /* |
|
2 * Copyright (c) 2007 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: Wraps wait note and real work thread |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CFILEMANAGERACTIVEBASE_H |
|
21 #define CFILEMANAGERACTIVEBASE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <AknWaitNoteWrapper.h> |
|
26 #include "MFileManagerThreadFunction.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CFileManagerThreadWrapper; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Class wraps wait note and real work thread to avoid long running steps |
|
34 * in the main thread that freezes the UI. |
|
35 * |
|
36 * @lib FileManagerEngine.lib |
|
37 * @since 3.2 |
|
38 */ |
|
39 NONSHARABLE_CLASS(CFileManagerActiveBase) : public CBase, |
|
40 public MAknBackgroundProcess, |
|
41 public MFileManagerThreadFunction |
|
42 { |
|
43 public: |
|
44 /** |
|
45 * Constructor for subclasses. |
|
46 */ |
|
47 void BaseConstructL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 ~CFileManagerActiveBase(); |
|
53 |
|
54 TInt Result() const; |
|
55 |
|
56 private: // From MAknBackgroundProcess |
|
57 void StepL(); |
|
58 |
|
59 TBool IsProcessDone() const; |
|
60 |
|
61 void DialogDismissedL( TInt aButtonId ); |
|
62 |
|
63 private: // From MFileManagerThreadFunction |
|
64 void ThreadStepL(); |
|
65 |
|
66 TBool IsThreadDone(); |
|
67 |
|
68 void NotifyThreadClientL( TNotifyType aType, TInt aValue ); |
|
69 |
|
70 protected: |
|
71 /** |
|
72 * For subclasses to handle all processing in work thread |
|
73 */ |
|
74 virtual void ThreadFunctionL( const TBool& aCanceled ) = 0; |
|
75 |
|
76 /** |
|
77 * For subclasses to request cancel in work thread |
|
78 */ |
|
79 virtual void CancelThreadFunction(); |
|
80 |
|
81 protected: |
|
82 /** |
|
83 * C++ default constructor. |
|
84 */ |
|
85 CFileManagerActiveBase(); |
|
86 |
|
87 private: // Data |
|
88 // Wraps work thread control. Own. |
|
89 CFileManagerThreadWrapper* iThreadWrapper; |
|
90 |
|
91 // Indicates if background process is done or not |
|
92 TBool iDone; |
|
93 |
|
94 // Indicates if thread is canceled |
|
95 TBool iCanceled; |
|
96 |
|
97 // Indicates the result |
|
98 TInt iResult; |
|
99 |
|
100 }; |
|
101 |
|
102 #endif // CFILEMANAGERACTIVEBASE_H |
|
103 |
|
104 // End of File |
|
105 |
|