deviceupdatesui/deviceupdates/src/nsmldmsynchandler.cpp
changeset 42 aa33c2cb9a50
parent 18 7d11f9a6646f
equal deleted inserted replaced
41:c742e1129640 42:aa33c2cb9a50
    27 #include <centralrepository.h>
    27 #include <centralrepository.h>
    28 #include <featmgr.h>
    28 #include <featmgr.h>
    29 #include "nsmldmsynchandler.h"
    29 #include "nsmldmsynchandler.h"
    30 #include "nsmldmsyncdebug.h"
    30 #include "nsmldmsyncdebug.h"
    31 #include "nsmldmsyncinternalpskeys.h"
    31 #include "nsmldmsyncinternalpskeys.h"
       
    32 #include "nsmldmsyncprivatecrkeys.h"
    32 
    33 
    33 // -----------------------------------------------------------------------------
    34 // -----------------------------------------------------------------------------
    34 // CNSmlDMSyncHandler::NewL
    35 // CNSmlDMSyncHandler::NewL
    35 //
    36 //
    36 // Two-phased constructor.
    37 // Two-phased constructor.
    62 	if ( iSyncRunning )
    63 	if ( iSyncRunning )
    63 	    {
    64 	    {
    64 	    TRAP_IGNORE( iSyncJob.StopL() );
    65 	    TRAP_IGNORE( iSyncJob.StopL() );
    65         iSyncJob.Close();
    66         iSyncJob.Close();
    66 	    }
    67 	    }
       
    68 	if(iPrimaryAction)
       
    69 	    iPrimaryAction->deleteLater();
       
    70 	
       
    71 	if(iDialog)
       
    72 	    iDialog->deleteLater();
       
    73 	
    67 	  FeatureManager::UnInitializeLib();
    74 	  FeatureManager::UnInitializeLib();
    68 	FLOG( "CNSmlDMSyncHandler::~CNSmlDMSyncHandler() completed" );
    75 	FLOG( "CNSmlDMSyncHandler::~CNSmlDMSyncHandler() completed" );
    69     }
    76     }
    70 
    77 
    71 // -----------------------------------------------------------------------------
    78 // -----------------------------------------------------------------------------
   224 	     KNSmlDMNoUserInitiatedJob ) );
   231 	     KNSmlDMNoUserInitiatedJob ) );
   225    	
   232    	
   226 	iSyncRunning = EFalse;
   233 	iSyncRunning = EFalse;
   227 	iSyncError = aError;    
   234 	iSyncError = aError;    
   228     iCheckUpdate = EFalse;        	
   235     iCheckUpdate = EFalse;        	
       
   236 
       
   237 #ifndef NO_UPDATE 
       
   238         CRepository* centrep = NULL;
       
   239         TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
       
   240 	TInt profileId;
       
   241 	centrep->Get( KNSmlDMDefaultFotaProfileKey, profileId );
       
   242 	//FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL profileId = %d", profileId );
       
   243 	delete centrep;
       
   244 	if ( profileId ==  iProfileId )
       
   245         {
       
   246         
       
   247 	//FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL - connected witrh default profile ID" );
       
   248         TInt configFlags( 0 );
       
   249         //TInt SetGenValue(0);
       
   250         TRAPD( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys ) );
       
   251         if ( centrep )
       
   252             {
       
   253 
       
   254 	  //  FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL Centrep is defined" );
       
   255 	       if( err == KErrNone )
       
   256         	{
       
   257 	        centrep->Get( KDevManSessionType, configFlags );
       
   258 	    //	FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL DevManSessiontype = %d", configFlags );
       
   259              	}
       
   260 	       centrep->Set( KDevManSessionType, 0 );
       
   261 	    	//FLOG( "CNSmlDMSyncHandler::SynchronizeCompletedL KDevManSessionType getting reset" );
       
   262 	        delete centrep;
       
   263             } 
       
   264         // configFlags=2 for FOTA Package not downloaded case ,1- successful download
       
   265         if ( (aError == KErrNone) 
       
   266         			&& configFlags == 2 )
       
   267             {
       
   268             //FLOG( "[OMADM]\t CNSmlDMSyncHandler::SynchronizeCompletedL(): No changes in FW Update states." );
       
   269         iDialog = new HbDialog();
       
   270         iDialog->setHeadingWidget(new HbLabel(hbTrId("txt_device_update_title_phone_uptodate")));
       
   271         iDialog->setContentWidget(new HbLabel(hbTrId("txt_device_update_dpopinfo_your_phone_is_already_u")));
       
   272         iPrimaryAction = new HbAction();
       
   273         iPrimaryAction->setText(hbTrId("OK"));
       
   274 	    iDialog->setPrimaryAction(iPrimaryAction);
       
   275 	    iDialog->setTimeout(HbPopup::NoTimeout);
       
   276 	    iDialog->setDismissPolicy(HbPopup::NoDismiss);
       
   277 	    iDialog->show();
       
   278             // show the dialog
       
   279             }
       
   280 
       
   281         }  
       
   282 #endif
   229 
   283 
   230 	iUseFotaProgressNote = EFalse;
   284 	iUseFotaProgressNote = EFalse;
   231     iSyncJob.Close();
   285     iSyncJob.Close();
   232     
   286     
   233 	// handle error in HandleActiveCallL (when active caller completes)
   287 	// handle error in HandleActiveCallL (when active caller completes)