phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp
branchRCL_3
changeset 32 2828b4d142c0
parent 0 e686773b3f54
child 45 34879f5cfc63
equal deleted inserted replaced
26:0d28c1c5b6dd 32:2828b4d142c0
   135 
   135 
   136 
   136 
   137 EXPORT_C void CPbk2RemoteContactLookupAccounts::GetAllAccountsL(
   137 EXPORT_C void CPbk2RemoteContactLookupAccounts::GetAllAccountsL(
   138     RPointerArray<CPbkxRemoteContactLookupProtocolAccount>& aAccounts )
   138     RPointerArray<CPbkxRemoteContactLookupProtocolAccount>& aAccounts )
   139     {
   139     {
       
   140     CleanupClosePushL( aAccounts );
   140     if ( iAdapters.Count() == 0 )
   141     if ( iAdapters.Count() == 0 )
   141         {
   142         {
   142         // No plugins were loaded.
   143         // No plugins were loaded.
   143         LoadProtocolPluginsL();
   144         LoadProtocolPluginsL();
   144         }
   145         }
   168             // Ownership is passed
   169             // Ownership is passed
   169             User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ x ] ) );
   170             User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ x ] ) );
   170             }
   171             }
   171         // just let protocolAccountsTmp pass out of scope. It doesn't own anything now.
   172         // just let protocolAccountsTmp pass out of scope. It doesn't own anything now.
   172         }
   173         }
       
   174     CleanupStack::Pop();
   173     }
   175     }
   174 
   176 
   175 
   177 
   176 
   178 
   177 EXPORT_C void CPbk2RemoteContactLookupAccounts::GetAccountsL(
   179 EXPORT_C void CPbk2RemoteContactLookupAccounts::GetAccountsL(
   178     RPointerArray<CPbkxRemoteContactLookupProtocolAccount>& aAccounts,
   180     RPointerArray<CPbkxRemoteContactLookupProtocolAccount>& aAccounts,
   179     const TUid& aProtocol )
   181     const TUid& aProtocol )
   180     {
   182     {
   181     //TODO Should optimise this.
   183     //TODO Should optimise this.
   182 
   184     CleanupClosePushL( aAccounts );
       
   185     
   183     RPointerArray<CPbkxRemoteContactLookupProtocolAccount> protocolAccounts;
   186     RPointerArray<CPbkxRemoteContactLookupProtocolAccount> protocolAccounts;
   184     TCleanupItem cleanupItemAcc(CleanupResetAndDestroyAccArray, &protocolAccounts);
   187     TCleanupItem cleanupItemAcc(CleanupResetAndDestroyAccArray, &protocolAccounts);
   185     CleanupStack::PushL(cleanupItemAcc);
   188     CleanupStack::PushL(cleanupItemAcc);
   186 
   189 
   187     GetAllAccountsL( protocolAccounts );
   190     GetAllAccountsL( protocolAccounts );
   201             delete account;
   204             delete account;
   202             }
   205             }
   203         protocolAccounts.Remove( j );
   206         protocolAccounts.Remove( j );
   204         }
   207         }
   205     CleanupStack::Pop(); // cleanupItemAcc
   208     CleanupStack::Pop(); // cleanupItemAcc
       
   209     CleanupStack::Pop();
   206     }
   210     }
   207 
   211 
   208 CPbk2RemoteContactLookupAccounts::CPbk2RemoteContactLookupAccounts()
   212 CPbk2RemoteContactLookupAccounts::CPbk2RemoteContactLookupAccounts()
   209     {
   213     {
   210     }
   214     }