javatools/javaappconverter/src.s60/silentmidletconvert.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2008 - 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Java platform 2.0 javaappconverter process
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SILENTMIDLETCONVERT_H
       
    20 #define SILENTMIDLETCONVERT_H
       
    21 
       
    22 #include <f32file.h>
       
    23 #include <e32base.h>
       
    24 #include <javasymbianoslayer.h>
       
    25 
       
    26 #include "convertserver.h"
       
    27 
       
    28 
       
    29 // This binary data file contains the uids of the old valid java applications
       
    30 // in this device
       
    31 _LIT(KUidsImportDataFilePathName, "C:\\private\\2002121C\\data\\");
       
    32 _LIT(KUidsImportDataFileName, "uids");
       
    33 
       
    34 // Default target installation disk for conversion should have at least
       
    35 // 10 MB of free disk space (10 * 1024 * 1204)
       
    36 const TInt64 KMinimumFreeDiskSpace = 10485760;
       
    37 
       
    38 
       
    39 /**
       
    40  * The main active object of Java App Converter that is executed once
       
    41  * to convert old S60 MIDlets to OMJ Java applications
       
    42  *
       
    43  * This active object is activated from the process main() after the
       
    44  * active scheduler has been created.
       
    45  */
       
    46 class CSilentMIDletConvert : public CActive
       
    47 {
       
    48     enum TConversionState
       
    49     {
       
    50         EFindOutDeviceDrives,
       
    51         EFindOutDrivesToBeScannedNow,
       
    52         EAppsInInstalledDirectories,
       
    53         ECheckWhichAppsShouldBeConverted,
       
    54         EExecuteConvertServer,
       
    55         EMarkConversionDone,
       
    56         EExit
       
    57     };
       
    58 
       
    59 public:
       
    60     static CSilentMIDletConvert* NewLC(RFs& aFs);
       
    61 
       
    62     void CompleteRequest();
       
    63     ~CSilentMIDletConvert();
       
    64     void Start();
       
    65 
       
    66 protected:
       
    67     // From CActive
       
    68     void RunL();
       
    69     void DoCancel();
       
    70     TInt RunError(TInt aError);
       
    71 
       
    72 private:
       
    73     void Exit();
       
    74     CSilentMIDletConvert(RFs& aFs);
       
    75     void ConstructL();
       
    76     void GetInstallFilesL(RPointerArray<HBufC>& aDirs);
       
    77     void CheckNeedToInstall();
       
    78     RArray<TUid> ReadMidletUids(const TPtrC& aDir);
       
    79     void RunJavaInstallerL();
       
    80     void RemoveDataFile();
       
    81     void FullCleanup();
       
    82     void AddJadJarToInstallFilesL(
       
    83         const TFileName &aSuitePathName,
       
    84         const CDir *aSuiteDirEntryList);
       
    85     void GetAllDeviceDrivesL();
       
    86     TBool HasBeenInstalled(const TDesC& aFilePath);
       
    87 
       
    88 
       
    89 private:
       
    90     RFs& iFs;
       
    91     RPointerArray<HBufC> iDirs;
       
    92     RPointerArray<HBufC> iInstallFiles;
       
    93     TInt iFileIndex;
       
    94     TConversionState iState;
       
    95     ConvertServer* iConvertServer;
       
    96 
       
    97     // contains the drive status info for each non-remote, non-substed drive
       
    98     // on device
       
    99     TUint iDriveStatuses[KMaxDrives];
       
   100     TInt iNumberOfAppsToInstall;
       
   101 
       
   102     // If the device has an internal drive with much free disk space,
       
   103     // the converted java applications will be installed to that drive.
       
   104     // This member variable contains the number of that drive, e.g. EDriveE
       
   105     // or -1 if the device does not have such drive
       
   106     TInt iDefaultTargetInstallationDrive;
       
   107 };
       
   108 
       
   109 #endif // SILENTMIDLETCONVERT_H