|
1 /* |
|
2 * Copyright (c) 2004, 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: File handling utility. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SVGTFILEMANGER_H |
|
21 #define SVGTFILEMANGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <f32file.h> |
|
25 #include <e32base.h> |
|
26 #include <SVGTUISaveListener.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KSVGTOneSecond(1000000); |
|
30 const TInt KSVGTOneMinute(60*KSVGTOneSecond); |
|
31 const TInt KOneHourInSeconds(3600); |
|
32 const TInt KSVGTPercent(100); |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * CSVGTFileManager |
|
38 * File operations |
|
39 * |
|
40 * @lib SVGTUIControl.lib |
|
41 * @since 3.0 |
|
42 */ |
|
43 NONSHARABLE_CLASS(CSVGTFileManager) : public CActive, |
|
44 public MFileManObserver |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 */ |
|
51 IMPORT_C static CSVGTFileManager* NewL(); |
|
52 |
|
53 /** |
|
54 * Destructor. |
|
55 */ |
|
56 IMPORT_C virtual ~CSVGTFileManager(); |
|
57 |
|
58 public: // New functions |
|
59 |
|
60 /** |
|
61 * Starts async copy operation |
|
62 * @since 3.0 |
|
63 * @param aCallback Callback to UI side |
|
64 * @param anOld source |
|
65 * @param aNew target |
|
66 * @return KErrDiskFull if mmc full, KErrNone if succesful. |
|
67 */ |
|
68 IMPORT_C TInt StartCopyOperationL( MSVGTUISaveListener* aCallback, |
|
69 const TDesC& anOld,const TDesC& aNew ); |
|
70 |
|
71 /** |
|
72 * Starts async copy operation |
|
73 * @since 3.0 |
|
74 * @param aCallback Callback to UI side |
|
75 * @param aFileHandle source |
|
76 * @param aNew target |
|
77 * @return KErrDiskFull if mmc full, KErrNone if succesful. |
|
78 */ |
|
79 IMPORT_C TInt StartCopyOperationL( MSVGTUISaveListener* aCallback, |
|
80 RFile& aFileHandle, const TDesC& aNew ); |
|
81 |
|
82 /** |
|
83 * Cancels async copy operation |
|
84 * @since 3.0 |
|
85 * @return void |
|
86 */ |
|
87 IMPORT_C void CancelCopy(); |
|
88 |
|
89 /** |
|
90 * Sets iMove if moving is preferred instead of copy. |
|
91 * @param Document handler EGenericParamAllowMove parameter value. |
|
92 * @since 2.8 |
|
93 */ |
|
94 IMPORT_C void SetAllowMove( TInt32 aValue ); |
|
95 |
|
96 public: // Functions from MFileManObserver |
|
97 |
|
98 /** @see MFileManObserver::NotifyFileManOperation */ |
|
99 MFileManObserver::TControl NotifyFileManOperation(); |
|
100 |
|
101 private: // Constructors |
|
102 |
|
103 /** |
|
104 * C++ default constructor. |
|
105 */ |
|
106 CSVGTFileManager(); |
|
107 |
|
108 /** |
|
109 * By default Symbian 2nd phase constructor is private. |
|
110 */ |
|
111 void ConstructL(); |
|
112 |
|
113 private: // From CActive |
|
114 |
|
115 /** @see CActive::RunL() */ |
|
116 void RunL(); |
|
117 |
|
118 /** @see CActive::DoCancel() */ |
|
119 void DoCancel(); |
|
120 |
|
121 private: // New fuctions |
|
122 |
|
123 /** |
|
124 * Timer callback for UI progress update |
|
125 * @since 3.0 |
|
126 * @param aPtr Pointer to callback class |
|
127 * @return KErrNone |
|
128 */ |
|
129 static TInt ProgressUpdate(TAny* aPtr); |
|
130 |
|
131 /** |
|
132 * Do progress update |
|
133 * @since 3.0 |
|
134 * @return void |
|
135 */ |
|
136 void DoProgressUpdate(); |
|
137 |
|
138 #ifdef SVGTVIEWERAPP_DBG_FLAG |
|
139 void PrintDebugMsg( const TDesC& aMsg ); |
|
140 #endif |
|
141 |
|
142 |
|
143 private: // Data |
|
144 TInt iFileSize; |
|
145 TInt iPosition; |
|
146 TBool iCancel; |
|
147 CFileMan* iFileMan; |
|
148 MSVGTUISaveListener* iCallback; // not owned |
|
149 CPeriodic* iProgressUpdater; |
|
150 CEikonEnv* iEikEnv; |
|
151 TBool iMove; |
|
152 }; |
|
153 |
|
154 #endif // SVGTFILEMANGER_H |
|
155 |
|
156 // End of File |