messagingfw/biomsgfw/wapptsrc/T_MMSSettingsProxy.cpp
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // test mms settings proxy dll
       
    15 // takes a settings list from caller and dumps to file for comparison
       
    16 // 
       
    17 //
       
    18 
       
    19 #include <ecom/implementationproxy.h>
       
    20 #include "T_MMSSettingsProxy.h"
       
    21 
       
    22 // constants
       
    23 _LIT(KSettingsProxyTestLogFileName, "c:\\MsgLogs\\tmmsproxy.log");
       
    24 
       
    25 
       
    26 CMMSSettingsProxy* CMMSSettingsProxy::NewL()
       
    27 	{
       
    28 	CMMSSettingsProxy* self = new(ELeave) CMMSSettingsProxy();
       
    29 	CleanupStack::PushL(self);
       
    30 	self->ConstructL();
       
    31 	CleanupStack::Pop(self);
       
    32 	return self;
       
    33 	}
       
    34 
       
    35 
       
    36 CMMSSettingsProxy::~CMMSSettingsProxy()
       
    37 	{
       
    38 	iFs.Close();
       
    39 	}
       
    40 
       
    41 
       
    42 void CMMSSettingsProxy::SetMMSValuesL(TSglQue<TMMSSettingsPair>& aMMSSettingsList)
       
    43 	{
       
    44 	// open log file
       
    45 	RFile file;
       
    46 	CleanupClosePushL(file);
       
    47 	User::LeaveIfError(file.Replace(iFs, KSettingsProxyTestLogFileName, EFileWrite | EFileStream));
       
    48 	TBuf8<256> log;
       
    49 
       
    50 	// access settings list
       
    51 	TSglQueIter<TMMSSettingsPair> listIter(aMMSSettingsList);
       
    52 	listIter.SetToFirst();
       
    53 	TMMSSettingsPair* settingsPair;
       
    54 	
       
    55 	// scan settings writing each in turn to file - replace dynamic data with static text
       
    56 	while ((settingsPair = listIter++) != NULL)
       
    57 		{
       
    58 		// write setting name
       
    59 		log.Copy(settingsPair->iName);
       
    60 		log += _L8(",");
       
    61 		User::LeaveIfError(file.Write(log));
       
    62 	
       
    63 		// write setting value (or static text)
       
    64 		if (settingsPair->iName == KMMSUrl)
       
    65 			{
       
    66 			log.Copy(*REINTERPRET_CAST(TPtrC*, settingsPair->iValue));
       
    67 			User::LeaveIfError(file.Write(log));
       
    68 			}
       
    69 		else if (settingsPair->iName == KCommDbRecordId)
       
    70 			{
       
    71 			User::LeaveIfError(file.Write(_L8("ID")));
       
    72 			}
       
    73 		else if (settingsPair->iName == KMsvEntry)
       
    74 			{
       
    75 			User::LeaveIfError(file.Write(_L8("PTR")));
       
    76 			}
       
    77 		else  
       
    78 			{
       
    79 			User::LeaveIfError(file.Write(_L8("UNKNOWN")));
       
    80 			}
       
    81 		User::LeaveIfError(file.Write(_L8("\r\n")));
       
    82 		}
       
    83 
       
    84 	CleanupStack::PopAndDestroy(); // file
       
    85 	}
       
    86 
       
    87 
       
    88 CMMSSettingsProxy::CMMSSettingsProxy()
       
    89 	{
       
    90 	}
       
    91 
       
    92 
       
    93 void CMMSSettingsProxy::ConstructL()
       
    94 	{
       
    95 	// connect to file server
       
    96 	User::LeaveIfError(iFs.Connect());
       
    97 	}
       
    98 
       
    99 
       
   100 const TImplementationProxy ImplementationTable[] =
       
   101 	{
       
   102 	// this is used by ECom to select the correct implementation
       
   103 	IMPLEMENTATION_PROXY_ENTRY(0x101F9421, CMMSSettingsProxy::NewL)
       
   104 	};
       
   105 
       
   106 
       
   107 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
   108 	{
       
   109 	aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
       
   110 	return ImplementationTable;
       
   111 	}
       
   112 
       
   113