filemanager/Engine/src/CFileManagerBackupSettingsFull.cpp
changeset 0 6a9f87576119
child 20 efe289f793e7
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:  Backup settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <avkon.rsg>
       
    22 #include <FileManagerEngine.rsg>
       
    23 #include <StringLoader.h>
       
    24 #include <centralrepository.h>
       
    25 #ifdef RD_MULTIPLE_DRIVE
       
    26 #include <driveinfo.h>
       
    27 #endif // RD_MULTIPLE_DRIVE
       
    28 #include <AknUtils.h>
       
    29 #include "FileManagerDebug.h"
       
    30 #include "CFileManagerEngine.h"
       
    31 #include "FileManagerPrivateCRKeys.h"
       
    32 #include "CFileManagerBackupSettings.h"
       
    33 #include "CFileManagerCommonDefinitions.h"
       
    34 
       
    35 // CONSTANTS
       
    36 _LIT( KSeparator, "\t" );
       
    37 const TInt KSeparatorSpace = 3;
       
    38 _LIT( KTimeFormatBefore, " %-B %J:%T" );
       
    39 _LIT( KTimeFormatAfter, " %J:%T %+B" );
       
    40 const TInt KTimeStrMax = 20;
       
    41 
       
    42 const TInt KSchedulingTextLookup[] = {
       
    43     R_QTN_FMGR_BACKUP_NO_SCHEDULING, // CFileManagerBackupSettings::ENoScheduling
       
    44     R_QTN_FMGR_BACKUP_DAILY, // CFileManagerBackupSettings::EDaily
       
    45     R_QTN_FMGR_BACKUP_WEEKLY // CFileManagerBackupSettings::EWeekly
       
    46 };
       
    47 
       
    48 const TInt KMinToMicroSecMultiplier = 60000000; 
       
    49 const TInt KTargetDriveStrMax = 4;
       
    50 _LIT( KTimeSeparatorPlaceHolder, ":" );
       
    51 const TInt KHourMinSeparator = 1;
       
    52 
       
    53 
       
    54 // ======== MEMBER FUNCTIONS ========
       
    55 
       
    56 // ----------------------------------------------------------------------------
       
    57 // CFileManagerBackupSettings::CFileManagerBackupSettings
       
    58 // ----------------------------------------------------------------------------
       
    59 //
       
    60 CFileManagerBackupSettings::CFileManagerBackupSettings(
       
    61         CFileManagerEngine& aEngine ) :
       
    62     iEngine( aEngine )
       
    63     {
       
    64     FUNC_LOG
       
    65     }
       
    66 
       
    67 // ----------------------------------------------------------------------------
       
    68 // CFileManagerBackupSettings::~CFileManagerBackupSettings
       
    69 // ----------------------------------------------------------------------------
       
    70 //
       
    71 CFileManagerBackupSettings::~CFileManagerBackupSettings()
       
    72     {
       
    73     FUNC_LOG
       
    74     delete iCenRep;
       
    75     iList.ResetAndDestroy();
       
    76     iList.Close();
       
    77     }
       
    78 
       
    79 // ----------------------------------------------------------------------------
       
    80 // CFileManagerBackupSettings::NewL
       
    81 // ----------------------------------------------------------------------------
       
    82 //
       
    83 CFileManagerBackupSettings* CFileManagerBackupSettings::NewL(
       
    84         CFileManagerEngine& aEngine )
       
    85     {
       
    86     CFileManagerBackupSettings* self =
       
    87         new ( ELeave ) CFileManagerBackupSettings(
       
    88             aEngine );
       
    89     CleanupStack::PushL( self );
       
    90     self->ConstructL();
       
    91     CleanupStack::Pop( self );
       
    92     return self;
       
    93     }
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // CFileManagerBackupSettings::ConstructL
       
    97 // ----------------------------------------------------------------------------
       
    98 //
       
    99 void CFileManagerBackupSettings::ConstructL()
       
   100     {
       
   101     FUNC_LOG
       
   102 
       
   103     iCenRep = CRepository::NewL( KCRUidFileManagerSettings );
       
   104 
       
   105     RefreshL();
       
   106     }
       
   107 
       
   108 // ----------------------------------------------------------------------------
       
   109 // CFileManagerBackupSettings::SetContent
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 EXPORT_C void CFileManagerBackupSettings::SetContent(
       
   113         const TUint32 aContent )
       
   114     {
       
   115     iContent = aContent;
       
   116     }
       
   117 
       
   118 // ----------------------------------------------------------------------------
       
   119 // CFileManagerBackupSettings::SetScheduling
       
   120 // ----------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C void CFileManagerBackupSettings::SetScheduling(
       
   123         const TInt aScheduling )
       
   124     {
       
   125     iScheduling = aScheduling;
       
   126     }        
       
   127 
       
   128 // ----------------------------------------------------------------------------
       
   129 // CFileManagerBackupSettings::SetDay
       
   130 // ----------------------------------------------------------------------------
       
   131 //
       
   132 EXPORT_C void CFileManagerBackupSettings::SetDay( const TInt aDay )
       
   133     {
       
   134     iDay = aDay;
       
   135     }
       
   136 
       
   137 // ----------------------------------------------------------------------------
       
   138 // CFileManagerBackupSettings::SetTime
       
   139 // ----------------------------------------------------------------------------
       
   140 //
       
   141 EXPORT_C void CFileManagerBackupSettings::SetTime( const TTime& aTime )
       
   142     {
       
   143     iTime = aTime;
       
   144     }
       
   145 
       
   146 // ----------------------------------------------------------------------------
       
   147 // CFileManagerBackupSettings::SetTargetDrive
       
   148 // ----------------------------------------------------------------------------
       
   149 //
       
   150 EXPORT_C void CFileManagerBackupSettings::SetTargetDrive( const TInt aDrive )
       
   151     {
       
   152     iTargetDrive = aDrive;
       
   153     }
       
   154 
       
   155 // ----------------------------------------------------------------------------
       
   156 // CFileManagerBackupSettings::Content
       
   157 // ----------------------------------------------------------------------------
       
   158 //
       
   159 EXPORT_C TUint32 CFileManagerBackupSettings::Content() const
       
   160     {
       
   161     return iContent;
       
   162     }
       
   163 
       
   164 // ----------------------------------------------------------------------------
       
   165 // CFileManagerBackupSettings::Scheduling
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 EXPORT_C TInt CFileManagerBackupSettings::Scheduling() const
       
   169     {
       
   170     return iScheduling;
       
   171     }
       
   172 
       
   173 // ----------------------------------------------------------------------------
       
   174 // CFileManagerBackupSettings::Day
       
   175 // ----------------------------------------------------------------------------
       
   176 //
       
   177 EXPORT_C TInt CFileManagerBackupSettings::Day() const
       
   178     {
       
   179     return iDay;
       
   180     }
       
   181 
       
   182 // ----------------------------------------------------------------------------
       
   183 // CFileManagerBackupSettings::Time
       
   184 // ----------------------------------------------------------------------------
       
   185 //
       
   186 EXPORT_C const TTime& CFileManagerBackupSettings::Time() const
       
   187     {
       
   188     return iTime;
       
   189     }
       
   190 
       
   191 // ----------------------------------------------------------------------------
       
   192 // CFileManagerBackupSettings::TargetDrive
       
   193 // ----------------------------------------------------------------------------
       
   194 //
       
   195 EXPORT_C TInt CFileManagerBackupSettings::TargetDrive() const
       
   196     {
       
   197     return iTargetDrive;
       
   198     }
       
   199 
       
   200 // ----------------------------------------------------------------------------
       
   201 // CFileManagerBackupSettings::ContentCount
       
   202 // ----------------------------------------------------------------------------
       
   203 //
       
   204 TInt CFileManagerBackupSettings::ContentsSelected() const
       
   205     {
       
   206     TInt ret( 0 );
       
   207     // Count selected only
       
   208     TUint32 mask( iContent );
       
   209     while ( mask )
       
   210         {
       
   211         if ( mask & 1 )
       
   212             {
       
   213             ++ret;
       
   214             }
       
   215         mask >>= 1;
       
   216         }
       
   217     return ret;
       
   218     }
       
   219 
       
   220 // ----------------------------------------------------------------------------
       
   221 // CFileManagerBackupSettings::SaveL
       
   222 // ----------------------------------------------------------------------------
       
   223 //
       
   224 EXPORT_C void CFileManagerBackupSettings::SaveL()
       
   225     {
       
   226     FUNC_LOG
       
   227 
       
   228     TInt err( KErrNone );
       
   229 
       
   230     err = iCenRep->Set(
       
   231         KFileManagerBackupContent, static_cast< TInt >( iContent ) );
       
   232     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Content-err%d",
       
   233         err )
       
   234 
       
   235     err = iCenRep->Set(
       
   236         KFileManagerBackupScheduling, static_cast< TInt >( iScheduling ) );
       
   237     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Scheduling-err%d",
       
   238         err )
       
   239 
       
   240     err = iCenRep->Set(
       
   241         KFileManagerBackupDay, static_cast< TInt >( iDay ) );
       
   242     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Day-err%d",
       
   243         err )
       
   244 
       
   245     // Convert micro secs to minutes
       
   246     TInt minutes( iTime.Int64() / KMinToMicroSecMultiplier );
       
   247     err = iCenRep->Set( KFileManagerBackupTime, minutes );
       
   248     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Time-err%d",
       
   249         err )
       
   250 
       
   251     TChar ch;
       
   252     User::LeaveIfError( RFs::DriveToChar( iTargetDrive, ch ) );
       
   253     TBuf< KTargetDriveStrMax > drive;
       
   254     drive.Append( ch );
       
   255     err = iCenRep->Set( KFileManagerBackupTargetPath, drive );
       
   256     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::SaveL-Target-err%d",
       
   257         err )
       
   258 
       
   259     RefreshListL();
       
   260     }
       
   261 
       
   262 // ----------------------------------------------------------------------------
       
   263 // CFileManagerBackupSettings::LoadL
       
   264 // ----------------------------------------------------------------------------
       
   265 //
       
   266 void CFileManagerBackupSettings::LoadL()
       
   267     {
       
   268     FUNC_LOG
       
   269 
       
   270     TInt buffer( 0 );
       
   271     TInt err( KErrNone );
       
   272     err = iCenRep->Get( KFileManagerBackupContent, buffer );
       
   273     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Content-err%d",
       
   274         err )
       
   275 
       
   276     iContent = buffer;
       
   277     if ( !iContent )
       
   278          {
       
   279          iContent |= EFileManagerBackupContentAll;
       
   280          }
       
   281 
       
   282     buffer = 0;
       
   283     err = iCenRep->Get( KFileManagerBackupScheduling, buffer );
       
   284     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Scheduling-err%d",
       
   285         err )
       
   286 
       
   287     iScheduling = buffer;
       
   288 
       
   289     buffer = 0;
       
   290     err = iCenRep->Get( KFileManagerBackupDay, buffer );
       
   291     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Day-err%d",
       
   292         err )
       
   293 
       
   294     iDay = buffer;
       
   295     if ( iDay == KErrNotFound )
       
   296         {
       
   297         TLocale locale;
       
   298         iDay = locale.StartOfWeek();
       
   299         }
       
   300     // Convert minutes to micro secs
       
   301     buffer = 0;
       
   302     err = iCenRep->Get( KFileManagerBackupTime, buffer );
       
   303     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Time-err%d",
       
   304         err )
       
   305 
       
   306     TInt64 microSecs( buffer );
       
   307     microSecs *= KMinToMicroSecMultiplier;
       
   308     iTime = microSecs;
       
   309 
       
   310     HBufC* path = HBufC::NewLC( KMaxPath );
       
   311     TPtr ptr( path->Des() );
       
   312     err = iCenRep->Get( KFileManagerBackupTargetPath, ptr );
       
   313     LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-Target-err%d",
       
   314         err )
       
   315 
       
   316     if ( !ptr.Length() )
       
   317         {
       
   318         User::Leave( KErrNotFound );
       
   319         }
       
   320 
       
   321     _LIT( KDefault, "?" );
       
   322     if ( ptr[ 0 ] == KDefault()[ 0 ] )
       
   323         {
       
   324 #ifdef RD_MULTIPLE_DRIVE
       
   325         err = DriveInfo::GetDefaultDrive(
       
   326             DriveInfo::EDefaultRemovableMassStorage, iTargetDrive );
       
   327         LOG_IF_ERROR1( err, "CFileManagerBackupSettings::LoadL-GetDefaultDrive-err%d",
       
   328             err )
       
   329         User::LeaveIfError( err );
       
   330 #else // RD_MULTIPLE_DRIVE
       
   331         iTargetDrive = KFmgrMemoryCardDrive;
       
   332 #endif // RD_MULTIPLE_DRIVE
       
   333         }
       
   334     else
       
   335         {
       
   336         User::LeaveIfError( RFs::CharToDrive( ptr[ 0 ], iTargetDrive ) );
       
   337         }
       
   338     CleanupStack::PopAndDestroy( path );
       
   339 
       
   340     // Get allowed drive mask
       
   341     err = iCenRep->Get( KFileManagerFeatures, iFileManagerFeatures );
       
   342     if ( err != KErrNone )
       
   343         {
       
   344         ERROR_LOG1( "CFileManagerBackupSettings::LoadL-Features-err%d",
       
   345             err )
       
   346         iFileManagerFeatures = 0;
       
   347         }
       
   348     INFO_LOG1(
       
   349         "CFileManagerBackupSettings::LoadL-iFileManagerFeatures=0x%x",
       
   350         iFileManagerFeatures )
       
   351     if ( iFileManagerFeatures & EFileManagerFeatureBackupAllowAllDrives )
       
   352         {
       
   353         iAllowedDriveMatchMask = KDriveAttRemovable | KDriveAttRemote;
       
   354         }
       
   355     else
       
   356         {
       
   357         iAllowedDriveMatchMask = KDriveAttRemovable;
       
   358         }
       
   359 
       
   360     RefreshListL();
       
   361     }
       
   362 
       
   363 // ----------------------------------------------------------------------------
       
   364 // CFileManagerBackupSettings::SettingAt
       
   365 // ----------------------------------------------------------------------------
       
   366 //
       
   367 EXPORT_C TInt CFileManagerBackupSettings::SettingAt( const TInt aIndex )
       
   368     {
       
   369     TInt type( ENone );
       
   370     if ( aIndex >= 0 && aIndex < iList.Count() )
       
   371         {
       
   372         type = iList[ aIndex ]->iType;
       
   373         }
       
   374     return type;
       
   375     }
       
   376 
       
   377 // ----------------------------------------------------------------------------
       
   378 // CFileManagerBackupSettings::MdcaCount
       
   379 // ----------------------------------------------------------------------------
       
   380 //
       
   381 TInt CFileManagerBackupSettings::MdcaCount() const
       
   382     {
       
   383     return iList.Count();
       
   384     }
       
   385 
       
   386 // ----------------------------------------------------------------------------
       
   387 // CFileManagerBackupSettings::MdcaPoint
       
   388 // ----------------------------------------------------------------------------
       
   389 //
       
   390 TPtrC CFileManagerBackupSettings::MdcaPoint( TInt aIndex ) const
       
   391     {
       
   392     return TPtrC( *( iList[ aIndex ]->iText ) );
       
   393     }
       
   394 
       
   395 // ----------------------------------------------------------------------------
       
   396 // CFileManagerBackupSettings::CEntry::~CEntry
       
   397 // ----------------------------------------------------------------------------
       
   398 //
       
   399 CFileManagerBackupSettings::CEntry::~CEntry()
       
   400     {
       
   401     delete iText;
       
   402     }
       
   403 
       
   404 // ----------------------------------------------------------------------------
       
   405 // CFileManagerBackupSettings::CreateEntryLC
       
   406 // ----------------------------------------------------------------------------
       
   407 // 
       
   408 CFileManagerBackupSettings::CEntry* CFileManagerBackupSettings::CreateEntryLC(
       
   409         const TSettingType aType,
       
   410         const TInt aTitleId,
       
   411         const TInt aTextId,
       
   412         const TInt aValue )
       
   413     {
       
   414     HBufC* value = NULL;
       
   415     if ( aValue )
       
   416         {
       
   417         value = StringLoader::LoadLC( aTextId, aValue );
       
   418         }
       
   419     else
       
   420         {
       
   421         value = StringLoader::LoadLC( aTextId );
       
   422         }
       
   423 
       
   424     CEntry* entry = CreateEntryLC( aType, aTitleId, *value );
       
   425     CleanupStack::Pop( entry );
       
   426     CleanupStack::PopAndDestroy( value );
       
   427     CleanupStack::PushL( entry );
       
   428     return entry;
       
   429     }
       
   430 
       
   431 // ----------------------------------------------------------------------------
       
   432 // CFileManagerBackupSettings::CreateEntryLC
       
   433 // ----------------------------------------------------------------------------
       
   434 // 
       
   435 CFileManagerBackupSettings::CEntry* CFileManagerBackupSettings::CreateEntryLC(
       
   436         const TSettingType aType,
       
   437         const TInt aTitleId,
       
   438         const TDesC& aText )
       
   439     {
       
   440     CEntry* entry = new ( ELeave ) CEntry;
       
   441     CleanupStack::PushL( entry );
       
   442 
       
   443     HBufC* title = StringLoader::LoadLC( aTitleId );
       
   444     entry->iText = HBufC::NewL(
       
   445         title->Length() + aText.Length() + KSeparatorSpace );
       
   446 
       
   447     // "\tFirstLabel\t\tValueText"
       
   448     TPtr ptr( entry->iText->Des() );
       
   449     ptr.Append( KSeparator );
       
   450     ptr.Append( *title );
       
   451     ptr.Append( KSeparator );
       
   452     ptr.Append( KSeparator );
       
   453     ptr.Append( aText );
       
   454 
       
   455     entry->iType = aType;
       
   456 
       
   457     CleanupStack::PopAndDestroy( title );
       
   458     return entry;
       
   459     }
       
   460 
       
   461 // ----------------------------------------------------------------------------
       
   462 // CFileManagerBackupSettings::CreateContentsEntryLC
       
   463 // ----------------------------------------------------------------------------
       
   464 // 
       
   465 CFileManagerBackupSettings::CEntry*
       
   466         CFileManagerBackupSettings::CreateContentsEntryLC()
       
   467     {
       
   468     TInt selected( ContentsSelected() );
       
   469     if ( !( iContent & EFileManagerBackupContentAll ) && selected > 1 )
       
   470         {
       
   471         return CreateEntryLC(
       
   472             EContents,
       
   473             R_QTN_FMGR_BACKUP_CONTENTS,
       
   474             R_QTN_FMGR_BACKUP_CONTENT_SELECTED,
       
   475             selected );
       
   476         }
       
   477     TInt textId( ContentToTextId( iContent ) );
       
   478     return CreateEntryLC( EContents, R_QTN_FMGR_BACKUP_CONTENTS, textId );
       
   479     }
       
   480 
       
   481 // ----------------------------------------------------------------------------
       
   482 // CFileManagerBackupSettings::CreateTimeEntryLC
       
   483 // ----------------------------------------------------------------------------
       
   484 // 
       
   485 CFileManagerBackupSettings::CEntry*
       
   486         CFileManagerBackupSettings::CreateTimeEntryLC()
       
   487     {
       
   488     TBuf< KTimeStrMax > timeFormatStr;
       
   489     TLocale local;
       
   490     if ( local.AmPmSymbolPosition() == ELocaleBefore )
       
   491         {
       
   492         timeFormatStr.Copy( KTimeFormatBefore );
       
   493         }
       
   494     else
       
   495         {
       
   496         timeFormatStr.Copy( KTimeFormatAfter );
       
   497         }
       
   498     TChar timeSeparator( local.TimeSeparator( KHourMinSeparator ) );
       
   499     AknTextUtils::ReplaceCharacters(
       
   500         timeFormatStr, KTimeSeparatorPlaceHolder, timeSeparator );
       
   501     TBuf< KTimeStrMax > timeStr;
       
   502     iTime.FormatL( timeStr, timeFormatStr );
       
   503     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( timeStr );
       
   504     return CreateEntryLC( ETime, R_QTN_FMGR_BACKUP_TIME, timeStr );
       
   505     }
       
   506 
       
   507 // ----------------------------------------------------------------------------
       
   508 // CFileManagerBackupSettings::RefreshListL 
       
   509 // ----------------------------------------------------------------------------
       
   510 //
       
   511 void CFileManagerBackupSettings::RefreshListL()
       
   512     {
       
   513     iList.ResetAndDestroy();
       
   514 
       
   515     // Contents
       
   516     CEntry* entry = CreateContentsEntryLC();
       
   517     iList.AppendL( entry );
       
   518     CleanupStack::Pop( entry );
       
   519 
       
   520     if ( !( iFileManagerFeatures & EFileManagerFeatureScheduledBackupDisabled ) )
       
   521         {
       
   522         // Scheduling
       
   523         entry = CreateEntryLC(
       
   524             EScheduling,
       
   525             R_QTN_FMGR_BACKUP_SCHEDULING,
       
   526             KSchedulingTextLookup[ iScheduling ] );
       
   527         iList.AppendL( entry );
       
   528         CleanupStack::Pop( entry );
       
   529     
       
   530         // Weekday
       
   531         if ( iScheduling == EFileManagerBackupScheduleWeekly )
       
   532             {
       
   533             TDayName dayName( static_cast< TDay >( iDay ) );
       
   534             entry = CreateEntryLC(
       
   535                 EWeekday,
       
   536                 R_QTN_FMGR_BACKUP_WEEKDAY,
       
   537                 dayName );
       
   538             iList.AppendL( entry );
       
   539             CleanupStack::Pop( entry );
       
   540             }
       
   541     
       
   542         // Time
       
   543         if ( iScheduling == EFileManagerBackupScheduleWeekly ||
       
   544             iScheduling == EFileManagerBackupScheduleDaily )
       
   545             {
       
   546             entry = CreateTimeEntryLC();
       
   547             iList.AppendL( entry );
       
   548             CleanupStack::Pop( entry );
       
   549             }
       
   550         }
       
   551 
       
   552     // Target drive
       
   553     if ( HasMultipleBackupTargets() )
       
   554         {
       
   555         entry = CreateTargetDriveEntryLC();
       
   556         iList.AppendL( entry );
       
   557         CleanupStack::Pop( entry );
       
   558         }
       
   559     }
       
   560 
       
   561 // ----------------------------------------------------------------------------
       
   562 // CFileManagerBackupSettings::ContentToTextId
       
   563 // ----------------------------------------------------------------------------
       
   564 //
       
   565 TInt CFileManagerBackupSettings::ContentToTextId( const TUint32 aContent )
       
   566     {
       
   567     TInt ret( R_QTN_FMGR_BACKUP_CONTENT_ALL );
       
   568 
       
   569     if ( aContent & EFileManagerBackupContentAll )
       
   570         {
       
   571         ret = R_QTN_FMGR_BACKUP_CONTENT_ALL;
       
   572         }
       
   573     else if ( aContent & EFileManagerBackupContentSettings )
       
   574         {
       
   575         ret = R_QTN_FMGR_BACKUP_CONTENT_SETTINGS;
       
   576         }
       
   577     else if ( aContent & EFileManagerBackupContentMessages )
       
   578         {
       
   579         ret = R_QTN_FMGR_BACKUP_CONTENT_MESSAGES;
       
   580         }
       
   581     else if ( aContent & EFileManagerBackupContentContacts )
       
   582         {
       
   583         ret = R_QTN_FMGR_BACKUP_CONTENT_CONTACTS;
       
   584         }
       
   585     else if ( aContent & EFileManagerBackupContentCalendar )
       
   586         {
       
   587         ret = R_QTN_FMGR_BACKUP_CONTENT_CALENDAR;
       
   588         }
       
   589     else if ( aContent & EFileManagerBackupContentBookmarks )
       
   590         {
       
   591         ret = R_QTN_FMGR_BACKUP_CONTENT_BOOKMARKS;
       
   592         }
       
   593     else if ( aContent & EFileManagerBackupContentUserFiles )
       
   594         {
       
   595         ret = R_QTN_FMGR_BACKUP_CONTENT_USERFILES;
       
   596         }
       
   597     return ret;
       
   598     }
       
   599 
       
   600 // ----------------------------------------------------------------------------
       
   601 // CFileManagerBackupSettings::RefreshL
       
   602 // ----------------------------------------------------------------------------
       
   603 //
       
   604 EXPORT_C void CFileManagerBackupSettings::RefreshL()
       
   605     {
       
   606     LoadL();
       
   607     }
       
   608 
       
   609 // ----------------------------------------------------------------------------
       
   610 // CFileManagerBackupSettings::CreateTargetDriveEntryLC
       
   611 // ----------------------------------------------------------------------------
       
   612 // 
       
   613 CFileManagerBackupSettings::CEntry*
       
   614         CFileManagerBackupSettings::CreateTargetDriveEntryLC()
       
   615     {
       
   616     TPtrC driveName( iEngine.DriveName( iTargetDrive ) );
       
   617 
       
   618     if ( driveName.Length() )
       
   619         {
       
   620         return CreateEntryLC(
       
   621             ETarget, R_QTN_FMGR_BACKUP_DESTINATION, driveName );
       
   622         }
       
   623         
       
   624     TChar ch;
       
   625     User::LeaveIfError( RFs::DriveToChar( iTargetDrive, ch ) );
       
   626     TBuf< KTargetDriveStrMax > drive;
       
   627     drive.Append( ch );
       
   628     return CreateEntryLC( ETarget, R_QTN_FMGR_BACKUP_DESTINATION, drive );
       
   629     }
       
   630 
       
   631 // ----------------------------------------------------------------------------
       
   632 // CFileManagerBackupSettings::AllowedDriveAttMatchMask
       
   633 // ----------------------------------------------------------------------------
       
   634 // 
       
   635 EXPORT_C TUint32 CFileManagerBackupSettings::AllowedDriveAttMatchMask() const
       
   636     {
       
   637     return iAllowedDriveMatchMask;
       
   638     }
       
   639 
       
   640 // ----------------------------------------------------------------------------
       
   641 // CFileManagerBackupSettings::HasMultipleBackupTargets
       
   642 // ----------------------------------------------------------------------------
       
   643 // 
       
   644 TBool CFileManagerBackupSettings::HasMultipleBackupTargets()
       
   645     {
       
   646 #ifdef RD_MULTIPLE_DRIVE
       
   647     TBool count( 0 );
       
   648     TUint32 driveAttMask( AllowedDriveAttMatchMask() );
       
   649     RFs& fs( iEngine.Fs() );
       
   650 
       
   651     for ( TInt i( 0 ); i < KMaxDrives; ++i )
       
   652         {
       
   653         TDriveInfo driveInfo;
       
   654         if ( fs.Drive( driveInfo, i ) == KErrNone )
       
   655             {
       
   656             // Do not allow backup for internal drives
       
   657             TUint driveStatus( 0 );
       
   658             DriveInfo::GetDriveStatus( fs, i, driveStatus );
       
   659             if ( driveStatus & DriveInfo::EDriveInternal )
       
   660                 {
       
   661                 continue;
       
   662                 }
       
   663             if ( driveInfo.iDriveAtt & driveAttMask )
       
   664                 {
       
   665                 ++count;
       
   666                 }
       
   667             }
       
   668         if ( count > 1 )
       
   669             {
       
   670             break;
       
   671             }
       
   672         }
       
   673     return count > 1;
       
   674 #else // RD_MULTIPLE_DRIVE
       
   675     return EFalse;
       
   676 #endif // RD_MULTIPLE_DRIVE
       
   677     }
       
   678 
       
   679 // End of File