Skip to content

Commit

Permalink
Merge pull request #103 from hpi-swa-teaching/US86
Browse files Browse the repository at this point in the history
date and time of the last save are stored and displayed
  • Loading branch information
oleschl committed Jun 15, 2020
2 parents 29426e3 + 766b815 commit b36cbcc
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ copy: aRichTextDocument

self
name: aRichTextDocument name copy;
timeLastSaved: aRichTextDocument timeLastSaved;
text: aRichTextDocument text copy;
textStructures: aRichTextDocument textStructures copy;
changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
isUnsavedDocument

^ self timeLastSaved = nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeLastSaved: aDateAndTime

timeLastSaved := aDateAndTime
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
timeLastSaved

^ timeLastSaved
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
"addAttribute:from:to:" : "AG 7/25/2019 13:08",
"charcount" : "frc 5/25/2020 16:02",
"charcountExcept:" : "frc 6/1/2020 10:14",
"copy:" : "MB 7/3/2019 18:58",
"copy:" : "OS 6/14/2020 11:18",
"createNewStructure:" : "ls 7/24/2019 15:24",
"emptyChars" : "frc 6/1/2020 13:43",
"hasStructure:forText:from:to:" : "AG 7/25/2019 13:20",
"initialize" : "ls 7/24/2019 15:10",
"initializeStructure:" : "ls 7/24/2019 15:13",
"initializeStructure:withEmphasis:" : "tok 6/8/2020 12:06",
"initializeStructures" : "ls 7/24/2019 15:12",
"isUnsavedDocument" : "OS 6/14/2020 18:19",
"name" : "ls 6/26/2019 17:28",
"name:" : "MB 7/3/2019 19:29",
"openEditor" : "lh 7/24/2019 21:27",
Expand All @@ -42,5 +43,7 @@
"textStructures" : "ls 6/26/2019 17:28",
"textStructures:" : "MB 7/3/2019 19:29",
"textStructuresDo:" : "ls 7/24/2019 21:29",
"timeLastSaved" : "OS 6/14/2020 11:16",
"timeLastSaved:" : "OS 6/15/2020 12:22",
"updateStyle:withEmphasis:" : "ls 6/26/2019 22:44",
"wordcount" : "frc 6/1/2020 13:46" } }
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"instvars" : [
"textStructures",
"text",
"name" ],
"name",
"timeLastSaved" ],
"name" : "RichTextDocument",
"pools" : [
],
Expand Down
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)].
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ footerText

| footerString|
footerString := 'You are using SquidWord · '.
footerString := (footerString, self bufferDocument wordcount), ' words'.
footerString := (footerString, self bufferDocument wordcount), ' words · '.
footerString := footerString, self documentTimeText.
^ footerString
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
"debufferedStructures" : "OS 5/31/2020 13:08",
"debufferedStructures:" : "OS 5/31/2020 13:08",
"documentClass" : "ls 7/10/2019 15:53",
"documentTimeText" : "OS 6/14/2020 18:22",
"editor" : "lh 7/24/2019 17:17",
"fitParagraphs" : "lh 7/24/2019 22:44",
"footer" : "frc 5/25/2020 15:40",
"footer:" : "frc 5/25/2020 15:22",
"footerText" : "frc 5/25/2020 16:00",
"footerText" : "OS 6/14/2020 18:23",
"getStructureSelectionAt:" : "OS 6/3/2020 23:53",
"hasStructure:" : "AG 7/25/2019 13:13",
"hasStructure:between:to:" : "6/1/2020 14:03:21",
Expand All @@ -70,8 +71,8 @@
"removeTextAttribute:" : "MB 7/24/2019 20:39",
"renameDocuments:" : "ls 6/26/2019 19:13",
"resetSaver" : "ls 6/26/2019 18:44",
"saveDocumentInSaverWithNamePrompt" : "lh 7/24/2019 20:33",
"saveText" : "lh 7/24/2019 16:44",
"saveDocumentInSaverWithNamePrompt" : "OS 6/14/2020 11:17",
"saveText" : "OS 6/14/2020 11:11",
"saveText:" : "ls 6/26/2019 18:33",
"saver" : "ls 6/26/2019 21:15",
"saves" : "ls 6/26/2019 21:15",
Expand Down
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)
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@
"testUS63InfoButtonExists" : "6/1/2020 14:03:20",
"testUS67HelpBrowserIsOpended" : "kh 5/25/2020 22:44",
"testUS67HelpButtonExists" : "kh 5/25/2020 22:35",
"testUS86timeLastSavedIsUpdatedWhenSaving" : "OS 6/15/2020 00:10",
"text" : "MB 7/25/2019 11:02" } }

0 comments on commit b36cbcc

Please sign in to comment.