examples/Messaging/SearchSortExample/searchsortexample.cpp

00001 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 //
00015 
00016 #include "searchsortexample.h"
00017 #include "mAsyncWaiter.h"
00018 #include <msvsearchsortoperation.h>
00019 
00020 void CSearchsortExample::HandleSessionEventL(TMsvSessionEvent aEvent, TAny*, TAny*, TAny*)
00021         {
00022 
00023         switch (aEvent)
00024                 {
00025                 case MMsvSessionObserver::EMsvServerReady:
00026                         break;
00027                 case MMsvSessionObserver::EMsvEntriesCreated:
00028                         break;
00029                 default:
00030                         break;
00031                 }
00032         }
00033 
00038  CSearchsortExample* CSearchsortExample::NewL()
00039         {
00040         CSearchsortExample* self=new(ELeave)CSearchsortExample;
00041         CleanupStack::PushL(self);
00042         self->ConstructL();
00043         CleanupStack::Pop();
00044         return self;
00045         }
00049 CSearchsortExample::CSearchsortExample()
00050         {
00051         }
00052 
00053 void CSearchsortExample::ConstructL()
00054         {
00055         }
00056 
00060  CSearchsortExample::~ CSearchsortExample()
00061         {
00062         if(iMtm)
00063                 {
00064                 delete iMtm;
00065                 iMtm = NULL;
00066                 }
00067         if(iClientRegistry)
00068                 {
00069                 delete iClientRegistry;
00070                 iClientRegistry  = NULL;
00071                 }
00072         if(iSearch)
00073                 {
00074                 delete iSearch;
00075                 iSearch = NULL;
00076                 }
00077         if(iSession)
00078                 {
00079                 delete iSession;
00080                 iSession = NULL;
00081                 }
00082 
00083         iQueryIdTable.Close();
00084         iTResultSummary.Close();
00085 
00086         }
00087 
00088 
00094 void  CSearchsortExample::CreateClientRegistryL()
00095         {
00096         //Creates a session with message server.
00097         iSession = CMsvSession::OpenAsyncL(*this);
00098         CleanupStack::PushL(iSession);
00099 
00100         iSearch = CMsvSearchSortOperation::NewL(*iSession);
00101         CleanupStack::PushL(iSearch);
00102 
00103         // Create a client-side MTM registry.
00104         iClientRegistry = CClientMtmRegistry::NewL(*iSession,KMsvDefaultTimeoutMicroSeconds32);
00105         if (iClientRegistry != NULL && iClientRegistry->IsPresent(KUidMsgTypePOP3))
00106                 {
00107                 CleanupStack::PushL(iClientRegistry);
00108                 }
00109         // Create a Client-side MTM object for the specified MTM UID.
00110         iMtm = (CPop3ClientMtm*)iClientRegistry->NewMtmL(KUidMsgTypePOP3);
00111 
00112         CleanupStack::Pop(3,iSession); //iClientRegistry,iSession,iSearch.
00113     }
00114 
00121 void  CSearchsortExample::CreatePopAndSmtpAccountL()
00122         {
00123         CEmailAccounts* emailAccounts = CEmailAccounts::NewLC();
00124         CImPop3Settings* settings = new(ELeave) CImPop3Settings();
00125         CleanupStack::PushL(settings);
00126 
00127         CImIAPPreferences* popIAP = CImIAPPreferences::NewLC();
00128 
00129         // Set the server address to system address.
00130         settings->SetServerAddressL(KPopServer);
00131         settings->SetLoginNameL(KPopLoginName);
00132         settings->SetPasswordL(KPopPassword);
00133         settings->SetPort(KPortValue);
00134 
00135         // Create a Pop account.
00136         iPopAccount = emailAccounts->CreatePopAccountL(KTxtAccountName, *settings,*popIAP,EFalse);
00137 
00138         CImSmtpSettings *smtpSettings = new (ELeave) CImSmtpSettings();
00139         CleanupStack::PushL(smtpSettings);
00140 
00141         emailAccounts->PopulateDefaultSmtpSettingsL(*smtpSettings, *popIAP);
00142 
00143         // Create an Smtp acoount.
00144         iSmtpAccount = emailAccounts->CreateSmtpAccountL(iPopAccount, *smtpSettings, *popIAP, EFalse);
00145 
00146         emailAccounts->SetDefaultSmtpAccountL(iSmtpAccount);
00147 
00148         smtpSettings->SetServerAddressL(KSmtpServerAddress);
00149         smtpSettings->SetEmailAliasL(KEmailAlias);
00150         smtpSettings->SetEmailAddressL(KSmtpEmailAddress);
00151         smtpSettings->SetReplyToAddressL(KSmtpEmailAddress);
00152         smtpSettings->SetReceiptAddressL(KSmtpEmailAddress);
00153         smtpSettings->SetPort(KSmtpPortValue);
00154 
00155         // Add IAP to the IAP preferences.
00156         CImIAPPreferences* prefs = CImIAPPreferences::NewLC();
00157         TImIAPChoice iap;
00158         TInt iapID = 0;
00159         CMDBSession* dbSession = CMDBSession::NewL(KCDVersion1_1);
00160         CleanupStack::PushL(dbSession);
00161         CCDConnectionPrefsRecord *connPrefRecord = static_cast<CCDConnectionPrefsRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdConnectionPrefsRecord));
00162         CleanupStack::PushL(connPrefRecord);
00163 
00164         // Set the direction of connection.
00165         connPrefRecord->iDirection = ECommDbConnectionDirectionOutgoing;
00166         connPrefRecord->iRanking = 1;
00167         if(!connPrefRecord->FindL(*dbSession))
00168                 {
00169                 User::Leave(KErrNotFound);
00170                 }
00171         iapID = connPrefRecord->iDefaultIAP;
00172         iap.iIAP = iapID;
00173         iap.iDialogPref = ECommDbDialogPrefDoNotPrompt;
00174         prefs->AddIAPL(iap);
00175 
00176         emailAccounts->GetSmtpAccountL(iSmtpAccount.iSmtpService, iSmtpAccount);
00177         emailAccounts->SaveSmtpSettingsL(iSmtpAccount,*smtpSettings);
00178         emailAccounts->SaveSmtpIapSettingsL(iSmtpAccount, *prefs);
00179 
00180         //Deleting the message entries if they exist for resetting.
00181         DeleteSmtpMessageL();
00182         //connPrefRecord, dbSession, prefs, smtpSettings, popIAP, settings, emailAccounts.
00183         CleanupStack::PopAndDestroy(7,emailAccounts);
00184         }
00185 
00190 void  CSearchsortExample::CreateSmtpMessageL(TInt aindex,TDes& aFrominfo,TDes& aToinfo,TDes& aSubjectinfo)
00191         {
00192 
00193         TMsvId inboxId = KMsvGlobalInBoxIndexEntryId;
00194 
00195         // Set the context to the folder in which message has to be created.
00196         CMsvEntry*      entry = CMsvEntry::NewL(*iSession,inboxId,TMsvSelectionOrdering());
00197         CleanupStack::PushL(entry);
00198         entry->SetEntryL(inboxId);
00199 
00200         CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
00201         CleanupStack::PushL(waiter);
00202 
00203         TMsvEmailTypeList msvEmailTypeList = 0;
00204         TMsvPartList partList = (KMsvMessagePartBody | KMsvMessagePartAttachments|KMsvMessagePartTo|KMsvMessagePartFrom|KMsvMessagePartSubject);
00205 
00206         CImEmailOperation* emailOperation = CImEmailOperation::CreateNewL(waiter->iStatus, *iSession,KMsvGlobalInBoxIndexEntryId, partList, msvEmailTypeList, KUidMsgTypeSMTP);
00207         CleanupStack::PushL(emailOperation);
00208         waiter->StartAndWait();
00209 
00210         TMsvId temp;
00211         TPckgC<TMsvId> paramPack(temp);
00212         const TDesC8& progBuf = emailOperation->ProgressL();
00213 
00214         paramPack.Set(progBuf);
00215         TMsvId newMessageId;
00216         newMessageId = paramPack();
00217 
00218 
00219         entry->SetEntryL(newMessageId);
00220 
00221         CMsvStore* store = entry->EditStoreL();
00222         CleanupStack::PushL(store);
00223 
00224         //Setting the Header for message entry.
00225         CImHeader* emailEntry = CImHeader::NewLC();
00226         emailEntry->RestoreL(*store);
00227 
00228         //Setting the Header according to the message entry count.
00229         switch(aindex)
00230                 {
00231                 case 0:
00232                         {
00233                         emailEntry->SetFromL((TDesC8&)KFrom1);
00234                         emailEntry->SetSubjectL((TDesC&)KSubject1);
00235                         emailEntry->ToRecipients().AppendL((TDesC&)KTo1);
00236                         aToinfo.Copy(KTo1);
00237                         }
00238                         break;
00239                 case 1:
00240                         {
00241                         emailEntry->SetFromL((TDesC8&)KFrom2);
00242                         emailEntry->SetSubjectL((TDesC&)KSubject2);
00243                         emailEntry->ToRecipients().AppendL((TDesC&)KTo2);
00244                         aToinfo.Copy(KTo2);
00245                         }
00246                         break;
00247                 case 2:
00248                         {
00249                         emailEntry->SetFromL((TDesC8&)KFrom3);
00250                         emailEntry->SetSubjectL((TDesC&)KSubject3);
00251                         emailEntry->ToRecipients().AppendL((TDesC&)KTo3);
00252                         aToinfo.Copy(KTo3);
00253                         }
00254                         break;
00255                 case 3:
00256                         {
00257                         emailEntry->SetFromL((TDesC8&)KFrom4);
00258                         emailEntry->SetSubjectL((TDesC&)KSubject4);
00259                         emailEntry->ToRecipients().AppendL((TDesC&)KTo4);
00260                         aToinfo.Copy(KTo4);
00261                         }
00262                         break;
00263                 case 4:
00264                         {
00265                         emailEntry->SetFromL((TDesC8&)KFrom5);
00266                         emailEntry->SetSubjectL((TDesC&)KSubject5);
00267                         emailEntry->ToRecipients().AppendL((TDesC&)KTo5);
00268                         aToinfo.Copy(KTo5);
00269                         }
00270                         break;
00271                 default:
00272                         break;
00273                 }
00274 
00275         aFrominfo.Copy(emailEntry->From());
00276         aSubjectinfo.Copy(emailEntry->Subject());
00277 
00278         // Paragraph format layer for the rich text object.
00279         CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
00280         CleanupStack::PushL(paraFormatLayer);
00281         // Character format layer for the rich text object.
00282         CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
00283         CleanupStack::PushL(charFormatLayer);
00284 
00285         CRichText* bodyText = CRichText::NewL(paraFormatLayer, charFormatLayer, CEditableText::EFlatStorage, 256);
00286         CleanupStack::PushL(bodyText);
00287 
00288         // Inserts the contents of a buffer into the document at specified position.
00289         bodyText->InsertL(0, KBodyContents);
00290         store->StoreBodyTextL(*bodyText);
00291         emailEntry->StoreL(*store);
00292         // Store the changes permanently.
00293         store->CommitL();
00294 
00295         // bodyText, charFormatLayer, paraFormatLayer, emailEntry, store, emailOperation, waiter, entry.
00296         CleanupStack::PopAndDestroy(8,entry);
00297         }
00298 
00299 
00303 void CSearchsortExample::SearchSortRequestWithoutIteratorL(TDes& aSearchtext,TBool aCaseSensitivity,TBool aWholeWordSearch,TBool aCombinedSearch,TInt& aResultCount)
00304         {
00305 
00306         //CMessAsyncWaiter for async request.
00307         CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
00308         CleanupStack::PushL(waiter);
00309 
00310         //Create instance of CMsvSearchSortQuery to create a search-sort query.
00311         CMsvSearchSortQuery* searchQuery = CMsvSearchSortQuery::NewL();
00312         CleanupStack::PushL(searchQuery);
00313 
00314         //Search-sort operation is performed on a specified folder. (e.g, on INBOX, SENT ITEMS,
00315         //DRAFT, OUTBOX or any user created folder). Needs to sets the value of the folder entry.
00316         searchQuery->SetParentId(KMsvGlobalInBoxIndexEntryIdValue);
00317         //Sets the type of result expected out of the search-sort operation.
00318         searchQuery->SetResultType(EMsvResultAsTMsvEntry);
00319         searchQuery->SetWholeWord(aWholeWordSearch);
00320         searchQuery->SetCaseSensitiveOption(aCaseSensitivity);
00321         searchQuery->SetWildCardSearch(EFalse);
00322 
00323         //Adding search option.
00324         searchQuery->AddSearchOptionL(EMsvTo,aSearchtext, EMsvEqual);
00325 
00326         //Combined search-sort we can add some more AddSearchOptionL function.
00327         if(aCombinedSearch)
00328                 {
00329                 TInt size = KSize;
00330                 //Adding search option.
00331                 searchQuery->AddSearchOptionL(EMsvSize, size, EMsvLessThanOrEqual);
00332                 searchQuery->AddSearchOptionL(EMsvSubject, KSubjectSearch, EMsvEqual);
00333 
00334                 }
00335 
00336         //Adding sort option.
00337         searchQuery->AddSortOptionL(EMsvDate, EMsvSortAscending);
00338 
00339         //Poping the searchQuery object from cleanupstack as here after.
00340         //the control transfers to CMsvSearchSortOperation by making a call to RequestL.
00341         CleanupStack::Pop(searchQuery);
00342 
00343         //Search-sort Request.
00344         iSearch->RequestL(searchQuery, ETrue, waiter->iStatus);
00345         waiter->StartAndWait();
00346 
00347         //To hold Search-sort results.
00348         RArray<TMsvEntry> resultArray;
00349 
00350         //After the completion RequestL(), GetResultsL function provides a list of
00351         //index entry Id objects (TMsvEntry).
00352         TRAPD(ret, iSearch->GetResultsL(resultArray));
00353 
00354         iTResultSummary.Reset();
00355 
00356         TMsvId inboxId=KMsvGlobalInBoxIndexEntryId;
00357         CMsvEntry*      entry = CMsvEntry::NewL(*iSession,inboxId,TMsvSelectionOrdering());
00358         CleanupStack::PushL(entry);
00359 
00360         if(ret == KErrNone)
00361                 {
00362                 //for getting and the entry details.
00363                 for(TInt index=0;index<resultArray.Count();index++)
00364                         {
00365                         TResultSummary tempdata;
00366                         TMsvEntry tempentry;
00367                         TTime date;
00368 
00369                         tempentry=resultArray[index];
00370                         entry->SetEntryL(tempentry.Id());
00371 
00372                         //For obtaining header info.
00373                         CMsvStore* store = entry->ReadStoreL();
00374                         CleanupStack::PushL(store);
00375                         CImHeader* emailEntry = CImHeader::NewLC();
00376                         emailEntry->RestoreL(*store);
00377 
00378                         tempdata.iSubjectText.Copy(emailEntry->Subject());
00379                         tempdata.iToText.Copy((emailEntry->ToRecipients())[0]);
00380                         tempdata.iSize=tempentry.iSize;
00381                         date=tempentry.iDate;
00382                         date.FormatL(tempdata.iDatestring,KFormat1);
00383                         date.FormatL(tempdata.iTimestring,KFormat2);
00384                         iTResultSummary.Append(tempdata);
00385 
00386                         CleanupStack::PopAndDestroy(2,store); //emailEntry, store.
00387                         }
00388                 aResultCount=iSearch->GetResultCountL();
00389                 }
00390         //After the completion of RequestL(), GetQueryIdL function provides the query Id.
00391         //corresponding to a search-sort query.
00392         iQueryId = iSearch->GetQueryIdL();
00393 
00394         iExampleTQueryTable.iQueryId=iQueryId;
00395         iExampleTQueryTable.iResultType=EMsvResultAsTMsvEntry;
00396         iQueryIdTable.Append(iExampleTQueryTable);
00397 
00398         resultArray.Close();
00399         CleanupStack::PopAndDestroy(2,waiter); //entry, waiter.
00400         }
00401 
00405 void CSearchsortExample::SearchSortRequestWithIteratorL(TInt& aResultCount)
00406         {
00407 
00408         //CMessAsyncWaiter for async request.
00409         CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
00410         CleanupStack::PushL(waiter);
00411 
00412         //Create instance of CMsvSearchSortQuery to create a search-sort query.
00413         CMsvSearchSortQuery* searchQuery = CMsvSearchSortQuery::NewL();
00414         CleanupStack::PushL(searchQuery);
00415 
00416         //Search-sort operation is performed on a specified folder. (e.g, on INBOX, SENT ITEMS,
00417         //DRAFT, OUTBOX or any user created folder). Needs to sets the value of the folder entry.
00418         searchQuery->SetParentId(KMsvGlobalInBoxIndexEntryIdValue);
00419         //Sets the type of result expected out of the search-sort operation.
00420         searchQuery->SetResultType(EMsvResultAsTMsvId);
00421         searchQuery->SetWholeWord(ETrue);
00422         searchQuery->SetCaseSensitiveOption(EFalse);
00423         searchQuery->SetWildCardSearch(EFalse);
00424 
00425 
00426         TInt size = KSize;
00427         //Add search option.
00428         searchQuery->AddSearchOptionL(EMsvSize, size, EMsvLessThanOrEqual);
00429 
00430         //Add sort option.
00431         searchQuery->AddSortOptionL(EMsvDate, EMsvSortAscending);
00432 
00433         //to enable Iterator.
00434         TInt iterator = 1;
00435 
00436         //Poping the searchQuery object from cleanupstack as here after.
00437         //the control transfers to CMsvSearchSortOperation by making a call to RequestL.
00438         CleanupStack::Pop(searchQuery);
00439         //Search-sort Request.
00440         iSearch->RequestL(searchQuery, ETrue, waiter->iStatus,iterator);
00441         waiter->StartAndWait();
00442 
00443         //Array to copy Search-sort results.
00444         RArray<TMsvId> resultArray;
00445         TMsvId resultAsTMsvId;
00446 
00447 
00448         //Gets the TMsvId of a single index entry object at a time.
00449         //GetNextResultL function is used when getting the results using iterative mechanism
00450         //and it returns remaining search-sort results Count.
00451         while(iSearch->GetNextResultL(resultAsTMsvId))
00452                 {
00453                 resultArray.AppendL(resultAsTMsvId);
00454                 }
00455 
00456         aResultCount=iSearch->GetResultCountL();
00457 
00458         resultArray.Close();
00459         CleanupStack::PopAndDestroy(waiter); //waiter.
00460         }
00461 
00465 void CSearchsortExample::SearchSortRequestByQueryIdL(TInt& aResultCount)
00466         {
00467 
00468 
00469         //CMessAsyncWaiter for async request.
00470         CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
00471         CleanupStack::PushL(waiter);
00472 
00473         //Search-sort Request by QueryId.
00474         iSearch->RequestL(iQueryId, waiter->iStatus);
00475         waiter->StartAndWait();
00476 
00477 
00478         //To hold Search-sort results.
00479         TInt count=iQueryIdTable.Count();
00480         TQueryTable tempdata;
00481 
00482         TMsvId inboxId=KMsvGlobalInBoxIndexEntryId;
00483         CMsvEntry*      entry = CMsvEntry::NewL(*iSession,inboxId,TMsvSelectionOrdering());
00484         CleanupStack::PushL(entry);
00485 
00486         iTResultSummary.Reset();
00487         for(TInt index=0;index<count;index++)
00488                 {
00489                 tempdata=iQueryIdTable[index];
00490                 if(tempdata.iQueryId==iQueryId)
00491                         {
00492                         if(tempdata.iResultType==EMsvResultAsTMsvId)
00493                                 {
00494                                 RArray<TMsvId> resultArray;
00495                                 TRAPD(ret, iSearch->GetResultsL(resultArray));
00496                                 if(ret == KErrNone)
00497                                         {
00498                                         TInt count = resultArray.Count();
00499                                         aResultCount=count;
00500                                         }
00501                                 resultArray.Close();
00502                                 }
00503                         else if(tempdata.iResultType==EMsvResultAsTMsvEntry)
00504                                 {
00505                                 RArray<TMsvEntry> resultArray;
00506                                 TRAPD(ret, iSearch->GetResultsL(resultArray));
00507                                 if(ret == KErrNone)
00508                                         {
00509                                         TInt count = resultArray.Count();
00510                                         aResultCount=count;
00511 
00512                                         //for getting the entry details.
00513                                         for(TInt index=0;index<count;index++)
00514                                                 {
00515                                                 TResultSummary tempdata;
00516                                                 TMsvEntry tempentry;
00517                                                 TTime date;
00518 
00519 
00520                                                 tempentry=resultArray[index];
00521                                                 entry->SetEntryL(tempentry.Id());
00522 
00523                                                 //for getting header info.
00524                                                 CMsvStore* store = entry->ReadStoreL();
00525                                                 CleanupStack::PushL(store);
00526                                                 CImHeader* emailEntry = CImHeader::NewLC();
00527                                                 emailEntry->RestoreL(*store);
00528 
00529 
00530                                                 tempdata.iSubjectText.Copy(emailEntry->Subject());
00531                                                 tempdata.iToText.Copy((emailEntry->ToRecipients())[0]);
00532                                                 tempdata.iSize=tempentry.iSize;
00533                                                 date=tempentry.iDate;
00534                                                 date.FormatL(tempdata.iDatestring,KFormat1);
00535                                                 date.FormatL(tempdata.iTimestring,KFormat2);
00536                                                 iTResultSummary.Append(tempdata);
00537 
00538                                                 CleanupStack::PopAndDestroy(2,store);
00539                                                 }
00540                                         }
00541                                         resultArray.Close();
00542                                 }
00543                         }
00544                 }
00545         CleanupStack::PopAndDestroy(2,waiter); // entry, waiter.
00546         }
00547 
00551 void  CSearchsortExample::DeleteSmtpMessageL()
00552         {
00553         //CMessAsyncWaiter for async request.
00554 
00555         CMessAsyncWaiter* waiter = CMessAsyncWaiter::NewL();
00556         CleanupStack::PushL(waiter);
00557 
00558         TInt mycount;
00559         TMsvId inboxId = KMsvGlobalInBoxIndexEntryId;
00560         CMsvEntry*      messagingEntry = CMsvEntry::NewL(*iSession,inboxId,TMsvSelectionOrdering());
00561         CleanupStack::PushL(messagingEntry);
00562         messagingEntry->SetEntryL(inboxId);
00563 
00564         CMsvEntrySelection* filteredMessageIds =messagingEntry->ChildrenL();
00565         CleanupStack::PushL( filteredMessageIds);
00566          mycount=filteredMessageIds->Count();
00567         if(mycount)
00568                 {
00569                 CMsvOperation* operation = messagingEntry->DeleteL(*filteredMessageIds,waiter->iStatus);
00570                 CleanupStack::PushL(operation);
00571                 waiter->StartAndWait();
00572                 CleanupStack::PopAndDestroy();
00573                 }
00574         CleanupStack::PopAndDestroy(3,waiter); //filteredMessageIds, messagingEntry, waiter.
00575         }
00576 
00577 void CSearchsortExample::DeleteAccountsL()
00578         {
00579 
00580         CEmailAccounts* accounts = CEmailAccounts::NewLC();
00581 
00582         RArray<TPopAccount>     pop3Accounts;
00583         CleanupClosePushL(pop3Accounts);
00584         accounts->GetPopAccountsL(pop3Accounts);
00585         TInt    count = pop3Accounts.Count();
00586         TInt    index=0;
00587         for( index = 0; index < count; index++ )
00588                 {
00589                 TPopAccount     id = pop3Accounts[index];
00590 
00591                 TRAPD(err,accounts->DeletePopAccountL( id ));
00592                 if(err!=KErrNone)
00593                         {
00594                         User::Panic(KUserPanic, err);
00595                         }
00596                 }
00597 
00598         RArray<TImapAccount>    imap4Accounts;
00599         CleanupClosePushL(imap4Accounts);
00600         accounts->GetImapAccountsL(imap4Accounts);
00601         count = imap4Accounts.Count();
00602         for( TInt index = 0; index < count; index++ )
00603                 {
00604                 TImapAccount    id = imap4Accounts[index];
00605                 TRAPD(err,accounts->DeleteImapAccountL( id ));
00606                 if(err!=KErrNone)
00607                         {
00608                         User::Panic(KUserPanic, err);
00609                         }
00610                 }
00611 
00612         RArray<TSmtpAccount>    smtpAccounts;
00613         CleanupClosePushL(smtpAccounts);
00614         accounts->GetSmtpAccountsL(smtpAccounts);
00615 
00616     count = smtpAccounts.Count();
00617     for( TInt index = 0; index < count; index++ )
00618                 {
00619                 TSmtpAccount    id = smtpAccounts[index];
00620 
00621                 TRAPD(err,accounts->DeleteSmtpAccountL( id ));
00622                 if(err!=KErrNone)
00623                         {
00624                         User::Panic(KUserPanic, err);
00625                         }
00626                 }
00627         CleanupStack::PopAndDestroy(4, accounts);
00628         }
00629 

Generated by  doxygen 1.6.2