diff --git a/po/tomboy-ng.po b/po/tomboy-ng.po index abffc496..4783e697 100644 --- a/po/tomboy-ng.po +++ b/po/tomboy-ng.po @@ -315,6 +315,14 @@ msgstr "" msgid "Label8" msgstr "" +#: tmainform.labelerror.caption +msgid "X" +msgstr "" + +#: tmainform.labelerror.hint +msgid "Launch from commandline to see errors. See website" +msgstr "" + #: tmainform.menuquit.caption msgctxt "tmainform.menuquit.caption" msgid "Quit, Close and Go Away." diff --git a/tomboy-ng/mainunit.lfm b/tomboy-ng/mainunit.lfm index b15fc346..6a471f58 100644 --- a/tomboy-ng/mainunit.lfm +++ b/tomboy-ng/mainunit.lfm @@ -1,10 +1,10 @@ object MainForm: TMainForm Left = 403 - Height = 292 + Height = 318 Top = 146 Width = 355 Caption = 'MainForm' - ClientHeight = 290 + ClientHeight = 316 ClientWidth = 355 Menu = MainMenu1 OnActivate = FormActivate @@ -344,6 +344,27 @@ object MainForm: TMainForm ParentShowHint = False ShowHint = True end + object LabelNotesFound: TLabel + Left = 24 + Height = 1 + Top = 256 + Width = 1 + ParentColor = False + end + object LabelError: TLabel + Left = 24 + Height = 18 + Hint = 'Launch from commandline to see errors. See website' + Top = 277 + Width = 11 + Caption = 'X' + Font.Height = -16 + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + ParentShowHint = False + ShowHint = True + end object PopupMenuTray: TPopupMenu left = 272 top = 64 diff --git a/tomboy-ng/mainunit.pas b/tomboy-ng/mainunit.pas index 59e56c0f..0f150a10 100644 --- a/tomboy-ng/mainunit.pas +++ b/tomboy-ng/mainunit.pas @@ -14,6 +14,7 @@ 2018/06/19 Got some stuff for singlenotemode() - almost working. 2018/06/22 As above but maybe working now ? DRB + 2018/07/04 Display number of notes found and a warning if indexing error occured. @@ -60,6 +61,7 @@ TMainForm = class(TForm) ImageNotesDirTick: TImage; ImageSyncTick: TImage; Label1: TLabel; + LabelError: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; @@ -67,6 +69,7 @@ TMainForm = class(TForm) Label6: TLabel; Label7: TLabel; Label8: TLabel; + LabelNotesFound: TLabel; MainMenu1: TMainMenu; MMRecent1: TMenuItem; MMRecent8: TMenuItem; @@ -227,7 +230,11 @@ procedure TMainForm.FormShow(Sender: TObject); Label7.Caption:=''; Label8.Caption := ''; CheckStatus(); - SearchForm.IndexNotes(); // also calls Checkstatus but safe to call anytime + LabelNotesFound.Caption := 'Found ' + inttostr(SearchForm.IndexNotes()) + + ' notes'; // also calls Checkstatus but safe to call anytime + if SearchForm.NoteLister.XMLError then + LabelError.Caption := 'Failed to index one or more notes.' + else LabelError.Caption := ''; if not AllowDismiss then begin Label7.Caption := 'Sadly, on this OS, I cannot'; Label8.Caption := 'let you dismiss this window'; diff --git a/tomboy-ng/note_lister.pas b/tomboy-ng/note_lister.pas index f186cf42..fb103b21 100644 --- a/tomboy-ng/note_lister.pas +++ b/tomboy-ng/note_lister.pas @@ -46,6 +46,7 @@ 2018/02/15 Can now search case sensitive or not and any combination or exact match 2018/04/28 Set FixedRows to zero after Clean-ing strgrid, seems necessary in Trunk 2018/06/26 Used E.Message in exception generated by bad XML - dah .... + 2018/07/04 Added a flag, XMLError, set if we found a note unable to index. } {$mode objfpc} @@ -140,6 +141,7 @@ TNoteLister = class function RemoveXml(const St: AnsiString): AnsiString; public + XMLError : Boolean; { The directory, with trailing seperator, that the notes are in } WorkingDir : ANSIString; SearchIndex : integer; @@ -511,7 +513,10 @@ procedure TNoteLister.GetNoteDetails(const Dir, FileName: ANSIString; // Notebook tag its the StartHere note, otherwise its the Template for // for the mentioned Notebook. end; - except on E: EXMLReadError do DebugLn(E.Message); + except on E: EXMLReadError do begin + DebugLn(E.Message); + XMLError := True; + end; on EAccessViolation do DebugLn('Access Violation ' + FileName); end; if NoteP^.IsTemplate then begin // Don't show templates in normal note list @@ -606,6 +611,7 @@ function TNoteLister.GetNotes(const Term: ANSIstring): longint; var Info : TSearchRec; begin + XMLError := False; DebugMode := Application.HasOption('debug-index'); if Term = '' then begin NoteList.Free; diff --git a/tomboy-ng/searchunit.pas b/tomboy-ng/searchunit.pas index dc726d20..27468535 100644 --- a/tomboy-ng/searchunit.pas +++ b/tomboy-ng/searchunit.pas @@ -79,6 +79,7 @@ 2018/05/12 Extensive changes - MainUnit is now just that. Name of this unit changed. 2018/05/20 Alterations to way we startup, wrt mainform status report. Mark 2018/06/04 NoteReadOnly() now checks if NoteLister is valid before calling. + 2018/07/04 Pass back some info about how the note indexing went. } {$mode objfpc}{$H+} @@ -150,7 +151,7 @@ TSearchForm = class(TForm) { Reads header in each note in notes directory, updating Search List and the recently used list under the TrayIcon. Downside is time it takes to index. use UpdateList() if you just have updates. } - procedure IndexNotes(); + function IndexNotes() : integer; { Returns true when passed string is the title of an existing note } function IsThisaTitle(const Term: ANSIString): boolean; { Gets called with a title and filename (clicking grid), with just a title @@ -383,7 +384,7 @@ procedure TSearchForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); if not AllowClose then hide(); } end; -procedure TSearchForm.IndexNotes(); +function TSearchForm.IndexNotes() : integer; // var // TS1, TS2 : TTimeStamp; begin @@ -393,7 +394,7 @@ procedure TSearchForm.IndexNotes(); NoteLister := TNoteLister.Create; NoteLister.WorkingDir:=Sett.NoteDirectory; end; - NoteLister.GetNotes(); { TODO : we should say how many we found } + Result := NoteLister.GetNotes(); // TS1 := DateTimeToTimeStamp(Now); // Edit1.Text := 'That took (mS) ' + inttostr(TS2.Time - TS1.Time); UseList();