brandingserver/tools/bsimport/src/bsbrandremover.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:31:29 +0300
branchRCL_3
changeset 21 cfd5c2994f10
parent 0 e6b17d312c8b
child 22 113b91e0a2ad
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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:   Removes brands from branding server
*
*/


#include <utf.h>

#include <cbsfactory.h>
#include <mbsupdater.h>

#include "bsbrandremover.h"


// ======== MEMBER FUNCTIONS ========
    
// ---------------------------------------------------------------------------
// BSBrandRemover::RemoveBrand
// ---------------------------------------------------------------------------
//
void BSBrandRemover::RemoveBrandL( const TDesC& aBrandId,
                                   const TDesC& aApplicationId )
    {
    // 16bit -> 8bit conversion
    HBufC8* brandBuf = HBufC8::NewLC( aBrandId.Length() );
    HBufC8* appBuf = HBufC8::NewLC( aApplicationId.Length() );
    TPtr8 brand( brandBuf->Des() );
    TPtr8 app( appBuf->Des() );
    
    CnvUtfConverter::ConvertFromUnicodeToUtf8( brand, aBrandId );
    CnvUtfConverter::ConvertFromUnicodeToUtf8( app, aApplicationId );
    
    // Remove brand
    CBSFactory* factory = CBSFactory::NewL( brand, app );
    CleanupStack::PushL( factory );
    MBSUpdater* updater = factory->CreateUpdaterLC();
    //updater->StartTransactionL( brand, ELangOther, KBSAutomaticVersionUpdate );
    updater->StartTransactionL( brand, ELangOther, MBSUpdater::EUpdateUninstall);
    
    updater->RemoveBrandL( brand, app );
    
    updater->StopTransactionL();
    CleanupStack::PopAndDestroy( 4 ); // updater, factory, brandBuf, appBuf
    }

// End of file