18 |
18 |
19 |
19 |
20 #include "emailtrace.h" |
20 #include "emailtrace.h" |
21 #include "ipsplgheaders.h" |
21 #include "ipsplgheaders.h" |
22 |
22 |
|
23 // <qmail> |
|
24 const TInt KIpsSetDataHeadersOnly = -2; |
|
25 const TInt KIpsSetDataFullBodyAndAttas = -1; |
|
26 const TInt KIpsSetDataFullBodyOnly = -3; |
|
27 // </qmail> |
23 |
28 |
24 _LIT( KIpsPlgIpsConnPanic, "IpsConn" ); |
29 _LIT( KIpsPlgIpsConnPanic, "IpsConn" ); |
25 |
30 |
26 // ---------------------------------------------------------------------------- |
31 // ---------------------------------------------------------------------------- |
27 // CIpsPlgImap4ConnectOp::NewL() |
32 // CIpsPlgImap4ConnectOp::NewL() |
124 if ( tentry.iType.iUid != KUidMsvServiceEntryValue ) |
128 if ( tentry.iType.iUid != KUidMsvServiceEntryValue ) |
125 { |
129 { |
126 User::Panic( KIpsPlgIpsConnPanic, KErrNotSupported ); |
130 User::Panic( KIpsPlgIpsConnPanic, KErrNotSupported ); |
127 } |
131 } |
128 |
132 |
129 if ( tentry.Connected() ) |
133 iState = EStateStartConnect; |
130 { |
134 iStatus = KRequestPending; |
131 iState = EStateCompleted; |
135 SetActive(); |
132 iAlreadyConnected = ETrue; |
136 CompleteThis(); |
133 SetActive(); |
|
134 CompleteThis(); |
|
135 } |
|
136 else |
|
137 { |
|
138 iState = EStateStartConnect; |
|
139 iStatus = KRequestPending; |
|
140 SetActive(); |
|
141 CompleteThis(); |
|
142 } |
|
143 } |
137 } |
144 |
138 |
145 // ---------------------------------------------------------------------------- |
139 // ---------------------------------------------------------------------------- |
146 // CIpsPlgImap4ConnectOp::ProgressL() |
140 // CIpsPlgImap4ConnectOp::ProgressL() |
147 // ---------------------------------------------------------------------------- |
141 // ---------------------------------------------------------------------------- |
217 { |
211 { |
218 FUNC_LOG; |
212 FUNC_LOG; |
219 return EIpsOpTypeImap4SyncOp; |
213 return EIpsOpTypeImap4SyncOp; |
220 } |
214 } |
221 |
215 |
222 // ---------------------------------------------------------------------------- |
216 // <qmail> Connected() moved to baseclass |
223 // CIpsPlgImap4ConnectOp::Connected() |
|
224 // ---------------------------------------------------------------------------- |
|
225 // |
|
226 TBool CIpsPlgImap4ConnectOp::Connected() const |
|
227 { |
|
228 FUNC_LOG; |
|
229 TMsvEntry tentry; |
|
230 TMsvId service; |
|
231 iMsvSession.GetEntry(iService, service, tentry ); |
|
232 return tentry.Connected(); |
|
233 } |
|
234 |
|
235 |
|
236 // ---------------------------------------------------------------------------- |
217 // ---------------------------------------------------------------------------- |
237 // CIpsPlgImap4ConnectOp::DoCancel() |
218 // CIpsPlgImap4ConnectOp::DoCancel() |
238 // ---------------------------------------------------------------------------- |
219 // ---------------------------------------------------------------------------- |
239 // |
220 // |
240 void CIpsPlgImap4ConnectOp::DoCancel() |
221 void CIpsPlgImap4ConnectOp::DoCancel() |
346 // ---------------------------------------------------------------------------- |
327 // ---------------------------------------------------------------------------- |
347 // CIpsPlgImap4ConnectOp::HandleImapConnectionEvent() |
328 // CIpsPlgImap4ConnectOp::HandleImapConnectionEvent() |
348 // ---------------------------------------------------------------------------- |
329 // ---------------------------------------------------------------------------- |
349 // |
330 // |
350 void CIpsPlgImap4ConnectOp::HandleImapConnectionEvent( |
331 void CIpsPlgImap4ConnectOp::HandleImapConnectionEvent( |
351 TImapConnectionEvent aConnectionEvent ) |
332 TImapConnectionEvent /*aConnectionEvent*/ ) |
352 { |
333 { |
353 FUNC_LOG; |
334 //not used at the moment |
354 switch ( aConnectionEvent ) |
|
355 { |
|
356 case EConnectingToServer: |
|
357 break; |
|
358 case ESynchronisingFolderList: |
|
359 case ESynchronisingInbox: |
|
360 case ESynchronisingFolders: |
|
361 // send sync started event in any of these sync events |
|
362 SignalSyncStarted(); |
|
363 break; |
|
364 case ESynchronisationComplete: |
|
365 break; |
|
366 case EDisconnecting: |
|
367 break; |
|
368 case EConnectionCompleted: |
|
369 default: |
|
370 break; |
|
371 } |
|
372 } |
335 } |
373 |
336 |
374 // ---------------------------------------------------------------------------- |
337 // ---------------------------------------------------------------------------- |
375 // CIpsPlgImap4ConnectOp::RequestResponseL() |
338 // CIpsPlgImap4ConnectOp::RequestResponseL() |
376 // ---------------------------------------------------------------------------- |
339 // ---------------------------------------------------------------------------- |
398 TBuf8<1> parameter; |
361 TBuf8<1> parameter; |
399 iStatus = KRequestPending; |
362 iStatus = KRequestPending; |
400 // connect and synchronise starts background sync or idle |
363 // connect and synchronise starts background sync or idle |
401 iOperation = iBaseMtm->InvokeAsyncFunctionL( |
364 iOperation = iBaseMtm->InvokeAsyncFunctionL( |
402 KIMAP4MTMConnect, *iSelection, parameter, iStatus); |
365 KIMAP4MTMConnect, *iSelection, parameter, iStatus); |
|
366 // also set sync started |
|
367 SignalSyncStarted(); |
403 iState = EStateConnectAndSync; |
368 iState = EStateConnectAndSync; |
404 SetActive(); |
369 SetActive(); |
405 } |
370 } |
406 else if ( Connected() ) |
371 else if ( Connected() ) |
407 { |
372 { |
422 // connect and synchronise starts background sync or idle |
387 // connect and synchronise starts background sync or idle |
423 iStatus = KRequestPending; |
388 iStatus = KRequestPending; |
424 iOperation = iBaseMtm->InvokeAsyncFunctionL( |
389 iOperation = iBaseMtm->InvokeAsyncFunctionL( |
425 KIMAP4MTMConnectAndSyncCompleteAfterFullSync, |
390 KIMAP4MTMConnectAndSyncCompleteAfterFullSync, |
426 *iSelection, parameter, iStatus); |
391 *iSelection, parameter, iStatus); |
|
392 SignalSyncStarted(); |
427 iState = EStateConnectAndSync; |
393 iState = EStateConnectAndSync; |
428 SetActive(); |
394 SetActive(); |
429 } |
395 } |
430 } |
396 } |
431 |
397 |
442 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
408 CEmailAccounts* accounts = CEmailAccounts::NewLC(); |
443 TImapAccount imapAcc; |
409 TImapAccount imapAcc; |
444 accounts->GetImapAccountL(iService, imapAcc ); |
410 accounts->GetImapAccountL(iService, imapAcc ); |
445 accounts->LoadImapSettingsL( imapAcc, *settings ); |
411 accounts->LoadImapSettingsL( imapAcc, *settings ); |
446 TImImap4GetPartialMailInfo info; |
412 TImImap4GetPartialMailInfo info; |
447 CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings ); |
413 ConstructImapPartialFetchInfo( info, *settings ); |
448 TPckgBuf<TImImap4GetPartialMailInfo> package(info); |
414 TPckgBuf<TImImap4GetPartialMailInfo> package(info); |
449 CleanupStack::PopAndDestroy( 2, settings ); |
415 CleanupStack::PopAndDestroy( 2, settings ); |
450 |
416 |
451 if ( info.iTotalSizeLimit != KIpsSetDataHeadersOnly ) |
417 if ( info.iTotalSizeLimit != KIpsSetDataHeadersOnly ) |
452 { |
418 { |
520 // CIpsPlgImap4ConnectOp::QueryUserPwdL() |
486 // CIpsPlgImap4ConnectOp::QueryUserPwdL() |
521 // ---------------------------------------------------------------------------- |
487 // ---------------------------------------------------------------------------- |
522 // |
488 // |
523 void CIpsPlgImap4ConnectOp::QueryUserPwdL() |
489 void CIpsPlgImap4ConnectOp::QueryUserPwdL() |
524 { |
490 { |
525 if ( iEventHandler ) |
491 iEventHandler->QueryUsrPassL( iService, this ); |
526 { |
|
527 iEventHandler->QueryUsrPassL( iService, this ); |
|
528 } |
|
529 } |
492 } |
530 |
493 |
531 |
494 |
532 // ---------------------------------------------------------------------------- |
495 // ---------------------------------------------------------------------------- |
533 // CIpsPlgImap4ConnectOp::GetOperationErrorCodeL() |
496 // CIpsPlgImap4ConnectOp::GetOperationErrorCodeL() |
534 // ---------------------------------------------------------------------------- |
497 // ---------------------------------------------------------------------------- |
535 // |
498 // |
536 /*TInt CIpsPlgImap4ConnectOp::GetOperationErrorCodeL( ) |
499 /*TInt CIpsPlgImap4ConnectOp::GetOperationErrorCodeL( ) |
537 { |
500 { |
538 if ( iAlreadyConnected ) |
|
539 { |
|
540 // Connected state was set in CIpsPlgPop3ConnectOp::ConstructL() |
|
541 // so iOperation is null |
|
542 return KErrNone; |
|
543 } |
|
544 |
|
545 if ( !iOperation ) |
501 if ( !iOperation ) |
546 { |
502 { |
547 return KErrNotFound; |
503 return KErrNotFound; |
548 } |
504 } |
549 if ( !iOperation->IsActive() && iOperation->iStatus.Int() != KErrNone ) |
505 if ( !iOperation->IsActive() && iOperation->iStatus.Int() != KErrNone ) |
599 //password has been set, continue with operation |
555 //password has been set, continue with operation |
600 |
556 |
601 SetActive(); |
557 SetActive(); |
602 CompleteThis(); |
558 CompleteThis(); |
603 } |
559 } |
|
560 |
|
561 // <qmail> |
|
562 // ---------------------------------------------------------------------------- |
|
563 // ---------------------------------------------------------------------------- |
|
564 void CIpsPlgImap4ConnectOp::ConstructImapPartialFetchInfo( |
|
565 TImImap4GetPartialMailInfo& aInfo, CImImap4Settings& aImap4Settings ) |
|
566 |
|
567 { |
|
568 FUNC_LOG; |
|
569 TInt sizeLimit = aImap4Settings.BodyTextSizeLimit(); |
|
570 |
|
571 if ( sizeLimit == KIpsSetDataHeadersOnly ) |
|
572 { |
|
573 aInfo.iTotalSizeLimit = KIpsSetDataHeadersOnly; |
|
574 } |
|
575 else if ( sizeLimit == KIpsSetDataFullBodyAndAttas ) |
|
576 { |
|
577 aInfo.iTotalSizeLimit = KMaxTInt; |
|
578 aInfo.iAttachmentSizeLimit = KMaxTInt; |
|
579 aInfo.iBodyTextSizeLimit = KMaxTInt; |
|
580 aInfo.iMaxEmailSize = KMaxTInt; |
|
581 aInfo.iPartialMailOptions = ENoSizeLimits; |
|
582 aInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments; |
|
583 } |
|
584 else if ( sizeLimit == KIpsSetDataFullBodyOnly ) |
|
585 { |
|
586 aInfo.iTotalSizeLimit = KMaxTInt; |
|
587 aInfo.iAttachmentSizeLimit = 0; |
|
588 aInfo.iBodyTextSizeLimit = KMaxTInt; |
|
589 aInfo.iMaxEmailSize = KMaxTInt; |
|
590 aInfo.iPartialMailOptions = EBodyAlternativeText; |
|
591 aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText; |
|
592 } |
|
593 else |
|
594 { |
|
595 aInfo.iTotalSizeLimit = sizeLimit*1024; |
|
596 // set zero when it not documentated does total size overrides these |
|
597 aInfo.iAttachmentSizeLimit = 0; |
|
598 aInfo.iMaxEmailSize = sizeLimit*1024; |
|
599 aInfo.iBodyTextSizeLimit = sizeLimit*1024; |
|
600 aInfo.iPartialMailOptions = EBodyAlternativeText; |
|
601 aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText; |
|
602 } |
|
603 } |
|
604 // </qmail> |
604 // End of File |
605 // End of File |
605 |
606 |