1 /* |
1 /* |
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // SYSTEM INCLUDES |
19 // SYSTEM INCLUDES |
20 #include <e32property.h> |
20 #include <e32property.h> |
|
21 #include <AknGlobalNote.h> |
|
22 #include <secondarydisplay/AknSecondaryDisplayDefs.h> |
|
23 #include <aknSDData.h> |
|
24 #include <avkon.rsg> |
21 #include <data_caging_path_literals.hrh> |
25 #include <data_caging_path_literals.hrh> |
22 #include <driveinfo.h> |
26 #include <driveinfo.h> |
23 #include <outofdiskmonitor.rsg> |
27 #include <outofdiskmonitor.rsg> |
24 #include <bautils.h> // BaflUtils |
28 #include <bautils.h> // BaflUtils |
25 #include <StringLoader.h> |
29 #include <StringLoader.h> |
26 |
30 #include <aknnotewrappers.h> |
27 |
31 |
28 // USER INCLUDES |
32 // USER INCLUDES |
29 #include "UiklafInternalCRKeys.h" |
33 #include "UiklafInternalCRKeys.h" |
30 #include "OodTraces.h" |
34 #include "OodTraces.h" |
31 #include "outofdiskglobalnote.h" |
35 #include "outofdiskglobalnote.h" |
54 // --------------------------------------------------------- |
58 // --------------------------------------------------------- |
55 // |
59 // |
56 COutOfDiskGlobalNote::~COutOfDiskGlobalNote() |
60 COutOfDiskGlobalNote::~COutOfDiskGlobalNote() |
57 { |
61 { |
58 TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote"); |
62 TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote"); |
|
63 delete iQuery; |
59 iOODResourceFile.Close(); |
64 iOODResourceFile.Close(); |
60 delete iNote; |
65 Cancel(); // Cancel active object |
61 iNote=NULL; |
66 TRACES("COutOfDiskGlobalNote::~COutOfDiskGlobalNote: End"); |
62 } |
67 } |
63 |
68 |
64 // --------------------------------------------------------- |
69 // --------------------------------------------------------- |
65 // |
70 // |
66 // --------------------------------------------------------- |
71 // --------------------------------------------------------- |
67 // |
72 // |
68 COutOfDiskGlobalNote::COutOfDiskGlobalNote( COutOfDiskMonitor* aOutOfDiskMonitor, RFs& aFs ) : |
73 COutOfDiskGlobalNote::COutOfDiskGlobalNote( COutOfDiskMonitor* aOutOfDiskMonitor, RFs& aFs ) : |
|
74 CActive( EPriorityStandard ), |
69 iOutOfDiskMonitor( aOutOfDiskMonitor ), |
75 iOutOfDiskMonitor( aOutOfDiskMonitor ), |
70 iFs( aFs ) |
76 iFs( aFs ) |
71 { |
77 { |
72 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote"); |
78 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote"); |
|
79 CActiveScheduler::Add( this ); |
73 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote: End"); |
80 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote: End"); |
74 } |
81 } |
75 |
82 |
76 // --------------------------------------------------------- |
83 // --------------------------------------------------------- |
77 // |
84 // |
81 { |
88 { |
82 TRACES("COutOfDiskGlobalNote::ConstructL"); |
89 TRACES("COutOfDiskGlobalNote::ConstructL"); |
83 iNoteInfo.iNoteId = KErrNotFound; |
90 iNoteInfo.iNoteId = KErrNotFound; |
84 iNoteInfo.iStatus = DISK_SPACE_OK; |
91 iNoteInfo.iStatus = DISK_SPACE_OK; |
85 iNoteInfo.iDrive = KErrNotFound; |
92 iNoteInfo.iDrive = KErrNotFound; |
86 iNote= CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); |
93 |
87 TRACES("COutOfDiskGlobalNote::ConstructL: Open OOD resource file"); |
94 TRACES("COutOfDiskGlobalNote::ConstructL: Open OOD resource file"); |
88 TFileName OODFileName; |
95 TFileName OODFileName; |
89 OODFileName.Append(_L("Z")); |
96 OODFileName.Append(_L("Z")); |
90 OODFileName.Append(_L(":")); |
97 OODFileName.Append(_L(":")); |
91 OODFileName.Append(KDC_RESOURCE_FILES_DIR); |
98 OODFileName.Append(KDC_RESOURCE_FILES_DIR); |
101 // --------------------------------------------------------- |
108 // --------------------------------------------------------- |
102 // |
109 // |
103 void COutOfDiskGlobalNote::DisplayL(const TDesC& aMessage) |
110 void COutOfDiskGlobalNote::DisplayL(const TDesC& aMessage) |
104 { |
111 { |
105 TRACES("COutOfDiskGlobalNote::DisplayL"); |
112 TRACES("COutOfDiskGlobalNote::DisplayL"); |
106 |
113 if (iNoteInfo.iNoteId > KErrNotFound) |
107 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote::DisplayL: set text and observer for the note"); |
114 { |
108 iNote->SetTextL(aMessage); |
115 CancelNoteL(); |
109 iNote->SetObserver(this); |
116 } |
110 iNote->SetTimeout(0); |
117 |
111 iNote->ShowL(); |
118 if (!iQuery) |
112 |
119 { |
|
120 TRACES("COutOfDiskGlobalNote::COutOfDiskGlobalNote::DisplayL: Create iQuery"); |
|
121 iQuery = CAknGlobalNote::NewL(); |
|
122 iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); |
|
123 } |
|
124 iNoteInfo.iNoteId = iQuery->ShowNoteL(iStatus, EAknGlobalWarningNote, aMessage); |
|
125 SetActive(); |
113 TRACES("COutOfDiskGlobalNote::DisplayL: End"); |
126 TRACES("COutOfDiskGlobalNote::DisplayL: End"); |
114 } |
127 } |
115 |
128 |
116 // --------------------------------------------------------- |
129 // --------------------------------------------------------- |
117 // Use a global query to display the message but make sure that eiksrv is |
130 // Use a global query to display the message but make sure that eiksrv is |
153 { |
167 { |
154 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! Drive: %c", aDrive+'A'); |
168 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! Drive: %c", aDrive+'A'); |
155 |
169 |
156 if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory()) |
170 if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory()) |
157 { |
171 { |
|
172 sdDialogId = EAknDiskWarnignNote; |
158 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_LOW); |
173 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_LOW); |
159 resReader.SetBuffer(str); |
174 resReader.SetBuffer(str); |
160 strings->AppendL( driveName ); |
175 strings->AppendL( driveName ); |
161 } |
176 } |
162 else if (driveStatus & DriveInfo::EDriveRemovable) |
177 else if (driveStatus & DriveInfo::EDriveRemovable) |
163 { |
178 { |
164 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! volNameLength: %d", nameLength); |
179 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Warning note! volNameLength: %d", nameLength); |
|
180 sdDialogId = EAknMMCWarningNote; |
165 TBufC<KMaxFileName> name(volInfo.iName); |
181 TBufC<KMaxFileName> name(volInfo.iName); |
166 if (nameLength) |
182 if (nameLength) |
167 { |
183 { |
168 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MEMORY_CARD_LOW_NAME); |
184 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MEMORY_CARD_LOW_NAME); |
169 resReader.SetBuffer(str); |
185 resReader.SetBuffer(str); |
178 strings->AppendL( driveName ); |
194 strings->AppendL( driveName ); |
179 } |
195 } |
180 } |
196 } |
181 else |
197 else |
182 { |
198 { |
|
199 sdDialogId = EAknDiskWarnignNote; |
183 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_MEMORY_LOW); |
200 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_MEMORY_LOW); |
184 resReader.SetBuffer(str); |
201 resReader.SetBuffer(str); |
185 strings->AppendL( driveName ); |
202 strings->AppendL( driveName ); |
186 } |
203 } |
187 } |
204 } |
188 else if (aStatus==DISK_SPACE_CRITICAL) |
205 else if (aStatus==DISK_SPACE_CRITICAL) |
189 { |
206 { |
190 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Critical note! Drive: %c", aDrive+'A'); |
207 TRACES1("COutOfDiskGlobalNote::ShowGlobalQueryL: Critical note! Drive: %c", aDrive+'A'); |
191 if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory()) |
208 if (aDrive == iOutOfDiskMonitor->GetDefaultPhoneMemory()) |
192 { |
209 { |
|
210 sdDialogId = EAknDiskFullNote; |
193 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_FULL); |
211 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_DEVICE_MEMORY_FULL); |
194 resReader.SetBuffer(str); |
212 resReader.SetBuffer(str); |
195 strings->AppendL( driveName ); |
213 strings->AppendL( driveName ); |
196 } |
214 } |
197 else if (driveStatus & DriveInfo::EDriveRemovable) |
215 else if (driveStatus & DriveInfo::EDriveRemovable) |
198 { |
216 { |
|
217 sdDialogId = EAknMMCFullNote; |
199 TBufC<KMaxFileName> name(volInfo.iName); |
218 TBufC<KMaxFileName> name(volInfo.iName); |
200 if (nameLength) |
219 if (nameLength) |
201 { |
220 { |
202 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MEMORY_CARD_FULL_NAME); |
221 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MEMORY_CARD_FULL_NAME); |
203 resReader.SetBuffer(str); |
222 resReader.SetBuffer(str); |
212 strings->AppendL( driveName ); |
231 strings->AppendL( driveName ); |
213 } |
232 } |
214 } |
233 } |
215 else |
234 else |
216 { |
235 { |
|
236 sdDialogId = EAknDiskFullNote; |
217 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_FULL); |
237 str = iOODResourceFile.AllocReadLC(R_QTN_MEMLO_MASS_STORAGE_FULL); |
218 resReader.SetBuffer(str); |
238 resReader.SetBuffer(str); |
219 strings->AppendL( driveName ); |
239 strings->AppendL( driveName ); |
220 } |
240 } |
221 } |
241 } |
222 resReader.SetBuffer(str); |
242 resReader.SetBuffer(str); |
223 HBufC* resHandle = resReader.ReadHBufCL(); |
243 HBufC* resHandle = resReader.ReadHBufCL(); |
224 CleanupStack::PushL( resHandle ); |
244 CleanupStack::PushL( resHandle ); |
225 HBufC* message(FormatStringL(resHandle->Des(),*strings)); |
245 HBufC* message(FormatStringL(resHandle->Des(),*strings)); |
226 CleanupStack::PushL( message ); |
246 CleanupStack::PushL( message ); |
227 TRACES1("COutOfDiskMonitor::ShowGlobalQueryL: txt: %S",message); |
247 TRACES1("COutOfDiskMonitor::ShowGlobalQueryL: txt: %S",message); |
228 DisplayL(message->Des()); |
248 DisplayL(message->Des()); |
|
249 |
|
250 TBuf8<2> sdDriveName; |
|
251 sdDriveName.Append(aDrive+'A'); |
|
252 sdDriveName.Append(_L8(":")); |
|
253 CAknSDData* sd = CAknSDData::NewL(KAknSecondaryDisplayCategory, sdDialogId, sdDriveName); |
|
254 iQuery->SetSecondaryDisplayData(sd); |
229 |
255 |
230 iNoteInfo.iStatus = aStatus; |
256 iNoteInfo.iStatus = aStatus; |
231 iNoteInfo.iDrive = aDrive; |
257 iNoteInfo.iDrive = aDrive; |
232 CleanupStack::PopAndDestroy(message); |
258 CleanupStack::PopAndDestroy(message); |
233 CleanupStack::PopAndDestroy(resHandle); |
259 CleanupStack::PopAndDestroy(resHandle); |
282 TRACES("COutOfDiskGlobalNote::FormatStringL: End"); |
308 TRACES("COutOfDiskGlobalNote::FormatStringL: End"); |
283 return retbuf; |
309 return retbuf; |
284 } |
310 } |
285 |
311 |
286 // ----------------------------------------------------------------------------- |
312 // ----------------------------------------------------------------------------- |
287 // COutOfDiskGlobalNote::MessageBoxClosed |
313 // COutOfDiskGlobalNote::DoCancel |
288 // ----------------------------------------------------------------------------- |
314 // ----------------------------------------------------------------------------- |
289 // |
315 // |
290 void COutOfDiskGlobalNote::MessageBoxClosed(const CHbDeviceMessageBoxSymbian* aMessageBox, |
316 void COutOfDiskGlobalNote::DoCancel() |
291 CHbDeviceMessageBoxSymbian::TButtonId aButton) |
317 { |
292 { |
318 TRACES("COutOfDiskGlobalNote::DoCancel"); |
293 TRACES("COutOfDiskGlobalNote::closed"); |
319 } |
|
320 |
|
321 // ----------------------------------------------------------------------------- |
|
322 // COutOfDiskGlobalNote::RunL |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 void COutOfDiskGlobalNote::RunL() |
|
326 { |
|
327 TRACES("COutOfDiskGlobalNote::RunL"); |
294 iNoteInfo.iNoteId = KErrNotFound; |
328 iNoteInfo.iNoteId = KErrNotFound; |
295 iNoteInfo.iStatus = DISK_SPACE_OK; |
329 iNoteInfo.iStatus = DISK_SPACE_OK; |
296 iNoteInfo.iDrive = KErrNotFound; |
330 iNoteInfo.iDrive = KErrNotFound; |
297 |
331 |
298 TInt drive = iOutOfDiskMonitor->GetTopPriorityDrive(); |
332 TInt drive = iOutOfDiskMonitor->GetTopPriorityDrive(); |
302 } |
336 } |
303 |
337 |
304 TRACES("COutOfDiskGlobalNote::RunL: End"); |
338 TRACES("COutOfDiskGlobalNote::RunL: End"); |
305 } |
339 } |
306 |
340 |
|
341 // ----------------------------------------------------------------------------- |
|
342 // COutOfDiskGlobalNote::CancelNoteL |
|
343 // ----------------------------------------------------------------------------- |
|
344 // |
|
345 void COutOfDiskGlobalNote::CancelNoteL() |
|
346 { |
|
347 TRACES("COutOfDiskGlobalNote::CancelNoteL"); |
|
348 |
|
349 if (iNoteInfo.iNoteId > KErrNotFound) |
|
350 { |
|
351 iQuery->CancelNoteL(iNoteInfo.iNoteId); |
|
352 } |
|
353 Cancel(); |
|
354 TRACES("COutOfDiskGlobalNote::CancelNoteL: End"); |
|
355 } |
307 |
356 |
308 // ----------------------------------------------------------------------------- |
357 // ----------------------------------------------------------------------------- |
309 // COutOfDiskGlobalNote::NoteOnDisplay |
358 // COutOfDiskGlobalNote::NoteOnDisplay |
310 // ----------------------------------------------------------------------------- |
359 // ----------------------------------------------------------------------------- |
311 // |
360 // |