mmappcomponents/collectionhelper/src/mpxcollectionhelpercommon.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Common helper functions for collection helper
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mpxcollectionframeworkdefs.h>
       
    20 #include <mpxcollectionplugin.hrh>
       
    21 #include <mpxcollectionutility.h>
       
    22 #include <f32file.h>
       
    23 #include "mpxcollectionhelpercommon.h"
       
    24 
       
    25 // ======== LOCAL FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // Send initialize command to plugins
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 void InitializeCollectionPluginsL( MMPXCollectionUtility& aCollectionUtil )
       
    32     {
       
    33     RArray<TUid> uid;
       
    34     CleanupClosePushL( uid );
       
    35     
       
    36     // Initialize/Merge music collection databases
       
    37     TInt err = KErrNone;
       
    38     
       
    39     uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
       
    40     TUid collection = aCollectionUtil.CollectionIDL( uid.Array() );
       
    41     // Cannot guarantee that KLocalCollection plugin always exists, therefore,
       
    42     // ignore the case error is KErrNotSupported
       
    43     TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, 
       
    44                                                      collection.iUid ) );
       
    45     if( err != KErrNone && err != KErrNotSupported)
       
    46         {
       
    47         User::Leave( err );
       
    48         }
       
    49     
       
    50     // Initialize/Merge podcast databases
       
    51     uid.Reset();
       
    52     uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
       
    53     collection = aCollectionUtil.CollectionIDL( uid.Array() );
       
    54     // Cannot guarantee that KPodcastCollection plugin always exists, 
       
    55     // therefore, ignore the case error is KErrNotSupported
       
    56     TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, 
       
    57                                                      collection.iUid ) );
       
    58     if( err != KErrNone && err != KErrNotSupported)
       
    59         {
       
    60         User::Leave( err );
       
    61         }
       
    62     CleanupStack::PopAndDestroy( &uid );
       
    63     }
       
    64