phonebookengines/contactsmodel/cntsrv/src/CCntBackupRestoreAgent.cpp
changeset 24 0ba2181d7c28
parent 0 e686773b3f54
equal deleted inserted replaced
0:e686773b3f54 24:0ba2181d7c28
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 /*
     2 // All rights reserved.
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 // This component and the accompanying materials are made available
     3 * All rights reserved.
     4 // under the terms of "Eclipse Public License v1.0"
     4 * This component and the accompanying materials are made available
     5 // which accompanies this distribution, and is available
     5 * under the terms of "Eclipse Public License v1.0"
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 * which accompanies this distribution, and is available
     7 //
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 // Initial Contributors:
     8 *
     9 // Nokia Corporation - initial contribution.
     9 * Initial Contributors:
    10 //
    10 * Nokia Corporation - initial contribution.
    11 // Contributors:
    11 *
    12 //
    12 * Contributors:
    13 // Description:
    13 *
    14 //
    14 * Description: 
    15 
    15 *
    16 #include "connect/sbdefs.h" // For conn::EBURNormal etc.
    16 */
    17 #include <utf.h> // For CnvUtfConverter::ConvertFromUnicodeToUtf8().
    17 
    18 
    18 
    19 #include "CCntBackupRestoreAgent.h"
    19 #include "connect/sbdefs.h" // for conn::eburnormal etc.
    20 #include "CIniFileManager.h"
    20 #include <utf.h> // for cnvutfconverter::convertfromunicodetoutf8().
    21 #include "CCntDbManagerController.h"
    21 
    22 #include "CCntServer.h" // For KCntNullConnectionId.
    22 #include "ccntbackuprestoreagent.h"
    23 #include "CCntLogger.h"
    23 #include "cinifilemanager.h"
       
    24 #include "ccntdbmanagercontroller.h"
       
    25 #include "ccntserver.h" // for kcntnullconnectionid.
       
    26 #include "ccntlogger.h"
    24 
    27 
    25 
    28 
    26 const TInt CCntBackupRestoreAgent::KMaxFileNameLength = 256;
    29 const TInt CCntBackupRestoreAgent::KMaxFileNameLength = 256;
    27 
    30 
    28 _LIT(KSqLiteFilePrefix, "SQLite__");
    31 _LIT(KSqLiteFilePrefix, "SQLite__");
   153 		User::Leave(err);
   156 		User::Leave(err);
   154 		}
   157 		}
   155 		
   158 		
   156 	HBufC* nameAndExt = NULL;
   159 	HBufC* nameAndExt = NULL;
   157 	nameAndExt = HBufC::NewLC(KSqLiteFilePrefix().Length() + parseFileName.NameAndExt().Length());
   160 	nameAndExt = HBufC::NewLC(KSqLiteFilePrefix().Length() + parseFileName.NameAndExt().Length());
   158 	if (parseFileName.NameAndExt().Compare(KContactsIniFileName) != 0)
   161 	nameAndExt->Des().Append(KSqLiteFilePrefix);
   159 		{
       
   160 		nameAndExt->Des().Append(KSqLiteFilePrefix);
       
   161 		}	
       
   162 	nameAndExt->Des().Append(parseFileName.NameAndExt());
   162 	nameAndExt->Des().Append(parseFileName.NameAndExt());
   163 
   163 
   164 	// Convert filename and extension to UTF8 before writing to file.
   164 	// Convert filename and extension to UTF8 before writing to file.
   165 	HBufC8* fileNameAndExt8 = HBufC8::NewLC(nameAndExt->Length());
   165 	HBufC8* fileNameAndExt8 = HBufC8::NewLC(nameAndExt->Length());
   166 	TPtr8 pFileNameAndExt8(fileNameAndExt8->Des());
   166 	TPtr8 pFileNameAndExt8(fileNameAndExt8->Des());