53 TState iState; |
55 TState iState; |
54 }; |
56 }; |
55 |
57 |
56 |
58 |
57 /** |
59 /** |
|
60 * MMdSDiskSpaceNotifierObserver |
|
61 * Observer interface for a disk space notifier. |
|
62 */ |
|
63 class MThumbnailStoreDiskSpaceNotifierObserver |
|
64 { |
|
65 public : |
|
66 /** |
|
67 * Called to notify the observer that disk space has crossed the specified threshold value. |
|
68 * |
|
69 * @param aDiskFull is disk full (freespace under specified threshold level) |
|
70 */ |
|
71 virtual void HandleDiskSpaceNotificationL(TBool aDiskFull) = 0; |
|
72 |
|
73 /** |
|
74 * Called to if disk space notifier has an error situation. |
|
75 * |
|
76 * @param aError error code |
|
77 */ |
|
78 virtual void HandleDiskSpaceError(TInt aError) = 0; |
|
79 |
|
80 }; |
|
81 |
|
82 /** |
|
83 * CMSDiskSpaceNotifierAO. |
|
84 * A disk space notifier class |
|
85 */ |
|
86 class CThumbnailStoreDiskSpaceNotifierAO : public CActive |
|
87 { |
|
88 public: |
|
89 enum TDiskSpaceNotifierState |
|
90 { |
|
91 ENormal, |
|
92 EIterate |
|
93 }; |
|
94 |
|
95 public : // Constructors and destructors |
|
96 /** |
|
97 * Constructs a disk space notifier implementation. |
|
98 * |
|
99 * @param aThreshold minimum free disk space threshold level in bytes |
|
100 * @param aFilename filename which defines monitored drive's number |
|
101 * @return implementation |
|
102 */ |
|
103 static CThumbnailStoreDiskSpaceNotifierAO* NewL( |
|
104 MThumbnailStoreDiskSpaceNotifierObserver& aObserver, |
|
105 TInt64 aThreshold, const TDesC& aFilename); |
|
106 |
|
107 /** |
|
108 * Constructs a disk space notifier implementation and leaves it |
|
109 * in the cleanup stack. |
|
110 * |
|
111 * @param aThreshold minimum free disk space threshold level in bytes |
|
112 * @return implementation |
|
113 */ |
|
114 static CThumbnailStoreDiskSpaceNotifierAO* NewLC( |
|
115 MThumbnailStoreDiskSpaceNotifierObserver& aObserver, |
|
116 TInt64 aThreshold, const TDesC& aFilename ); |
|
117 |
|
118 /** |
|
119 * Destructor. |
|
120 */ |
|
121 virtual ~CThumbnailStoreDiskSpaceNotifierAO(); |
|
122 |
|
123 TBool DiskFull() const; |
|
124 |
|
125 protected: // Functions from base classes |
|
126 /** |
|
127 * From CActive |
|
128 * Callback function. |
|
129 * Invoked to handle responses from the server. |
|
130 */ |
|
131 void RunL(); |
|
132 |
|
133 /** |
|
134 * From CActive |
|
135 * Handles errors that occur during notifying the observer. |
|
136 */ |
|
137 TInt RunError(TInt aError); |
|
138 |
|
139 /** |
|
140 * From CActive |
|
141 * Cancels any outstanding operation. |
|
142 */ |
|
143 void DoCancel(); |
|
144 |
|
145 private: // Constructors and destructors |
|
146 |
|
147 /** |
|
148 * constructor |
|
149 */ |
|
150 CThumbnailStoreDiskSpaceNotifierAO( |
|
151 MThumbnailStoreDiskSpaceNotifierObserver& aObserver, |
|
152 TInt64 aThreshold, TDriveNumber aDrive ); |
|
153 |
|
154 /** |
|
155 * 2nd phase constructor |
|
156 * @param aThreshold minimum free disk space threshold level in bytes |
|
157 * @param aDrive monitored drive's number |
|
158 */ |
|
159 void ConstructL(); |
|
160 |
|
161 private: // New methods |
|
162 |
|
163 void StartNotifier(); |
|
164 |
|
165 static TDriveNumber GetDriveNumberL( const TDesC& aFilename ); |
|
166 |
|
167 private: // Data |
|
168 |
|
169 MThumbnailStoreDiskSpaceNotifierObserver& iObserver; |
|
170 |
|
171 RFs iFileServerSession; |
|
172 |
|
173 const TInt64 iThreshold; |
|
174 |
|
175 const TDriveNumber iDrive; |
|
176 |
|
177 TDiskSpaceNotifierState iState; |
|
178 |
|
179 TInt iIterationCount; |
|
180 |
|
181 TBool iDiskFull; |
|
182 }; |
|
183 |
|
184 |
|
185 /** |
58 * Store for thumbnails. |
186 * Store for thumbnails. |
59 * |
187 * |
60 * @since S60 v5.0 |
188 * @since S60 v5.0 |
61 */ |
189 */ |
62 class CThumbnailStore: public CBase |
190 class CThumbnailStore: public CBase, public MThumbnailStoreDiskSpaceNotifierObserver |
63 { |
191 { |
64 // Bitmasked Flags |
192 // Bitmasked Flags |
65 typedef enum |
193 typedef enum |
66 { |
194 { |
67 KThumbnailDbFlagCropped = 1, |
195 KThumbnailDbFlagCropped = 1, |