129 OpenConnection(); |
126 OpenConnection(); |
130 } |
127 } |
131 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::OpenL() completed" ); |
128 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::OpenL() completed" ); |
132 } |
129 } |
133 |
130 |
134 // ----------------------------------------------------------------------------- |
131 |
135 // CIAUpdateFWSyncProfile::CreateL |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CIAUpdateFWSyncProfile::CreateL() |
|
139 { |
|
140 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CreateL()" ); |
|
141 |
|
142 iProfile.CreateL( *iSyncSession ); |
|
143 iProfile.SetCreatorId( iApplicationId ); |
|
144 iProfile.UpdateL(); |
|
145 TInt id = iProfile.Identifier(); |
|
146 iProfile.Close(); |
|
147 |
|
148 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CreateL() completed" ); |
|
149 return id; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CIAUpdateFWSyncProfile::CreateCopyL |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 void CIAUpdateFWSyncProfile::CreateCopyL( TInt aProfileId ) |
|
157 { |
|
158 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CreateCopyL()" ); |
|
159 |
|
160 iProfile.CreateL( *iSyncSession ); |
|
161 iProfile.SetCreatorId( iApplicationId ); |
|
162 iProfile.UpdateL(); |
|
163 if ( !iConnectionOpen ) |
|
164 { |
|
165 OpenConnection(); |
|
166 } |
|
167 if ( !iHistoryLogOpen ) |
|
168 { |
|
169 OpenHistoryLog(); |
|
170 } |
|
171 |
|
172 CIAUpdateFWSyncProfile* profile = |
|
173 CIAUpdateFWSyncProfile::NewL( KIAUpdateUiUid, iSyncSession ); |
|
174 CleanupStack::PushL( profile ); |
|
175 profile->OpenL( aProfileId, ESmlOpenRead ); |
|
176 CopyValuesL( profile ); |
|
177 CleanupStack::PopAndDestroy( profile ); |
|
178 profile = NULL; |
|
179 |
|
180 iProfile.UpdateL(); |
|
181 CloseHistoryLog(); |
|
182 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CreateCopyL() completed" ); |
|
183 } |
|
184 |
132 |
185 // ----------------------------------------------------------------------------- |
133 // ----------------------------------------------------------------------------- |
186 // CIAUpdateFWSyncProfile::SaveL |
134 // CIAUpdateFWSyncProfile::SaveL |
187 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
188 // |
136 // |
210 void CIAUpdateFWSyncProfile::GetName( TDes& aText ) |
158 void CIAUpdateFWSyncProfile::GetName( TDes& aText ) |
211 { |
159 { |
212 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetName()" ); |
160 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetName()" ); |
213 |
161 |
214 TUtil::StrCopy( aText, iProfile.DisplayName() ); |
162 TUtil::StrCopy( aText, iProfile.DisplayName() ); |
215 } |
|
216 |
|
217 // ----------------------------------------------------------------------------- |
|
218 // CIAUpdateFWSyncProfile::SetNameL |
|
219 // ----------------------------------------------------------------------------- |
|
220 // |
|
221 void CIAUpdateFWSyncProfile::SetNameL( const TDesC& aText ) |
|
222 { |
|
223 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetNameL:" ); |
|
224 |
|
225 iProfile.SetDisplayNameL( aText ); |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CIAUpdateFWSyncProfile::CreatorId |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 TInt CIAUpdateFWSyncProfile::CreatorId() |
|
233 { |
|
234 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CreatorId:" ); |
|
235 |
|
236 return iProfile.CreatorId(); |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CIAUpdateFWSyncProfile::SetCreatorId |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 void CIAUpdateFWSyncProfile::SetCreatorId( TInt aCreatorId ) |
|
244 { |
|
245 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetCreatorId:" ); |
|
246 |
|
247 iProfile.SetCreatorId( aCreatorId ); |
|
248 } |
163 } |
249 |
164 |
250 // ----------------------------------------------------------------------------- |
165 // ----------------------------------------------------------------------------- |
251 // CIAUpdateFWSyncProfile::ProfileId |
166 // CIAUpdateFWSyncProfile::ProfileId |
252 // ----------------------------------------------------------------------------- |
167 // ----------------------------------------------------------------------------- |
259 "[IAUPDATEFW] CIAUpdateFWSyncProfile::ProfileId() completed: Profile id = %d"), |
174 "[IAUPDATEFW] CIAUpdateFWSyncProfile::ProfileId() completed: Profile id = %d"), |
260 retval ) ); |
175 retval ) ); |
261 return retval; |
176 return retval; |
262 } |
177 } |
263 |
178 |
264 // ----------------------------------------------------------------------------- |
|
265 // CIAUpdateFWSyncProfile::DeleteAllowed |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 TBool CIAUpdateFWSyncProfile::DeleteAllowed() |
|
269 { |
|
270 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::DeleteAllowed:" ); |
|
271 |
|
272 return iProfile.DeleteAllowed(); |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // CIAUpdateFWSyncProfile::IsSynced |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 TBool CIAUpdateFWSyncProfile::IsSynced() |
|
280 { |
|
281 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced()" ); |
|
282 |
|
283 TBool retVal = EFalse; |
|
284 if ( !iHistoryLogOpen ) |
|
285 { |
|
286 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced(): Opening history log" ); |
|
287 OpenHistoryLog(); |
|
288 } |
|
289 |
|
290 if ( iHistoryLogOpen ) |
|
291 { |
|
292 FTRACE( FPrint( _L( |
|
293 "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced(): Log open! Log count = %d"), |
|
294 iHistoryLog.Count() ) ); |
|
295 if ( iHistoryLog.Count() > 0 ) |
|
296 { |
|
297 const CSyncMLHistoryJob* job = LatestHistoryJob(); |
|
298 if ( job ) |
|
299 { |
|
300 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced(): True" ); |
|
301 if( job->LastSuccessSyncTime() != NULL ) |
|
302 { |
|
303 retVal = ETrue; |
|
304 } |
|
305 } |
|
306 else |
|
307 { |
|
308 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced(): False" ); |
|
309 } |
|
310 } |
|
311 } |
|
312 else |
|
313 { |
|
314 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced() Could not open history log!!!" ); |
|
315 } |
|
316 CloseHistoryLog(); |
|
317 |
|
318 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::IsSynced() completed" ); |
|
319 return retVal; |
|
320 } |
|
321 |
|
322 // ----------------------------------------------------------------------------- |
|
323 // CIAUpdateFWSyncProfile::LastSync |
|
324 // ----------------------------------------------------------------------------- |
|
325 // |
|
326 TTime CIAUpdateFWSyncProfile::LastSync() |
|
327 { |
|
328 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync()" ); |
|
329 |
|
330 if ( !iHistoryLogOpen ) |
|
331 { |
|
332 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync(): Opening history log" ); |
|
333 OpenHistoryLog(); |
|
334 } |
|
335 |
|
336 TTime time = 0; |
|
337 if ( iHistoryLogOpen ) |
|
338 { |
|
339 FTRACE( FPrint( _L( |
|
340 "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync(): Log open! Log count = %d"), |
|
341 iHistoryLog.Count() ) ); |
|
342 |
|
343 if (iHistoryLog.Count() > 0) |
|
344 { |
|
345 const CSyncMLHistoryJob* job = LatestHistoryJob(); |
|
346 if ( job ) |
|
347 { |
|
348 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync() timestamp" ); |
|
349 time = job->TimeStamp(); |
|
350 } |
|
351 } |
|
352 } |
|
353 else |
|
354 { |
|
355 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync() Could not open history log!!!" ); |
|
356 } |
|
357 |
|
358 CloseHistoryLog(); |
|
359 |
|
360 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync() completed" ); |
|
361 return time; |
|
362 } |
|
363 |
|
364 TTime CIAUpdateFWSyncProfile::LastSuccessSync() |
|
365 { |
|
366 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSuccessSynctime()" ); |
|
367 |
|
368 if ( !iHistoryLogOpen ) |
|
369 { |
|
370 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync(): Opening history log" ); |
|
371 OpenHistoryLog(); |
|
372 } |
|
373 |
|
374 TTime time = 0; |
|
375 if ( iHistoryLogOpen ) |
|
376 { |
|
377 FTRACE( FPrint( _L( |
|
378 "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync(): Log open! Log count = %d"), |
|
379 iHistoryLog.Count() ) ); |
|
380 |
|
381 if (iHistoryLog.Count() > 0) |
|
382 { |
|
383 const CSyncMLHistoryJob* job = LatestHistoryJob(); |
|
384 iProfileId=ProfileId(); |
|
385 if ( job ) |
|
386 { |
|
387 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync() timestamp" ); |
|
388 time = job->LastSuccessSyncTime(); |
|
389 } |
|
390 } |
|
391 } |
|
392 else |
|
393 { |
|
394 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSync() Could not open history log!!!" ); |
|
395 } |
|
396 |
|
397 CloseHistoryLog(); |
|
398 |
|
399 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LastSuccessSynctime() completed" ); |
|
400 return time; |
|
401 } |
|
402 |
|
403 // ----------------------------------------------------------------------------- |
|
404 // CIAUpdateFWSyncProfile::GetServerIdL |
|
405 // ----------------------------------------------------------------------------- |
|
406 // |
|
407 void CIAUpdateFWSyncProfile::GetServerId( TDes& aText ) |
|
408 { |
|
409 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetServerIdL:" ); |
|
410 |
|
411 TUtil::StrCopy(aText, iProfile.ServerId()); |
|
412 } |
|
413 |
|
414 // ----------------------------------------------------------------------------- |
|
415 // CIAUpdateFWSyncProfile::SetServerIdL |
|
416 // ----------------------------------------------------------------------------- |
|
417 // |
|
418 void CIAUpdateFWSyncProfile::SetServerIdL( const TDesC& aText ) |
|
419 { |
|
420 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetServerIdL:" ); |
|
421 |
|
422 TBuf8<KBufSize256> buf; |
|
423 TUtil::StrCopy(buf, aText); |
|
424 iProfile.SetServerIdL(buf); |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // CIAUpdateFWSyncProfile::GetServerPassword |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void CIAUpdateFWSyncProfile::GetServerPassword(TDes& aText) |
|
432 { |
|
433 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetServerPassword:" ); |
|
434 |
|
435 TUtil::StrCopy( aText, iProfile.ServerPassword() ); |
|
436 } |
|
437 |
|
438 // ----------------------------------------------------------------------------- |
|
439 // CIAUpdateFWSyncProfile::SetServerPasswordL |
|
440 // ----------------------------------------------------------------------------- |
|
441 // |
|
442 void CIAUpdateFWSyncProfile::SetServerPasswordL(const TDesC& aText) |
|
443 { |
|
444 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetServerPasswordL:" ); |
|
445 |
|
446 TUtil::StrCopy(iBuf8, aText); // conver TDes to TDes8 |
|
447 iProfile.SetServerPasswordL(iBuf8); |
|
448 } |
|
449 |
|
450 // ----------------------------------------------------------------------------- |
|
451 // CIAUpdateFWSyncProfile::ProtocolVersion |
|
452 // ----------------------------------------------------------------------------- |
|
453 // |
|
454 TInt CIAUpdateFWSyncProfile::ProtocolVersion() |
|
455 { |
|
456 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::ProtocolVersion:" ); |
|
457 |
|
458 TSmlProtocolVersion version = iProfile.ProtocolVersion(); |
|
459 return version; |
|
460 } |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CIAUpdateFWSyncProfile::SetProtocolVersionL |
|
464 // ----------------------------------------------------------------------------- |
|
465 // |
|
466 void CIAUpdateFWSyncProfile::SetProtocolVersionL(TInt aProtocolVersion) |
|
467 { |
|
468 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetProtocolVersionL:" ); |
|
469 |
|
470 iProfile.SetProtocolVersionL((TSmlProtocolVersion) aProtocolVersion); |
|
471 } |
|
472 |
179 |
473 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
474 // CIAUpdateFWSyncProfile::BearerType |
181 // CIAUpdateFWSyncProfile::BearerType |
475 // ----------------------------------------------------------------------------- |
182 // ----------------------------------------------------------------------------- |
476 // |
183 // |
585 |
270 |
586 } |
271 } |
587 } |
272 } |
588 |
273 |
589 // ----------------------------------------------------------------------------- |
274 // ----------------------------------------------------------------------------- |
590 // CIAUpdateFWSyncProfile::GetHostAddressL |
|
591 // ----------------------------------------------------------------------------- |
|
592 // |
|
593 void CIAUpdateFWSyncProfile::GetHostAddress(TDes& aText, TInt& aPort) |
|
594 { |
|
595 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetHostAddress:" ); |
|
596 aText = KNullDesC; |
|
597 aPort = KDefaultHttpPort; |
|
598 |
|
599 if (!iConnectionOpen) |
|
600 { |
|
601 return; |
|
602 } |
|
603 |
|
604 if (BearerType() != EAspBearerInternet) |
|
605 { |
|
606 TUtil::StrCopy(aText, iConnection.ServerURI()); // convert TDes8 to TDes |
|
607 return; // port number handling is for internet bearer only |
|
608 } |
|
609 |
|
610 TUtil::StrCopy( iBuf, iConnection.ServerURI() ); // convert TDes8 to TDes |
|
611 |
|
612 TURIParser parser( iBuf ); |
|
613 parser.GetUriWithoutPort( aText ); |
|
614 aPort = parser.Port(); |
|
615 if (aPort == KErrNotFound) |
|
616 { |
|
617 aPort = parser.DefaultPort(); |
|
618 } |
|
619 } |
|
620 |
|
621 // ----------------------------------------------------------------------------- |
|
622 // CIAUpdateFWSyncProfile::SetHostAddressL |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 void CIAUpdateFWSyncProfile::SetHostAddressL( const TDesC& aText, const TInt aPort ) |
|
626 { |
|
627 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetHostAddressL:" ); |
|
628 |
|
629 if (!iConnectionOpen) |
|
630 { |
|
631 return; |
|
632 } |
|
633 if (BearerType() != EAspBearerInternet) |
|
634 { |
|
635 // port number handling is for internet bearer only |
|
636 TUtil::StrCopy(iBuf, aText); |
|
637 } |
|
638 else |
|
639 { |
|
640 TURIParser parser(aText); |
|
641 parser.GetUri(iBuf, aPort); |
|
642 } |
|
643 |
|
644 TUtil::StrCopy( iBuf8, iBuf ); |
|
645 iConnection.SetServerURIL( iBuf8 ); |
|
646 } |
|
647 |
|
648 // ----------------------------------------------------------------------------- |
|
649 // CIAUpdateFWSyncProfile::GetUserNameL |
|
650 // ----------------------------------------------------------------------------- |
|
651 // |
|
652 void CIAUpdateFWSyncProfile::GetUserName(TDes& aText) |
|
653 { |
|
654 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetUserNameL:" ); |
|
655 |
|
656 TUtil::StrCopy( aText, iProfile.UserName() ); |
|
657 } |
|
658 |
|
659 // ----------------------------------------------------------------------------- |
|
660 // CIAUpdateFWSyncProfile::SetUserNameL |
|
661 // ----------------------------------------------------------------------------- |
|
662 // |
|
663 void CIAUpdateFWSyncProfile::SetUserNameL(const TDesC& aText) |
|
664 { |
|
665 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetUserNameL:" ); |
|
666 |
|
667 TUtil::StrCopy(iBuf8, aText); // conver TDes to TDes8 |
|
668 iProfile.SetUserNameL(iBuf8); |
|
669 } |
|
670 |
|
671 // ----------------------------------------------------------------------------- |
|
672 // CIAUpdateFWSyncProfile::GetPasswordL |
|
673 // ----------------------------------------------------------------------------- |
|
674 // |
|
675 void CIAUpdateFWSyncProfile::GetPassword(TDes& aText) |
|
676 { |
|
677 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetPasswordL:" ); |
|
678 |
|
679 TUtil::StrCopy( aText, iProfile.Password() ); |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CIAUpdateFWSyncProfile::SetPasswordL |
|
684 // ----------------------------------------------------------------------------- |
|
685 // |
|
686 void CIAUpdateFWSyncProfile::SetPasswordL(const TDesC& aText) |
|
687 { |
|
688 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetPasswordL:" ); |
|
689 TUtil::StrCopy( iBuf8, aText ); // conver TDes to TDes8 |
|
690 |
|
691 FTRACE( RDebug::Print( |
|
692 _L("[IAUPDATEFW] CIAUpdateFWSyncProfile::SetPasswordL iBuf8 (%S)"), &iBuf8 ) ); |
|
693 iProfile.SetPasswordL( iBuf8 ); |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // CIAUpdateFWSyncProfile::SASyncState |
275 // CIAUpdateFWSyncProfile::SASyncState |
698 // ----------------------------------------------------------------------------- |
276 // ----------------------------------------------------------------------------- |
699 // |
277 // |
700 TInt CIAUpdateFWSyncProfile::SASyncState() |
278 TInt CIAUpdateFWSyncProfile::SASyncState() |
701 { |
279 { |
742 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetSASyncStateL:ESmlEnableSync" ); |
320 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetSASyncStateL:ESmlEnableSync" ); |
743 Profile().SetSanUserInteractionL(ESmlEnableSync); |
321 Profile().SetSanUserInteractionL(ESmlEnableSync); |
744 } |
322 } |
745 } |
323 } |
746 |
324 |
747 // ----------------------------------------------------------------------------- |
325 |
748 // CIAUpdateFWSyncProfile::SetHttpUsed |
326 |
749 // ----------------------------------------------------------------------------- |
327 |
750 // |
|
751 void CIAUpdateFWSyncProfile::SetHttpUsedL(TBool aEnable) |
|
752 { |
|
753 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetHttpUsed:" ); |
|
754 |
|
755 if ( iConnectionOpen ) |
|
756 { |
|
757 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
758 { |
|
759 TBuf8<KBufSize32> key; |
|
760 TBuf8<KBufSize32> value; |
|
761 |
|
762 if ( aEnable ) |
|
763 { |
|
764 value.Num( KHttpUsed ); |
|
765 } |
|
766 else |
|
767 { |
|
768 value.Num( KHttpNotUsed ); |
|
769 } |
|
770 |
|
771 GetConnectionPropertyNameL( key, EPropertyHttpUsed ); |
|
772 iConnection.SetPropertyL( key, value ); |
|
773 } |
|
774 } |
|
775 } |
|
776 |
|
777 // ----------------------------------------------------------------------------- |
|
778 // CIAUpdateFWSyncProfile::HttpUsedL |
|
779 // ----------------------------------------------------------------------------- |
|
780 // |
|
781 TBool CIAUpdateFWSyncProfile::HttpUsedL() |
|
782 { |
|
783 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::HttpUsedL:" ); |
|
784 TBool retVal = EFalse; |
|
785 if ( iConnectionOpen ) |
|
786 { |
|
787 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
788 { |
|
789 TBuf8<KBufSize32> key; |
|
790 TBuf<KBufSize32> value; |
|
791 TInt intValue; |
|
792 |
|
793 GetConnectionPropertyNameL(key, EPropertyHttpUsed); |
|
794 TUtil::StrCopy(value, iConnection.GetPropertyL(key)); |
|
795 |
|
796 User::LeaveIfError( TUtil::StrToInt( value, intValue ) ); |
|
797 |
|
798 if ( intValue == 1 ) |
|
799 { |
|
800 retVal = ETrue; |
|
801 } |
|
802 } |
|
803 } |
|
804 return retVal; |
|
805 } |
|
806 |
|
807 // ----------------------------------------------------------------------------- |
|
808 // CIAUpdateFWSyncProfile::GetHttpUsernameL |
|
809 // ----------------------------------------------------------------------------- |
|
810 // |
|
811 void CIAUpdateFWSyncProfile::GetHttpUserNameL( TDes& aText ) |
|
812 { |
|
813 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetHttpUsernameL:" ); |
|
814 |
|
815 aText = KNullDesC; |
|
816 |
|
817 if ( iConnectionOpen ) |
|
818 { |
|
819 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
820 { |
|
821 TBuf8<KBufSize32> key; |
|
822 |
|
823 GetConnectionPropertyNameL( key, EPropertyHttpUserName ); |
|
824 TUtil::StrCopy( aText, iConnection.GetPropertyL( key ) ); |
|
825 } |
|
826 } |
|
827 } |
|
828 |
|
829 // ----------------------------------------------------------------------------- |
|
830 // CIAUpdateFWSyncProfile::SetHttpUsernameL |
|
831 // ----------------------------------------------------------------------------- |
|
832 // |
|
833 void CIAUpdateFWSyncProfile::SetHttpUserNameL( const TDesC& aText ) |
|
834 { |
|
835 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetHttpUsernameL:" ); |
|
836 |
|
837 if ( iConnectionOpen ) |
|
838 { |
|
839 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
840 { |
|
841 TBuf8<KBufSize32> key; |
|
842 |
|
843 GetConnectionPropertyNameL( key, EPropertyHttpUserName ); |
|
844 TUtil::StrCopy( iBuf8, aText ); // convert TDes to TDes8 |
|
845 iConnection.SetPropertyL( key, iBuf8 ); |
|
846 } |
|
847 } |
|
848 } |
|
849 |
|
850 // ----------------------------------------------------------------------------- |
|
851 // CIAUpdateFWSyncProfile::GetHttpPasswordL |
|
852 // ----------------------------------------------------------------------------- |
|
853 // |
|
854 void CIAUpdateFWSyncProfile::GetHttpPasswordL( TDes& aText ) |
|
855 { |
|
856 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetHttpPasswordL:" ); |
|
857 aText = KNullDesC; |
|
858 |
|
859 if ( iConnectionOpen ) |
|
860 { |
|
861 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
862 { |
|
863 TBuf8<KBufSize32> key; |
|
864 GetConnectionPropertyNameL( key, EPropertyHttpPassword ); |
|
865 TUtil::StrCopy( aText, iConnection.GetPropertyL( key ) ); |
|
866 } |
|
867 } |
|
868 } |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // CIAUpdateFWSyncProfile::SetHttpPasswordL |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 void CIAUpdateFWSyncProfile::SetHttpPasswordL( const TDesC& aText ) |
|
875 { |
|
876 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::SetHttpPasswordL:" ); |
|
877 |
|
878 if ( iConnectionOpen ) |
|
879 { |
|
880 if ( iConnection.Identifier() == KUidNSmlMediumTypeInternet.iUid ) |
|
881 { |
|
882 TBuf8<KBufSize32> key; |
|
883 |
|
884 GetConnectionPropertyNameL( key, EPropertyHttpPassword ); |
|
885 TUtil::StrCopy( iBuf8, aText ); // convert TDes to TDes8 |
|
886 iConnection.SetPropertyL( key, iBuf8 ); |
|
887 } |
|
888 } |
|
889 } |
|
890 |
328 |
891 // ----------------------------------------------------------------------------- |
329 // ----------------------------------------------------------------------------- |
892 // CIAUpdateFWSyncProfile::Profile |
330 // CIAUpdateFWSyncProfile::Profile |
893 // ----------------------------------------------------------------------------- |
331 // ----------------------------------------------------------------------------- |
894 // |
332 // |
897 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::Profile()" ); |
335 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::Profile()" ); |
898 |
336 |
899 return iProfile; |
337 return iProfile; |
900 } |
338 } |
901 |
339 |
902 // ----------------------------------------------------------------------------- |
340 |
903 // CIAUpdateFWSyncProfile::LatestHistoryJob |
341 |
904 // ----------------------------------------------------------------------------- |
|
905 // |
|
906 const CSyncMLHistoryJob* CIAUpdateFWSyncProfile::LatestHistoryJob() |
|
907 { |
|
908 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob:" ); |
|
909 |
|
910 if ( !iHistoryLogOpen ) |
|
911 { |
|
912 OpenHistoryLog(); |
|
913 } |
|
914 |
|
915 if ( iHistoryLogOpen ) |
|
916 { |
|
917 TInt count = iHistoryLog.Count(); |
|
918 FTRACE( FPrint( _L( |
|
919 "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob(): Log count %d"), |
|
920 count ) ); |
|
921 |
|
922 if ( count == 0 ) |
|
923 { |
|
924 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob(): No history" ); |
|
925 return NULL; // profile has no history job |
|
926 } |
|
927 |
|
928 // sort array |
|
929 iHistoryLog.SortEntries( CSyncMLHistoryEntry::ESortByTime ); |
|
930 |
|
931 // try to find latest sync job (start from last array entry) |
|
932 for ( TInt index = count - 1; index >= 0; index-- ) |
|
933 { |
|
934 FTRACE( FPrint( _L( |
|
935 "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob: count %d index %d"), |
|
936 count, index ) ); |
|
937 //const CSyncMLHistoryEntry& entry = iHistoryLog[index]; |
|
938 const CSyncMLHistoryEntry& entry = iHistoryLog.Entry( index ); |
|
939 |
|
940 FTRACE( FPrint( _L( |
|
941 "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob: Entry type = %x"), |
|
942 entry.EntryType().iUid ) ); |
|
943 |
|
944 const CSyncMLHistoryJob* jobEntry = |
|
945 CSyncMLHistoryJob::DynamicCast( &entry ); |
|
946 |
|
947 if ( jobEntry ) |
|
948 { |
|
949 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob() completed: OK" ); |
|
950 return jobEntry; |
|
951 } |
|
952 } |
|
953 } |
|
954 |
|
955 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::LatestHistoryJob() completed: No history found" ); |
|
956 return NULL; // profile has no history job |
|
957 } |
|
958 |
|
959 // ----------------------------------------------------------------------------- |
|
960 // CIAUpdateFWSyncProfile::OpenHistoryLog |
|
961 // ----------------------------------------------------------------------------- |
|
962 // |
|
963 void CIAUpdateFWSyncProfile::OpenHistoryLog() |
|
964 { |
|
965 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::OpenHistoryLog()" ); |
|
966 |
|
967 TInt id = ProfileId(); |
|
968 TRAPD( err, iHistoryLog.OpenL( Session(), id ) ); |
|
969 |
|
970 if ( err == KErrNone ) |
|
971 { |
|
972 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::OpenHistoryLog(): Opened" ); |
|
973 iHistoryLogOpen = ETrue; |
|
974 } |
|
975 |
|
976 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::OpenHistoryLog() completed" ); |
|
977 } |
|
978 |
|
979 // ----------------------------------------------------------------------------- |
|
980 // CIAUpdateFWSyncProfile::CloseHistoryLog |
|
981 // ----------------------------------------------------------------------------- |
|
982 // |
|
983 void CIAUpdateFWSyncProfile::CloseHistoryLog() |
|
984 { |
|
985 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CloseHistoryLog()" ); |
|
986 |
|
987 if ( iHistoryLogOpen ) |
|
988 { |
|
989 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CloseHistoryLog(): Closed " ); |
|
990 iHistoryLog.Close(); |
|
991 iHistoryLogOpen = EFalse; |
|
992 } |
|
993 |
|
994 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CloseHistoryLog() completed" ); |
|
995 } |
|
996 |
342 |
997 // ----------------------------------------------------------------------------- |
343 // ----------------------------------------------------------------------------- |
998 // CIAUpdateFWSyncProfile::OpenConnection |
344 // CIAUpdateFWSyncProfile::OpenConnection |
999 // ----------------------------------------------------------------------------- |
345 // ----------------------------------------------------------------------------- |
1000 // |
346 // |
1065 CleanupStack::PopAndDestroy( &transport ); |
411 CleanupStack::PopAndDestroy( &transport ); |
1066 |
412 |
1067 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetConnectionPropertyNameL() completed" ); |
413 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::GetConnectionPropertyNameL() completed" ); |
1068 } |
414 } |
1069 |
415 |
1070 // ----------------------------------------------------------------------------- |
|
1071 // CIAUpdateFWSyncProfile::CopyValuesL |
|
1072 // ----------------------------------------------------------------------------- |
|
1073 // |
|
1074 void CIAUpdateFWSyncProfile::CopyValuesL( CIAUpdateFWSyncProfile* aSource ) |
|
1075 { |
|
1076 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CopyValuesL()" ); |
|
1077 |
|
1078 TBuf<KBufSize256> buf; |
|
1079 TInt num = 0; |
|
1080 |
|
1081 num = aSource->ProtocolVersion(); |
|
1082 SetProtocolVersionL( num ); |
|
1083 if ( num == 1 ) |
|
1084 { |
|
1085 aSource->GetServerId( buf ); |
|
1086 SetServerIdL( buf ); |
|
1087 } |
|
1088 |
|
1089 num = aSource->BearerType(); |
|
1090 SetBearerTypeL( num ); |
|
1091 |
|
1092 num = aSource->AccessPointL(); |
|
1093 SetAccessPointL( num ); |
|
1094 |
|
1095 aSource->GetHostAddress( buf, num ); |
|
1096 SetHostAddressL( buf, num ); |
|
1097 |
|
1098 aSource->GetUserName( buf ); |
|
1099 SetUserNameL(buf); |
|
1100 |
|
1101 aSource->GetPassword( buf ); |
|
1102 SetPasswordL( buf ); |
|
1103 |
|
1104 num = aSource->SASyncState(); |
|
1105 SetSASyncStateL( num ); |
|
1106 |
|
1107 if ( aSource->BearerType() == EAspBearerInternet) |
|
1108 { |
|
1109 num = aSource->HttpUsedL(); |
|
1110 SetHttpUsedL(num); |
|
1111 |
|
1112 aSource->GetHttpUserNameL(buf); |
|
1113 SetHttpUserNameL(buf); |
|
1114 |
|
1115 aSource->GetHttpPasswordL(buf); |
|
1116 SetHttpPasswordL(buf); |
|
1117 } |
|
1118 FLOG( "[IAUPDATEFW] CIAUpdateFWSyncProfile::CopyValuesL() completed" ); |
|
1119 } |
|
1120 |
416 |
1121 // End of File |
417 // End of File |