📄 settingdata.cpp
字号:
/*
* ============================================================================
* Name : CSettingData from SettingData.cpp
* Part of : Sabber
* Created : 2004-12-9 by Xie Tian Lu
* Description:
* Setting data.
* Version : 0.1
* Copyright: 2004 Xie Tian Lu xietl@yeah.net
* ============================================================================
*/
// INCLUDE FILES
#include <eikenv.h>
#include <in_sock.h>
#include <stdio.h>
#include <string.h>
#include "fileio.h"
#include "osaux.h"
#include "SettingData.h"
const TInt KMinFldVal = 20;
_LIT(KSettingFileName, "\\system\\apps\\Sabber\\sabber.set");
// ================= MEMBER FUNCTIONS =========================================
// ----------------------------------------------------------------------------
// CAknExSettingListListbox::NewL
// Two-phase constructor
// ----------------------------------------------------------------------------
//
CSettingData* CSettingData::NewL()
{
CSettingData* data = new CSettingData;
CleanupStack::PushL(data);
data->ConstructL();
CleanupStack::Pop(); // data
return data;
}
// Destructor
//
CSettingData::~CSettingData()
{
}
// Constructor
//
CSettingData::CSettingData() : iIapId( 0 ), iPort( 5222 ), iAutoConnect( EFalse )
{
}
// Epoc default constructor
//
void CSettingData::ConstructL()
{
}
TBool CSettingData::Load()
{
RFs fs;
RFile file;
TInt len;
char buf[ 128 ];
if ( !CFileIO::OpenForRead( fs, file, KSettingFileName ) )
return EFalse;
CFileIO::Read( file, len );
CFileIO::ReadData( file, buf, len );
buf[ len ] = 0;
CUtil::UTF82Unicode( iUserID, buf );
CFileIO::Read( file, len );
CFileIO::ReadData( file, buf, len );
buf[ len ] = 0;
CUtil::UTF82Unicode( iUserPassword, buf );
CFileIO::Read( file, iPort );
CFileIO::Read( file, iIapId );
CFileIO::Close( fs, file );
return ETrue;
}
TBool CSettingData::Save()
{
RFs fs;
RFile file;
TInt len;
char buf[ 128 ];
if ( !CFileIO::OpenForWrite( fs, file, KSettingFileName ) )
return EFalse;
CUtil::Unicode2UTF8( buf, iUserID );
len = strlen( buf );
CFileIO::Write( file, len );
CFileIO::WriteData( file, buf, len );
CUtil::Unicode2UTF8( buf, iUserPassword );
len = strlen( buf );
CFileIO::Write( file, len );
CFileIO::WriteData( file, buf, len );
CFileIO::Write( file, iPort );
CFileIO::Write( file, iIapId );
CFileIO::Close( fs, file );
return ETrue;
}
void CSettingData::DefaultValues()
{
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -