CNotepadModel Class Reference

class CNotepadModel : public CNotepadCoreModel

Engine of NpdLib. CNotepadModel is the engine of Notepad Library. This class has an array of texts for listing data in a text list box.

NpdLib.lib CNotepadCoreModel, CNotepadTableModel

Inherits from

Nested Classes and Structures

Public Member Functions
~CNotepadModel()
IMPORT_C voidAddContentL(const TDesC &)
voidCancelDeletion()
IMPORT_C voidClose()
HBufC *ContentL(TInt)
voidDeleteByKeysL(const RArray< TInt > &)
voidHandleDatabaseChangedL(TInt)
voidHandleDateChangedL(TBool)
TInt IndexOf(const TInt)
TBool IsDeleting()
IMPORT_C TBoolIsOpen()
TUint ItemArrayFlags()
TInt Key(TInt)
const RArray< TInt > &KeyArray()
IMPORT_C TIntMdcaCount()
IMPORT_C TPtrCMdcaPoint(TInt)
IMPORT_C CNotepadModel *NewL(RFs &, TInt)
IMPORT_C voidOpenL()
IMPORT_C TIntSeekKey(const TInt)
voidSetItemArrayFlags()
voidSetNotepadModelObserver(MNotepadModelObserver *)
voidSyncL(const TBool)
Private Member Functions
CNotepadModel()
voidAbortDeletionL()
voidBuildItemArrayL(const TBool)
IMPORT_C voidCNotepadModel_Reserved()
voidCompleteDeletionL()
voidConstructL(TInt)
TInt DeleteCallBack(TAny *)
voidDoBuildItemArrayL()
voidDoBuildNotepadItemArrayL(TPtr &)
voidDoBuildTemplateItemArrayL(TPtr &)
TInt DoDeleteCallBackL()
TInt DoRemoveLinkCallBackL()
voidExecuteDeleteStepL()
voidPrepareToDeleteByKeysL(const RArray< TInt > &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CNotepadCoreModel::AppendContentAsLabelL(TDes &,RDbView &)
CNotepadCoreModel::AppendContentAsLabelL(TDes &,const TInt)
CNotepadCoreModel::CNotepadCoreModel()
CNotepadCoreModel::Compact()
CNotepadCoreModel::ContentByKeyL(const TInt)
CNotepadCoreModel::CountL()
CNotepadCoreModel::DeleteL(TInt)
CNotepadCoreModel::DoUpdateNotepadItemArrayAndKeyArrayL(CDesCArray &,RArray< TInt > &,HBufC &)
CNotepadCoreModel::InsertL(const TDesC &,TInt &)
CNotepadCoreModel::IsTemplates()const
CNotepadCoreModel::ModeOp()
CNotepadCoreModel::SetModeOp(CNotepadCoreModel::TNotepadModelRowResult)
CNotepadCoreModel::UpdateL(const TDesC &,TInt &)
CNotepadCoreModel::~CNotepadCoreModel()
Public Member Enumerations
enumTNotepadModelFlag { ENotepadRequireDbViewUpdate = 0x01, ENotepadRequireItemArrayUpdate = 0x02, ENotepadIsDeleting = 0x04, ENotepadIsRemovingLinks = 0x08, ENotepadItemArrayUpdateOnly = 0x10 }
Inherited Enumerations
CNotepadCoreModel:TNotepadColumnType
CNotepadCoreModel:TNotepadModelRowResult
Private Attributes
CNotepadModel::CDatabaseChangeNotifier *iDatabaseChangeNotifier
HBufC *iDateFormat
RDbUpdate iDbUpdate
RDbView iDbView
CIdle *iExecuter
RFs iFileSession
HBufC *iFixedFirstNote
TUint iFlag
CDesCArray *iItemArray
RArray< TInt >iKeyArray
TInt iListingStyle
MNotepadModelObserver *iModelObserver
TInt iProgressCount
TInt iRetval
RArray< TInt >iSavedDeleteKeys
TInt iStepCount
HBufC *iTimeFormat
Inherited Attributes
CNotepadCoreModel::iDatabase
CNotepadCoreModel::iEnv

Constructor & Destructor Documentation

CNotepadModel()

CNotepadModel()[private]

Default C++ constructor.

~CNotepadModel()

IMPORT_C~CNotepadModel()[virtual]

Destructor.

Member Functions Documentation

AbortDeletionL()

voidAbortDeletionL()[private]

Should be called if deleting process was aborted.

AddContentL(const TDesC &)

IMPORT_C voidAddContentL(const TDesC &aText)

Save text as a memo. API for SaveAsMemo.

Parameters

const TDesC & aTexttext to save

BuildItemArrayL(const TBool)

voidBuildItemArrayL(const TBoolaForceSync)[private]

Create iItemArray and iKeyArray.

Parameters

const TBool aForceSync

CNotepadModel_Reserved()

IMPORT_C voidCNotepadModel_Reserved()[private]

Reserved.

CancelDeletion()

voidCancelDeletion()

Cancel deleting process if running.

Close()

IMPORT_C voidClose()

Close a datafile.

CompleteDeletionL()

voidCompleteDeletionL()[private]

Should be called if deleting process has completed.

ConstructL(TInt)

voidConstructL(TIntaResId)[private]

Second phase constructor.

Parameters

TInt aResIdresource id of type STRUCT NOTEPAD_MODEL

ContentL(TInt)

HBufC *ContentL(TIntaItemIndex)

Return content of the item.

Caller own a returned object.

Parameters

TInt aItemIndextarget index.

DeleteByKeysL(const RArray< TInt > &)

voidDeleteByKeysL(const RArray< TInt > &aKeys)

Start deleting process. This method gives an incremental version of deletion.

Parameters

const RArray< TInt > & aKeyskeys of items to be deleted.

DeleteCallBack(TAny *)

TInt DeleteCallBack(TAny *aSelf)[private, static]

Callback function while iExecuter is running for deletion.

Parameters

TAny * aSelfan object of this class.

DoBuildItemArrayL()

voidDoBuildItemArrayL()[private]

Implementation of BuildItemArrayL.

DoBuildNotepadItemArrayL(TPtr &)

voidDoBuildNotepadItemArrayL(TPtr &aBuf)[private]

Implementation of BuildItemArrayL when Notepad.

Parameters

TPtr & aBuf

DoBuildTemplateItemArrayL(TPtr &)

voidDoBuildTemplateItemArrayL(TPtr &aBuf)[private]

Implementation of BuildItemArrayL when Tempaltes.

Parameters

TPtr & aBuf

DoDeleteCallBackL()

TInt DoDeleteCallBackL()[private]

Callback function while iExecuter is running for deletion.

DoRemoveLinkCallBackL()

TInt DoRemoveLinkCallBackL()[private]

Callback function while iExecuter is running for removal of links.

ExecuteDeleteStepL()

voidExecuteDeleteStepL()[private]

HandleDatabaseChangedL(TInt)

voidHandleDatabaseChangedL(TIntaStatus)

Refresh the cached data accroding to changes of the database.

This function is called from iDatabaseChangeNotifer.

Parameters

TInt aStatus

HandleDateChangedL(TBool)

voidHandleDateChangedL(TBoolaSyncNow)

Refresh the text array.

This function should be called if date has changed.

Parameters

TBool aSyncNow

IndexOf(const TInt)

TInt IndexOf(const TIntaKey)const

Return an index of the key.

Parameters

const TInt aKeyunique key id.

IsDeleting()

TBool IsDeleting()const [inline]

Return ETrue if deleting process is running.

IsOpen()

IMPORT_C TBoolIsOpen()

Return ETrue if it is opened now.

ItemArrayFlags()

TUint ItemArrayFlags()

Retruns the item array flags.

Key(TInt)

TInt Key(TIntaItemIndex)const [inline]

Return key UID of specified item.

Parameters

TInt aItemIndex

KeyArray()

const RArray< TInt > &KeyArray()const [inline]

Return iKeyArray (for Editor to create a sequence).

MdcaCount()

IMPORT_C TIntMdcaCount()const

From MDesCArray. Return the number of items.

MdcaPoint(TInt)

IMPORT_C TPtrCMdcaPoint(TIntaIndex)const

From MDesCArray. Return the text of specified item.

Parameters

TInt aIndex

NewL(RFs &, TInt)

IMPORT_C CNotepadModel *NewL(RFs &aFs,
TIntaResId
)[static]

Constructor.

Parameters

RFs & aFsfile server session.
TInt aResIdresource id of type STRUCT NOTEPAD_MODEL.

OpenL()

IMPORT_C voidOpenL()

Open (or create) a datafile.

If already opened, do nothing. If there is no datafile, create a new datafile.

PrepareToDeleteByKeysL(const RArray< TInt > &)

voidPrepareToDeleteByKeysL(const RArray< TInt > &aKeys)[private]

Prepare to start deletion. Create a SQL statement and set it on iDbUpdate.

Parameters

const RArray< TInt > & aKeyskeys of items to be deleted.

SeekKey(const TInt)

IMPORT_C TIntSeekKey(const TIntaKey)

Seek a specified key UID in item array.

Parameters

const TInt aKeykey to seek.

SetItemArrayFlags()

voidSetItemArrayFlags()

Sets the item array flags.

SetNotepadModelObserver(MNotepadModelObserver *)

voidSetNotepadModelObserver(MNotepadModelObserver *aObserver)

Set a Notepad model observer.

Parameters

MNotepadModelObserver * aObserveran object which implements MNotepadModelObserver.

SyncL(const TBool)

voidSyncL(const TBoolaForceSync)

Sync iDbView, iItemArray and iKeyArray.

Parameters

const TBool aForceSyncforce sync.

Member Enumerations Documentation

Enum TNotepadModelFlag

Enumerators

ENotepadRequireDbViewUpdate = 0x01
ENotepadRequireItemArrayUpdate = 0x02
ENotepadIsDeleting = 0x04
ENotepadIsRemovingLinks = 0x08
ENotepadItemArrayUpdateOnly = 0x10

Member Data Documentation

CNotepadModel::CDatabaseChangeNotifier * iDatabaseChangeNotifier

CNotepadModel::CDatabaseChangeNotifier *iDatabaseChangeNotifier[private]

HBufC * iDateFormat

HBufC *iDateFormat[private]

RDbUpdate iDbUpdate

RDbUpdate iDbUpdate[private]

RDbView iDbView

RDbView iDbView[private]

CIdle * iExecuter

CIdle *iExecuter[private]

RFs iFileSession

RFs iFileSession[private]

HBufC * iFixedFirstNote

HBufC *iFixedFirstNote[private]

TUint iFlag

TUint iFlag[private]

CDesCArray * iItemArray

CDesCArray *iItemArray[private]

RArray< TInt > iKeyArray

RArray< TInt >iKeyArray[private]

TInt iListingStyle

TInt iListingStyle[private]

MNotepadModelObserver * iModelObserver

MNotepadModelObserver *iModelObserver[private]

TInt iProgressCount

TInt iProgressCount[private]

TInt iRetval

TInt iRetval[private]

RArray< TInt > iSavedDeleteKeys

RArray< TInt >iSavedDeleteKeys[private]

TInt iStepCount

TInt iStepCount[private]

HBufC * iTimeFormat

HBufC *iTimeFormat[private]