iaupdate/IAD/ui/src/iaupdateuicontroller.cpp
changeset 42 d17dc5398051
parent 33 8110bf1194d1
child 44 329d304c1aa1
child 52 92f864ef0288
equal deleted inserted replaced
37:6e7b00453237 42:d17dc5398051
    22 #include <centralrepository.h>
    22 #include <centralrepository.h>
    23 #include <SWInstDefs.h>
    23 #include <SWInstDefs.h>
    24 #include <featurecontrol.h>
    24 #include <featurecontrol.h>
    25 #include <cmmanager.h>
    25 #include <cmmanager.h>
    26 #include <qapplication.h>
    26 #include <qapplication.h>
    27 #include <hbmessagebox.h>
       
    28 #include <hbaction.h>
    27 #include <hbaction.h>
    29 #include <hbprogressdialog.h>
    28 #include <hbprogressdialog.h>
    30 #include <iaupdateparameters.h>
    29 #include <iaupdateparameters.h>
    31 
    30 
    32 #include "iaupdateuicontroller.h"
    31 #include "iaupdateuicontroller.h"
    57 #include "iaupdatefileconsts.h"
    56 #include "iaupdatefileconsts.h"
    58 #include "iaupdatefirsttimeinfo.h"
    57 #include "iaupdatefirsttimeinfo.h"
    59 #include "iaupdaterefreshhandler.h"
    58 #include "iaupdaterefreshhandler.h"
    60 #include "iaupdatenodeid.h"
    59 #include "iaupdatenodeid.h"
    61 #include "iaupdatewaitdialog.h"
    60 #include "iaupdatewaitdialog.h"
       
    61 #include "iaupdatedialogutil.h"
    62 #include "iaupdatedebug.h"
    62 #include "iaupdatedebug.h"
    63 
    63 
    64 
    64 
    65 // cenrep in emulator:
    65 // cenrep in emulator:
    66 // copy 2000F85A.txt to '\epoc32\release\winscw\udeb\Z\private\10202be9\'
    66 // copy 2000F85A.txt to '\epoc32\release\winscw\udeb\Z\private\10202be9\'
   260     delete iStarter;
   260     delete iStarter;
   261     delete iConfigData;
   261     delete iConfigData;
   262     delete iRoamingHandler;
   262     delete iRoamingHandler;
   263     delete iParams;
   263     delete iParams;
   264     delete iRefreshHandler;
   264     delete iRefreshHandler;
       
   265     delete mDialogUtil;
   265 
   266 
   266     // If dialogs have not been released yet, release them now.
   267     // If dialogs have not been released yet, release them now.
   267     // ProcessFinishedL() should normally be used for dialogs but
   268     // ProcessFinishedL() should normally be used for dialogs but
   268     // here just use non-leaving delete. In normal cases, dialogs should
   269     // here just use non-leaving delete. In normal cases, dialogs should
   269     // already be released in the end of the update flow before coming here.
   270     // already be released in the end of the update flow before coming here.
   307 // ---------------------------------------------------------------------------
   308 // ---------------------------------------------------------------------------
   308 //
   309 //
   309 void CIAUpdateUiController::CheckUpdatesL()
   310 void CIAUpdateUiController::CheckUpdatesL()
   310     {
   311     {
   311     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::CheckUpdatesL() begin");
   312     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::CheckUpdatesL() begin");
   312 
   313     
   313     iCountOfAvailableUpdates = 0;
   314     iCountOfAvailableUpdates = 0;
   314     
   315     
   315     if ( iParams )
   316     if ( iParams )
   316         {
   317         {
   317     	iFilter->SetFilterParams( iParams ); //iParams ownership is changed
   318     	iFilter->SetFilterParams( iParams ); //iParams ownership is changed
   318     	iParams = NULL;
   319     	iParams = NULL;
   319         }
   320         }
   320      
   321      
   321     TBool agreementAccepted( EFalse ); 
   322     TBool agreementAccepted( EFalse );
   322     if ( !ForcedRefresh() )
   323     if ( !ForcedRefresh() )
   323         {
   324         {
   324         CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   325         CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   325         agreementAccepted = agreement->AgreementAcceptedL();
   326         agreementAccepted = agreement->AgreementAcceptedL();
   326         if ( ( !agreementAccepted )&& ( iRequestType != IAUpdateUiDefines::ECheckUpdates ) )
   327         if ( ( !agreementAccepted )&& ( iRequestType != IAUpdateUiDefines::ECheckUpdates ) )
   328             // agreement (disclaimer) dialog is not prompted when CheckUpdates is called
   329             // agreement (disclaimer) dialog is not prompted when CheckUpdates is called
   329             //
   330             //
   330             // Refresh from network is allowed when first time case 
   331             // Refresh from network is allowed when first time case 
   331             iRefreshFromNetworkDenied = EFalse;
   332             iRefreshFromNetworkDenied = EFalse;
   332             agreementAccepted = agreement->AcceptAgreementL();  
   333             agreementAccepted = agreement->AcceptAgreementL();  
       
   334             if (!agreementAccepted)
       
   335                 {
       
   336                 if ( !mDialogUtil )
       
   337                     {
       
   338                     mDialogUtil = new IAUpdateDialogUtil(NULL, this);
       
   339                     }
       
   340                 if ( mDialogUtil )
       
   341                     {
       
   342                     mPrimaryAction = NULL;
       
   343                     mPrimaryAction = new HbAction("Accept");
       
   344                     HbAction *secondaryAction = NULL;
       
   345                     secondaryAction = new HbAction("Decline");
       
   346                     mDialogUtil->showAgreement(mPrimaryAction,secondaryAction);
       
   347                     iDialogState = EAgreement;
       
   348                     }
       
   349                 }
   333             }
   350             }
   334         CleanupStack::PopAndDestroy( agreement );
   351         CleanupStack::PopAndDestroy( agreement );
   335         }
   352         }
   336   	             
   353     if ( iDialogState != EAgreement )
       
   354         {
       
   355         AgreementHandledL();
       
   356         }
       
   357     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::CheckUpdatesL() end");
       
   358     return;
       
   359     }
       
   360 
       
   361 // ---------------------------------------------------------------------------
       
   362 // CIAUpdateUiController:: AgreementHandledL
       
   363 // Updates the update item list.
       
   364 // ---------------------------------------------------------------------------
       
   365 //
       
   366 void CIAUpdateUiController::AgreementHandledL()
       
   367     {
       
   368     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::AgreementHandledL() begin");
       
   369     TBool agreementAccepted( EFalse );
       
   370     CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
       
   371     agreementAccepted = agreement->AgreementAcceptedL();
       
   372     CleanupStack::PopAndDestroy( agreement );        
   337     if ( !agreementAccepted && !ForcedRefresh() )
   373     if ( !agreementAccepted && !ForcedRefresh() )
   338         {
   374         {
   339         if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
   375         if ( iRequestType == IAUpdateUiDefines::ECheckUpdates )
   340             {
   376             {
   341             CIAUpdateAutomaticCheck* automaticCheck = CIAUpdateAutomaticCheck::NewLC();
   377             CIAUpdateAutomaticCheck* automaticCheck = CIAUpdateAutomaticCheck::NewLC();
   393             // and new startup should not be called. Also, leave in that case.
   429             // and new startup should not be called. Also, leave in that case.
   394             User::LeaveIfError( ret );	
   430             User::LeaveIfError( ret );	
   395             }	
   431             }	
   396         }
   432         }
   397 
   433 
   398     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::CheckUpdatesL() end");
   434     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::AgreementHandledL() end");
   399     }
   435     }
   400 
   436 
   401 
   437 
   402 // ---------------------------------------------------------------------------
   438 // ---------------------------------------------------------------------------
   403 // CIAUpdateUiController::StartUpdateL
   439 // CIAUpdateUiController::StartUpdateL
   415 
   451 
   416     CreateSelectedNodesArrayL();
   452     CreateSelectedNodesArrayL();
   417                 
   453                 
   418     if ( !IAUpdateUtils::SpaceAvailableInInternalDrivesL( iSelectedNodesArray ) )
   454     if ( !IAUpdateUtils::SpaceAvailableInInternalDrivesL( iSelectedNodesArray ) )
   419         {
   455         {
   420             HbMessageBox messageBox(HbMessageBox::MessageTypeInformation); 
   456         if ( !mDialogUtil )
   421             messageBox.setText(QString("Insufficient memory. Free some memory and try again."));
   457             {
   422             HbAction action("OK");
   458             mDialogUtil = new IAUpdateDialogUtil(NULL, this);
   423             messageBox.setPrimaryAction(&action);
   459             }
   424             messageBox.setTimeout(HbPopup::NoTimeout);
   460         if ( mDialogUtil )
   425             messageBox.show();
   461             {
   426             //messageBox.exec();
   462             mPrimaryAction = NULL;
       
   463             mPrimaryAction = new HbAction("OK");
       
   464             mDialogUtil->showInformation(QString("Insufficient memory. Free some memory and try again."), mPrimaryAction);
       
   465             iDialogState = EInsufficientMemory;
       
   466             }
   427         }
   467         }
   428     else
   468     else
   429         {
   469         {
   430         if ( !IsStartedByLauncher() )
   470         if ( !IsStartedByLauncher() )
   431             {
   471             {
  1547     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::HandleWaitDialogCancel() end");
  1587     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::HandleWaitDialogCancel() end");
  1548 
  1588 
  1549     }
  1589     }
  1550 
  1590 
  1551 // -----------------------------------------------------------------------------
  1591 // -----------------------------------------------------------------------------
       
  1592 // CIAUpdateUiController::dialogFinished
       
  1593 // Called when dialog is finished.
       
  1594 // -----------------------------------------------------------------------------
       
  1595 //
       
  1596 void CIAUpdateUiController::dialogFinished(HbAction *action)
       
  1597     {
       
  1598     TDialogState dialogState = iDialogState;
       
  1599     iDialogState = ENoDialog;
       
  1600     
       
  1601     switch ( dialogState )
       
  1602         {
       
  1603         case EAgreement:
       
  1604             if ( action == mPrimaryAction )
       
  1605                  {
       
  1606                 CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
       
  1607                 agreement->SetAgreementAcceptedL();
       
  1608 
       
  1609                 CleanupStack::PopAndDestroy(agreement);
       
  1610                 }
       
  1611             AgreementHandledL();        
       
  1612             break;
       
  1613         case EInsufficientMemory:    
       
  1614             break;
       
  1615         default: 
       
  1616             break;
       
  1617         }
       
  1618     }
       
  1619 
       
  1620 // -----------------------------------------------------------------------------
  1552 // CIAUpdateUiController::HandleUiRefreshL
  1621 // CIAUpdateUiController::HandleUiRefreshL
  1553 // 
  1622 // 
  1554 // -----------------------------------------------------------------------------
  1623 // -----------------------------------------------------------------------------
  1555 //
  1624 //
  1556 void CIAUpdateUiController::HandleUiRefreshL()
  1625 void CIAUpdateUiController::HandleUiRefreshL()
  2083 // ---------------------------------------------------------------------------
  2152 // ---------------------------------------------------------------------------
  2084 // CIAUpdateUiController::ShowUpdatingDialogL
  2153 // CIAUpdateUiController::ShowUpdatingDialogL
  2085 // 
  2154 // 
  2086 // ---------------------------------------------------------------------------
  2155 // ---------------------------------------------------------------------------
  2087 //
  2156 //
  2088 void CIAUpdateUiController::ShowUpdatingDialogL( TInt /*aTextResourceId*/,
  2157 /*
       
  2158 void CIAUpdateUiController::ShowUpdatingDialogL( TInt aTextResourceId,
  2089                                                  const TDesC& aName,
  2159                                                  const TDesC& aName,
  2090                                                  TInt aNumber,
  2160                                                  TInt aNumber,
  2091                                                  TInt aTotalCount )   
  2161                                                  TInt aTotalCount )   
  2092                                                     
  2162                                                     
  2093     {
  2163     {
  2122     CleanupStack::PopAndDestroy( noteText ); 
  2192     CleanupStack::PopAndDestroy( noteText ); 
  2123     CleanupStack::PopAndDestroy( numberArray );
  2193     CleanupStack::PopAndDestroy( numberArray );
  2124     CleanupStack::PopAndDestroy( stringArray );
  2194     CleanupStack::PopAndDestroy( stringArray );
  2125 
  2195 
  2126     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowUpdatingDialogL() end");
  2196     IAUPDATE_TRACE("[IAUPDATE] CIAUpdateUiController::ShowUpdatingDialogL() end");
  2127     }
  2197     }*/
  2128  
  2198  
  2129 
  2199 
  2130 // ---------------------------------------------------------------------------
  2200 // ---------------------------------------------------------------------------
  2131 // CIAUpdateUiController::ShowWaitDialogL
  2201 // CIAUpdateUiController::ShowWaitDialogL
  2132 // 
  2202 //