javatools/usersettingsconfigurator/src.s60/main.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 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:
       
    15 *
       
    16 */
       
    17 #include <e32base.h>
       
    18 #include <vector>
       
    19 #include "logger.h"
       
    20 #include "storagehandler.h"
       
    21 
       
    22 using namespace java::tools::usersettingsconfigurator;
       
    23 
       
    24 static void DoL()
       
    25 {
       
    26     // initializations
       
    27     std::auto_ptr<StorageHandler> storage(StorageHandler::NewL());
       
    28     std::vector<MidletSuiteSecuritySettings*> midletSuitesSecuritySettings;
       
    29     std::vector<MidletSuiteCustomAttributes*> midletSuitesCustomAttributes;
       
    30 
       
    31     // read the settings from the legacy java DB
       
    32     storage->readMidletSuitesPropertiesL(midletSuitesSecuritySettings, midletSuitesCustomAttributes);
       
    33 
       
    34     // write the settings into the OMJ storage
       
    35     storage->writeMidletSuitePropertiesL(midletSuitesSecuritySettings, midletSuitesCustomAttributes);
       
    36 
       
    37     storage->convertAPNSettingsL();
       
    38 
       
    39     // Cleanup
       
    40     for (int i=0; i<midletSuitesSecuritySettings.size(); i++)
       
    41     {
       
    42         for (int j=0; j<midletSuitesSecuritySettings[i]->iSecuritySettings.size(); j++)
       
    43         {
       
    44             delete midletSuitesSecuritySettings[i]->iSecuritySettings[j];
       
    45         }
       
    46         delete midletSuitesSecuritySettings[i];
       
    47     }
       
    48     for (int i=0; i<midletSuitesCustomAttributes.size(); i++)
       
    49     {
       
    50         for (int j=0; j<midletSuitesCustomAttributes[i]->iCustomAttributes.size(); j++)
       
    51         {
       
    52             delete midletSuitesCustomAttributes[i]->iCustomAttributes[j];
       
    53         }
       
    54         delete midletSuitesCustomAttributes[i];
       
    55     }
       
    56 }
       
    57 
       
    58 TInt E32Main()
       
    59 {
       
    60     //__UHEAP_MARK;
       
    61     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    62     TRAPD(error, DoL());
       
    63     if (KErrNone != error)
       
    64     {
       
    65         ELOG1(EJavaConverters,
       
    66               "Usersettingsconfigurator DoL leved with error: %d ", error);
       
    67     }
       
    68     delete cleanupStack;
       
    69     //__UHEAP_MARKEND;
       
    70     return error;
       
    71 }