📄 mdictionarydocument.cpp
字号:
/*
* MDictionary - dictionary program for Symbian cellular phones
*
* Copyright (C) 2005 Egyeki Gergely
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// INCLUDE FILES
#include "MDictionaryAppUi.h"
#include "MDictionaryDocument.h"
#include "SettingsData.h"
#include "DBHandler.h"
CMDictionaryDocument* CMDictionaryDocument::NewL( CEikApplication& aApp )
{
CMDictionaryDocument* self = NewLC( aApp );
CleanupStack::Pop( self );
return self;
}
CMDictionaryDocument* CMDictionaryDocument::NewLC( CEikApplication& aApp )
{
CMDictionaryDocument* self = new ( ELeave ) CMDictionaryDocument( aApp );
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
void CMDictionaryDocument::ConstructL()
{
iData = CSettingsData::NewL();
}
CMDictionaryDocument::CMDictionaryDocument( CEikApplication& aApp )
: CAknDocument( aApp ), iDB(NULL), iData(NULL)
{
}
CMDictionaryDocument::~CMDictionaryDocument()
{
delete iData;
iData = NULL;
delete iDB;
iDB = NULL;
}
CEikAppUi* CMDictionaryDocument::CreateAppUiL()
{
//databases
iDB = CDBHandler::NewL();
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
return ( static_cast <CEikAppUi*> ( new ( ELeave ) CMDictionaryAppUi ) );
}
CFileStore* CMDictionaryDocument::OpenFileL(
TBool aDoOpen,const TDesC& aFilename,RFs& aFs)
{
return CEikDocument::OpenFileL( aDoOpen, aFilename, aFs);
}
void CMDictionaryDocument::NewDocumentL()
{
iData->InitDataL();
}
void CMDictionaryDocument::RestoreL(
const CStreamStore& aStore, const CStreamDictionary& aStreamDic)
{
TStreamId id = aStreamDic.At( Application()->AppDllUid() );
RStoreReadStream stream;
stream.OpenLC(aStore, id);
iData->InternalizeL(stream);
CleanupStack::PopAndDestroy(); // stream
}
void CMDictionaryDocument::StoreL(
CStreamStore& aStore, CStreamDictionary& aStreamDic) const
{
RStoreWriteStream stream;
TStreamId id = stream.CreateLC(aStore);
iData->ExternalizeL( stream );
stream.CommitL();
aStreamDic.AssignL( Application()->AppDllUid(), id);
CleanupStack::PopAndDestroy(); // stream
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -