696 // ---------------------------------------------------------------------------- |
696 // ---------------------------------------------------------------------------- |
697 void CNSmlNotepadDataStore::DoWriteItemL( const TDesC8& aData ) |
697 void CNSmlNotepadDataStore::DoWriteItemL( const TDesC8& aData ) |
698 { |
698 { |
699 _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): begin"); |
699 _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): begin"); |
700 if ( iState == ENSmlItemCreating || iState == ENSmlItemUpdating ) |
700 if ( iState == ENSmlItemCreating || iState == ENSmlItemUpdating ) |
701 { |
701 { |
702 TInt totalSize = aData.Size() + iItemData->Size(); |
|
703 if( SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, totalSize, iDrive ) ) |
|
704 { |
|
705 User::RequestComplete(iCallerStatus, KErrDiskFull); |
|
706 return; |
|
707 } |
|
708 if ( iItemData ) |
702 if ( iItemData ) |
709 { |
703 { |
710 if ( iWriterPosition == -1 ) |
704 TInt totalSize = aData.Size() + iItemData->Size(); |
711 { |
705 if( SysUtil::DiskSpaceBelowCriticalLevelL( &iRfs, totalSize, iDrive ) ) |
|
706 { |
|
707 User::RequestComplete(iCallerStatus, KErrDiskFull); |
|
708 return; |
|
709 } |
|
710 if ( iWriterPosition == -1 ) |
|
711 { |
712 User::Leave( KErrEof ); |
712 User::Leave( KErrEof ); |
713 } |
713 } |
714 iItemData->InsertL( iWriterPosition , aData ); |
714 iItemData->InsertL( iWriterPosition , aData ); |
715 iWriterPosition = aData.Size(); |
715 iWriterPosition = aData.Size(); |
716 return; |
716 return; |
717 } |
717 } |
718 } |
718 } |
719 User::Leave( KErrNotReady ); |
719 User::Leave( KErrNotReady ); |
720 _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): end"); |
720 _NOTEPAD_DBG_FILE("CNSmlNotepadDataStore::DoWriteItemL(): end"); |
721 } |
721 } |
722 |
722 |
723 // ---------------------------------------------------------------------------- |
723 // ---------------------------------------------------------------------------- |