diff -r 491b3ed49290 -r 65326cf895ed filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp --- a/filemanager/src/fmbkupenginewrapper/src/fmrestoresettings.cpp Tue Aug 31 15:06:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2009 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: - * The source file of the restore settings of file manager - */ - -#include "fmrestoresettings.h" -#include "fmbackupsettings.h" -#include "fmbkupengine.h" -#include "fmbkupcommon.h" - -#include -#include -#include - -FmRestoreSettings::FmRestoreSettings( FmBkupEngine& engine ) : mEngine( engine ) -{ - -} - -FmRestoreSettings::~FmRestoreSettings() -{ - resetAndDestoryRestoreEntry(); -} - -void FmRestoreSettings::load( QList drivesAndOperationList ) -{ - refreshList( drivesAndOperationList ); -} - -QList< FmRestoreEntry* > FmRestoreSettings::restoreEntryList() -{ - return mRestoreEntryList; -} - -void FmRestoreSettings::resetAndDestoryRestoreEntry() -{ - for( QList< FmRestoreEntry* >::iterator it = mRestoreEntryList.begin(); - it!= mRestoreEntryList.end(); ++it ){ - delete *it; - } - mRestoreEntryList.clear(); -} - -void FmRestoreSettings::refreshList( QList &drivesAndOperationList ) -{ - resetAndDestoryRestoreEntry(); - - QList< FmRestoreInfo > restoreInfoList; - - QString targetDrive = mEngine.BackupSettingsL()->availableTargetDrive(); - mEngine.GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, targetDrive ); - - - // fetch info list from engine, and then init the entry list for display - - int count( restoreInfoList.count() ); - quint32 mask( FmBkupEngineCommon::EFileManagerBackupContentFirst); - while ( mask <= FmBkupEngineCommon::EFileManagerBackupContentLast ) - { - for ( int i( 0 ); i < count; ++i ) - { - FmRestoreInfo& info( restoreInfoList[ i ] ); - if ( info.content() & mask ) - { - FmRestoreEntry* entry = CreateEntry( info ); - mRestoreEntryList.push_back( entry ); - } - } - mask <<= 1; - } -} - - -FmRestoreEntry *FmRestoreSettings::CreateEntry( const FmRestoreInfo &info ) -{ - QString text = FmBackupSettings::contentToString( info.content() ); - - FmRestoreEntry *entry = new FmRestoreEntry( text, info ); - return entry; -} - -void FmRestoreSettings::SetSelection( - const quint64& aSelection ) - { - iSelection = aSelection; - } - -void FmRestoreSettings::GetSelectionL( - QList< FmRestoreInfo >& infoArray ) const -{ - infoArray.clear(); - - int count( mRestoreEntryList.count() ); - - for ( int i( 0 ); i < count; ++i ) - { - if ( ( ( ( quint64 ) 1 ) << i ) & iSelection ) - { - infoArray.append( mRestoreEntryList[ i ]->restoreInfo() ); - } - } -}