1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
35 Default constructor. |
35 Default constructor. |
36 */ |
36 */ |
37 CImapUpsResponseWaiter::CImapUpsResponseWaiter(CMsvServerEntry& aServerEntry, CImapProtocolController& aImapProtocolController) |
37 CImapUpsResponseWaiter::CImapUpsResponseWaiter(CMsvServerEntry& aServerEntry, CImapProtocolController& aImapProtocolController) |
38 :CMsgActive(EPriorityStandard), iServerEntry(aServerEntry), iImapProtocolController(aImapProtocolController) |
38 :CMsgActive(EPriorityStandard), iServerEntry(aServerEntry), iImapProtocolController(aImapProtocolController) |
39 { |
39 { |
40 CActiveScheduler::Add(this); |
40 iImapSettings = CImapSettings::NewL(iServerEntry); |
|
41 CActiveScheduler::Add(this); |
41 } |
42 } |
42 |
43 |
43 /** |
44 /** |
44 Destructor. |
45 Destructor. |
45 */ |
46 */ |
46 CImapUpsResponseWaiter::~CImapUpsResponseWaiter() |
47 CImapUpsResponseWaiter::~CImapUpsResponseWaiter() |
47 { |
48 { |
48 Cancel(); |
49 Cancel(); |
|
50 delete iImapSettings; |
49 iUpsSubsession.Close(); |
51 iUpsSubsession.Close(); |
50 iUpsSession.Close(); |
52 iUpsSession.Close(); |
51 } |
53 } |
52 |
54 |
53 /** |
55 /** |
71 } |
73 } |
72 else if(aCommand == KIMAP4MTMConnectAndSynchronise) |
74 else if(aCommand == KIMAP4MTMConnectAndSynchronise) |
73 { |
75 { |
74 iState = EIMAP4MTMConnectAndSynchronise; |
76 iState = EIMAP4MTMConnectAndSynchronise; |
75 } |
77 } |
76 iEntrySelection = &aEntrySelection; |
78 |
|
79 iEntrySelection = &aEntrySelection; |
77 |
80 |
78 iDecision = EUpsDecNo; |
81 iDecision = EUpsDecNo; |
79 |
82 |
80 CImapSettings* imapSettings = CImapSettings::NewL(iServerEntry); |
83 if( iImapSettings->SettingsLoaded() == EFalse) |
81 CleanupStack::PushL(imapSettings); |
84 { |
82 imapSettings->LoadSettingsL(iServerEntry.Entry().Id()); |
85 iImapSettings->LoadSettingsL(iServerEntry.Entry().Id()); |
|
86 } |
83 |
87 |
84 // Connect to UPS service..... |
88 // Connect to UPS service..... |
85 User::LeaveIfError(iUpsSession.Connect()); |
89 User::LeaveIfError(iUpsSession.Connect()); |
|
90 |
86 RThread clientThread; |
91 RThread clientThread; |
87 User::LeaveIfError(clientThread.Open(aClientThreadId)); |
92 User::LeaveIfError(clientThread.Open(aClientThreadId)); |
88 CleanupClosePushL(clientThread); |
93 CleanupClosePushL(clientThread); |
89 User::LeaveIfError(iUpsSubsession.Initialise(iUpsSession, clientThread)); |
94 |
|
95 User::LeaveIfError(iUpsSubsession.Initialise(iUpsSession, clientThread)); |
90 CleanupStack::PopAndDestroy(&clientThread); |
96 CleanupStack::PopAndDestroy(&clientThread); |
91 |
97 |
92 |
|
93 iStatus=KRequestPending; |
98 iStatus=KRequestPending; |
94 iUpsSubsession.Authorise(aHasCapability, KUidIMAPService, imapSettings->ServerAddress(), iDecision, iStatus); |
99 iUpsSubsession.Authorise(aHasCapability, KUidIMAPService, iImapSettings->ServerAddress(), iDecision, iStatus); |
|
100 |
95 Queue(aStatus); |
101 Queue(aStatus); |
96 SetActive(); |
102 SetActive(); |
97 CleanupStack::PopAndDestroy();// imapSettings |
103 |
98 } |
104 } |
99 |
105 |
100 |
106 |
101 void CImapUpsResponseWaiter::DoRunL() |
107 void CImapUpsResponseWaiter::DoRunL() |
102 { |
108 { |