iaupdate/IAD/ui/src/iaupdateengine.cpp
changeset 77 d1838696558c
parent 69 b18a4bf55ddb
child 80 9dcba1ee99f7
equal deleted inserted replaced
75:2d2d25361590 77:d1838696558c
    72 
    72 
    73 IAUpdateEngine::~IAUpdateEngine()
    73 IAUpdateEngine::~IAUpdateEngine()
    74     {
    74     {
    75     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() begin");
    75     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::~IAUpdateEngine() begin");
    76     InformRequestObserver(KErrCancel);
    76     InformRequestObserver(KErrCancel);
       
    77     if (iController)
       
    78         {
       
    79         delete iController;
       
    80         }
       
    81     
    77     if (iIdle)
    82     if (iIdle)
    78         {
    83         {
    79         delete iIdle;
    84         delete iIdle;
    80         }
    85         }
    81     if (iIdleAutCheck)
    86     if (iIdleAutCheck)
    88         }
    93         }
    89     if (iAutomaticCheck)
    94     if (iAutomaticCheck)
    90         {
    95         {
    91         delete iAutomaticCheck;
    96         delete iAutomaticCheck;
    92         }
    97         }
    93     if (iController)
    98     
    94         {
       
    95         delete iController;
       
    96         }
       
    97     if (iFwUpdateHandler)
    99     if (iFwUpdateHandler)
    98         {
   100         {
    99         delete iFwUpdateHandler;
   101         delete iFwUpdateHandler;
   100         }
   102         }
   101     if (mServiceProvider)
   103     if (mServiceProvider)
   253     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() begin");
   255     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() begin");
   254     if (aFirmwareUpdate)
   256     if (aFirmwareUpdate)
   255         {
   257         {
   256         if (!iFwUpdateHandler)
   258         if (!iFwUpdateHandler)
   257             {
   259             {
   258             TRAP_IGNORE( CIAUpdateFWUpdateHandler::NewL() );
   260             TRAP_IGNORE(CIAUpdateFWUpdateHandler::NewL());
   259             }
   261             }
   260         if (iFwUpdateHandler)
   262         if (iFwUpdateHandler)
   261             {
   263             {
   262             iFwUpdateHandler->FirmWareUpdatewithFOTA();
   264             iFwUpdateHandler->FirmWareUpdatewithFOTA(this);
   263             }
   265             }
   264         }
   266         }
   265     else
   267     else
   266         {
   268         {
   267         // by pushing object to cleanup stack it's destructor is called if leave happens
   269         // by pushing object to cleanup stack it's destructor is called if leave happens
   286             CleanupStack::PopAndDestroy(globalLockHandler);
   288             CleanupStack::PopAndDestroy(globalLockHandler);
   287             }
   289             }
   288         }
   290         }
   289     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() end");
   291     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::StartUpdate() end");
   290     }
   292     }
       
   293 
   291 
   294 
   292 // -----------------------------------------------------------------------------
   295 // -----------------------------------------------------------------------------
   293 // IAUpdateEngine::SetVisibleL
   296 // IAUpdateEngine::SetVisibleL
   294 // 
   297 // 
   295 // -----------------------------------------------------------------------------
   298 // -----------------------------------------------------------------------------
   353     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() inBackground: %d", inBackground );
   356     IAUPDATE_TRACE_1("[IAUPDATE] IAUpdateEngine::ClientInBackgroundL() inBackground: %d", inBackground );
   354     return inBackground;
   357     return inBackground;
   355     }
   358     }
   356 
   359 
   357 // -----------------------------------------------------------------------------
   360 // -----------------------------------------------------------------------------
       
   361 // IAUpdateEngine::Controller()
       
   362 // 
       
   363 // -----------------------------------------------------------------------------
       
   364 //      
       
   365 CIAUpdateUiController* IAUpdateEngine::Controller() const
       
   366     {
       
   367     return iController;
       
   368     }
       
   369 
       
   370 
       
   371 
       
   372 
       
   373 
       
   374 // -----------------------------------------------------------------------------
   358 // IAUpdateEngine::handleAllClientsClosed()
   375 // IAUpdateEngine::handleAllClientsClosed()
   359 // 
   376 // 
   360 // -----------------------------------------------------------------------------
   377 // -----------------------------------------------------------------------------
   361 //
   378 //
   362 void IAUpdateEngine::handleAllClientsClosed()
   379 void IAUpdateEngine::handleAllClientsClosed()
   554     {
   571     {
   555     emit refresh(iController->Nodes(), iController->FwNodes(), KErrNone);
   572     emit refresh(iController->Nodes(), iController->FwNodes(), KErrNone);
   556     }
   573     }
   557 
   574 
   558 // -----------------------------------------------------------------------------
   575 // -----------------------------------------------------------------------------
       
   576 // IAUpdateEngine::RefreshUIProgress
       
   577 // 
       
   578 // -----------------------------------------------------------------------------
       
   579 //
       
   580 void IAUpdateEngine::RefreshUIProgress()
       
   581     {
       
   582     emit refreshProgress();
       
   583     }
       
   584 
       
   585 // -----------------------------------------------------------------------------
       
   586 // IAUpdateEngine::SetUpdatesRefreshing
       
   587 // 
       
   588 // -----------------------------------------------------------------------------
       
   589 //
       
   590 void IAUpdateEngine::SetUpdatesRefreshing( TBool aRefreshing )
       
   591     {
       
   592     emit setUpdatesRefreshing(aRefreshing);
       
   593     }
       
   594 
       
   595 // -----------------------------------------------------------------------------
   559 // IAUpdateEngine::RefreshCompleteL
   596 // IAUpdateEngine::RefreshCompleteL
   560 // 
   597 // 
   561 // -----------------------------------------------------------------------------
   598 // -----------------------------------------------------------------------------
   562 //      
   599 //      
   563 void IAUpdateEngine::RefreshCompleteL(TBool /*aWithViewActivation*/,
   600 void IAUpdateEngine::RefreshCompleteL(TBool /*aWithViewActivation*/,
   574         InformRequestObserver(aError);
   611         InformRequestObserver(aError);
   575         }
   612         }
   576     else
   613     else
   577         {
   614         {
   578         emit refresh(iController->Nodes(), iController->FwNodes(), aError);
   615         emit refresh(iController->Nodes(), iController->FwNodes(), aError);
   579         
       
   580         // inform bgchecker to clear indicator menu
       
   581         User::LeaveIfError( 
       
   582                 RProperty::Set(KPSUidBgc, KIAUpdateBGNotifyIndicatorRemove, 0) );
       
   583         
       
   584         //if ( aWithViewActivation)
   616         //if ( aWithViewActivation)
   585         //  {
   617         //  {
   586         //  ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
   618         //  ActivateLocalViewL( TUid::Uid( EIAUpdateMainViewId ) );
   587         //  }
   619         //  }
   588         CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   620         CIAUpdateAgreement* agreement = CIAUpdateAgreement::NewLC();
   621     if (mRequestType != IAUpdateUiDefines::ENoRequest)
   653     if (mRequestType != IAUpdateUiDefines::ENoRequest)
   622         {
   654         {
   623         InformRequestObserver(aError);
   655         InformRequestObserver(aError);
   624         }
   656         }
   625 
   657 
       
   658     emit updateCompleted();
   626     ShowResultsDialogL();
   659     ShowResultsDialogL();
   627 
   660 
   628     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL end");
   661     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::UpdateCompleteL end");
       
   662     }
       
   663 
       
   664 // -----------------------------------------------------------------------------
       
   665 // IAUpdateEngine::PreparingStarted
       
   666 // 
       
   667 // -----------------------------------------------------------------------------
       
   668 //
       
   669 void IAUpdateEngine::PreparingStarted()
       
   670     {
       
   671 
       
   672     }
       
   673 
       
   674 // -----------------------------------------------------------------------------
       
   675 // IAUpdateEngine::Prepared
       
   676 // 
       
   677 // -----------------------------------------------------------------------------
       
   678 //
       
   679 void IAUpdateEngine::Prepared()
       
   680     {
       
   681     emit updateCompleted();
   629     }
   682     }
   630 
   683 
   631 // -----------------------------------------------------------------------------
   684 // -----------------------------------------------------------------------------
   632 // IAUpdateEngine::ShowResultsDialogL
   685 // IAUpdateEngine::ShowResultsDialogL
   633 // 
   686 // 
   655     {
   708     {
   656     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() begin");
   709     IAUPDATE_TRACE("[IAUPDATE] IAUpdateEngine::ShowRebootDialogL() begin");
   657 
   710 
   658     HbMessageBox *messageBox = new HbMessageBox(
   711     HbMessageBox *messageBox = new HbMessageBox(
   659             HbMessageBox::MessageTypeQuestion);
   712             HbMessageBox::MessageTypeQuestion);
   660     messageBox->setText(QString("Phone restart needed. Restart now?"));
   713     messageBox->setText
       
   714         (hbTrId("txt_software_info_device_restart_is_needed_restar"));
   661     int actionCount = messageBox->actions().count();
   715     int actionCount = messageBox->actions().count();
   662     for (int i = actionCount - 1; i >= 0; i--)
   716     for (int i = actionCount - 1; i >= 0; i--)
   663         {
   717         {
   664         messageBox->removeAction(messageBox->actions().at(i));
   718         messageBox->removeAction(messageBox->actions().at(i));
   665         }
   719         }
   666     mPrimaryAction = NULL;
   720     mPrimaryAction = NULL;
   667     mPrimaryAction = new HbAction("Ok");
   721     mPrimaryAction = new HbAction(hbTrId("txt_common_button_ok"));
   668     HbAction *secondaryAction = NULL;
   722     HbAction *secondaryAction = NULL;
   669     secondaryAction = new HbAction("Cancel");
   723     secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"));
   670 
   724 
   671     messageBox->addAction(mPrimaryAction);
   725     messageBox->addAction(mPrimaryAction);
   672     messageBox->addAction(secondaryAction);
   726     messageBox->addAction(secondaryAction);
   673     messageBox->setTimeout(HbPopup::NoTimeout);
   727     messageBox->setTimeout(HbPopup::NoTimeout);
   674     messageBox->setAttribute(Qt::WA_DeleteOnClose);
   728     messageBox->setAttribute(Qt::WA_DeleteOnClose);