installationservices/swi/source/uiss/client/sisuihandler.cpp
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
equal deleted inserted replaced
25:7333d7932ef7 26:8b7f4e561641
    59 	{
    59 	{
    60 	if (aAmount==0)
    60 	if (aAmount==0)
    61 		{
    61 		{
    62 		return;
    62 		return;
    63 		}
    63 		}
    64 	TInt progressAmount = aAmount;
    64 	
    65 
       
    66 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
    67 	_LIT(KProgressorPanicDescriptor, "UISSCLIENT:The progress bar value publisher has not been set!");
    65 	_LIT(KProgressorPanicDescriptor, "UISSCLIENT:The progress bar value publisher has not been set!");
    68 	__ASSERT_ALWAYS(iPublisher, User::Panic(KProgressorPanicDescriptor,KErrAbort));
    66 	__ASSERT_ALWAYS(iPublisher, User::Panic(KProgressorPanicDescriptor,KErrAbort));
    69 	progressAmount = iPublisher->UpdateProgressBarValueL(aAmount);	
    67 	TInt progressAmount = iPublisher->CalculateProgressBarValue(aAmount);	
    70 #endif	
       
    71 	
    68 	
    72 	if (progressAmount != 0)
    69 	if (progressAmount != 0)
    73 	    {
    70 	    {
    74 	    CHandleInstallEvent* event=CHandleInstallEvent::NewLC(aAppInfo, EEventUpdateProgressBar, progressAmount, KNullDesC);
    71 	    CHandleInstallEvent* event=CHandleInstallEvent::NewLC(aAppInfo, EEventUpdateProgressBar, progressAmount, KNullDesC);
    75 	    ExecuteL(*event);
    72 	    ExecuteL(*event);
    79 	        User::Leave(KErrCancel);
    76 	        User::Leave(KErrCancel);
    80 	        }
    77 	        }
    81 	    CleanupStack::PopAndDestroy(event);
    78 	    CleanupStack::PopAndDestroy(event);
    82 	    }
    79 	    }
    83 	}
    80 	}
    84 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    81 
       
    82 
    85 EXPORT_C void RUiHandler::SetProgressBarValuePublisher(CProgressBarValuePublisher* aPublisher)
    83 EXPORT_C void RUiHandler::SetProgressBarValuePublisher(CProgressBarValuePublisher* aPublisher)
    86 	{
    84 	{
    87 	iPublisher = aPublisher;
    85 	iPublisher = aPublisher;
    88 	}
    86 	}
    89 #endif
    87 
    90 
    88 
    91 // CUissCmd
    89 // CUissCmd
    92 
    90 
    93 EXPORT_C CUissCmd::CUissCmd(TInt aMessage)
    91 EXPORT_C CUissCmd::CUissCmd(TInt aMessage)
    94 	: iMessage(aMessage), iArgumentsMarshalled(EFalse)
    92 	: iMessage(aMessage), iArgumentsMarshalled(EFalse)
   119 EXPORT_C void CUissCmd::UnmarshallArgumentsL()
   117 EXPORT_C void CUissCmd::UnmarshallArgumentsL()
   120 	{
   118 	{
   121 	// default base class version which does not do any unmarshalling
   119 	// default base class version which does not do any unmarshalling
   122 	}
   120 	}
   123 
   121 
   124 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   125 // CProgressBarValuePublisher
   122 // CProgressBarValuePublisher
   126 CProgressBarValuePublisher::CProgressBarValuePublisher()
   123 CProgressBarValuePublisher::CProgressBarValuePublisher()
   127 	{
   124 	{
   128 	// empty
   125 	// empty
   129 	}
   126 	}
   143 	return self;
   140 	return self;
   144 	}
   141 	}
   145 
   142 
   146 void CProgressBarValuePublisher::ConstructL()
   143 void CProgressBarValuePublisher::ConstructL()
   147 	{
   144 	{
   148 	// Initialize the value of the install progress bar property
   145 	iLastPercentCompletion = 0;
   149 	User::LeaveIfError(RProperty::Set(KUidInstallServerCategory, KUidSwiProgressBarValueKey, 0));
   146 	iLastProgressValue = 0;
   150 	}
   147 	}
   151 
   148 
   152 EXPORT_C void CProgressBarValuePublisher::SetFinalProgressBarValue(TInt aValue)
   149 EXPORT_C void CProgressBarValuePublisher::SetFinalProgressBarValue(TInt aValue)
   153 	{
   150 	{
   154 	iFinalProgressValue = aValue;
   151 	iFinalProgressValue = aValue;
   155 	}
   152 	}
   156 
   153 
   157 EXPORT_C TInt CProgressBarValuePublisher::UpdateProgressBarValueL(TInt aValue)
   154 EXPORT_C TInt CProgressBarValuePublisher::CalculateProgressBarValue(TInt aValue)
   158 	{
   155 	{
   159 	iCurrentProgressValue += aValue;
   156 	iCurrentProgressValue += aValue;
   160 	TUint percentage = (iFinalProgressValue <= 0) ? 100 : (iCurrentProgressValue * 100) / iFinalProgressValue;
   157 	TUint percentage = (iFinalProgressValue <= 0) ? 100 : (iCurrentProgressValue * 100) / iFinalProgressValue;
   161 	if ((percentage - iLastPercentCompletion) >= KProgressBarIncrement)
   158 	if ((percentage - iLastPercentCompletion) >= KProgressBarIncrement)
   162 	    {
   159 	    {
   163 	    TInt amountCompleted = iCurrentProgressValue - iLastProgressValue; 
   160 	    TInt amountCompleted = iCurrentProgressValue - iLastProgressValue; 
   164 	    iLastProgressValue = iCurrentProgressValue;
   161 	    iLastProgressValue = iCurrentProgressValue;
   165 		iLastPercentCompletion = percentage;
       
   166 		User::LeaveIfError(RProperty::Set(KUidInstallServerCategory, KUidSwiProgressBarValueKey, percentage));
       
   167 	    return amountCompleted;
   162 	    return amountCompleted;
   168 	    }
   163 	    }
   169 	return 0;
   164 	return 0;
   170 	}	 
   165 	}	 
   171 #endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   172 } // namespace Swi
   166 } // namespace Swi