tvplanit: Refactor ical/vcard import (property Skip --> Checked)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8398 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-19 14:06:54 +00:00
parent 259d689c42
commit a430be7bcf
6 changed files with 15 additions and 13 deletions

View File

@ -1791,7 +1791,7 @@ begin
end;
for i := 0 to ical.Count-1 do begin
if ical[i].Skip or (not (ical[i] is TVpICalEvent)) then
if (not ical[i].Checked) or (not (ical[i] is TVpICalEvent)) then
Continue;
startTime := TVpICalEvent(ical[i]).StartTime[false]; // use local times
endTime := TVpICalEvent(ical[i]).EndTime[false];
@ -2971,7 +2971,7 @@ begin
end;
for i := 0 to vcards.Count-1 do begin
if vCards[i].Skip then
if (not vCards[i].Checked) then
Continue;
id := datastore.GetNextID(ContactsTableName);
lContact := AddContact(id);
@ -3246,7 +3246,7 @@ begin
end;
for i := 0 to ical.Count-1 do begin
if ical[i].Skip or (not (ical[i] is TVpICalToDo)) then
if (not ical[i].Checked) or (not (ical[i] is TVpICalToDo)) then
Continue;
id := dataStore.GetNextID(TasksTableName);

View File

@ -18,11 +18,11 @@ type
TVpICalEntry = class(TVpFileBlock)
private
FCalendar: TVpICalendar;
FSkip: Boolean;
FChecked: Boolean;
public
constructor Create(ACalendar: TVpICalendar); virtual;
function FindItem(AKey: String): TVpICalItem;
property Skip: Boolean read FSkip write FSkip default false;
property Checked: Boolean read FChecked write FChecked default true;
end;
TVpICalTimeZoneInfo = class(TVpICalEntry)
@ -283,6 +283,7 @@ end;
constructor TVpICalEntry.Create(ACalendar: TVpICalendar);
begin
inherited Create(TVpICalItem);
FChecked := true;
FCalendar := ACalendar;
end;

View File

@ -66,7 +66,7 @@ begin
exit;
item := TVpICalEntry(FItems[ARow - Grid.FixedRows]);
if item <> nil then
item.Skip := not AChecked;
item.Checked := AChecked;
end;
function TVpImportPreviewICalEventForm.GetCellText(ACol, ARow: Integer): String;
@ -208,7 +208,7 @@ begin
exit;
item := TVpICalEntry(FItems[ARow - Grid.FixedRows]);
if (item <> nil) then
Result := not item.Skip;
Result := item.Checked;
end;
procedure TVpImportPreviewICalEventForm.PrepareItems;

View File

@ -66,7 +66,7 @@ begin
exit;
item := TVpICalEntry(FItems[ARow - Grid.FixedRows]);
if item <> nil then
item.Skip := not AChecked;
item.Checked := AChecked;
end;
function TVpImportPreviewICalTaskForm.GetCellText(ACol, ARow: Integer): String;
@ -146,7 +146,7 @@ begin
exit;
item := TVpICalEntry(FItems[ARow - Grid.FixedRows]);
if (item <> nil) then
Result := not item.Skip;
Result := item.Checked;
end;
procedure TVpImportPreviewICalTaskForm.PrepareItems;

View File

@ -61,7 +61,7 @@ begin
exit;
card := TVpVCard(FItems[ARow - Grid.FixedRows]);
if card <> nil then
card.Skip := not AChecked;
card.Checked := AChecked;
end;
function TVpImportPreviewVCardForm.GetCellText(ACol, ARow: Integer): String;
@ -135,7 +135,7 @@ begin
exit;
card := TVpVCard(FItems[ARow - Grid.FixedRows]);
if (card <> nil) then
Result := not card.Skip;
Result := card.Checked;
end;
procedure TVpImportPreviewVCardForm.PrepareItems;

View File

@ -53,7 +53,7 @@ type
FCategories: TStrings;
FPickedCategory: Integer;
FSkip: Boolean;
FChecked: Boolean;
function GetCategory(AIndex: Integer): String;
function GetCategoryCount: Integer;
@ -107,7 +107,7 @@ type
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
property Version: String read FVersion;
property Skip: Boolean read FSkip write FSkip; // Flag to skip import
property Checked: Boolean read FChecked write FChecked default true; // Flag to skip import
end;
TVpVCards = class
@ -218,6 +218,7 @@ end;
constructor TVpVCard.Create;
begin
inherited Create(TVpVCardItem);
FChecked := true;
FCategories := TStringList.Create;
FCategories.Delimiter := ','; // VCard categories are separated by comma in vcf file.
FCategories.StrictDelimiter := true;