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

  • CNotepadModel

Nested Classes and Structures

Public Member Functions
~CNotepadModel ()
IMPORT_C void AddContentL (const TDesC &)
void CancelDeletion ()
IMPORT_C void Close ()
HBufC * ContentL ( TInt )
void DeleteByKeysL (const RArray < TInt > &)
void HandleDatabaseChangedL ( TInt )
void HandleDateChangedL ( TBool )
TInt IndexOf (const TInt )
TBool IsDeleting ()
IMPORT_C TBool IsOpen ()
TUint ItemArrayFlags ()
TInt Key ( TInt )
const RArray < TInt > & KeyArray ()
IMPORT_C TInt MdcaCount ()
IMPORT_C TPtrC MdcaPoint ( TInt )
IMPORT_C CNotepadModel * NewL ( RFs &, TInt )
IMPORT_C void OpenL ()
IMPORT_C TInt SeekKey (const TInt )
void SetItemArrayFlags ()
void SetNotepadModelObserver ( MNotepadModelObserver *)
void SyncL (const TBool )
Private Member Functions
CNotepadModel ()
void AbortDeletionL ()
void BuildItemArrayL (const TBool )
IMPORT_C void CNotepadModel_Reserved ()
void CompleteDeletionL ()
void ConstructL ( TInt )
TInt DeleteCallBack ( TAny *)
void DoBuildItemArrayL ()
void DoBuildNotepadItemArrayL ( TPtr &)
void DoBuildTemplateItemArrayL ( TPtr &)
TInt DoDeleteCallBackL ()
TInt DoRemoveLinkCallBackL ()
void ExecuteDeleteStepL ()
void PrepareToDeleteByKeysL (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
enum TNotepadModelFlag { 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()

void AbortDeletionL ( ) [private]

Should be called if deleting process was aborted.

AddContentL(const TDesC &)

IMPORT_C void AddContentL ( const TDesC & aText )

Save text as a memo. API for SaveAsMemo.

Parameters

const TDesC & aText text to save

BuildItemArrayL(const TBool)

void BuildItemArrayL ( const TBool aForceSync ) [private]

Create iItemArray and iKeyArray.

Parameters

const TBool aForceSync

CNotepadModel_Reserved()

IMPORT_C void CNotepadModel_Reserved ( ) [private]

Reserved.

CancelDeletion()

void CancelDeletion ( )

Cancel deleting process if running.

Close()

IMPORT_C void Close ( )

Close a datafile.

CompleteDeletionL()

void CompleteDeletionL ( ) [private]

Should be called if deleting process has completed.

ConstructL(TInt)

void ConstructL ( TInt aResId ) [private]

Second phase constructor.

Parameters

TInt aResId resource id of type STRUCT NOTEPAD_MODEL

ContentL(TInt)

HBufC * ContentL ( TInt aItemIndex )

Return content of the item.

Caller own a returned object.

Parameters

TInt aItemIndex target index.

DeleteByKeysL(const RArray< TInt > &)

void DeleteByKeysL ( const RArray < TInt > & aKeys )

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

Parameters

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

DeleteCallBack(TAny *)

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

Callback function while iExecuter is running for deletion.

Parameters

TAny * aSelf an object of this class.

DoBuildItemArrayL()

void DoBuildItemArrayL ( ) [private]

Implementation of BuildItemArrayL.

DoBuildNotepadItemArrayL(TPtr &)

void DoBuildNotepadItemArrayL ( TPtr & aBuf ) [private]

Implementation of BuildItemArrayL when Notepad.

Parameters

TPtr & aBuf

DoBuildTemplateItemArrayL(TPtr &)

void DoBuildTemplateItemArrayL ( 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()

void ExecuteDeleteStepL ( ) [private]

HandleDatabaseChangedL(TInt)

void HandleDatabaseChangedL ( TInt aStatus )

Refresh the cached data accroding to changes of the database.

This function is called from iDatabaseChangeNotifer.

Parameters

TInt aStatus

HandleDateChangedL(TBool)

void HandleDateChangedL ( TBool aSyncNow )

Refresh the text array.

This function should be called if date has changed.

Parameters

TBool aSyncNow

IndexOf(const TInt)

TInt IndexOf ( const TInt aKey ) const

Return an index of the key.

Parameters

const TInt aKey unique key id.

IsDeleting()

TBool IsDeleting ( ) const [inline]

Return ETrue if deleting process is running.

IsOpen()

IMPORT_C TBool IsOpen ( )

Return ETrue if it is opened now.

ItemArrayFlags()

TUint ItemArrayFlags ( )

Retruns the item array flags.

Key(TInt)

TInt Key ( TInt aItemIndex ) 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 TInt MdcaCount ( ) const

From MDesCArray. Return the number of items.

MdcaPoint(TInt)

IMPORT_C TPtrC MdcaPoint ( TInt aIndex ) const

From MDesCArray. Return the text of specified item.

Parameters

TInt aIndex

NewL(RFs &, TInt)

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

Constructor.

Parameters

RFs & aFs file server session.
TInt aResId resource id of type STRUCT NOTEPAD_MODEL.

OpenL()

IMPORT_C void OpenL ( )

Open (or create) a datafile.

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

PrepareToDeleteByKeysL(const RArray< TInt > &)

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

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

Parameters

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

SeekKey(const TInt)

IMPORT_C TInt SeekKey ( const TInt aKey )

Seek a specified key UID in item array.

Parameters

const TInt aKey key to seek.

SetItemArrayFlags()

void SetItemArrayFlags ( )

Sets the item array flags.

SetNotepadModelObserver(MNotepadModelObserver *)

void SetNotepadModelObserver ( MNotepadModelObserver * aObserver )

Set a Notepad model observer.

Parameters

MNotepadModelObserver * aObserver an object which implements MNotepadModelObserver.

SyncL(const TBool)

void SyncL ( const TBool aForceSync )

Sync iDbView, iItemArray and iKeyArray.

Parameters

const TBool aForceSync force 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]