mmappcomponents/collectionhelper/src/mpxcollectionhelpercommon.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 20:36:37 +0200
changeset 2 7a9a8e73f54b
parent 0 a2952bb97e68
permissions -rw-r--r--
Revision: 201001 Kit: 201003

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Common helper functions for collection helper
*
*/


#include <mpxcollectionframeworkdefs.h>
#include <mpxcollectionplugin.hrh>
#include <mpxcollectionutility.h>
#include <f32file.h>
#include "mpxcollectionhelpercommon.h"

// ======== LOCAL FUNCTIONS ========

// ---------------------------------------------------------------------------
// Send initialize command to plugins
// ---------------------------------------------------------------------------
//
void InitializeCollectionPluginsL( MMPXCollectionUtility& aCollectionUtil )
    {
    RArray<TUid> uid;
    CleanupClosePushL( uid );
    
    // Initialize/Merge music collection databases
    TInt err = KErrNone;
    
    uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
    TUid collection = aCollectionUtil.CollectionIDL( uid.Array() );
    // Cannot guarantee that KLocalCollection plugin always exists, therefore,
    // ignore the case error is KErrNotSupported
    TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, 
                                                     collection.iUid ) );
    if( err != KErrNone && err != KErrNotSupported)
        {
        User::Leave( err );
        }
    
    // Initialize/Merge podcast databases
    uid.Reset();
    uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
    collection = aCollectionUtil.CollectionIDL( uid.Array() );
    // Cannot guarantee that KPodcastCollection plugin always exists, 
    // therefore, ignore the case error is KErrNotSupported
    TRAP(err, aCollectionUtil.Collection().CommandL( EMcCmdCollectionInit, 
                                                     collection.iUid ) );
    if( err != KErrNone && err != KErrNotSupported)
        {
        User::Leave( err );
        }
    CleanupStack::PopAndDestroy( &uid );
    }