pushmtm/MtmUiSrc/PushLoadServiceOp.cpp
changeset 25 92a061761a7b
parent 24 868cceedabd3
equal deleted inserted replaced
24:868cceedabd3 25:92a061761a7b
    24 #include "PushMtmUiPanic.h"
    24 #include "PushMtmUiPanic.h"
    25 #include "PushMtmLog.h"
    25 #include "PushMtmLog.h"
    26 #include "PushMtmUtil.h"
    26 #include "PushMtmUtil.h"
    27 #include "PushMtmSettings.h"
    27 #include "PushMtmSettings.h"
    28 #include "PushAuthenticationUtilities.h"
    28 #include "PushAuthenticationUtilities.h"
    29 #include <CSIPushMsgEntry.h>
    29 #include <push/CSIPushMsgEntry.h>
    30 #include <CSLPushMsgEntry.h>
    30 #include <push/CSLPushMsgEntry.h>
    31 #include <eikenv.h>
    31 #include <eikenv.h>
    32 #include <apmstd.h>
    32 #include <apmstd.h>
    33 #include <schemehandler.h>
    33 #include <schemehandler.h>
    34 #include <AknNoteWrappers.h>
    34 #include <AknNoteWrappers.h>
    35 #include <PushEntry.h>
    35 #include <PushEntry.h>
    49 
    49 
    50 // ---------------------------------------------------------
    50 // ---------------------------------------------------------
    51 // CPushLoadServiceOp::NewL
    51 // CPushLoadServiceOp::NewL
    52 // ---------------------------------------------------------
    52 // ---------------------------------------------------------
    53 //
    53 //
    54 CPushLoadServiceOp* CPushLoadServiceOp::NewL( CMsvSession& aSession, 
    54 CPushLoadServiceOp* CPushLoadServiceOp::NewL( CMsvSession& aSession,
    55                                               TMsvId aEntryId, 
    55                                               TMsvId aEntryId,
    56                                               TRequestStatus& aObserverStatus ) 
    56                                               TRequestStatus& aObserverStatus )
    57     {
    57     {
    58     PUSHLOG_ENTERFN("CPushLoadServiceOp::NewL")
    58     PUSHLOG_ENTERFN("CPushLoadServiceOp::NewL")
    59 
    59 
    60     CPushLoadServiceOp* self = 
    60     CPushLoadServiceOp* self =
    61         new (ELeave) CPushLoadServiceOp( aSession, aEntryId, aObserverStatus );
    61         new (ELeave) CPushLoadServiceOp( aSession, aEntryId, aObserverStatus );
    62     CleanupStack::PushL( self );
    62     CleanupStack::PushL( self );
    63     self->ConstructL();
    63     self->ConstructL();
    64     CleanupStack::Pop( self );
    64     CleanupStack::Pop( self );
    65 
    65 
    95     // Check expiration (SI specific).
    95     // Check expiration (SI specific).
    96     if ( IsExpiredL( iTEntry ) )
    96     if ( IsExpiredL( iTEntry ) )
    97         {
    97         {
    98         PUSHLOG_WRITE(" Msg is expired.")
    98         PUSHLOG_WRITE(" Msg is expired.")
    99         // The entry is expired.
    99         // The entry is expired.
   100         
   100 
   101         // Display a confirmation dialog.
   101         // Display a confirmation dialog.
   102         TParse* fileParser = new (ELeave) TParse;
   102         TParse* fileParser = new (ELeave) TParse;
   103         CleanupStack::PushL( fileParser );
   103         CleanupStack::PushL( fileParser );
   104         fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL ); 
   104         fileParser->Set( KPushMtmUiResourceFileAndDrive, &KDC_MTM_RESOURCE_DIR, NULL );
   105         AssureResourceL( fileParser->FullName() );
   105         AssureResourceL( fileParser->FullName() );
   106         CleanupStack::PopAndDestroy( fileParser ); // fileParser
   106         CleanupStack::PopAndDestroy( fileParser ); // fileParser
   107         fileParser = NULL;
   107         fileParser = NULL;
   108 
   108 
   109         HBufC* value = iCoeEnv.AllocReadResourceLC( R_PUSHLS_EXPIRED_NOTE );
   109         HBufC* value = iCoeEnv.AllocReadResourceLC( R_PUSHLS_EXPIRED_NOTE );
   128 
   128 
   129 // ---------------------------------------------------------
   129 // ---------------------------------------------------------
   130 // CPushLoadServiceOp::CPushLoadServiceOp
   130 // CPushLoadServiceOp::CPushLoadServiceOp
   131 // ---------------------------------------------------------
   131 // ---------------------------------------------------------
   132 //
   132 //
   133 CPushLoadServiceOp::CPushLoadServiceOp( CMsvSession& aSession, 
   133 CPushLoadServiceOp::CPushLoadServiceOp( CMsvSession& aSession,
   134                                         TMsvId aEntryId, 
   134                                         TMsvId aEntryId,
   135                                         TRequestStatus& aObserverStatus ) 
   135                                         TRequestStatus& aObserverStatus )
   136 :   CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ), 
   136 :   CPushMtmUiOperation( aSession, aEntryId, aObserverStatus ),
   137     iDone( EFalse )
   137     iDone( EFalse )
   138     {
   138     {
   139     PUSHLOG_WRITE("CPushLoadServiceOp constructing")
   139     PUSHLOG_WRITE("CPushLoadServiceOp constructing")
   140     }
   140     }
   141 
   141 
   142 // ---------------------------------------------------------
   142 // ---------------------------------------------------------
   143 // CPushLoadServiceOp::ConstructL
   143 // CPushLoadServiceOp::ConstructL
   144 // ---------------------------------------------------------
   144 // ---------------------------------------------------------
   145 //
   145 //
   146 void CPushLoadServiceOp::ConstructL() 
   146 void CPushLoadServiceOp::ConstructL()
   147     {
   147     {
   148     PUSHLOG_ENTERFN("CPushLoadServiceOp::ConstructL")
   148     PUSHLOG_ENTERFN("CPushLoadServiceOp::ConstructL")
   149 
   149 
   150     FeatureManager::InitializeLibL();
   150     FeatureManager::InitializeLibL();
   151 
   151 
   152     CPushMtmUiOperation::ConstructL();
   152     CPushMtmUiOperation::ConstructL();
   153 
   153 
   154     // Initialize iTEntry.
   154     // Initialize iTEntry.
   155     TMsvId service;
   155     TMsvId service;
   156     User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, iTEntry ) );
   156     User::LeaveIfError( iMsvSession.GetEntry( iEntryId, service, iTEntry ) );
   157     __ASSERT_ALWAYS( iTEntry.iMtm == KUidMtmWapPush, 
   157     __ASSERT_ALWAYS( iTEntry.iMtm == KUidMtmWapPush,
   158                      UiPanic( EPushMtmUiPanBadMtm ) );
   158                      UiPanic( EPushMtmUiPanBadMtm ) );
   159 
   159 
   160     PUSHLOG_LEAVEFN("CPushLoadServiceOp::ConstructL")
   160     PUSHLOG_LEAVEFN("CPushLoadServiceOp::ConstructL")
   161     }
   161     }
   162 
   162 
   203 
   203 
   204     if ( bioType == KUidWapPushMsgSI.iUid )
   204     if ( bioType == KUidWapPushMsgSI.iUid )
   205         {
   205         {
   206         context = CSIPushMsgEntry::NewL();
   206         context = CSIPushMsgEntry::NewL();
   207         }
   207         }
   208     else if ( bioType == KUidWapPushMsgSL.iUid && 
   208     else if ( bioType == KUidWapPushMsgSL.iUid &&
   209               FeatureManager::FeatureSupported( KFeatureIdPushSL ) )
   209               FeatureManager::FeatureSupported( KFeatureIdPushSL ) )
   210         {
   210         {
   211         context = CSLPushMsgEntry::NewL();
   211         context = CSLPushMsgEntry::NewL();
   212         }
   212         }
   213     else
   213     else
   240 
   240 
   241 // ---------------------------------------------------------
   241 // ---------------------------------------------------------
   242 // CPushLoadServiceOp::AuthenticateL
   242 // CPushLoadServiceOp::AuthenticateL
   243 // ---------------------------------------------------------
   243 // ---------------------------------------------------------
   244 //
   244 //
   245 TBool CPushLoadServiceOp::AuthenticateL( const CPushMsgEntryBase& aPushMsg, 
   245 TBool CPushLoadServiceOp::AuthenticateL( const CPushMsgEntryBase& aPushMsg,
   246                                          const CPushMtmSettings& aMtmSettings ) const
   246                                          const CPushMtmSettings& aMtmSettings ) const
   247     {
   247     {
   248     PUSHLOG_ENTERFN("CPushLoadServiceOp::AuthenticateL");
   248     PUSHLOG_ENTERFN("CPushLoadServiceOp::AuthenticateL");
   249 
   249 
   250     TBool isAuthenticated = ETrue; // by default.
   250     TBool isAuthenticated = ETrue; // by default.
   268                 {
   268                 {
   269                 // Ask the user...
   269                 // Ask the user...
   270                 isAuthenticated = ExecuteUserQueryL( R_PUSHLS_SL_CACHE_NOT_AUTH );
   270                 isAuthenticated = ExecuteUserQueryL( R_PUSHLS_SL_CACHE_NOT_AUTH );
   271                 }
   271                 }
   272             }
   272             }
   273         else if 
   273         else if
   274            ( 
   274            (
   275              sl.Action() == CSLPushMsgEntry::ESLPushMsgExecuteHigh && 
   275              sl.Action() == CSLPushMsgEntry::ESLPushMsgExecuteHigh &&
   276              aMtmSettings.ServiceLoadingType() == CPushMtmSettings::EAutomatic 
   276              aMtmSettings.ServiceLoadingType() == CPushMtmSettings::EAutomatic
   277            )
   277            )
   278             {
   278             {
   279             PUSHLOG_WRITE(" SL high + auto");
   279             PUSHLOG_WRITE(" SL high + auto");
   280             isAuthenticated = TPushAuthenticationUtil::
   280             isAuthenticated = TPushAuthenticationUtil::
   281                               AuthenticateMsgL( aMtmSettings, aPushMsg );
   281                               AuthenticateMsgL( aMtmSettings, aPushMsg );
   373             // Download the URL.
   373             // Download the URL.
   374             delete iSchemeHandler;
   374             delete iSchemeHandler;
   375             iSchemeHandler = NULL;
   375             iSchemeHandler = NULL;
   376             HBufC* validatedUrl = ValidateLC( url );
   376             HBufC* validatedUrl = ValidateLC( url );
   377             iSchemeHandler = CSchemeHandler::NewL( *validatedUrl );
   377             iSchemeHandler = CSchemeHandler::NewL( *validatedUrl );
   378             
   378 
   379             if( (url.Mid(0,7).Compare(_L("http://")) == 0) || (url.Mid(0,8).Compare(_L("https://")) == 0))
   379             if( (url.Mid(0,7).Compare(_L("http://")) == 0) || (url.Mid(0,8).Compare(_L("https://")) == 0))
   380             {
   380             {
   381             	TRAPD( err, iSchemeHandler->HandleUrlStandaloneL());
   381             	TRAPD( err, iSchemeHandler->HandleUrlStandaloneL());
   382             	CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl
   382             	CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl
   383             	SignalObserver( err );
   383             	SignalObserver( err );
   388 				TRAPD(err, iSchemeHandler->HandleUrlEmbeddedL());
   388 				TRAPD(err, iSchemeHandler->HandleUrlEmbeddedL());
   389 				CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl
   389 				CleanupStack::PopAndDestroy( validatedUrl ); // validatedUrl
   390 			    if( err != KErrNone)
   390 			    if( err != KErrNone)
   391 				    SignalObserver( err );
   391 				    SignalObserver( err );
   392             }
   392             }
   393             
   393 
   394           }
   394           }
   395 
   395 
   396         CleanupStack::PopAndDestroy( context ); // context, needed for 'url'
   396         CleanupStack::PopAndDestroy( context ); // context, needed for 'url'
   397         }
   397         }
   398 
   398