serviceproviders/sapi_calendar/src/calendariterableimpl.cpp
changeset 19 989d2f495d90
child 50 5dae2c62e9b6
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     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 the License "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:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include "calendariterableimpl.h"
       
    19 #include "calendarconstants.h"
       
    20 #include "calendarinterface.h"
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // Two-Phase constructor
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 CIterableCalendarList* CIterableCalendarList::NewL( CDesCArray* aList )
       
    27 	{
       
    28 	return new(ELeave) CIterableCalendarList( aList );
       
    29 	}
       
    30 	
       
    31 // ---------------------------------------------------------------------------
       
    32 // Destructor
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CIterableCalendarList::~CIterableCalendarList()
       
    36 	{
       
    37 	if( iList )
       
    38 		{
       
    39 		iList->Reset();
       
    40 		delete iList;
       
    41 		}
       
    42 	
       
    43 	}
       
    44 	
       
    45 // ---------------------------------------------------------------------------
       
    46 // Reset the list
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 void CIterableCalendarList::Reset()
       
    50 	{
       
    51 	iIndex = 0;
       
    52 	}
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // Gets next element in list
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 TBool CIterableCalendarList::NextL(TLiwVariant& aNext)
       
    59 	{
       
    60 	TBool retValue = EFalse;
       
    61 	if ( iList && iList->Count() > iIndex )
       
    62 		{
       
    63 		aNext.SetL( (*iList)[iIndex] );
       
    64 		iIndex++;
       
    65 		retValue = ETrue;
       
    66 		}
       
    67 	return retValue;
       
    68 	}
       
    69 
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // Constructor
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 CIterableCalendarList::CIterableCalendarList(CDesCArray* aList):
       
    76 	iList( aList )
       
    77 	{
       
    78 	}
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // Two-Phase constructor
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 CIterableCalEntryList* CIterableCalEntryList::NewL( CCalendarInterface& aInterface, 
       
    86 													const TDesC& aCalendarName,
       
    87 													const TBool aIsEntryList )
       
    88 	{
       
    89 	CIterableCalEntryList* self = new(ELeave) CIterableCalEntryList( aInterface, aIsEntryList );
       
    90 	CleanupStack::PushL(  TCleanupItem(CCalendarInterface::CleanupIterableCalEntry, self ) );
       
    91 	self->ConstructL(aCalendarName);
       
    92 	CleanupStack::Pop();
       
    93 	return self;
       
    94 	}
       
    95 	
       
    96 // ---------------------------------------------------------------------------
       
    97 // Two-Phase constructor
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 void CIterableCalEntryList::ConstructL( const TDesC& aCalendarName )
       
   101 	{
       
   102 	if( aCalendarName.Length() )
       
   103 		iCalendarName = aCalendarName.AllocL();
       
   104 	}
       
   105 	
       
   106 // ---------------------------------------------------------------------------
       
   107 // Destructor
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 CIterableCalEntryList::~CIterableCalEntryList()
       
   111 	{
       
   112 	if ( !iIsResourceFree )
       
   113 		{
       
   114 		iInterface.RemoveCalEntryListFromArray( this );
       
   115 		iInstanceList.ResetAndDestroy();
       
   116 		iEntryList.ResetAndDestroy();
       
   117 		}
       
   118 		
       
   119 	delete iCalendarName;	
       
   120 	}
       
   121 	
       
   122 // ---------------------------------------------------------------------------
       
   123 // Constructor
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 CIterableCalEntryList::CIterableCalEntryList( CCalendarInterface& aInterface, 
       
   127 												const TBool aIsEntryList ):
       
   128 	iIsEntryList( aIsEntryList ),
       
   129 	iInterface( aInterface )
       
   130 	{
       
   131 	}
       
   132 
       
   133 // ---------------------------------------------------------------------------
       
   134 // Reset the list
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CIterableCalEntryList::Reset()
       
   138 	{
       
   139 	iIndex = 0;
       
   140 	}
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // Gets next element in list
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 TBool CIterableCalEntryList::NextL(TLiwVariant& aNext)
       
   147 	{
       
   148 	TBool retValue = EFalse;
       
   149 	
       
   150 	TInt count = iIsEntryList? iEntryList.Count() : iInstanceList.Count();
       
   151 	
       
   152 	if ( count > iIndex )
       
   153 		{
       
   154 		// Create the Map for Instance/Entry and return it. Ownership is also passed to User.
       
   155 		if( iIsEntryList )
       
   156 			{
       
   157 			CLiwCalEntryMap* entryMap = CLiwCalEntryMap::NewL( iEntryList[iIndex] );
       
   158 			CleanupClosePushL( *entryMap );
       
   159 			aNext.SetL( entryMap );
       
   160 			CleanupStack::PopAndDestroy( entryMap );
       
   161 			}
       
   162 		else
       
   163 			{
       
   164 			CLiwCalEntryMap* instanceMap = CLiwCalEntryMap::NewL( iInstanceList[iIndex] );
       
   165 			CleanupClosePushL( *instanceMap );
       
   166 			aNext.SetL( instanceMap );
       
   167 			CleanupStack::PopAndDestroy( instanceMap );
       
   168 			}	
       
   169 		iIndex++;
       
   170 		retValue = ETrue;
       
   171 		}
       
   172 	return retValue;
       
   173 	}
       
   174 
       
   175 // ---------------------------------------------------------------------------
       
   176 // Return reference of the collection Entries.
       
   177 // ---------------------------------------------------------------------------
       
   178 //
       
   179 RPointerArray<CCalEntry>& CIterableCalEntryList::EntryArray()
       
   180 	{
       
   181 	return iEntryList;
       
   182 	}
       
   183 
       
   184 // ---------------------------------------------------------------------------
       
   185 // Return reference of the collection Instances.
       
   186 // ---------------------------------------------------------------------------
       
   187 //
       
   188 RPointerArray<CCalInstance>& CIterableCalEntryList::InstanceArray()
       
   189 	{
       
   190 	return iInstanceList;
       
   191 	}
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // Free the resources held by this Iterator
       
   195 // ---------------------------------------------------------------------------
       
   196 //
       
   197 void CIterableCalEntryList::SetResourceFree()
       
   198 	{
       
   199 	iInstanceList.ResetAndDestroy();
       
   200 	iEntryList.ResetAndDestroy();
       
   201 	iIsResourceFree = ETrue;
       
   202 	}
       
   203 
       
   204 // ---------------------------------------------------------------------------
       
   205 // Returns calendar name
       
   206 // ---------------------------------------------------------------------------
       
   207 //
       
   208 TPtrC CIterableCalEntryList::CalendarName()
       
   209 	{
       
   210 	return iCalendarName ? TPtrC( *iCalendarName ) : TPtrC();
       
   211 	}
       
   212 
       
   213 		
       
   214 // ---------------------------------------------------------------------------
       
   215 // Two-Phase constructor
       
   216 // ---------------------------------------------------------------------------
       
   217 //
       
   218 CLiwCalEntryMap* CLiwCalEntryMap::NewL( CCalEntry* aCalEntry )
       
   219     {
       
   220     CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
       
   221     CLiwCalEntryMap* tempMap = new (ELeave) CLiwCalEntryMap(gl, aCalEntry );
       
   222     CleanupStack::Pop(gl); 
       
   223     return tempMap;
       
   224     }
       
   225 
       
   226 // ---------------------------------------------------------------------------
       
   227 // Two-Phase constructor
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230 CLiwCalEntryMap* CLiwCalEntryMap::NewL( CCalInstance* aCalInstance )
       
   231     {
       
   232     CLiwGenericParamList* gl = CLiwGenericParamList::NewLC();
       
   233     CLiwCalEntryMap* tempMap = new (ELeave) CLiwCalEntryMap(gl, aCalInstance );
       
   234     CleanupStack::Pop(gl); 
       
   235     return tempMap;
       
   236     }
       
   237 
       
   238 // ---------------------------------------------------------------------------
       
   239 // Destructor
       
   240 // ---------------------------------------------------------------------------
       
   241 //
       
   242 CLiwCalEntryMap::~CLiwCalEntryMap()
       
   243     {
       
   244     delete iMap;
       
   245     }
       
   246 
       
   247 // ---------------------------------------------------------------------------
       
   248 // Inserts a key-value pair element to the map collection. If key already existes,
       
   249 // it is removed
       
   250 // ---------------------------------------------------------------------------
       
   251 //
       
   252 void CLiwCalEntryMap::InsertL(const TDesC8& aKey, const TLiwVariant& aValue)
       
   253     {
       
   254     Remove(aKey);
       
   255     TLiwGenericParam mp;
       
   256     mp.SetNameAndValueL(aKey, aValue);
       
   257     iMap->AppendL(mp);
       
   258     mp.Reset();
       
   259     }
       
   260 
       
   261 // ---------------------------------------------------------------------------
       
   262 // Adds Meeting entry elements  to the Map is it doesnot exist already
       
   263 // ---------------------------------------------------------------------------
       
   264 //
       
   265 void CLiwCalEntryMap::PopulateMeetingKeyL( CLiwCalEntryMap* aMap, const TDesC8& aKey )
       
   266 	{
       
   267 	// Instance Specific attributes
       
   268 	if ( aKey.CompareF( KInstStartTime ) == 0 )
       
   269 		{
       
   270 		if ( !aMap->iIsEntry && aMap->iCalInstance )
       
   271 			{
       
   272 			aMap->InsertL( KInstStartTime, TLiwVariant( aMap->iCalInstance->StartTimeL().TimeUtcL() ));
       
   273 			}
       
   274 		}
       
   275 		
       
   276 	else if ( aKey.CompareF( KInstEndTime ) == 0 )	
       
   277 		{
       
   278 		if ( !aMap->iIsEntry && aMap->iCalInstance )
       
   279 			{
       
   280 			aMap->InsertL( KInstEndTime, TLiwVariant( aMap->iCalInstance->EndTimeL().TimeUtcL() ));
       
   281 			}
       
   282 		}
       
   283 	else if(  aKey.CompareF( KSeqNum ) == 0 )	
       
   284 		{
       
   285 		aMap->InsertL( KSeqNum, TLiwVariant( TInt32( aMap->iCalEntry->SequenceNumberL() ) ));
       
   286 		}
       
   287 		
       
   288 	else if(  aKey.CompareF( KLocation ) == 0 )	
       
   289 		{
       
   290 		aMap->InsertL( KLocation, TLiwVariant( aMap->iCalEntry->LocationL() ) );
       
   291 		}
       
   292 		
       
   293 	else if(  aKey.CompareF( KRepeatDates ) == 0 )	
       
   294 		{
       
   295 		RArray<TCalTime> rdates;
       
   296 		aMap->iCalEntry->GetRDatesL( rdates );
       
   297 		if ( rdates.Count() > 0 )
       
   298 			{
       
   299     		CLiwDefaultList* dateList = CCalendarInterface::GetDatesListL( rdates );
       
   300 			aMap->InsertL( KRepeatDates, TLiwVariant( dateList ) );
       
   301 			dateList->DecRef();
       
   302 			}
       
   303 		rdates.Reset();
       
   304 		}
       
   305 		
       
   306 	else if(  aKey.CompareF( KExceptionDates ) == 0 )	
       
   307 		{
       
   308 		RArray<TCalTime> rdates;
       
   309 		aMap->iCalEntry->GetExceptionDatesL( rdates );
       
   310 		if ( rdates.Count() > 0 )
       
   311 			{
       
   312     		CLiwDefaultList* dateList = CCalendarInterface::GetDatesListL( rdates );
       
   313 			aMap->InsertL( KRepeatDates, TLiwVariant( dateList ) );
       
   314 			dateList->DecRef();
       
   315 			}
       
   316 		rdates.Reset();
       
   317 		}
       
   318 		
       
   319  	else if(  aKey.CompareF( KMethod ) == 0 )	
       
   320 		{
       
   321 		aMap->InsertL( KMethod, TLiwVariant( CCalendarInterface::GetMethodL( aMap->iCalEntry->MethodL() ) ));
       
   322 		}
       
   323 		
       
   324  	else if(  aKey.CompareF( KPhoneOwner ) == 0 )	
       
   325 		{
       
   326 		CCalUser* phoneOwner = aMap->iCalEntry->PhoneOwnerL();
       
   327 		if ( phoneOwner )
       
   328 			{
       
   329 			aMap->InsertL( KPhoneOwner, TLiwVariant( phoneOwner->Address() ) );
       
   330 			}
       
   331 		}
       
   332 		
       
   333  	else if(  aKey.CompareF( KOrganizer ) == 0 )	
       
   334 		{
       
   335 		CCalUser* orgraniser = aMap->iCalEntry->OrganizerL();
       
   336 		if ( orgraniser )
       
   337 			{
       
   338     		CLiwDefaultMap* ownerMap = CCalendarInterface::GetCalUserL( orgraniser );
       
   339 			aMap->InsertL( KOrganizer, TLiwVariant( ownerMap ) );
       
   340 			ownerMap->DecRef(); 
       
   341 			}
       
   342 		}
       
   343 		
       
   344  	else if(  aKey.CompareF( KAttendeeList ) == 0 )	
       
   345 		{
       
   346 		RPointerArray< CCalAttendee >& attendeeList = aMap->iCalEntry->AttendeesL();
       
   347 		TInt count = attendeeList.Count();
       
   348 		if ( count > 0 )
       
   349 			{
       
   350 	    	CLiwDefaultList* attendList = CLiwDefaultList::NewL();
       
   351 
       
   352 	    	CleanupClosePushL( *attendList );
       
   353 	    	
       
   354 			for ( TInt index = 0; index < count; index++ )
       
   355 				{
       
   356 	    		CLiwDefaultMap* attendMap = CCalendarInterface::GetCalUserL( attendeeList[index], ETrue );
       
   357 				attendList->AppendL( TLiwVariant ( attendMap ) );
       
   358 				attendMap->DecRef(); 
       
   359 				}
       
   360 				
       
   361 			aMap->InsertL( KAttendeeList, TLiwVariant( attendList ) );
       
   362 
       
   363 	    	CleanupStack::PopAndDestroy( attendList );
       
   364 			}
       
   365 		}
       
   366 
       
   367  	else if(  aKey.CompareF( KRepeatRule ) == 0 )	
       
   368 		{
       
   369 		TCalRRule repeatRule;
       
   370 		if ( aMap->iCalEntry->GetRRuleL( repeatRule ) )
       
   371 			{
       
   372     		CLiwDefaultMap* rrMap = CCalendarInterface::GetRRMapL( repeatRule );
       
   373     		if ( rrMap )
       
   374     			{
       
   375 				aMap->InsertL( KRepeatRule, TLiwVariant( rrMap ) );
       
   376 				rrMap->DecRef(); 
       
   377     			}
       
   378 			}
       
   379 		}
       
   380 		
       
   381 
       
   382 	}
       
   383 // ---------------------------------------------------------------------------
       
   384 // Adds an element to the Map is it doesnot exist already
       
   385 // ---------------------------------------------------------------------------
       
   386 //
       
   387 void CLiwCalEntryMap::PopulateKeyL( CLiwCalEntryMap* aMap, const TDesC8& aKey )
       
   388 	{
       
   389 	// Entry Specific attributes
       
   390 	if ( aKey.CompareF( KId ) == 0 )
       
   391 		{
       
   392 		HBufC* globalUid = HBufC::NewL( aMap->iCalEntry->UidL().Length() + 1 );
       
   393 		CleanupStack::PushL( globalUid );
       
   394 		globalUid->Des().Copy( aMap->iCalEntry->UidL() );
       
   395 		aMap->InsertL( KId, TLiwVariant( *globalUid ));
       
   396 		CleanupStack::PopAndDestroy( globalUid );
       
   397 		}
       
   398 		
       
   399 	else if ( aKey.CompareF( KLocalId ) == 0 )
       
   400 		{
       
   401 		TBuf<KMaxUidLength> localUid;
       
   402 		localUid.Num(TInt64(aMap->iCalEntry->LocalUidL()));
       
   403 		aMap->InsertL( KLocalId, TLiwVariant( localUid));
       
   404 		}
       
   405 		
       
   406 	else if ( aKey.CompareF( KType ) == 0 )
       
   407 		{
       
   408 		aMap->InsertL( KType, TLiwVariant( CCalendarInterface::GetEntryTypeL( aMap->iCalEntry->EntryTypeL() )));
       
   409 		}
       
   410 		
       
   411 	else if(  aKey.CompareF( KSummary ) == 0 )	
       
   412 		{
       
   413 		aMap->InsertL( KSummary, TLiwVariant( aMap->iCalEntry->SummaryL() ));
       
   414 		}
       
   415 		
       
   416 	else if(  aKey.CompareF( KStartTime ) == 0 )	
       
   417 		{
       
   418 		if( aMap->iCalEntry->EntryTypeL() != CCalEntry::ETodo )
       
   419 			{
       
   420 			if ( !aMap->iIsEntry && aMap->iCalInstance && aMap->iCalEntry->EntryTypeL() == CCalEntry::EAnniv )
       
   421 				{
       
   422 				if ( aMap->iCalInstance->StartTimeL().TimeUtcL() != Time::NullTTime() )
       
   423 					aMap->InsertL( KStartTime, TLiwVariant( aMap->iCalInstance->StartTimeL().TimeUtcL() ));
       
   424 				}
       
   425 			else 
       
   426 				{
       
   427 				if ( aMap->iCalEntry->StartTimeL().TimeUtcL() != Time::NullTTime() )
       
   428 					aMap->InsertL( KStartTime, TLiwVariant( aMap->iCalEntry->StartTimeL().TimeUtcL() ));
       
   429 				}
       
   430 			}
       
   431 		}
       
   432 		
       
   433 	else if(  aKey.CompareF( KEndTime ) == 0 )	
       
   434 		{
       
   435 		if ( ( aMap->iCalEntry->EntryTypeL() == CCalEntry::EAppt ) ||
       
   436 				( aMap->iCalEntry->EntryTypeL() == CCalEntry::ETodo ) ||
       
   437 				( aMap->iCalEntry->EntryTypeL() == CCalEntry::EEvent ) )
       
   438 			{
       
   439 			if ( aMap->iCalEntry->EndTimeL().TimeUtcL() != Time::NullTTime() )
       
   440 				aMap->InsertL( KEndTime, TLiwVariant( aMap->iCalEntry->EndTimeL().TimeUtcL() ));
       
   441 			}
       
   442 		}
       
   443 		
       
   444 	else if(  aKey.CompareF( KReplication ) == 0 )	
       
   445 		{
       
   446 		aMap->InsertL( KReplication, TLiwVariant( CCalendarInterface::GetReplicationL( aMap->iCalEntry->ReplicationStatusL() ) ));
       
   447 		}
       
   448 		
       
   449 	else if(  aKey.CompareF( KDescription ) == 0 )	
       
   450 		{
       
   451 		aMap->InsertL( KDescription, TLiwVariant( aMap->iCalEntry->DescriptionL() ));
       
   452 		}
       
   453 		
       
   454 	else if(  aKey.CompareF( KPriority ) == 0 )	
       
   455 		{
       
   456 		aMap->InsertL( KPriority, TLiwVariant( TInt32( aMap->iCalEntry->PriorityL() ) ));
       
   457 		}
       
   458 		
       
   459 	else if(  aKey.CompareF( KAlarmTime ) == 0 )	
       
   460 		{
       
   461 		CCalAlarm* alarm = aMap->iCalEntry->AlarmL();
       
   462 		if ( alarm )
       
   463 			{
       
   464 			CleanupStack::PushL( alarm );
       
   465 			
       
   466 			TTimeIntervalMinutes offset = alarm->TimeOffset();
       
   467 			TTime stTime;
       
   468 			if ( aMap->iIsEntry )
       
   469 				{
       
   470 				stTime = aMap->iCalEntry->StartTimeL().TimeUtcL();
       
   471 				}
       
   472 			else
       
   473 				{
       
   474 				stTime = aMap->iCalInstance->StartTimeL().TimeUtcL();
       
   475 				}
       
   476 			
       
   477 			stTime -= offset;
       
   478 	
       
   479 			aMap->InsertL( KAlarmTime, TLiwVariant( stTime ));
       
   480 
       
   481 			CleanupStack::PopAndDestroy( alarm );
       
   482 			}
       
   483 		}
       
   484 		
       
   485 	else if(  aKey.CompareF( KStatus ) == 0 )	
       
   486 		{
       
   487 		if ( ( aMap->iCalEntry->EntryTypeL() == CCalEntry::EAppt ) &&
       
   488 				( aMap->iCalEntry->EntryTypeL() == CCalEntry::ETodo ))
       
   489 			{
       
   490 			aMap->InsertL( KStatus, TLiwVariant( CCalendarInterface::GetStatusL( aMap->iCalEntry->StatusL() ) ) );
       
   491 			}
       
   492 		}
       
   493 		
       
   494 	if ( aMap->iCalEntry->EntryTypeL() == CCalEntry::EAppt )
       
   495 		{
       
   496 		PopulateMeetingKeyL( aMap, aKey);
       
   497 		}
       
   498 	}
       
   499 	
       
   500 // ---------------------------------------------------------------------------
       
   501 // Finds a value stored in the map collection based on the key.
       
   502 // ---------------------------------------------------------------------------
       
   503 //
       
   504 TBool CLiwCalEntryMap::FindL(const TDesC8& aKey, TLiwVariant& aValue) const
       
   505     {
       
   506     TInt pos = 0;
       
   507     const TLiwGenericParam* tempParam = iMap->FindFirst(pos, aKey);
       
   508     if ( tempParam )
       
   509         {
       
   510         aValue.SetL(tempParam->Value());
       
   511         return ETrue;
       
   512         }
       
   513     else
       
   514     	{
       
   515     	PopulateKeyL( (CLiwCalEntryMap*)this, aKey );
       
   516     	}
       
   517     	
       
   518 	pos = 0;
       
   519 	tempParam = iMap->FindFirst( pos, aKey );
       
   520 	
       
   521 	if ( tempParam )
       
   522 		{
       
   523         aValue.SetL(tempParam->Value());
       
   524         return ETrue;
       
   525 		}
       
   526 
       
   527     return EFalse;
       
   528     }
       
   529 
       
   530 // ---------------------------------------------------------------------------
       
   531 // Returns the number of key-value pair stored in the map collection.
       
   532 // ---------------------------------------------------------------------------
       
   533 //
       
   534 TInt CLiwCalEntryMap::Count() const
       
   535     {
       
   536     return iMap->Count();
       
   537     }
       
   538 
       
   539 // ---------------------------------------------------------------------------
       
   540 // Returns the key stored at a specified index. 
       
   541 // ---------------------------------------------------------------------------
       
   542 //
       
   543 TBool CLiwCalEntryMap::AtL(TInt aIndex, TDes8& aKey) const
       
   544     {
       
   545     if(0 <= aIndex && aIndex < iMap->Count())
       
   546         {
       
   547         aKey = ((*iMap)[aIndex]).Name();
       
   548         return ETrue;   
       
   549         }
       
   550     else
       
   551         {
       
   552         return EFalse;  
       
   553         }
       
   554     }
       
   555 
       
   556 // ---------------------------------------------------------------------------
       
   557 // Removes a key from the map collection.
       
   558 // ---------------------------------------------------------------------------
       
   559 //
       
   560 void CLiwCalEntryMap::Remove(const TDesC8& aKey)
       
   561     {
       
   562     iMap->Remove( aKey );
       
   563     }
       
   564 
       
   565 	
       
   566 	
       
   567 // ---------------------------------------------------------------------------
       
   568 // Two-Phase constructor
       
   569 // ---------------------------------------------------------------------------
       
   570 //
       
   571 CIterableUIDMapList* CIterableUIDMapList::NewL( CLiwDefaultList *aUIDMapList )
       
   572 	{
       
   573 	return new(ELeave) CIterableUIDMapList( aUIDMapList );
       
   574 	}
       
   575 	
       
   576 // ---------------------------------------------------------------------------
       
   577 // Destructor
       
   578 // ---------------------------------------------------------------------------
       
   579 //
       
   580 CIterableUIDMapList::~CIterableUIDMapList()
       
   581 	{
       
   582 	if( iUIDMapList )
       
   583 		{
       
   584 		iUIDMapList->DecRef(); 
       
   585 		}
       
   586 	}
       
   587 	
       
   588 // ---------------------------------------------------------------------------
       
   589 // Reset the list
       
   590 // ---------------------------------------------------------------------------
       
   591 //
       
   592 void CIterableUIDMapList::Reset()
       
   593 	{
       
   594 	iIndex = 0;
       
   595 	}
       
   596 
       
   597 // ---------------------------------------------------------------------------
       
   598 // Gets next element in list
       
   599 // ---------------------------------------------------------------------------
       
   600 //
       
   601 TBool CIterableUIDMapList::NextL(TLiwVariant& aNext)
       
   602 	{
       
   603 	TBool retValue = EFalse;
       
   604 	if ( iUIDMapList && iUIDMapList->Count() > iIndex )
       
   605 		{
       
   606 		iUIDMapList->AtL( iIndex++, aNext); 
       
   607 		retValue = ETrue;
       
   608 		}
       
   609 	return retValue;
       
   610 	}
       
   611 
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 // Constructor
       
   615 // ---------------------------------------------------------------------------
       
   616 //
       
   617 CIterableUIDMapList::CIterableUIDMapList( CLiwDefaultList *aUIDMapList ):
       
   618 	 iUIDMapList( aUIDMapList ), iIndex( 0 )
       
   619 	{
       
   620 	}