applicationmanagement/server/src/AMDeploymentComponent.cpp
branchRCL_3
changeset 58 5b858729772b
parent 57 6757f1e2efd2
equal deleted inserted replaced
57:6757f1e2efd2 58:5b858729772b
    13  *
    13  *
    14  * Description: Implementation of applicationmanagement components
    14  * Description: Implementation of applicationmanagement components
    15  *
    15  *
    16  */
    16  */
    17 
    17 
       
    18 #include "AMDownload.h"
       
    19 #include "AMDeploymentComponent.h"
       
    20 #include "debug.h"
    18 #include <e32debug.h>
    21 #include <e32debug.h>
    19 #include <s32mem.h>
    22 #include <s32mem.h>
    20 #include <featmgr.h>
    23 #include <featmgr.h>
    21 #include <ssl.h>
    24 #include "amprivateCRKeys.h"
    22 #include <apgcli.h>
    25 //#include "aminstalloptions.h"
    23 #include <apmrec.h>
    26 #include <ssl.h>	
    24 #include <apmstd.h>
       
    25 #ifdef __SERIES60_30__
    27 #ifdef __SERIES60_30__
    26 #include <CMenuClient.h>
    28 #include <CMenuClient.h>
    27 #endif
    29 #endif
    28 #include "amsmlhelper.h"
    30 #include "amsmlhelper.h"
    29 #include "amprivateCRKeys.h"
    31 #include "apgcli.h"
    30 #include "AMDeploymentComponent.h"
    32 #include "apmrec.h"
    31 #include "debug.h"
    33 #include "apmstd.h"
    32 
       
    33 
    34 
    34 using namespace NApplicationManagement;
    35 using namespace NApplicationManagement;
    35 
    36 
    36 _LIT8( KAMDCDataSuffix, "_D.txt");
    37 _LIT8( KAMDCDataSuffix, "_D.txt");
    37 _LIT8( KAMDCMetaDataSuffix, "_M.txt");
    38 _LIT8( KAMDCMetaDataSuffix, "_M.txt");
   126         iPkgID = aData.PkgId();
   127         iPkgID = aData.PkgId();
   127         iDescription = aData.Description();
   128         iDescription = aData.Description();
   128         iPkgIDRef = aData.PkgIDRef();
   129         iPkgIDRef = aData.PkgIDRef();
   129         iPkgType = aData.PkgType();
   130         iPkgType = aData.PkgType();
   130         iRemovableApp = aData.AppRemovable();
   131         iRemovableApp = aData.AppRemovable();
   131         iDriveSelection = aData.DriveSelected();
       
   132         iComponentId = aData.iComponentId;
       
   133         iInstallOptsSet = aData.InstallOptsSet();
   132         iInstallOptsSet = aData.InstallOptsSet();
   134         iPkgVersion = aData.iPkgVersion;
   133         iPkgVersion = aData.iPkgVersion;
   135         iDownloadStatus = aData.iDownloadStatus;
   134         iDownloadStatus = aData.iDownloadStatus;
   136         iDownloadURI = aData.iDownloadURI;
   135         iDownloadURI = aData.iDownloadURI;
   137         iUninstallOpts = aData.UninstallOpts();
   136         iUninstallOpts = aData.UninstallOpts();
   252     {
   251     {
   253     //   0			1		2		3		4		5			6			7	8			9			10		11
   252     //   0			1		2		3		4		5			6			7	8			9			10		11
   254     // iUserId , iState, iPkgVer, iUid, iIdLen, iNameLen, iVersLen, iDownState, iOwner, iOldState ,iDownUriLen, iInstallOptsset
   253     // iUserId , iState, iPkgVer, iUid, iIdLen, iNameLen, iVersLen, iDownState, iOwner, iOldState ,iDownUriLen, iInstallOptsset
   255     return (20*4)+iUserId.Length() + iId.Length() + iName.Length()
   254     return (20*4)+iUserId.Length() + iId.Length() + iName.Length()
   256             + iVersion.Length() +
   255             + iVersion.Length() +
   257             
   256 
   258     iMidletName.Length() + iMideltVendorName.Length()
   257     iMidletName.Length() + iMideltVendorName.Length()
   259             + iMidletVersion.Length()+ iDownloadURI.Length()
   258             + iMidletVersion.Length()+ iDownloadURI.Length()
   260             + iDescription.Length()+ iPkgID.Length()+iPkgIDRef.Length()
   259             + iDescription.Length()+ iPkgID.Length()+iPkgIDRef.Length()
   261             +iPkgType.Length()+ sizeof(iRemovableApp)+sizeof(iDriveSelection)+sizeof(iComponentId) + iData->SerializedFormLength()
   260             +iPkgType.Length()+ sizeof(iRemovableApp) + iData->SerializedFormLength()
   262             + iMetaData->SerializedFormLength() + sizeof(TAMInstallOptions);
   261             + iMetaData->SerializedFormLength() + sizeof(TAMInstallOptions);
   263     }
   262     }
   264 
   263 
   265 TInt CDeploymentComponent::SerializedFormL(RWriteStream &aBuffer) const
   264 TInt CDeploymentComponent::SerializedFormL(RWriteStream &aBuffer) const
   266     {
   265     {
   303     aBuffer.WriteUint32L(iPkgIDRef.Length() );
   302     aBuffer.WriteUint32L(iPkgIDRef.Length() );
   304     aBuffer.WriteL(iPkgIDRef);
   303     aBuffer.WriteL(iPkgIDRef);
   305     aBuffer.WriteUint32L(iPkgType.Length() );
   304     aBuffer.WriteUint32L(iPkgType.Length() );
   306     aBuffer.WriteL(iPkgType);
   305     aBuffer.WriteL(iPkgType);
   307     aBuffer.WriteUint32L(iRemovableApp);
   306     aBuffer.WriteUint32L(iRemovableApp);
   308     aBuffer.WriteUint32L(iDriveSelection);
       
   309     aBuffer.WriteInt32L(iComponentId);
       
   310     iData->SerializedFormL(aBuffer);
   307     iData->SerializedFormL(aBuffer);
   311     iMetaData->SerializedFormL(aBuffer);
   308     iMetaData->SerializedFormL(aBuffer);
   312     aBuffer.WriteUint32L(iInstallOptsSet);
   309     aBuffer.WriteUint32L(iInstallOptsSet);
   313     TPckg<TAMInstallOptions> opts(iInstallOpts);
   310     TPckg<TAMInstallOptions> opts(iInstallOpts);
   314     aBuffer.WriteL(opts);
   311     aBuffer.WriteL(opts);
   374 
   371 
   375     len = stream.ReadUint32L();
   372     len = stream.ReadUint32L();
   376     stream.ReadL(iPkgType, len);
   373     stream.ReadL(iPkgType, len);
   377 
   374 
   378     iRemovableApp = stream.ReadUint32L();
   375     iRemovableApp = stream.ReadUint32L();
   379     iDriveSelection = stream.ReadUint32L();
       
   380     iComponentId = stream.ReadInt32L();
       
   381     iData = CDeploymentComponentData::LoadL(stream);
   376     iData = CDeploymentComponentData::LoadL(stream);
   382     iMetaData = CDeploymentComponentData::LoadL(stream);
   377     iMetaData = CDeploymentComponentData::LoadL(stream);
   383 
   378 
   384     //using namespace SwiUI;
   379     //using namespace SwiUI;
   385     iInstallOptsSet = stream.ReadUint32L();
   380     iInstallOptsSet = stream.ReadUint32L();
   426 TBool CDeploymentComponent::AppRemovable() const
   421 TBool CDeploymentComponent::AppRemovable() const
   427     {
   422     {
   428     return iRemovableApp;
   423     return iRemovableApp;
   429     }
   424     }
   430 
   425 
   431 TBool CDeploymentComponent::DriveSelected() const
       
   432         {
       
   433         return iDriveSelection;
       
   434         }
       
   435 
       
   436 TInt CDeploymentComponent::GetComponentId() const
       
   437         {
       
   438         return iComponentId;
       
   439         }
       
   440 void CDeploymentComponent::SetMetaDataL(const TDesC8 &aMimeType)
   426 void CDeploymentComponent::SetMetaDataL(const TDesC8 &aMimeType)
   441     {
   427     {
   442     iMetaData->DataFileName();
   428     iMetaData->DataFileName();
   443     iMetaData->SetDataL(aMimeType);
   429     iMetaData->SetDataL(aMimeType);
   444     }
   430     }
   450     }
   436     }
   451 
   437 
   452 void CDeploymentComponent::SetAppRemovableStatus(const TBool &aRemovable)
   438 void CDeploymentComponent::SetAppRemovableStatus(const TBool &aRemovable)
   453     {
   439     {
   454     iRemovableApp = aRemovable;
   440     iRemovableApp = aRemovable;
   455     }
       
   456 
       
   457 void CDeploymentComponent::SetDriveSelectionStatus(const TBool &aDriveSelection)
       
   458     {
       
   459     iDriveSelection = aDriveSelection;
       
   460     }
   441     }
   461 
   442 
   462 void CDeploymentComponent::SetInstallOptsL(const TDesC8 &aInstallOpts)
   443 void CDeploymentComponent::SetInstallOptsL(const TDesC8 &aInstallOpts)
   463     {
   444     {
   464     using namespace SwiUI;
   445     using namespace SwiUI;
   722 // ----------------------------------------------------------------------------------------	
   703 // ----------------------------------------------------------------------------------------	
   723 void CDeploymentComponent::SuccessStatusUpdateL(const TDesC &aDlFileName,
   704 void CDeploymentComponent::SuccessStatusUpdateL(const TDesC &aDlFileName,
   724         const TDesC8& aDlMimeType)
   705         const TDesC8& aDlMimeType)
   725     {
   706     {
   726     RDEBUG( "CDeploymentComponent::SuccessStatusUpdateL : start");
   707     RDEBUG( "CDeploymentComponent::SuccessStatusUpdateL : start");
   727     
   708     SetDataL(aDlFileName, aDlMimeType);
   728    
       
   729     
   709     
   730     TBuf<256> FileType;
   710     TBuf<256> FileType;
   731     TBuf8<256> FileType8;
   711     TBuf8<256> FileType8;
   732     
   712     
   733     RApaLsSession RSession;      
   713     RApaLsSession RSession;      
   736         TUid uid;
   716         TUid uid;
   737         TDataType datatype;
   717         TDataType datatype;
   738         RSession.AppForDocument(aDlFileName,uid, datatype );
   718         RSession.AppForDocument(aDlFileName,uid, datatype );
   739          
   719          
   740         FileType.Copy(datatype.Des()); 
   720         FileType.Copy(datatype.Des()); 
   741         RDEBUG_2( "CDeploymentComponent::Pkg Id: %d ", uid.iUid);  
   721             
   742         RDEBUG_2( "CDeploymentComponent::Pkg MIME: '%S' ", &FileType);  
   722            
   743         }
   723         }
   744     RSession.Close();
   724     RSession.Close();
   745     
   725     
   746     FileType8.Copy(FileType);
   726     FileType8.Copy(FileType);
   747     
   727     
   748     SetDataL(aDlFileName, FileType8);
   728     SetDataL(FileType8);
   749     
       
   750     
       
   751     
       
   752     //SetDataL(FileType8);
       
   753 
   729 
   754     RDEBUG8_2( "CDeploymentComponent::Pkg MIME: '%S' ", &FileType8);
   730     RDEBUG8_2( "CDeploymentComponent::Pkg MIME: '%S' ", &FileType8);
   755 
   731 
   756     
   732     
   757     // Set PkgID same as MiME type of downloaded content
   733     // Set PkgID same as MiME type of downloaded content
   857 void CDeploymentComponent::SetOwner(const TInt &aInfo)
   833 void CDeploymentComponent::SetOwner(const TInt &aInfo)
   858     {
   834     {
   859     iOwner = aInfo;
   835     iOwner = aInfo;
   860     }
   836     }
   861 
   837 
   862 void CDeploymentComponent::SetComponentId(const TInt &aComponentId)
       
   863     {
       
   864     iComponentId = aComponentId;
       
   865     }
       
   866 
       
   867 void CDeploymentComponent::SetIAPL(const TInt aIap)
   838 void CDeploymentComponent::SetIAPL(const TInt aIap)
   868     {
   839     {
   869     RDEBUG8_2( "CDeploymentComponent::SetIAPL: %d ", aIap );
   840     RDEBUG8_2( "CDeploymentComponent::SetIAPL: %d ", aIap );
   870     iInstallOpts.iIAP = aIap;
   841     iInstallOpts.iIAP = aIap;
   871     }
   842     }