-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from hpi-swa-teaching/US86
date and time of the last save are stored and displayed
- Loading branch information
Showing
12 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/RichTextEditing-Core.package/RichTextDocument.class/instance/isUnsavedDocument.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
isUnsavedDocument | ||
|
||
^ self timeLastSaved = nil |
4 changes: 4 additions & 0 deletions
4
packages/RichTextEditing-Core.package/RichTextDocument.class/instance/timeLastSaved..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
timeLastSaved: aDateAndTime | ||
|
||
timeLastSaved := aDateAndTime |
4 changes: 4 additions & 0 deletions
4
packages/RichTextEditing-Core.package/RichTextDocument.class/instance/timeLastSaved.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
timeLastSaved | ||
|
||
^ timeLastSaved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/RichTextEditing-Core.package/RichTextEditorModel.class/instance/documentTimeText.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document information | ||
documentTimeText | ||
|
||
self bufferDocument isUnsavedDocument | ||
ifTrue: [^ 'unsaved document'] | ||
ifFalse: [^ 'last saved ', (self bufferDocument timeLastSaved at: 1), ' ', (self bufferDocument timeLastSaved at: 2)]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/RichTextEditing-Core.package/RichTextEditorModel.class/instance/saveText.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
saving and loading | ||
saveText | ||
|
||
|
||
self bufferDocument timeLastSaved: Time dateAndTimeNow. | ||
self targetDocument copy: self bufferDocument. | ||
self noUnacceptedEdits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ts.package/RichTextEditorTests.class/instance/testUS86timeLastSavedIsUpdatedWhenSaving.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
tests | ||
testUS86timeLastSavedIsUpdatedWhenSaving | ||
|
||
| before after documentSaveTime | | ||
before := Time current asSeconds. | ||
self editorModel saveText. | ||
documentSaveTime := (self document timeLastSaved at: 2) asSeconds. | ||
after := Time current asSeconds. | ||
self assert: (before <= documentSaveTime and: documentSaveTime <= after) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters