1 /* |
|
2 * Copyright (c) 2007-2008 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: Interface of the folder command |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <liwcommon.h> |
|
19 #include <e32base.h> |
|
20 #include <eikenv.h> |
|
21 #include <StringLoader.h> |
|
22 #include <AknQueryDialog.h> |
|
23 #include <aknnotewrappers.h> |
|
24 #include <s32mem.h> |
|
25 |
|
26 #include "mmfoldercommand.h" |
|
27 #include "mmfoldercommandadd.h" |
|
28 #include "mmfoldercommandrename.h" |
|
29 #include "mmfoldercommanddelete.h" |
|
30 #include "mmmovetofoldercommand.h" |
|
31 #include "mmdialogmanager.h" |
|
32 #include "hnliwutils.h" |
|
33 #include "menudebug.h" |
|
34 #include "hnutils.h" |
|
35 |
|
36 #include "hnmdbasekey.h" |
|
37 #include "hnmdkeyfactory.h" |
|
38 #include "menudebug.h" |
|
39 #include "hnconvutils.h" |
|
40 #include "hnservicehandler.h" |
|
41 #include "mmfolderuiextpluginconstants.h" |
|
42 #include "mmpluginsharedresources.h" |
|
43 |
|
44 #include <avkon.rsg> |
|
45 #include <matrixmenu.rsg> |
|
46 #include <mmfolderuiextplugin.rsg> |
|
47 |
|
48 |
|
49 const TInt KCountNotAllowedChars = 9; |
|
50 // Unicode character of sign obtained by press '0' key three times. Enter key. |
|
51 const TUint16 KIllegalCharEnter = 0x21b2; |
|
52 // Unicode line separator character obtained by pressing Shift + Enter keys |
|
53 const TUint16 KIllegalCharLineSeparator = 0x2028; |
|
54 // Space unicode character. |
|
55 // Characters which ascii value is smaller than 32 are not allowed. |
|
56 const TUint16 KSpace = ' '; //32; |
|
57 |
|
58 // ============================ MEMBER FUNCTIONS ============================= |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 CMmFolderCommand::~CMmFolderCommand() |
|
64 { |
|
65 iSerializedInputList.Close(); |
|
66 iSerializedOutputList.Close(); |
|
67 delete iGetListOutParam; |
|
68 delete iGetListInParam; |
|
69 iMcs.Close(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void CMmFolderCommand::BaseConstructL() |
|
77 { |
|
78 // Init MCS session |
|
79 TBuf16<KMaxFileName> buf; |
|
80 buf.Copy(KMatrixMenuData); |
|
81 iMcs.OpenL(buf); |
|
82 iGetListInParam = CLiwGenericParamList::NewL(); |
|
83 iGetListOutParam = CLiwGenericParamList::NewL(); |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 // --------------------------------------------------------------------------- |
|
89 // |
|
90 void CMmFolderCommand::MCSQueryExecutionL( |
|
91 const TDesC8& aQueryName, |
|
92 const CHnMdBaseKey* aInputData, |
|
93 const CHnMdBaseKey* aFilter, |
|
94 MLiwNotifyCallback* aCallback ) |
|
95 { |
|
96 RPointerArray< CHnMdBaseKey > data; |
|
97 CleanupClosePushL( data ); |
|
98 data.AppendL( aInputData ); |
|
99 if ( aFilter ) |
|
100 { |
|
101 data.AppendL( aFilter ); |
|
102 } |
|
103 |
|
104 CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL( |
|
105 KServiceContentName, KKeyTypeString, KMatrixMenuData ); |
|
106 CleanupStack::PushL( serviceData ); |
|
107 |
|
108 RPointerArray< CHnMdBaseKey> constructor; |
|
109 CleanupClosePushL( constructor ); |
|
110 constructor.AppendL( serviceData ); |
|
111 CLiwGenericParamList* constructorLiw = CLiwGenericParamList::NewLC(); |
|
112 CLiwGenericParamList* commandLiw = CLiwGenericParamList::NewLC(); |
|
113 HnLiwUtils::SetGenericParamListL( constructor, *constructorLiw ); |
|
114 HnLiwUtils::SetGenericParamListL( data, *commandLiw ); |
|
115 |
|
116 TBuf8< KMaxLength > interface( KMCSDataSourceInterface8 ); |
|
117 if ( !aQueryName.Compare( KCmdOrganize8 ) || |
|
118 !aQueryName.Compare( KCmdExecuteAction8 ) ) |
|
119 { |
|
120 interface.Copy( KMCSMenuContentInterface8 ); |
|
121 } |
|
122 |
|
123 delete iServiceHandler; |
|
124 iServiceHandler = NULL; |
|
125 iServiceHandler = CHnServiceHandler::NewL( |
|
126 KMCSService8, interface, aQueryName, |
|
127 EServiceModeAsynchronous, constructorLiw, commandLiw ); |
|
128 |
|
129 CleanupStack::Pop( commandLiw ); |
|
130 CleanupStack::Pop( constructorLiw ); |
|
131 |
|
132 iServiceHandler->ExecuteL( aCallback , 0 ); |
|
133 |
|
134 CleanupStack::PopAndDestroy( &constructor ); |
|
135 CleanupStack::PopAndDestroy( serviceData ); |
|
136 CleanupStack::PopAndDestroy( &data ); |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 CMmFolderCommand* CMmFolderCommand::FactoryL( const TDesC& aCommand ) |
|
144 { |
|
145 CMmFolderCommand* ret = NULL; |
|
146 if( !aCommand.Compare( KAddFolderCmd ) ) |
|
147 { |
|
148 ret = CMmFolderCommandAdd::NewL(); |
|
149 } |
|
150 else if ( !aCommand.Compare( KRenameFolderCmd ) ) |
|
151 { |
|
152 ret = CMmFolderCommandRename::NewL(); |
|
153 } |
|
154 else if ( !aCommand.Compare( KDeleteFolderCmd ) ) |
|
155 { |
|
156 ret = CMmFolderCommandDelete::NewL(); |
|
157 } |
|
158 else if ( !aCommand.Compare( KDeleteAppCmd ) ) |
|
159 { |
|
160 ret = CMmFolderDeleteApp::NewL(); |
|
161 } |
|
162 else if ( !aCommand.Compare( KDeleteSuiteCmd ) ) |
|
163 { |
|
164 ret = CMmFolderDeleteSuite::NewL(); |
|
165 } |
|
166 else if ( !aCommand.Compare( KMoveToFolderCmd ) ) |
|
167 { |
|
168 ret = CMmMoveToFolderCommand::NewL(); |
|
169 } |
|
170 return ret; |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 TBool CMmFolderCommand::DoChangeNameL( RBuf& aFolderName, |
|
178 TInt aDefaultNameLength, RBuf& aNumberInBracket, |
|
179 CLiwGenericParamList& aFoldersNames, TLiwVariant& aVar, |
|
180 TInt aNumberToAppend ) |
|
181 { |
|
182 TBool nameChanged( EFalse ); |
|
183 TInt position( KErrNone ); |
|
184 TInt count = aFoldersNames.FindFirst( position, KReturnValue8() ) |
|
185 ->Value().AsList()->Count(); |
|
186 aNumberInBracket.Delete( KOpenBracket().Length(), |
|
187 aNumberInBracket.Length() - KOpenBracket().Length() ); |
|
188 |
|
189 if ( aNumberToAppend < KMaxDigitNumber ) |
|
190 { |
|
191 aNumberInBracket.AppendNum( 0 ); |
|
192 } |
|
193 |
|
194 for ( TInt i = 0; i < count; i++ ) |
|
195 { |
|
196 HnLiwUtils::GetVariantL( aFoldersNames, KLongNamePath8, i, aVar ); |
|
197 TPtrC longName; |
|
198 aVar.Get( longName ); |
|
199 if ( !aFolderName.Compare( longName ) ) |
|
200 { |
|
201 aNumberInBracket.AppendNum( aNumberToAppend ); |
|
202 aNumberInBracket.Append( KCloseBracket ); |
|
203 aFolderName.Delete( aDefaultNameLength, |
|
204 aFolderName.Length() - aDefaultNameLength ); |
|
205 aFolderName.Append( aNumberInBracket ); |
|
206 nameChanged = ETrue; |
|
207 break; |
|
208 } |
|
209 } |
|
210 return nameChanged; |
|
211 } |
|
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 // --------------------------------------------------------------------------- |
|
216 // |
|
217 void CMmFolderCommand::ChangeNameIfAlreadyExistsL( RBuf& aFolderName, |
|
218 CLiwGenericParamList* aFoldersNames, TInt aNumberToAppend ) |
|
219 { |
|
220 if ( !aFoldersNames ) |
|
221 { |
|
222 return; |
|
223 } |
|
224 TLiwVariant var; |
|
225 var.PushL(); |
|
226 RBuf numberInBracket; |
|
227 CleanupClosePushL(numberInBracket); |
|
228 numberInBracket.CreateL( KMaxLength ); |
|
229 numberInBracket.Append( KOpenBracket ); |
|
230 numberInBracket.AppendNum( aNumberToAppend ); |
|
231 numberInBracket.Append( KCloseBracket ); |
|
232 TInt defaultNameLength = aFolderName.Length(); |
|
233 |
|
234 while( DoChangeNameL( aFolderName, defaultNameLength, numberInBracket, |
|
235 *aFoldersNames, var, ++aNumberToAppend ) ) |
|
236 ; |
|
237 |
|
238 CleanupStack::PopAndDestroy(&numberInBracket); |
|
239 CleanupStack::PopAndDestroy( &var ); |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 TBool CMmFolderCommand::GetFolderNameL( RBuf& aFolderName, |
|
247 CLiwGenericParamList* aFoldersNames ) |
|
248 { |
|
249 TBool res( EFalse ); |
|
250 if( aFolderName.Length() == 0 ) |
|
251 { |
|
252 aFolderName.Append( iSharedResources->GetDefaultFolderName() ); |
|
253 ChangeNameIfAlreadyExistsL( aFolderName, aFoldersNames ); |
|
254 } |
|
255 |
|
256 CAknTextQueryDialog* dialog = |
|
257 CAknTextQueryDialog::NewL( aFolderName, CAknQueryDialog::ENoTone ); |
|
258 |
|
259 dialog->PrepareLC( R_MENU_FILENAME_QUERY ); |
|
260 dialog->SetPromptL( iSharedResources->GetEditFolderName() ); |
|
261 |
|
262 SetDialogL( dialog ); |
|
263 res = dialog->RunLD(); |
|
264 SetDialogL( NULL ); |
|
265 |
|
266 return res; |
|
267 } |
|
268 |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 // --------------------------------------------------------------------------- |
|
272 // |
|
273 void CMmFolderCommand::GetFolderListL( TInt aItemId ) |
|
274 { |
|
275 // Prepare data for GetList |
|
276 iGetListInParam->Reset(); |
|
277 PrepareGetListInputL( aItemId ); |
|
278 PrepareGetListFolderFilterL(); |
|
279 ExternalizeInputListL(); |
|
280 |
|
281 // Get folders list from MCS |
|
282 iMcs.GetListL( iSerializedInputList, iSerializedOutputList ); |
|
283 InternalizeOutputListL(); |
|
284 } |
|
285 |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CMmFolderCommand::GetListL( TInt aItemId ) |
|
291 { |
|
292 // Prepare data for GetList |
|
293 iGetListInParam->Reset(); |
|
294 PrepareGetListInputL( aItemId ); |
|
295 PrepareGetListFilterL(); |
|
296 ExternalizeInputListL(); |
|
297 |
|
298 // Get folders list from MCS |
|
299 iMcs.GetListL( iSerializedInputList, iSerializedOutputList ); |
|
300 InternalizeOutputListL(); |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 void CMmFolderCommand::DisplayErrorInfoL( const TDesC& aFolderName ) |
|
308 { |
|
309 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
|
310 CAknNoteDialog::EConfirmationTone, |
|
311 CAknNoteDialog::ELongTimeout ); |
|
312 HBufC* msg = StringLoader::LoadLC( |
|
313 R_FLDR_CANNOT_DELETE_ITEM, aFolderName ); |
|
314 dialog->SetTextL( msg->Des() ); |
|
315 dialog->ExecuteDlgLD( R_MENU_EDIT_INTERRUPTION_INFO ); |
|
316 |
|
317 CleanupStack::PopAndDestroy( msg ); |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------------------------- |
|
321 // |
|
322 // --------------------------------------------------------------------------- |
|
323 // |
|
324 void CMmFolderCommand::SetRequestInterface( MMmActionRequest* aActionRequest ) |
|
325 { |
|
326 iActionRequest = aActionRequest; |
|
327 } |
|
328 |
|
329 void CMmFolderCommand::SetSharedResources( CMmPluginSharedResources* aResources ) |
|
330 { |
|
331 iSharedResources = aResources; |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 void CMmFolderCommand::SetDialogL( CAknQueryDialog* aDialog ) |
|
339 { |
|
340 iDialog = aDialog; |
|
341 } |
|
342 |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 // --------------------------------------------------------------------------- |
|
346 // |
|
347 void CMmFolderCommand::RemoveDialogL() |
|
348 { |
|
349 iLockDialog = ETrue; |
|
350 if( iDialog ) |
|
351 { |
|
352 iDialog->HandleQueryEditorStateEventL( NULL, |
|
353 MAknQueryControlObserver::EEmergencyCallAttempted, |
|
354 MAknQueryControlObserver::EEditorEmpty ); |
|
355 iDialog = NULL; |
|
356 } |
|
357 } |
|
358 |
|
359 // --------------------------------------------------------------------------- |
|
360 // |
|
361 // --------------------------------------------------------------------------- |
|
362 // |
|
363 void CMmFolderCommand::AddSubKeyL( CHnMdBaseKey* aInDataKey, |
|
364 const TDesC8& aKeyName, |
|
365 const TDesC8& aKeyType, |
|
366 const TDesC8& aKeyValue ) |
|
367 { |
|
368 CHnMdBaseKey* key = HnMdKeyFactory::CreateL( |
|
369 aKeyName, aKeyType, aKeyValue ); |
|
370 CleanupStack::PushL( key ); |
|
371 aInDataKey->AddSubKeyL( key ); |
|
372 CleanupStack::Pop( key ); |
|
373 } |
|
374 |
|
375 // --------------------------------------------------------------------------- |
|
376 // |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 void CMmFolderCommand::AddSubKeyL( CHnMdBaseKey* aInDataKey, |
|
380 const TDesC8& aKeyName, |
|
381 const TDesC8& aKeyType, |
|
382 const TDesC& aKeyValue ) |
|
383 { |
|
384 CHnMdBaseKey* key = HnMdKeyFactory::CreateL( |
|
385 aKeyName, aKeyType, aKeyValue ); |
|
386 CleanupStack::PushL( key ); |
|
387 aInDataKey->AddSubKeyL( key ); |
|
388 CleanupStack::Pop( key ); |
|
389 } |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 // --------------------------------------------------------------------------- |
|
393 // |
|
394 TInt CMmFolderCommand::FolderNameValidationL(RBuf& aFolderName, |
|
395 CLiwGenericParamList* aFoldersNames) |
|
396 { |
|
397 TValidation allowed(EValidationOk); |
|
398 |
|
399 allowed = (TValidation) IllegalCharacterRemoveL(aFolderName, aFoldersNames); |
|
400 if (allowed != EValidationOk) |
|
401 { |
|
402 return allowed; |
|
403 } |
|
404 allowed = (TValidation) CheckValidFileNameL(aFolderName); |
|
405 if (allowed != EValidationOk) |
|
406 { |
|
407 // §qtn_fldr_bad_file_name§ |
|
408 // data entry (for example data query New name: §qtn_fldr_item_name_prmpt§ ) is opened |
|
409 DisplayNameErrorInfoL(iSharedResources->GetMsgBadFileName()); |
|
410 return allowed; |
|
411 } |
|
412 allowed = (TValidation) CheckAllowedCharsL(aFolderName); |
|
413 if (allowed != EValidationOk) |
|
414 { |
|
415 // information note "Name cannot contain |
|
416 // the characters < > \\ /"" |:*?" §qtn_fldr_illegal_characters§ is displayed. |
|
417 DisplayNameErrorInfoL(iSharedResources->GetMsgIllegalCharacters()); |
|
418 } |
|
419 return allowed; |
|
420 } |
|
421 // --------------------------------------------------------------------------- |
|
422 // |
|
423 // --------------------------------------------------------------------------- |
|
424 // |
|
425 TInt CMmFolderCommand::IllegalCharacterRemoveL(RBuf& aFolderName, |
|
426 CLiwGenericParamList* aFoldersNames) |
|
427 { |
|
428 TValidation allowed( EValidationOk ); |
|
429 // illegal characters are removed |
|
430 TInt pos( 0 ); |
|
431 while ( pos < aFolderName.Length() ) |
|
432 { |
|
433 if ( aFolderName[pos] == KIllegalCharEnter || |
|
434 aFolderName[pos] == KIllegalCharLineSeparator ) |
|
435 { |
|
436 aFolderName.Delete( pos, 1 ); |
|
437 } |
|
438 else |
|
439 { |
|
440 ++pos; |
|
441 } |
|
442 } |
|
443 if (aFolderName.Length() == 0) |
|
444 { |
|
445 aFolderName.Append(iSharedResources->GetDefaultFolderName()); |
|
446 ChangeNameIfAlreadyExistsL(aFolderName, aFoldersNames); |
|
447 return allowed; |
|
448 } |
|
449 // only space character is not allowed |
|
450 RBuf trimBuf; |
|
451 CleanupClosePushL(trimBuf); |
|
452 trimBuf.CreateL(aFolderName.Length()); |
|
453 trimBuf.Copy(aFolderName); |
|
454 trimBuf.Trim(); |
|
455 if (!trimBuf.Length()) |
|
456 { |
|
457 allowed = EValidationInvalid; |
|
458 } |
|
459 CleanupStack::PopAndDestroy(&trimBuf); |
|
460 |
|
461 return allowed; |
|
462 } |
|
463 // --------------------------------------------------------------------------- |
|
464 // |
|
465 // --------------------------------------------------------------------------- |
|
466 // |
|
467 TInt CMmFolderCommand::CheckValidFileNameL( const TDes& aFolderName ) |
|
468 { |
|
469 TValidation allowed(EValidationOk); |
|
470 _LIT( KSingleDot, "."); |
|
471 _LIT( KDoubleDot, ".."); |
|
472 |
|
473 if (!aFolderName.Compare( KSingleDot) || |
|
474 !aFolderName.Compare( KDoubleDot ) || |
|
475 aFolderName.Length() > KMaxFileName) |
|
476 { |
|
477 allowed = EValidationInvalid; |
|
478 } |
|
479 else |
|
480 { |
|
481 // characters with ascii value less than 32 |
|
482 for (TInt index(0); index < aFolderName.Length(); index++) |
|
483 { |
|
484 if (aFolderName[index] < KSpace) |
|
485 { |
|
486 allowed = EValidationInvalid; |
|
487 } |
|
488 } |
|
489 } |
|
490 return allowed; |
|
491 } |
|
492 // --------------------------------------------------------------------------- |
|
493 // |
|
494 // --------------------------------------------------------------------------- |
|
495 // |
|
496 TInt CMmFolderCommand::CheckAllowedCharsL( const TDes& aFolderName ) |
|
497 { |
|
498 TValidation allowed(EValidationOk); |
|
499 |
|
500 for (TInt index(0); index < aFolderName.Length(); index++) |
|
501 { |
|
502 for (TInt c(0); c < KCountNotAllowedChars; c++) |
|
503 { |
|
504 if (TChar( KNotAllowedChars[c] ) == aFolderName[index]) |
|
505 { |
|
506 allowed = EValidationNotAllowed; |
|
507 } |
|
508 } |
|
509 } |
|
510 |
|
511 return allowed; |
|
512 } |
|
513 // --------------------------------------------------------------------------- |
|
514 // |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 void CMmFolderCommand::DisplayNameErrorInfoL( const TDesC& aMsg ) |
|
518 { |
|
519 CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog( |
|
520 CAknNoteDialog::EConfirmationTone, |
|
521 CAknNoteDialog::ELongTimeout ); |
|
522 dialog->SetTextL( aMsg ); |
|
523 dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_ABORT_NOTIFICATION ); |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------------------------- |
|
527 // |
|
528 // --------------------------------------------------------------------------- |
|
529 // |
|
530 void CMmFolderCommand::PrepareGetListInputL(TInt aItemId) |
|
531 { |
|
532 CLiwDefaultMap* inputMap = CLiwDefaultMap::NewLC(); |
|
533 |
|
534 // Specify GetList input data |
|
535 inputMap->InsertL( KIdAttrName8, TLiwVariant( TInt32( aItemId ) ) ); // Item id |
|
536 inputMap->InsertL( KRecursiveSearch8, TLiwVariant( TBool ( EFalse ) ) ); // Recursive Search |
|
537 inputMap->InsertL( KFlatResult8, TLiwVariant ( TBool ( ETrue ) ) ); // Flat GetList |
|
538 inputMap->InsertL( KParentOnly8, TLiwVariant ( TBool ( EFalse ) ) ); // Get children |
|
539 |
|
540 // Fill GetList input param list |
|
541 InsertToLiwListL(iGetListInParam, KInData8, inputMap); |
|
542 |
|
543 CleanupStack::PopAndDestroy(inputMap); |
|
544 } |
|
545 |
|
546 // --------------------------------------------------------------------------- |
|
547 // |
|
548 // --------------------------------------------------------------------------- |
|
549 // |
|
550 void CMmFolderCommand::PrepareGetListFolderFilterL() |
|
551 { |
|
552 // Specify GetList filter |
|
553 CLiwDefaultMap* folderFilter = CLiwDefaultMap::NewLC(); |
|
554 folderFilter->InsertL( KTypeAttrName8, TLiwVariant( KMenuFolder ) ); // Folders |
|
555 |
|
556 folderFilter->InsertL( KHidden8, TLiwVariant( TBool(EFalse) ) ); // Not Hidden |
|
557 folderFilter->InsertL( KDeleteLocked8, TLiwVariant( TBool(EFalse) ) ); // Not locked |
|
558 |
|
559 // Fill GetList input param list |
|
560 InsertToLiwListL(iGetListInParam, KFilter8, folderFilter); |
|
561 |
|
562 CleanupStack::PopAndDestroy(folderFilter); |
|
563 } |
|
564 |
|
565 // --------------------------------------------------------------------------- |
|
566 // |
|
567 // --------------------------------------------------------------------------- |
|
568 // |
|
569 void CMmFolderCommand::PrepareGetListFilterL() |
|
570 { |
|
571 // Specify GetList filter |
|
572 CLiwDefaultMap* folderFilter = CLiwDefaultMap::NewLC(); |
|
573 |
|
574 folderFilter->InsertL( KHidden8, TLiwVariant( TBool(EFalse) ) ); // Not Hidden |
|
575 folderFilter->InsertL( KMissing8, TLiwVariant( TBool(EFalse) ) ); // Not Missing |
|
576 |
|
577 // Fill GetList input param list |
|
578 InsertToLiwListL(iGetListInParam, KFilter8, folderFilter); |
|
579 |
|
580 CleanupStack::PopAndDestroy(folderFilter); |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // |
|
585 // --------------------------------------------------------------------------- |
|
586 // |
|
587 void CMmFolderCommand::InsertToLiwListL(CLiwGenericParamList* aList, |
|
588 const TDesC8& aKey, const CLiwDefaultMap* aMap) |
|
589 { |
|
590 TLiwVariant liwVar; |
|
591 liwVar.Set( aMap ); |
|
592 liwVar.PushL(); |
|
593 TLiwGenericParam livGenParam( aKey, liwVar ); |
|
594 livGenParam.PushL(); |
|
595 aList->AppendL ( livGenParam ); |
|
596 CleanupStack::PopAndDestroy( &livGenParam ); |
|
597 CleanupStack::PopAndDestroy( &liwVar ); |
|
598 } |
|
599 |
|
600 // --------------------------------------------------------------------------- |
|
601 // |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 void CMmFolderCommand::ExternalizeInputListL() |
|
605 { |
|
606 iSerializedInputList.Close(); |
|
607 iSerializedOutputList.Close(); |
|
608 iSerializedInputList.CreateL( iGetListInParam->Size() ); |
|
609 RDesWriteStream datastrm( iSerializedInputList ); |
|
610 CleanupClosePushL(datastrm); |
|
611 iGetListInParam->ExternalizeL(datastrm); |
|
612 datastrm.CommitL(); |
|
613 CleanupStack::PopAndDestroy(&datastrm); |
|
614 } |
|
615 |
|
616 // --------------------------------------------------------------------------- |
|
617 // |
|
618 // --------------------------------------------------------------------------- |
|
619 // |
|
620 void CMmFolderCommand::InternalizeOutputListL() |
|
621 { |
|
622 iGetListOutParam->Reset(); |
|
623 if (iSerializedOutputList.Size()) |
|
624 { |
|
625 RDesReadStream stream( iSerializedOutputList ); |
|
626 CleanupClosePushL( stream ); |
|
627 iGetListOutParam->InternalizeL( stream ) ; |
|
628 CleanupStack::PopAndDestroy(&stream); |
|
629 } |
|
630 } |
|
631 |
|
632 |
|
633 // --------------------------------------------------------------------------- |
|
634 // |
|
635 // --------------------------------------------------------------------------- |
|
636 // |
|
637 TInt CMmFolderCommand::GetIntL( |
|
638 const CLiwGenericParamList& aParam, const TDesC8& aPath ) |
|
639 { |
|
640 TInt pos( 0 ); |
|
641 const TLiwGenericParam* param = aParam.FindFirst( pos, aPath ); |
|
642 if( pos != KErrNotFound && param ) |
|
643 { |
|
644 return param->Value().AsTInt32(); |
|
645 } |
|
646 return KErrNotFound; |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------------------------- |
|
650 // |
|
651 // --------------------------------------------------------------------------- |
|
652 // |
|
653 TPtrC CMmFolderCommand::GetStringL( |
|
654 const CLiwGenericParamList& aParam, const TDesC8& aPath ) |
|
655 { |
|
656 TInt pos( 0 ); |
|
657 const TLiwGenericParam* param = aParam.FindFirst( pos, aPath ); |
|
658 if( pos != KErrNotFound && param ) |
|
659 { |
|
660 return param->Value().AsDes(); |
|
661 } |
|
662 TPtrC ret( KNullDesC16 ); |
|
663 return ret; |
|
664 } |
|
665 |
|
666 // --------------------------------------------------------------------------- |
|
667 // |
|
668 // --------------------------------------------------------------------------- |
|
669 // |
|
670 TBool CMmFolderCommand::GetBoolL( |
|
671 const CLiwGenericParamList& aParam, const TDesC8& aPath ) |
|
672 { |
|
673 TInt pos( 0 ); |
|
674 const TLiwGenericParam* param = aParam.FindFirst( pos, aPath ); |
|
675 if( pos != KErrNotFound && param ) |
|
676 { |
|
677 return param->Value().AsTBool(); |
|
678 } |
|
679 return EFalse; |
|
680 } |
|
681 |
|
682 // end of file |
|