phonebookui/Phonebook2/Presentation/src/CPbk2StoreConfigurationImpl.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-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 "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 
       
    19 // INCLUDE FILES
       
    20 #include "CPbk2StoreConfigurationImpl.h"
       
    21 
       
    22 // Phonebook2
       
    23 #include "CPbk2StoreConfigurationMonitor.h"
       
    24 #include "CPbk2DefaultSavingStoreMonitor.h"
       
    25 #include <Phonebook2InternalCRKeys.h>
       
    26 
       
    27 // Virtual Phonebook
       
    28 #include <TVPbkContactStoreUriPtr.h>
       
    29 #include <CVPbkContactStoreUriArray.h>
       
    30 
       
    31 // System includes
       
    32 #include <centralrepository.h>
       
    33 
       
    34 // Debugging headers
       
    35 #include <Pbk2Debug.h>
       
    36 
       
    37 // Unnamed namespace for local definitions
       
    38 namespace {
       
    39 
       
    40 // Definition for contact initial contact store uri size
       
    41 const TInt KInitialStoreUriSize = 1;
       
    42 
       
    43 } // namespace
       
    44 
       
    45 
       
    46 // --------------------------------------------------------------------------
       
    47 // CPbk2StoreConfigurationImpl::CPbk2StoreConfigurationImpl
       
    48 // --------------------------------------------------------------------------
       
    49 //
       
    50 CPbk2StoreConfigurationImpl::CPbk2StoreConfigurationImpl()
       
    51     {
       
    52     }
       
    53 
       
    54 // --------------------------------------------------------------------------
       
    55 // CPbk2StoreConfigurationImpl::~CPbk2StoreConfigurationImpl
       
    56 // --------------------------------------------------------------------------
       
    57 //
       
    58 CPbk2StoreConfigurationImpl::~CPbk2StoreConfigurationImpl()
       
    59     {
       
    60     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
    61         ("CPbk2StoreConfigurationImpl::~CPbk2StoreConfigurationImpl(0x%x)"), this);
       
    62 
       
    63     iObservers.Reset();
       
    64     iDefaultStoreObservers.Reset();
       
    65     delete iDefaultSavingStoreMonitor;
       
    66     delete iConfigurationMonitor;
       
    67     delete iRepository;
       
    68     }
       
    69 
       
    70 // --------------------------------------------------------------------------
       
    71 // CPbk2StoreConfigurationImpl::NewL
       
    72 // --------------------------------------------------------------------------
       
    73 //
       
    74 CPbk2StoreConfigurationImpl* CPbk2StoreConfigurationImpl::NewL()
       
    75     {
       
    76     CPbk2StoreConfigurationImpl* self = new(ELeave) CPbk2StoreConfigurationImpl;
       
    77     CleanupStack::PushL(self);
       
    78     self->ConstructL();
       
    79     CleanupStack::Pop(self);
       
    80     return self;
       
    81     }
       
    82 
       
    83 // --------------------------------------------------------------------------
       
    84 // CPbk2StoreConfigurationImpl::ConstructL
       
    85 // --------------------------------------------------------------------------
       
    86 //
       
    87 void CPbk2StoreConfigurationImpl::ConstructL()
       
    88     {
       
    89     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
    90         ("CPbk2StoreConfigurationImpl::ConstructL(0x%x)"), this);
       
    91 
       
    92     iRepository = CRepository::NewL
       
    93         (TUid::Uid(KCRUidPhonebookStoreConfiguration));
       
    94 
       
    95     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
    96         ("CPbk2StoreConfigurationImpl::ConstructL(0x%x) Repository created"), this);
       
    97 
       
    98     iConfigurationMonitor = CPbk2StoreConfigurationMonitor::NewL
       
    99         ( *iRepository, *this );
       
   100 
       
   101     iDefaultSavingStoreMonitor = CPbk2DefaultSavingStoreMonitor::NewL
       
   102         ( *iRepository, *this );
       
   103 
       
   104     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   105         ("CPbk2StoreConfigurationImpl::ConstructL(0x%x) end"), this);
       
   106     }
       
   107 
       
   108 // --------------------------------------------------------------------------
       
   109 // CPbk2StoreConfigurationImpl::CurrentConfigurationL
       
   110 // --------------------------------------------------------------------------
       
   111 //
       
   112 CVPbkContactStoreUriArray*
       
   113         CPbk2StoreConfigurationImpl::CurrentConfigurationL() const
       
   114     {
       
   115     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   116         ("CPbk2StoreConfigurationImpl::CurrentConfigurationL(0x%x)"), this);
       
   117 
       
   118     CVPbkContactStoreUriArray* result = CVPbkContactStoreUriArray::NewLC();
       
   119 
       
   120     RArray<TUint32> configurationKeys;
       
   121     CleanupClosePushL(configurationKeys);
       
   122 
       
   123     iRepository->FindL(KPhonebookCurrentConfigurationPartialKey,
       
   124             KPhonebookCurrentConfigurationMask,
       
   125             configurationKeys);
       
   126 
       
   127     HBufC* buffer = HBufC::NewLC(KInitialStoreUriSize);
       
   128     const TInt keyCount = configurationKeys.Count();
       
   129     for (TInt i = 0; i < keyCount; ++i)
       
   130         {
       
   131         TPtr ptr = buffer->Des();
       
   132         ptr.Zero();
       
   133         TInt actualSize = 0;
       
   134         TInt ret = iRepository->Get(configurationKeys[i], ptr, actualSize);
       
   135         if (ret == KErrOverflow)
       
   136             {
       
   137             CleanupStack::PopAndDestroy(); // buffer
       
   138             buffer = HBufC::NewLC(actualSize);
       
   139             ptr.Set(buffer->Des());
       
   140             User::LeaveIfError(iRepository->Get(configurationKeys[i], ptr));
       
   141             }
       
   142         else
       
   143             {
       
   144             User::LeaveIfError(ret);
       
   145             }
       
   146         if( !result->IsIncluded( TVPbkContactStoreUriPtr( ptr ) ) )  // Only append if the uri is not yet included
       
   147             {
       
   148             result->AppendL( ptr );
       
   149             }
       
   150 
       
   151         }
       
   152     CleanupStack::PopAndDestroy(); // buffer
       
   153 
       
   154     CleanupStack::PopAndDestroy(); // configurationKeys
       
   155     CleanupStack::Pop(result); // result
       
   156 
       
   157     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   158         ("CPbk2StoreConfigurationImpl::CurrentConfigurationL(0x%x) end"), this);
       
   159 
       
   160     return result;
       
   161     }
       
   162 
       
   163 // --------------------------------------------------------------------------
       
   164 // CPbk2StoreConfigurationImpl::SearchStoreConfigurationL
       
   165 // --------------------------------------------------------------------------
       
   166 //
       
   167 CVPbkContactStoreUriArray*
       
   168         CPbk2StoreConfigurationImpl::SearchStoreConfigurationL()
       
   169     {
       
   170     CVPbkContactStoreUriArray* result = CVPbkContactStoreUriArray::NewLC();
       
   171 
       
   172     // The default saving store shall be appended to the result array
       
   173     // as an first element, when it becomes available
       
   174 
       
   175     // Finally append the current Phonebook configuration for searching
       
   176     CVPbkContactStoreUriArray* currentConfiguration = CurrentConfigurationL();
       
   177     CleanupStack::PushL(currentConfiguration);
       
   178     result->AppendAllL(*currentConfiguration);
       
   179     CleanupStack::PopAndDestroy(currentConfiguration);
       
   180     CleanupStack::Pop(result);
       
   181     return result;
       
   182     }
       
   183 
       
   184 // --------------------------------------------------------------------------
       
   185 // CPbk2StoreConfigurationImpl::SupportedStoreConfigurationL
       
   186 // --------------------------------------------------------------------------
       
   187 //
       
   188 CVPbkContactStoreUriArray*
       
   189         CPbk2StoreConfigurationImpl::SupportedStoreConfigurationL() const
       
   190     {
       
   191     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   192         ("CPbk2StoreConfigurationImpl::SupportedStoreConfigurationL(0x%x)"), this);
       
   193 
       
   194     CVPbkContactStoreUriArray* result = CVPbkContactStoreUriArray::NewLC();
       
   195 
       
   196     RArray<TUint32> configurationKeys;
       
   197     CleanupClosePushL( configurationKeys );
       
   198 
       
   199     User::LeaveIfError( iRepository->FindL(
       
   200                             KPhonebookSupportedConfigurationPartialKey,
       
   201                             KPhonebookSupportedConfigurationMask,
       
   202                             configurationKeys ) );
       
   203 
       
   204     HBufC* buffer = HBufC::NewLC(KInitialStoreUriSize);
       
   205     const TInt keyCount = configurationKeys.Count();
       
   206     for (TInt i = 0; i < keyCount; ++i)
       
   207         {
       
   208         TPtr ptr = buffer->Des();
       
   209         ptr.Zero();
       
   210         TInt actualSize = 0;
       
   211         TInt ret = iRepository->Get(configurationKeys[i], ptr, actualSize);
       
   212         if (ret == KErrOverflow)
       
   213             {
       
   214             CleanupStack::PopAndDestroy(); // buffer
       
   215             buffer = HBufC::NewLC(actualSize);
       
   216             ptr.Set(buffer->Des());
       
   217             User::LeaveIfError(iRepository->Get(configurationKeys[i], ptr));
       
   218             }
       
   219         else
       
   220             {
       
   221             User::LeaveIfError(ret);
       
   222             }
       
   223         result->AppendL(ptr);
       
   224         }
       
   225     CleanupStack::PopAndDestroy(); // buffer
       
   226 
       
   227     CleanupStack::PopAndDestroy(); // configurationKeys
       
   228     CleanupStack::Pop(result); // result
       
   229 
       
   230     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   231         ("CPbk2StoreConfigurationImpl::SupportedStoreConfigurationL(0x%x) end"), this);
       
   232 
       
   233     return result;
       
   234     }
       
   235 
       
   236 // --------------------------------------------------------------------------
       
   237 // CPbk2StoreConfigurationImpl::DefaultSavingStoreL
       
   238 // --------------------------------------------------------------------------
       
   239 //
       
   240 TVPbkContactStoreUriPtr
       
   241         CPbk2StoreConfigurationImpl::DefaultSavingStoreL() const
       
   242     {
       
   243     return iDefaultSavingStoreMonitor->DefaultSavingStoreL();
       
   244     }
       
   245 
       
   246 // --------------------------------------------------------------------------
       
   247 // CPbk2StoreConfigurationImpl::AddContactStoreURIL
       
   248 // --------------------------------------------------------------------------
       
   249 //
       
   250 void CPbk2StoreConfigurationImpl::AddContactStoreURIL
       
   251         (TVPbkContactStoreUriPtr aURI)
       
   252     {
       
   253     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   254         ("CPbk2StoreConfigurationImpl::AddContactStoreURIL(0x%x)"), this);
       
   255 
       
   256     RArray<TUint32> configurationKeys;
       
   257     CleanupClosePushL(configurationKeys);
       
   258 
       
   259     iRepository->FindL(
       
   260             KPhonebookCurrentConfigurationPartialKey,
       
   261             KPhonebookCurrentConfigurationMask,
       
   262             configurationKeys);
       
   263 
       
   264     if ( AlreadyRegisteredL( aURI, configurationKeys ) )
       
   265         {
       
   266         User::Leave( KErrAlreadyExists );
       
   267         }
       
   268 
       
   269     // Find the first free key starting from
       
   270     // KPhonebookCurrentConfigurationFirstKey
       
   271     TBool keyFound = EFalse;
       
   272     TUint32 newKey = KPhonebookCurrentConfigurationFirstKey;
       
   273     for (TInt i = KPhonebookCurrentConfigurationFirstKey;
       
   274         i < KPhonebookCurrentConfigurationLastKey && !keyFound; ++i)
       
   275         {
       
   276         if (configurationKeys.Find(i) == KErrNotFound)
       
   277             {
       
   278             newKey = i;
       
   279             keyFound = ETrue;
       
   280             }
       
   281         }
       
   282 
       
   283     if (!keyFound)
       
   284         {
       
   285         User::Leave(KErrOverflow);
       
   286         }
       
   287 
       
   288     TInt err = iRepository->Create(newKey, aURI.UriDes());
       
   289     User::LeaveIfError(err);
       
   290 
       
   291     CleanupStack::PopAndDestroy(); // configurationKeys
       
   292 
       
   293     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   294         ("CPbk2StoreConfigurationImpl::AddContactStoreURIL(0x%x) end"), this);
       
   295     }
       
   296 
       
   297 // --------------------------------------------------------------------------
       
   298 // CPbk2StoreConfigurationImpl::RemoveContactStoreURIL
       
   299 // --------------------------------------------------------------------------
       
   300 //
       
   301 void CPbk2StoreConfigurationImpl::RemoveContactStoreURIL
       
   302         (TVPbkContactStoreUriPtr aURI)
       
   303     {
       
   304     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   305         ("CPbk2StoreConfigurationImpl::RemoveContactStoreURIL(0x%x)"), this);
       
   306 
       
   307     RArray<TUint32> configurationKeys;
       
   308     CleanupClosePushL(configurationKeys);
       
   309 
       
   310     iRepository->FindEqL(
       
   311             KPhonebookCurrentConfigurationPartialKey,
       
   312             KPhonebookCurrentConfigurationMask,
       
   313             aURI.UriDes(),
       
   314             configurationKeys);
       
   315 
       
   316     const TInt keyCount = configurationKeys.Count();
       
   317     for (TInt i = 0; i < keyCount; ++i)
       
   318         {
       
   319         iRepository->Delete(configurationKeys[i]);
       
   320         }
       
   321     CleanupStack::PopAndDestroy(); // configurationKeys
       
   322 
       
   323     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   324         ("CPbk2StoreConfigurationImpl::RemoveContactStoreURIL(0x%x) end"), this);
       
   325     }
       
   326 
       
   327 // --------------------------------------------------------------------------
       
   328 // CPbk2StoreConfigurationImpl::AddObserverL
       
   329 // --------------------------------------------------------------------------
       
   330 //
       
   331 void CPbk2StoreConfigurationImpl::AddObserverL
       
   332         (MPbk2StoreConfigurationObserver& aObserver)
       
   333     {
       
   334      iObservers.Append( &aObserver );
       
   335     }
       
   336 
       
   337 // --------------------------------------------------------------------------
       
   338 // CPbk2StoreConfigurationImpl::RemoveObserver
       
   339 // --------------------------------------------------------------------------
       
   340 //
       
   341 void CPbk2StoreConfigurationImpl::RemoveObserver
       
   342         (MPbk2StoreConfigurationObserver& aObserver)
       
   343     {
       
   344     TInt index = iObservers.Find(&aObserver);
       
   345     if (index != KErrNotFound)
       
   346         {
       
   347         iObservers.Remove(index);
       
   348         }
       
   349     }
       
   350 
       
   351 // --------------------------------------------------------------------------
       
   352 // CPbk2StoreConfigurationImpl::AddDefaultSavingStoreObserverL
       
   353 // --------------------------------------------------------------------------
       
   354 //
       
   355 void CPbk2StoreConfigurationImpl::AddDefaultSavingStoreObserverL
       
   356         ( MPbk2DefaultSavingStoreObserver& aObserver )
       
   357     {
       
   358     TInt index = iDefaultStoreObservers.Find(&aObserver);
       
   359     if (index == KErrNotFound)
       
   360         {
       
   361         // Insert to the beginning so that the observers will get the
       
   362         // events in the order they have registere
       
   363         // This has to be done because events are sent from last to first
       
   364         // in the ConfigurationChanged function
       
   365         iDefaultStoreObservers.InsertL(&aObserver, 0);
       
   366         }
       
   367     }
       
   368 
       
   369 // --------------------------------------------------------------------------
       
   370 // CPbk2StoreConfigurationImpl::RemoveDefaultSavingStoreObserver
       
   371 // --------------------------------------------------------------------------
       
   372 //
       
   373 void CPbk2StoreConfigurationImpl::RemoveDefaultSavingStoreObserver
       
   374         ( MPbk2DefaultSavingStoreObserver& aObserver )
       
   375     {
       
   376     TInt index = iDefaultStoreObservers.Find(&aObserver);
       
   377     if (index != KErrNotFound)
       
   378         {
       
   379         iDefaultStoreObservers.Remove(index);
       
   380         }
       
   381     }
       
   382 
       
   383 // --------------------------------------------------------------------------
       
   384 // CPbk2StoreConfigurationImpl::AddSupportedContactStoreURIL
       
   385 // --------------------------------------------------------------------------
       
   386 //
       
   387 void CPbk2StoreConfigurationImpl::AddSupportedContactStoreURIL
       
   388         ( TVPbkContactStoreUriPtr aURI )
       
   389     {
       
   390     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   391         ("CPbk2StoreConfigurationImpl::AddSupportedContactStoreURIL(0x%x)"), this);
       
   392 
       
   393     RArray<TUint32> configurationKeys;
       
   394     CleanupClosePushL(configurationKeys);
       
   395 
       
   396     iRepository->FindL(
       
   397             KPhonebookSupportedConfigurationPartialKey,
       
   398             KPhonebookSupportedConfigurationMask,
       
   399             configurationKeys);
       
   400 
       
   401     if ( AlreadyRegisteredL( aURI, configurationKeys ) )
       
   402         {
       
   403         User::Leave( KErrAlreadyExists );
       
   404         }
       
   405 
       
   406     // Find the first free key starting from
       
   407     // KPhonebookSupportedConfigurationFirstKey
       
   408     TBool keyFound = EFalse;
       
   409     TUint32 newKey = KPhonebookSupportedConfigurationFirstKey;
       
   410     for (TInt i = KPhonebookSupportedConfigurationFirstKey;
       
   411         i < KPhonebookSupportedConfigurationLastKey && !keyFound; ++i)
       
   412         {
       
   413         if (configurationKeys.Find(i) == KErrNotFound)
       
   414             {
       
   415             newKey = i;
       
   416             keyFound = ETrue;
       
   417             }
       
   418         }
       
   419 
       
   420     if (!keyFound)
       
   421         {
       
   422         User::Leave(KErrOverflow);
       
   423         }
       
   424 
       
   425     TInt err = iRepository->Create(newKey, aURI.UriDes());
       
   426     User::LeaveIfError(err);
       
   427 
       
   428     CleanupStack::PopAndDestroy(); // configurationKeys
       
   429 
       
   430     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   431         ("CPbk2StoreConfigurationImpl::AddSupportedContactStoreURIL(0x%x) end"), this);
       
   432     }
       
   433     
       
   434 // --------------------------------------------------------------------------
       
   435 // CPbk2StoreConfigurationImpl::RemoveSupportedContactStoreURIL
       
   436 // --------------------------------------------------------------------------
       
   437 //
       
   438 void CPbk2StoreConfigurationImpl::RemoveSupportedContactStoreURIL
       
   439         ( TVPbkContactStoreUriPtr aURI )
       
   440     {
       
   441     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   442         ("CPbk2StoreConfigurationImpl::RemoveSupportedContactStoreURIL(0x%x)"), this);
       
   443 
       
   444     RArray<TUint32> configurationKeys;
       
   445     CleanupClosePushL(configurationKeys);
       
   446 
       
   447     iRepository->FindEqL(
       
   448             KPhonebookSupportedConfigurationPartialKey,
       
   449             KPhonebookSupportedConfigurationMask,
       
   450             aURI.UriDes(),
       
   451             configurationKeys);
       
   452 
       
   453     const TInt keyCount = configurationKeys.Count();
       
   454     for (TInt i = 0; i < keyCount; ++i)
       
   455         {
       
   456         iRepository->Delete(configurationKeys[i]);
       
   457         }
       
   458     CleanupStack::PopAndDestroy(); // configurationKeys
       
   459 
       
   460     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
       
   461         ("CPbk2StoreConfigurationImpl::RemoveSupportedContactStoreURIL(0x%x) end"), this);
       
   462     }
       
   463 
       
   464 // --------------------------------------------------------------------------
       
   465 // CPbk2StoreConfigurationImpl::ConfigurationChanged
       
   466 // --------------------------------------------------------------------------
       
   467 //
       
   468 void CPbk2StoreConfigurationImpl::ConfigurationChanged()
       
   469     {
       
   470     for (TInt i = iObservers.Count() - 1; i >= 0; --i)
       
   471         {
       
   472         iObservers[i]->ConfigurationChanged();
       
   473         }
       
   474 
       
   475     for (TInt i = iObservers.Count() - 1; i >= 0; --i)
       
   476         {
       
   477         iObservers[i]->ConfigurationChangedComplete();
       
   478         }
       
   479     }
       
   480 
       
   481 // --------------------------------------------------------------------------
       
   482 // CPbk2StoreConfigurationImpl::ConfigurationChangedComplete
       
   483 // --------------------------------------------------------------------------
       
   484 //
       
   485 void CPbk2StoreConfigurationImpl::ConfigurationChangedComplete()
       
   486     {
       
   487     }
       
   488 
       
   489 // --------------------------------------------------------------------------
       
   490 // CPbk2StoreConfigurationImpl::SavingStoreChanged
       
   491 // --------------------------------------------------------------------------
       
   492 //
       
   493 void CPbk2StoreConfigurationImpl::SavingStoreChanged()
       
   494     {
       
   495     for (TInt i = iDefaultStoreObservers.Count() - 1; i >= 0; --i)
       
   496         {
       
   497         iDefaultStoreObservers[i]->SavingStoreChanged();
       
   498         }
       
   499     }
       
   500 
       
   501 // --------------------------------------------------------------------------
       
   502 // CPbk2StoreConfigurationImpl::AlreadyRegisteredL
       
   503 // --------------------------------------------------------------------------
       
   504 //
       
   505 TBool CPbk2StoreConfigurationImpl::AlreadyRegisteredL
       
   506         ( TVPbkContactStoreUriPtr aURI, RArray<TUint32> aKeys )
       
   507     {
       
   508     TBool already = EFalse;
       
   509 
       
   510     HBufC* buffer = HBufC::NewLC(KInitialStoreUriSize);
       
   511     const TInt keyCount = aKeys.Count();
       
   512     for (TInt j = 0; j < keyCount; ++j)
       
   513         {
       
   514         TPtr ptr = buffer->Des();
       
   515         ptr.Zero();
       
   516         TInt actualSize = 0;
       
   517         TInt ret = iRepository->Get(aKeys[j], ptr, actualSize);
       
   518         if (ret == KErrOverflow)
       
   519             {
       
   520             CleanupStack::PopAndDestroy(); // buffer
       
   521             buffer = HBufC::NewLC(actualSize);
       
   522             ptr.Set(buffer->Des());
       
   523             User::LeaveIfError(iRepository->Get(aKeys[j], ptr));
       
   524             }
       
   525 
       
   526         TVPbkContactStoreUriPtr uri( *buffer );
       
   527         if ( uri.Compare( aURI,
       
   528             TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) == 0 )
       
   529             {
       
   530             already = ETrue;
       
   531             break;
       
   532             }
       
   533         }
       
   534 
       
   535     CleanupStack::PopAndDestroy(); // buffer
       
   536 
       
   537     return already;
       
   538     }
       
   539     
       
   540 // End of File