Skip to content

Commit

Permalink
Improvements: warning before deletion, date time quick change, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Mar 3, 2024
1 parent 888c13c commit c172b4b
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 68 deletions.
4 changes: 2 additions & 2 deletions README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
## Настройка
1. Распакуйте [приложение уведомлений](https://github.com/r57zone/Notifications), например, в `C:\Program Files\Notifications` и запустите 1 раз.
2. Распакуйте EasyReminders в `C:\Program Files\EasyReminders`.
3. Для автозапуска добавьте ярлык программы "Reminders.exe" в автозагрузку - Windows `%AppData%\Microsoft\Windows\Start Menu\Programs\Startup`.
4. Можно также установить ["Центр уведомлений"](https://github.com/r57zone/Notification-center), чтобы увидеть напоминание, если вы отошли от компьютера.
3. Для автозапуска добавьте ярлык программы `Reminders.exe` в автозагрузку - Windows `%AppData%\Microsoft\Windows\Start Menu\Programs\Startup`.
4. Можно также установить [Центр уведомлений](https://github.com/r57zone/NotificationCenter), чтобы увидеть напоминание, если вы отошли от компьютера.

## Скриншоты
![](https://user-images.githubusercontent.com/9499881/223116699-5871fe67-fa40-41f4-8231-81d7fc4c3e95.png)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Reminder apps for Windows. Add a reminder for a specific day, day and month, or
## Setup
1. Unzip the [notifications app](https://github.com/r57zone/Notifications), for example, to `C:\Program Files\Notifications` and run 1 time.
2. Unzip EasyReminders to `C:\Program Files\EasyReminders`.
3. For autorun, add a shortcut to the "Reminders.exe" program to startup - Windows `%AppData%\Microsoft\Windows\Start Menu\Programs\Startup`.
4. You can also install ["Notification Center"](https://github.com/r57zone/Notification-center) to see a reminder if you leave your computer.
3. For autorun, add a shortcut to the `Reminders.exe` program to startup - Windows `%AppData%\Microsoft\Windows\Start Menu\Programs\Startup`.
4. You can also install [Notification Center](https://github.com/r57zone/NotificationCenter) to see a reminder if you leave your computer.

## Screenshots
![](https://user-images.githubusercontent.com/9499881/223116808-78bcff19-0502-42d2-b6f9-54c5e9a84830.png)
Expand Down
2 changes: 2 additions & 0 deletions Source/Setup.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Main]
DefaultTime=13:00:00
10 changes: 5 additions & 5 deletions Source/Unit1.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object Main: TMain
Width = 75
Height = 25
Caption = #1044#1086#1073#1072#1074#1080#1090#1100
TabOrder = 0
TabOrder = 1
OnClick = AddBtnClick
end
object ListView: TListView
Expand Down Expand Up @@ -55,7 +55,7 @@ object Main: TMain
ReadOnly = True
RowSelect = True
PopupMenu = ListViewPopupMenu
TabOrder = 1
TabOrder = 0
ViewStyle = vsReport
OnDblClick = ListViewDblClick
OnKeyPress = ListViewKeyPress
Expand All @@ -66,7 +66,7 @@ object Main: TMain
Width = 75
Height = 25
Caption = #1059#1076#1072#1083#1080#1090#1100
TabOrder = 2
TabOrder = 3
OnClick = RemBtnClick
end
object AboutBtn: TButton
Expand All @@ -75,7 +75,7 @@ object Main: TMain
Width = 27
Height = 25
Caption = '?'
TabOrder = 3
TabOrder = 4
OnClick = AboutBtnClick
end
object ChangeBtn: TButton
Expand All @@ -84,7 +84,7 @@ object Main: TMain
Width = 75
Height = 25
Caption = #1048#1079#1084#1077#1085#1080#1090#1100
TabOrder = 4
TabOrder = 2
OnClick = ChangeBtnClick
end
object XPManifest1: TXPManifest
Expand Down
44 changes: 34 additions & 10 deletions Source/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, XPMan, ShellAPI, DateUtils, Registry, Menus,
ExtCtrls;
ExtCtrls, IniFiles;

type TReminder = record
Name: string;
Expand Down Expand Up @@ -77,9 +77,10 @@ TMain = class(TForm)
CurReminderIndex: integer; // Äëÿ èçìåíåíèÿ âûáðàííîãî íàïîìèíàíèÿ
AllowClose: boolean = false;
AllowHide: boolean = true;
AddDefaultTime: string; // Âðåìÿ ïî óìîë÷àíèþ â äîáàâëåíèè
CurrentLanguage: string;

IDS_ADD, IDS_CHANGE, IDS_ABOUT, IDS_LAST_UPDATE: string;
IDS_ADD, IDS_CHANGE, IDS_REMOVE_CONFIRM, IDS_ABOUT, IDS_LAST_UPDATE: string;

IDS_REMINDER, IDS_CURRENT_DAY_TYPE, IDS_EVERY_FEW_DAYS_TYPE, IDS_EVERY_FEW_DAYS_TYPE2,
IDS_EVERY_MONTH_AND_DAY_TYPE, IDS_CURRENT_DAY_MONTH_TYPE: string;
Expand Down Expand Up @@ -252,15 +253,27 @@ procedure TMain.Check;

// Äåíü ìåñÿöà
end else if (Reminders[i].RType = EveryMonthAndDayType) and (SecondOfTheDay(Time) > Reminders[i].TimeSec) then begin
if FormatDateTime('d', Date) = FormatDateTime('d', Reminders[i].Date) then begin
if (DayOfTheMonth(Date) = DayOfTheMonth(Reminders[i].Date)) or
// Åñëè òåêóùèé äåíü áîëüøå, ÷åì â ýòîì ìåñÿöå äíåé, òî ïîêàçûâàåì â ýòîò äåíü (êîíåö ìåñÿöà)
( (DayOfTheMonth(Reminders[i].Date) > DayOfTheMonth(Date) ) and // Íàïîìèíàíèå áîëüøå òåêóùåé äàòû
(DayOfTheMonth(Date) = DaysInAMonth(YearOf(Date), MonthOf(Date)) )) // Åñëè òåêóùèé äåíü ðàâåí êîë-âó äíåé â ìåñÿöå

then begin
SendNotfication(IDS_REMINDER, Reminders[i].Name);
Reminders[i].LastNoticeDate:=DateToStr(Date);
ChangeReminders:=true;
end;

// Äåíü è ìåñÿö
end else if (Reminders[i].RType = CurrentDayMonthType) and (SecondOfTheDay(Time) > Reminders[i].TimeSec) then begin
if FormatDateTime('d m', Date) = FormatDateTime('d m', Reminders[i].Date) then begin
if (MonthOf(Date) = MonthOf(Reminders[i].Date)) and
( (DayOfTheMonth(Date) = DayOfTheMonth(Reminders[i].Date)) or
(
(DayOfTheMonth(Reminders[i].Date) > DayOfTheMonth(Date) ) and // Íàïîìèíàíèå áîëüøå òåêóùåé äàòû
(DayOfTheMonth(Date) = DaysInAMonth(YearOf(Date), MonthOf(Date)) ) // Åñëè òåêóùèé äåíü ðàâåí êîë-âó äíåé â ìåñÿöå
)
) // Åñëè òåêóùèé äåíü áîëüøå, ÷åì â ýòî ìåñÿöå äíåé, òî ïîêàçûâàåì â ýòîò äåíü (êîíöåö ìåñÿöà)
then begin
SendNotfication(IDS_REMINDER, Reminders[i].Name);
Reminders[i].LastNoticeDate:=DateToStr(Date);
ChangeReminders:=true;
Expand Down Expand Up @@ -288,7 +301,7 @@ function GetLocaleInformation(Flag: Integer): string;
Result:=pcLCA;
end;

procedure Tray(ActInd: integer); //1 - Äîáàâèòü, 2 - Îáíîâèòü, 3 - Óäàëèòü
procedure Tray(ActInd: integer); // 1 - äîáàâèòü, 2 - îáíîâèòü, 3 - óäàëèòü
var
NIM: TNotifyIconData;
begin
Expand All @@ -309,17 +322,25 @@ function GetLocaleInformation(Flag: Integer): string;
end;

procedure TMain.FormCreate(Sender: TObject);
var
Ini: TIniFile;
begin
WM_TASKBARCREATED:=RegisterWindowMessage('TaskbarCreated');
AppHide;

CurrentLanguage:=GetLocaleInformation(LOCALE_SENGLANGUAGE); // + 'test'
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Setup.ini');
AddDefaultTime:=Ini.ReadString('Main', 'DefaultTime', '13:00:00');
Ini.Free;

CurrentLanguage:=GetLocaleInformation(LOCALE_SENGLANGUAGE);
if CurrentLanguage <> 'Russian' then begin
IDS_ADD:='Add';
AddBtn.Caption:=IDS_ADD;
IDS_CHANGE:='Change';
ChangeBtn.Caption:=IDS_CHANGE;
RemBtn.Caption:='Remove';
IDS_REMOVE_CONFIRM:='Remove this reminder?' + #13#10#13#10 + 'Name: %s' + #13#10 + 'Type: %s' + #13#10 + 'Date and time: %s';

Caption:='Reminders';
ListView.Column[0].Caption:='Date';
ListView.Column[1].Caption:='Time';
Expand Down Expand Up @@ -352,6 +373,7 @@ procedure TMain.FormCreate(Sender: TObject);
end else begin
IDS_ADD:='Äîáàâèòü';
IDS_CHANGE:='Èçìåíèòü';
IDS_REMOVE_CONFIRM:='Óäàëèòü ýòî íàïîìèíàíèå?' + #13#10#13#10 + 'Íàçâàíèå: %s' + #13#10 + 'Òèï: %s' + #13#10 + 'Äàòà è âðåìÿ: %s';

IDS_REMINDER:='Íàïîìèíàíèå';
IDS_CURRENT_DAY_TYPE:='Äàòà';
Expand Down Expand Up @@ -395,24 +417,26 @@ procedure TMain.AddBtnClick(Sender: TObject);
AddDialog.NofifyNameEdt.Text:='';
AddDialog.ByDateRB.Checked:=true;
AddDialog.DatePicker.Date:=Date;
AddDialog.TimePicker.Time:=StrToTime('13:00:00');
AddDialog.TimePicker.Time:=StrToTime(AddDefaultTime);
AddDialog.DoneBtn.Caption:=IDS_ADD;
end;

procedure TMain.RemBtnClick(Sender: TObject);
begin
if ListView.ItemIndex <> -1 then begin
AllowHide:=false;
if (ListView.ItemIndex <> -1) and (MessageBox(Handle, PChar(Format(IDS_REMOVE_CONFIRM, [ListView.Items.Item[ListView.ItemIndex].SubItems[2], ListView.Items.Item[ListView.ItemIndex].SubItems[1], ListView.Items.Item[ListView.ItemIndex].Caption + ', ' + ListView.Items.Item[ListView.ItemIndex].SubItems[0] ])), PChar(IDS_REMINDER), 35) = 6) then begin
RemReminder(ListView.ItemIndex);
UpdateRemindersView;
SaveReminders;
end;
AllowHide:=true;
end;

procedure TMain.AboutBtnClick(Sender: TObject);
begin
AllowHide:=false;
Application.MessageBox(PChar(Caption + ' 0.4.1' + #13#10 +
IDS_LAST_UPDATE + ' 28.03.2023' + #13#10 +
Application.MessageBox(PChar(Caption + ' 0.5' + #13#10 +
IDS_LAST_UPDATE + ' 29.02.24' + #13#10 +
'https://r57zone.github.io' + #13#10 +
'r57zone@gmail.com'), PChar(IDS_ABOUT), MB_ICONINFORMATION);
AllowHide:=true;
Expand Down
Loading

0 comments on commit c172b4b

Please sign in to comment.