browserutilities/favouritesengine/ClientServer/utilsrc/BookmarkImportMain.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2003 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 the License "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 *      Entry point and main function for Bookmark Import utility application.
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <bacline.h>
       
    24 #include "BookmarkFileImporter.h"
       
    25 
       
    26 // ================= LOCAL FUNCTIONS =======================
       
    27 
       
    28 /**
       
    29 * Main function. Process command line arguments and import bookmark data.
       
    30 */
       
    31 LOCAL_D void MainL()
       
    32     {
       
    33     CCommandLineArguments* args = CCommandLineArguments::NewLC();
       
    34     if( args->Count() != 2 )
       
    35         {
       
    36         // Expecting command line 'Appname infile'.
       
    37         User::Leave( KErrArgument );
       
    38         }
       
    39     CBookmarkFileImporter* importer = CBookmarkFileImporter::NewL();
       
    40     CleanupStack::PushL( importer );
       
    41     importer->ImportL(  args->Arg( 1 ) );
       
    42     CleanupStack::PopAndDestroy( 2 );   // importer, args
       
    43     }
       
    44 
       
    45 /**
       
    46 * Entry point to the application.
       
    47 * @return Error code.
       
    48 */
       
    49 GLDEF_C TInt E32Main()
       
    50     {
       
    51     TInt err = KErrNone;
       
    52     CTrapCleanup* trapCleanup = CTrapCleanup::New();
       
    53     if ( trapCleanup )
       
    54         {
       
    55         TRAP( err, MainL() );
       
    56         delete trapCleanup;
       
    57         }
       
    58     else
       
    59         {
       
    60         err = KErrNoMemory;
       
    61         }
       
    62     return err;
       
    63     }