Skip to content

Commit

Permalink
Dont force GUID filenames unless in official notes dir, still looking…
Browse files Browse the repository at this point in the history
… for v0.19
  • Loading branch information
davidbannon committed Nov 5, 2018
1 parent 7878abb commit 6663cbf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
14 changes: 7 additions & 7 deletions doc/recover.note
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

If you are reading this, odds are you are worried ! So, first bit of advice is <size:huge>
<italic><bold>don't panic</bold></italic></size:huge><size:small><italic><bold> (1)</bold></italic></size:small>
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 -<size:large>

Expand All @@ -27,11 +27,11 @@ OK, I get you, this is serious. But we at have two paths left, lets see -
<bold>I sync my notes from somewhere else.</bold>
Oh, that's good. Maybe all you need do is clean out your current notes directory <size:small>(4)</size:small> and rejoin the sync network. Note, I emphasise, not just do a sync. You <highlight>MUST</highlight> go to the sync tab and click "<highlight>Set File Sync Repo</highlight>". 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.

<bold>I have a auto-snapshot in place</bold>
Great news (<highlight>although unlikely, its not enabled yet</highlight>). You can easily choose to roll back to a particular snapshot and blow away all your troubles. Too Easy !
<list><list-item dir="ltr">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.</list-item></list>
<bold>I have a snapshot</bold>
Great news ! You can easily choose to roll back to a particular snapshot and blow away all your troubles. Too Easy !
<list><list-item dir="ltr">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.</list-item></list>
<list><list-item dir="ltr">Go to the "Recover Snapshot" tab, choose the snapshot you wish to use and away you go <size:small>(5).</size:small></list-item></list><size:small></size:small>
Back out, go to the Search and click "Refresh". After you have checked all is good, re enable auto-snapshots. Its your best friend !<size:large>
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 !<size:large>

<bold>Notes </bold></size:large>
(1) By Douglas Adams, used without permission.
Expand All @@ -42,8 +42,8 @@ Back out, go to the Search and click "Refresh". After you have checked all is go


</note-content></text>
<last-change-date>2018-08-26T15:34:22.8360000+10:00</last-change-date>
<last-metadata-change-date>2018-08-26T15:34:22.8360000+10:00</last-metadata-change-date>
<last-change-date>2018-11-05T21:34:54.4680000+11:00</last-change-date>
<last-metadata-change-date>2018-11-05T21:34:54.4680000+11:00</last-metadata-change-date>
<create-date>2018-08-26T14:03:28.1020000+10:00</create-date>
<cursor-position>1</cursor-position>
<selection-bound-position>1</selection-bound-position>
Expand Down
19 changes: 12 additions & 7 deletions tomboy-ng/editbox.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----- }

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tomboy-ng/recover.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
13 changes: 8 additions & 5 deletions tomboy-ng/recover.pas
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,19 @@ 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);
var
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
Expand Down Expand Up @@ -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');
Expand All @@ -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;
Expand Down

0 comments on commit 6663cbf

Please sign in to comment.