diff --git a/doc/recover.note b/doc/recover.note index 213b594c..7e2403ae 100644 --- a/doc/recover.note +++ b/doc/recover.note @@ -5,7 +5,7 @@ If you are reading this, odds are you are worried ! So, first bit of advice is don't panic (1) -Its quite possible we can help you. That will depend on whats happened and if you have enabled auto snapshots (or took a manual one recently). Firstly, don't do a sync, and disable auto-snapshots. Thats to prevent bad data replacing what might be good data currently not obvious to you. Next, take small steps. +Its quite possible we can help you. That will depend on whats happened and if you have enabled auto snapshots (or took a manual one recently). Firstly, don't do a sync. Thats to prevent bad data replacing what might be good data currently not obvious to you. Next, take small steps. Lets look at the possibilities - @@ -27,11 +27,11 @@ OK, I get you, this is serious. But we at have two paths left, lets see - I sync my notes from somewhere else. Oh, that's good. Maybe all you need do is clean out your current notes directory (4) and rejoin the sync network. Note, I emphasise, not just do a sync. You MUST go to the sync tab and click "Set File Sync Repo". That way, the sync system sees you as a new friend and sends you a full set of notes. Just how good an approach this is depends on how recently you last synced, obviously any changes since last sync will be lost. -I have a auto-snapshot in place -Great news (although unlikely, its not enabled yet). You can easily choose to roll back to a particular snapshot and blow away all your troubles. Too Easy ! -From the SnapShot tab, click "Recover one or more lost Notes". If you have not already, now would be a great time to click "Intro Snapshot", you are in seriously dangerous space right now. +I have a snapshot +Great news ! You can easily choose to roll back to a particular snapshot and blow away all your troubles. Too Easy ! +From the SnapShot tab, click "Recover one or more lost Notes". If you have not already, now would be a great time to click "Safety Snapshot", you are in seriously dangerous space right now. Go to the "Recover Snapshot" tab, choose the snapshot you wish to use and away you go (5). -Back out, go to the Search and click "Refresh". After you have checked all is good, re enable auto-snapshots. Its your best friend ! +Back out, go to the Search and click "Refresh". After you have checked all is good, please remember to take a snapshot every now and again ! Notes (1) By Douglas Adams, used without permission. @@ -42,8 +42,8 @@ Back out, go to the Search and click "Refresh". After you have checked all is go - 2018-08-26T15:34:22.8360000+10:00 - 2018-08-26T15:34:22.8360000+10:00 + 2018-11-05T21:34:54.4680000+11:00 + 2018-11-05T21:34:54.4680000+11:00 2018-08-26T14:03:28.1020000+10:00 1 1 diff --git a/tomboy-ng/editbox.pas b/tomboy-ng/editbox.pas index 7ca27e30..486c08de 100644 --- a/tomboy-ng/editbox.pas +++ b/tomboy-ng/editbox.pas @@ -366,8 +366,8 @@ implementation NoteBook, MainUnit, SyncUtils, // Just for IDLooksOK() - K_Prn; // Custom print unit. - + K_Prn, // Custom print unit. + FileUtil; // just for ExtractSimplePath ... ~#1620 { ---- U S E R C L I C K F U N C T I O N S ----- } @@ -1668,11 +1668,15 @@ procedure TEditBoxForm.SaveTheNote(); if KMemo1.ReadOnly then exit(); if length(NoteFileName) = 0 then NoteFileName := Sett.NoteDirectory + GetAFilename(); - if not IDLooksOK(ExtractFileNameOnly(NoteFileName)) then - if mrYes = QuestionDlg('Invalid GUID', 'Give this note a new GUID Filename (recommended) ?', mtConfirmation, [mrYes, mrNo], 0) then begin - OldFileName := NoteFileName; - NoteFileName := Sett.NoteDirectory + GetAFilename(); - end; + if Sett.NoteDirectory = CleanAndExpandDirectory(ExtractFilePath(NoteFileName)) then begin // UTF8 OK + //debugln('Working in Notes dir ' + Sett.NoteDirectory + ' = ' + CleanAndExpandDirectory(ExtractFilePath(NoteFileName))); + if not IDLooksOK(ExtractFileNameOnly(NoteFileName)) then + if mrYes = QuestionDlg('Invalid GUID', 'Give this note a new GUID Filename (recommended) ?', mtConfirmation, [mrYes, mrNo], 0) then begin + OldFileName := NoteFileName; + NoteFileName := Sett.NoteDirectory + GetAFilename(); + end; + end; //else debugln('NOT Working in Notes dir ' + Sett.NoteDirectory + ' <> ' + CleanAndExpandDirectory(extractFilePath(NoteFileName))); + // We do not enforce the valid GUID file name rule if note is not in official Notes Dir Saver := TBSaveNote.Create(); KMemo1.Blocks.LockUpdate; try @@ -1697,6 +1701,7 @@ procedure TEditBoxForm.SaveTheNote(); // if we have rewrtten GUID, that will create new entry for it. if OldFileName <> '' then SearchForm.DeleteNote(OldFileName); + finally Saver.Destroy; Dirty := false; diff --git a/tomboy-ng/recover.lfm b/tomboy-ng/recover.lfm index 880bb71b..f687d99e 100644 --- a/tomboy-ng/recover.lfm +++ b/tomboy-ng/recover.lfm @@ -47,9 +47,9 @@ object FormRecover: TFormRecover Height = 172 Top = 44 Width = 675 - ActivePage = TabSheetSnapshots + ActivePage = TabSheetExisting Anchors = [akTop, akLeft, akRight] - TabIndex = 2 + TabIndex = 1 TabOrder = 1 object TabSheetIntro: TTabSheet Caption = 'Introduction' diff --git a/tomboy-ng/recover.pas b/tomboy-ng/recover.pas index e3a125d5..34dd9fb9 100644 --- a/tomboy-ng/recover.pas +++ b/tomboy-ng/recover.pas @@ -194,7 +194,9 @@ procedure TFormRecover.RestoreSnapshot(const Snapshot : string); procedure TFormRecover.Button4Click(Sender: TObject); begin - RestoreSnapshot('Safety.zip'); + if fileexists(SnapDir + 'Safety.zip') then + RestoreSnapshot('Safety.zip') + else showmessage('A Safety snapshot not found. Try setting Snapsot Dir to where you may have one.'); end; procedure TFormRecover.StringGrid1DblClick(Sender: TObject); @@ -202,9 +204,9 @@ procedure TFormRecover.StringGrid1DblClick(Sender: TObject); NName : string; begin case PageControl1.ActivePageIndex of - 0, 1 : begin + {0,} 1 : begin try - NName := StringGrid1.Cells[0, StringGrid1.Row] + '.note'; + NName := StringGrid1.Cells[0, StringGrid1.Row]; except on EGridException do exit; end; if length(NName) < 9 then exit; // empty returns ID.note from col(0) title @@ -358,7 +360,7 @@ procedure TFormRecover.ListBoxSnapshotsDblClick(Sender: TObject); procedure TFormRecover.TabSheetExistingShow(Sender: TObject); var - I : integer; + I, Comma : integer; Msg : string; begin //showmessage('Existing Show'); @@ -380,7 +382,8 @@ procedure TFormRecover.TabSheetExistingShow(Sender: TObject); StringGrid1.FixedRows := 1; for I := 0 to SearchForm.NoteLister.ErrorNotes.Count -1 do begin Msg := SearchForm.NoteLister.ErrorNotes.Strings[I]; - StringGrid1.InsertRowWithValues(I + 1, [copy(Msg, 1, 36), copy(Msg, 44, 200)]); + Comma := pos(',', Msg); + StringGrid1.InsertRowWithValues(I + 1, [copy(Msg, 1, Comma-1), copy(Msg, Comma+1, 200)]); end; StringGrid1.AutoSizeColumns; if I > 0 then ButtonDeleteBadNotes.Enabled:= True;