pnpmobileservices/pnpms/PnP/PnpProvisioningAppSrc/PnpProvisioningSaver.cpp
changeset 2 a5fecba4b1e4
parent 0 3ce708148e4d
child 14 4699373c9af8
equal deleted inserted replaced
1:4490afcb47b1 2:a5fecba4b1e4
    37 // CLASS DECLARATION
    37 // CLASS DECLARATION
    38 
    38 
    39 // ================= MEMBER FUNCTIONS =======================
    39 // ================= MEMBER FUNCTIONS =======================
    40 
    40 
    41 // C++ default constructor.
    41 // C++ default constructor.
    42 CPnpProvisioningSaver::CPnpProvisioningSaver( CWPEngine& aEngine, TBool aSetAsDefault )
    42 CPnpProvisioningSaver::CPnpProvisioningSaver( CWPEngine& aEngine, TBool aSetAsDefault, TBool aWaitNote )
    43 : CActive( EPriorityStandard ), iEngine( aEngine ), 
    43 : CActive( EPriorityStandard ), iEngine( aEngine ), 
    44   iSetAsDefault( aSetAsDefault ),
    44   iSetAsDefault( aSetAsDefault ),
    45   iCurrentItem( 0 ), iResult( KErrNone ),iEndKeyPressed(EFalse)
    45   iCurrentItem( 0 ), iResult( KErrNone ),iEndKeyPressed(EFalse), iShowWaitNote(aWaitNote)
    46     {
    46     {
    47     CActiveScheduler::Add( this );
    47     CActiveScheduler::Add( this );
    48     }
    48     }
    49 
    49 
    50 // ---------------------------------------------------------
    50 // ---------------------------------------------------------
    62     iRetryTimer = CPeriodic::NewL( EPriorityStandard );
    62     iRetryTimer = CPeriodic::NewL( EPriorityStandard );
    63 
    63 
    64     LOGSTRING("Constructing dialog");
    64     LOGSTRING("Constructing dialog");
    65     
    65     
    66     // Set up the dialog and callback mechanism.
    66     // Set up the dialog and callback mechanism.
       
    67     if(iSetAsDefault && iShowWaitNote)
    67     ShowWaitNoteL();
    68     ShowWaitNoteL();
    68     }
    69     }
    69 
    70 
    70 // ---------------------------------------------------------
    71 // ---------------------------------------------------------
    71 // CPnpProvisioningSaver::ExecuteLD
    72 // CPnpProvisioningSaver::ExecuteLD
   159                 iEngine.SetAsDefaultL( iCurrentItem );
   160                 iEngine.SetAsDefaultL( iCurrentItem );
   160                 } );
   161                 } );
   161         }
   162         }
   162     else
   163     else
   163         {
   164         {
   164         if(iWaitDialogMonitor->iStatus != KErrCancel)
   165 
   165         	{
       
   166         LOGSTRING2("Saving item: %i", iCurrentItem );
   166         LOGSTRING2("Saving item: %i", iCurrentItem );
   167         TRAP( err, iEngine.SaveL( iCurrentItem ) );
   167         TRAP( err, iEngine.SaveL( iCurrentItem ) );
   168         	}
   168         
   169         else
       
   170         	{
       
   171         	iEndKeyPressed = ETrue; //means End key or cancel pressed before saving some sttings
       
   172         	LOGSTRING2("item: %i not saved", iCurrentItem );
       
   173         	}
       
   174         }
   169         }
   175 
   170 
   176     // If CommsDB or BookmarkDB are locked, schedule a retry
   171     // If CommsDB or BookmarkDB are locked, schedule a retry
   177     if( err == EWPCommsDBLocked )
   172     if( err == EWPCommsDBLocked )
   178         {
   173         {
   201 
   196 
   202     // Normal progress
   197     // Normal progress
   203     if( iCurrentItem == iEngine.ItemCount()-1 )
   198     if( iCurrentItem == iEngine.ItemCount()-1 )
   204         {
   199         {
   205         LOGSTRING("All saved");
   200         LOGSTRING("All saved");
   206         LOGSTRING2( "Saver RunL iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );        
   201         //LOGSTRING2( "Saver RunL iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );        
   207         ProcessFinishedL();
   202         ProcessFinishedL();
   208         }
   203         }
   209     else
   204     else
   210         {
   205         {
   211         LOGSTRING2( "Saver RunL 2nd iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );
   206         //LOGSTRING2( "Saver RunL 2nd iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );
   212         iCurrentItem++;
   207         iCurrentItem++;
   213         CompleteRequest();
   208         CompleteRequest();
   214         }
   209         }
   215     }
   210     }
   216 
   211 
   218 // CPnpProvisioningSaver::ProcessFinishedL
   213 // CPnpProvisioningSaver::ProcessFinishedL
   219 // ---------------------------------------------------------
   214 // ---------------------------------------------------------
   220 //
   215 //
   221 void CPnpProvisioningSaver::ProcessFinishedL()
   216 void CPnpProvisioningSaver::ProcessFinishedL()
   222     {
   217     {
   223     LOGSTRING2( "Saver iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );
   218     //LOGSTRING2( "Saver iWaitDialogMonitor->iStatus %i", iWaitDialogMonitor->iStatus.Int() );
       
   219     iWait.AsyncStop();
       
   220     if(iWaitDialogMonitor)
       
   221     {
   224     //End key or cancel pressed after saving settings
   222     //End key or cancel pressed after saving settings
   225     if(iWaitDialogMonitor->iStatus == KErrCancel)
   223     if(iWaitDialogMonitor->iStatus == KErrCancel)
   226     	{
   224     	{
   227     	iEndKeyPressed = ETrue;
   225     	iEndKeyPressed = ETrue;
   228     	}
   226     	}
   229     if( iGlobalWaitNote )
   227     if( iGlobalWaitNote )
   230         {
   228         {
   231         delete iGlobalWaitNote;
   229         delete iGlobalWaitNote;
   232         iGlobalWaitNote = NULL;
   230         iGlobalWaitNote = NULL;
   233         }
   231         }
       
   232      }
   234     }
   233     }
   235 
   234 
   236 // ---------------------------------------------------------
   235 // ---------------------------------------------------------
   237 // CPnpProvisioningSaver::RunError
   236 // CPnpProvisioningSaver::RunError
   238 // ---------------------------------------------------------
   237 // ---------------------------------------------------------