Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Only show tray icon when TNotificationCenter is not supported.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:58ee7bc51d8be3c1c2a10a2c7e830e9807edb075
User & Date: tinus 2017-02-13 20:01:58
Context
2017-02-15
17:27
Replaced menu action bar by regular TMainMenu. Leaf check-in: e689ac5b7d user: tinus tags: trunk
2017-02-13
20:01
Only show tray icon when TNotificationCenter is not supported. check-in: 58ee7bc51d user: tinus tags: trunk
19:48
Show notifications on each change event. check-in: dd23419f8b user: tinus tags: trunk
Changes

Changes to src/M_Actions.dfm.

201
202
203
204
205
206
207


208
209
210
211
  end
  object ntcNotificationCenter: TNotificationCenter
    Left = 176
    Top = 136
  end
  object trayIcon: TTrayIcon
    IconIndex = -1


    Left = 264
    Top = 144
  end
end







>
>

|


201
202
203
204
205
206
207
208
209
210
211
212
213
  end
  object ntcNotificationCenter: TNotificationCenter
    Left = 176
    Top = 136
  end
  object trayIcon: TTrayIcon
    IconIndex = -1
    OnBalloonClick = trayIconBalloonClick
    OnClick = trayIconClick
    Left = 264
    Top = 136
  end
end

Changes to src/M_Actions.pas.

26
27
28
29
30
31
32


33
34
35
36
37
38
39
..
96
97
98
99
100
101
102

103
104
105
106
107
108
109
...
324
325
326
327
328
329
330










331
332
333
334
335
336
337
338
339
340
341
342
343
    ntcNotificationCenter: TNotificationCenter;
    trayIcon: TTrayIcon;
    procedure DataModuleCreate(Sender: TObject);
    procedure DataModuleDestroy(Sender: TObject);
    procedure WatchersNotify(Sender: TObject; const Watcher: TFileSystemWatcher; Action: TCollectionNotification);
    procedure FileSystemChange(Sender: TFileSystemWatcher; FileOperation: TFileOperation; const FileName1, FileName2: string);
    procedure actFolderAddAccept(Sender: TObject);


  private
    { Private declarations }
    FWatchers: TObjectList<TFileSystemWatcher>;
    FHandlers: TList<TCollectionNotifyEvent<TFileSystemWatcher>>;
    FSettings: TCustomIniFile;

    procedure LoadActions;
................................................................................
    end;
  finally
    Folders.Free;
  end;

  trayIcon.Icon := Application.Icon;
  trayIcon.BalloonTitle := Application.Title;

end;

procedure TmodActions.DataModuleDestroy(Sender: TObject);
begin
  try
    SaveActions;
  finally
................................................................................

    Value := GetEnumValue(EnumType, Name.Trim);
    if Value = -1 then
      raise EConvertError.CreateFmt('Unknown enumeration member: "%s"', [Name]);
    Include(Result, TNotifyFilter(Value));
  end;
end;











procedure TmodActions.WatchersNotify(Sender: TObject; const Watcher: TFileSystemWatcher; Action: TCollectionNotification);
var
  Handler: TCollectionNotifyEvent<TFileSystemWatcher>;
begin
  // propagate the event
  for Handler in FHandlers do begin
    Handler(Self, Watcher, Action);
  end;
end;


end.







>
>







 







>







 







>
>
>
>
>
>
>
>
>
>













26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
    ntcNotificationCenter: TNotificationCenter;
    trayIcon: TTrayIcon;
    procedure DataModuleCreate(Sender: TObject);
    procedure DataModuleDestroy(Sender: TObject);
    procedure WatchersNotify(Sender: TObject; const Watcher: TFileSystemWatcher; Action: TCollectionNotification);
    procedure FileSystemChange(Sender: TFileSystemWatcher; FileOperation: TFileOperation; const FileName1, FileName2: string);
    procedure actFolderAddAccept(Sender: TObject);
    procedure trayIconBalloonClick(Sender: TObject);
    procedure trayIconClick(Sender: TObject);
  private
    { Private declarations }
    FWatchers: TObjectList<TFileSystemWatcher>;
    FHandlers: TList<TCollectionNotifyEvent<TFileSystemWatcher>>;
    FSettings: TCustomIniFile;

    procedure LoadActions;
................................................................................
    end;
  finally
    Folders.Free;
  end;

  trayIcon.Icon := Application.Icon;
  trayIcon.BalloonTitle := Application.Title;
  trayIcon.Visible := not ntcNotificationCenter.Supported;
end;

procedure TmodActions.DataModuleDestroy(Sender: TObject);
begin
  try
    SaveActions;
  finally
................................................................................

    Value := GetEnumValue(EnumType, Name.Trim);
    if Value = -1 then
      raise EConvertError.CreateFmt('Unknown enumeration member: "%s"', [Name]);
    Include(Result, TNotifyFilter(Value));
  end;
end;

procedure TmodActions.trayIconBalloonClick(Sender: TObject);
begin
  Application.MainForm.Show;
end;

procedure TmodActions.trayIconClick(Sender: TObject);
begin
  Application.MainForm.Visible := not Application.MainForm.Visible;
end;

procedure TmodActions.WatchersNotify(Sender: TObject; const Watcher: TFileSystemWatcher; Action: TCollectionNotification);
var
  Handler: TCollectionNotifyEvent<TFileSystemWatcher>;
begin
  // propagate the event
  for Handler in FHandlers do begin
    Handler(Self, Watcher, Action);
  end;
end;


end.