tvplanit: Add option to select category to ical task import form. Update translations (de, en).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8385 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-12 13:47:03 +00:00
parent 6c53ea5417
commit b3d76d7f60
19 changed files with 309 additions and 125 deletions

View File

@ -80,6 +80,10 @@ msgstr "Termin"
msgid "Sat"
msgstr "Sam"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr "Zugewiesene Kategorie"
#: vpsr.rsasunday
msgid "Sun"
msgstr "Son"
@ -263,6 +267,10 @@ msgstr "Ereignis aus dem Kalender löschen?"
msgid "Delete this task from your list?"
msgstr "Diese Aufgabe von Ihrer Liste löschen?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr "Adress-Einträge"
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Kontakt hinzufügen..."
@ -460,6 +468,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Ereignis"
#: vpsr.rseventitems
msgid "Event items"
msgstr "Termin-Einträge"
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -561,15 +573,15 @@ msgstr "iCalendar Dateien ('*.ical;*.ics)|*.ical;*.ics"
#: vpsr.rsimporticalevent
msgid "Import ICalendar Event"
msgstr ""
msgstr "iCalendar-Termin importieren"
#: vpsr.rsimporticaltask
msgid "Import ICalendar Task"
msgstr ""
msgstr "ICalendar-Aufgabe importieren"
#: vpsr.rsimportvcard
msgid "Import VCard"
msgstr ""
msgstr "VCard-Kontakt importieren"
#: vpsr.rsinches
msgid "Inches"
@ -782,7 +794,7 @@ msgstr "TCanvas wurde nicht zugewiesen"
#: vpsr.rsnocontactsfoundinvcard
#, object-pascal-format
msgid "No contact items found in \"%s\"."
msgstr ""
msgstr "Keine Kontakt-Einträge in \"%s\" gefunden."
#: vpsr.rsnocontrollink
msgid "Component must be linked to a TVpControlLink"
@ -918,6 +930,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Persönlich"
#: vpsr.rsphone
msgid "Phone"
msgstr "Telefon"
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr "Telefon/Fax"
@ -1266,6 +1282,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr "Aufgabe fertiggestellt"
#: vpsr.rstaskitems
msgid "Task items"
msgstr "Aufgaben-Einträge"
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Aufgabe hinzufügen..."
@ -1770,4 +1790,3 @@ msgstr "Unbekannte Achsen-Spezifikation: %s"
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr "Die XML-Deklaration muss vor dem ersten Element erscheinen"

View File

@ -80,6 +80,10 @@ msgstr "Appointment"
msgid "Sat"
msgstr "Sat"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr "Assigned category"
#: vpsr.rsasunday
msgid "Sun"
msgstr "Sun"
@ -262,6 +266,10 @@ msgstr "Delete event from schedule?"
msgid "Delete this task from your list?"
msgstr "Delete this task from your list?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr "Contact items"
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Add contact..."
@ -454,6 +462,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Event"
#: vpsr.rseventitems
msgid "Event items"
msgstr "Event items"
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -555,15 +567,15 @@ msgstr "iCalendar files (*.ical;*.ics)|*.ical;*.ics"
#: vpsr.rsimporticalevent
msgid "Import ICalendar Event"
msgstr ""
msgstr "Import ICalendar Event"
#: vpsr.rsimporticaltask
msgid "Import ICalendar Task"
msgstr ""
msgstr "Import ICalendar Task"
#: vpsr.rsimportvcard
msgid "Import VCard"
msgstr ""
msgstr "Import VCard"
#: vpsr.rsinches
msgid "Inches"
@ -774,7 +786,7 @@ msgstr "TCanvas not assigned"
#: vpsr.rsnocontactsfoundinvcard
#, object-pascal-format
msgid "No contact items found in \"%s\"."
msgstr ""
msgstr "No contact items found in \"%s\"."
#: vpsr.rsnocontrollink
msgid "Component must be linked to a TVpControlLink"
@ -910,6 +922,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Personal"
#: vpsr.rsphone
msgid "Phone"
msgstr "Phone"
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr "Phone/fax"
@ -1250,6 +1266,10 @@ msgstr "Sunday"
msgid "Task complete"
msgstr "Task complete"
#: vpsr.rstaskitems
msgid "Task items"
msgstr "Task items"
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Add task..."
@ -1751,4 +1771,3 @@ msgstr "Unknown axis specifier: %s"
#: vpsr.sxmldecnotatbeg
msgid "The XML declaration must appear before the first element"
msgstr "The XML declaration must appear before the first element"

View File

@ -70,6 +70,10 @@ msgstr ""
msgid "Sat"
msgstr "La"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr "Su"
@ -253,6 +257,10 @@ msgstr ""
msgid "Delete this task from your list?"
msgstr ""
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr ""
@ -450,6 +458,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr ""
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -909,6 +921,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr ""
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr ""
@ -1257,6 +1273,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr ""
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr ""

View File

@ -86,6 +86,10 @@ msgstr "Rendevous"
msgid "Sat"
msgstr "Sam"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr "Dim"
@ -269,6 +273,10 @@ msgstr "Supprimer l'événement du calendrier"
msgid "Delete this task from your list?"
msgstr "Supprimer la tache de votre liste?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Ajouter un contact..."
@ -466,6 +474,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Événement"
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -924,6 +936,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Personnel"
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr ""
@ -1274,6 +1290,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr "Tache terminé"
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Ajouter un tâche..."

View File

@ -80,6 +80,10 @@ msgstr "Afspraak"
msgid "Sat"
msgstr "Za"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr "Zo"
@ -263,6 +267,10 @@ msgstr "Gebeurtenis wissen uit de kalender?"
msgid "Delete this task from your list?"
msgstr "Deze taak uit de lijst wissen?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Contact toevoegen..."
@ -460,6 +468,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Gebeurtenis"
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -918,6 +930,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Persoonlijk"
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr ""
@ -1268,6 +1284,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr "Taak afgerond"
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Taak toevoegen..."

View File

@ -80,6 +80,10 @@ msgstr "Spotkanie"
msgid "Sat"
msgstr "Sob"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr "Nie"
@ -263,6 +267,10 @@ msgstr "Skasować wydarzenie z kalendarza?"
msgid "Delete this task from your list?"
msgstr "Skasować zadanie z listy?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Dodawanie kontaktu..."
@ -460,6 +468,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Wydarzenie"
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -918,6 +930,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Osobisty"
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr "Telefon/Fax"
@ -1266,6 +1282,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr "Zadanie wykonane"
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Dodaj zadanie..."

View File

@ -70,6 +70,10 @@ msgstr ""
msgid "Sat"
msgstr ""
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr ""
@ -252,6 +256,10 @@ msgstr ""
msgid "Delete this task from your list?"
msgstr ""
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr ""
@ -444,6 +452,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr ""
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -900,6 +912,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr ""
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr ""
@ -1240,6 +1256,10 @@ msgstr ""
msgid "Task complete"
msgstr ""
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr ""

View File

@ -80,6 +80,10 @@ msgstr "Встреча"
msgid "Sat"
msgstr "Сб"
#: vpsr.rsassignedcategory
msgid "Assigned category"
msgstr ""
#: vpsr.rsasunday
msgid "Sun"
msgstr "Вск"
@ -263,6 +267,10 @@ msgstr "Удалить событие из расписания?"
msgid "Delete this task from your list?"
msgstr "Удалить эту задачу из вашего списка?"
#: vpsr.rscontactitems
msgid "Contact items"
msgstr ""
#: vpsr.rscontactpopupadd
msgid "Add contact..."
msgstr "Добавить контакт..."
@ -460,6 +468,10 @@ msgctxt "vpsr.rsevent"
msgid "Event"
msgstr "Событие"
#: vpsr.rseventitems
msgid "Event items"
msgstr ""
#: vpsr.rseverydays
#, object-pascal-format
msgid "Every %d days"
@ -918,6 +930,10 @@ msgctxt "vpsr.rspersonalwebsitelabel"
msgid "Personal"
msgstr "Персонал"
#: vpsr.rsphone
msgid "Phone"
msgstr ""
#: vpsr.rsphonefax
msgid "Phone/fax"
msgstr ""
@ -1266,6 +1282,10 @@ msgctxt "vpsr.rstaskcomplete"
msgid "Task complete"
msgstr "Задача выполнена"
#: vpsr.rstaskitems
msgid "Task items"
msgstr ""
#: vpsr.rstaskpopupadd
msgid "Add task..."
msgstr "Добавит задачу..."

View File

@ -168,6 +168,7 @@ resourcestring
RSConfirmDeleteContact = 'Delete contact %s?';
RSLoadVCardsTitle = 'Import from vCard(s)';
RSVCardFilter = 'vCard files (*.vcf)|*.vcf';
RSContactItems = 'Contact items';
{Event Specific}
RSEvent = 'Event';
@ -189,6 +190,8 @@ resourcestring
RSNoEventItemsFoundInICAL = 'No event items found in "%s".';
RSNoTaskItemsFoundInICAL = 'No task items found in "%s".';
RSNoContactsFoundInVCARD = 'No contact items found in "%s".';
RSAssignedCategory = 'Assigned category';
RSEventItems = 'Event items';
{Task Specific}
RSConfirmDeleteTask = 'Delete this task from your list?';
@ -198,6 +201,7 @@ resourcestring
RSTaskPopupDelete = 'Delete task...';
RSTaskTitleResource = 'Task list - '; {!!.01}
RSTaskTitleNoResource = 'Task list'; {!!.01}
RSTaskItems = 'Task items';
{ Popup specific }
RSPopupAddEvent = 'Add event...';
@ -281,6 +285,7 @@ resourcestring
RSBirthDateLbl = 'Birth date:';
RSAgeLbl = 'Age:';
RSAnniversaryLbl = 'Anniversary:';
RSPhone = 'Phone';
RSPhoneFax = 'Phone/fax';
RSWebsites = 'Websites';
RSUppercaseContact = 'CONTACT';

View File

@ -312,11 +312,11 @@ type
destructor Destroy; override;
function CanEdit: Boolean;
function CopyToSchedule(ASchedule: TVpSchedule): TVpEvent;
class procedure GetAlarmParams(ATrigger: TDateTime; out AdvTime: Integer;
out AdvTimeUnits: TVpAlarmAdvType);
function GetResource: TVpResource;
function IsOverlayed: Boolean;
procedure LoadFromICalendar(AEntry: TVpICalEvent);
class procedure GetAlarmParams(ATrigger: TDateTime; out AdvTime: Integer;
out AdvTimeUnits: TVpAlarmAdvType);
property Owner: TVpSchedule read FOwner;
property ResourceID: Integer read FResourceID write FResourceID;
property Loading : Boolean read FLoading write FLoading;
@ -2922,6 +2922,10 @@ begin
{ Category }
{ tvplanit has only 1 category, ical may have several. We pick the first one
defined by TVpCategorytype. If none is found we select ctOther. }
if AEntry.PickedCategory > -1 then
FCategory := AEntry.PickedCategory
else
begin
FCategory :=ord(ctOther);
datastore := TVpCustomDatastore(Owner.Owner.Owner.Owner);
cat := datastore.FindBestTaskCategory(AEntry.Categories);
@ -2932,6 +2936,7 @@ begin
break;
end;
end;
end;
procedure TVpTask.SetCategory(const Value: Integer);
begin
@ -3089,8 +3094,8 @@ begin
begin
previewForm := TVpImportPreviewICalTaskForm.Create(nil);
previewForm.Position := poMainFormCenter;
previewForm.Calendar := ical;
previewForm.Datastore := datastore;
previewForm.Calendar := ical;
if ADefaultCategory <> -1 then
previewForm.DefaultCategory := CategoryLabel(TVpCategoryType(ADefaultCategory));
if not previewForm.Execute then

View File

@ -107,6 +107,7 @@ type
FCompletedTimeTZ: String;
FDuration: double;
FCategories: TStrings;
FPickedCategory: Integer;
FPriority: integer;
FStatus: String;
function GetCategory(AIndex: integer): String;
@ -126,6 +127,7 @@ type
property CompletedTime[UTC: Boolean]: TDateTime read GetCompletedTime;
property Category[AIndex: Integer]: String read GetCategory;
property CategoryCount: Integer read GetCategoryCount;
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
property Priority: Integer read FPriority; // 0=undefined, 1-highest, 9=lowest
property Status: String read FStatus;
end;
@ -485,6 +487,8 @@ begin
FCategories := TStringList.Create;
FCategories.Delimiter := ','; // ToDo categories are separated by comma in ical file.
FCategories.StrictDelimiter := true;
FStartTime := NO_DATE;
FDueTime := NO_DATE;
end;
destructor TVpICalToDo.Destroy;

View File

@ -29,7 +29,7 @@ object VpImportPreviewForm: TVpImportPreviewForm
end>
ExtendedSelect = False
FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goThumbTracking, goSmoothScroll]
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goSmoothScroll]
TabOrder = 0
OnDrawCell = GridDrawCell
OnGetCheckboxState = GridGetCheckboxState

View File

@ -9,7 +9,6 @@ uses
Forms, Controls, Dialogs, Grids, ExtCtrls, StdCtrls;
type
{ TVpImportPreviewForm }
TVpImportPreviewForm = class(TForm)
@ -57,7 +56,7 @@ uses
constructor TVpImportPreviewForm.Create(AOwner: TComponent);
begin
inherited;
Grid.Options := Grid.Options + [goRowSelect];
Grid.Options := Grid.Options + [goEditing, goRowSelect, goThumbTracking];
FItems := TFPList.Create;
end;
@ -148,7 +147,7 @@ begin
begin
ts := Grid.Canvas.TextStyle;
ts.SingleLine := false;
ts.Wordbreak := true;
ts.EndEllipsis := true;
Grid.Canvas.TextStyle := ts;
end;
end;
@ -176,28 +175,6 @@ begin
Grid.RowCount := Grid.FixedRows + FItems.Count;
CalcRowHeights;
end;
{
var
i: Integer;
begin
FItems.Clear;
if FCalendar <> nil then
begin
case FKind of
icEvent:
for i := 0 to FCalendar.Count-1 do
if (FCalendar.Entry[i] is TVpICalEvent) then
FItems.Add(FCalendar.Entry[i]);
icToDo:
for i := 0 to FCalendar.Count-1 do
if (FCalendar.Entry[i] is TVpICalToDo) then
FItems.Add(FCalendar.Entry[i]);
end;
Grid.RowCount := Grid.FixedRows + FItems.Count;
CalcRowHeights;
end else
Grid.RowCount := Grid.FixedRows;
end;
}
end.

View File

@ -23,7 +23,6 @@ inherited VpImportPreviewICalEventForm: TVpImportPreviewICalEventForm
Width = 634
end>
OnGetEditText = GridGetEditText
OnPickListSelect = GridPickListSelect
OnSetEditText = GridSetEditText
ColWidths = (
33

View File

@ -15,7 +15,6 @@ type
TVpImportPreviewICalEventForm = class(TVpImportPreviewForm)
procedure GridGetEditText(Sender: TObject; ACol, ARow: Integer;
var Value: string);
procedure GridPickListSelect(Sender: TObject);
procedure GridSetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
private
@ -80,8 +79,6 @@ begin
case ACol of
1: Result := GetEventText(event);
2: Result := Grid.Columns[2].PickList[event.PickedCategory];
//if FDatastore <> nil then
// Result := FDatastore.FindBestEventCategory(TVpICalEvent(item).Categories);
end;
end;
end;
@ -114,15 +111,14 @@ begin
RSEndTimeLbl + ' ' + sEndTime;
Result := Result + LineEnding +
RSDescriptionLbl + ' ' + AEvent.Summary + LineEnding +
RSCategoryLbl + ' ';
RSDescriptionLbl + ' ' + AEvent.Summary;
// Categories
if Assigned(FDatastore) then
begin
cat := AEvent.Categories.Text;
if cat = '' then cat := '(none)';
Result := Result + cat;
cat := AEvent.Categories.CommaText;
if cat = '' then cat := RSNoneStr;
Result := Result + LineEnding + RSCategoryLbl + ' ' + cat;
end;
// Recurrence
@ -186,27 +182,11 @@ procedure TVpImportPreviewICalEventForm.GridGetEditText(Sender: TObject; ACol,
var
event: TVpICalEvent;
begin
DebugLn('GetEditText: "' + Value + '"');
event := TVpICalEvent(FItems[Grid.Row - Grid.FixedRows]);
if event <> nil then
Value := Grid.Columns[2].PickList[event.PickedCategory];
end;
procedure TVpImportPreviewICalEventForm.GridPickListSelect(Sender: TObject);
var
item: TVpICalEntry;
cat: String;
col: TGridcolumn;
begin
item := TVpICalEntry(FItems[Grid.Row - Grid.FixedRows]);
if item <> nil then
begin
col := Grid.Columns[2];
//TVpICalEvent(item).PickedCategory := Grid.Columns[2].PickList.IndexOf(ItemIndex);
end;
end;
procedure TVpImportPreviewICalEventForm.GridSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: string);
var
@ -215,10 +195,8 @@ begin
event := TVpICalEvent(FItems[Grid.Row - Grid.FixedRows]);
if event <> nil then
event.PickedCategory := Grid.Columns[2].PickList.IndexOf(Value);;
// DebugLn('SetEditText: "' + Value + '"');
end;
function TVpImportPreviewICalEventForm.IsChecked(ARow: Integer): Boolean;
var
item: TVpICalEntry;
@ -248,11 +226,13 @@ begin
if (FCalendar <> nil) and (FDataStore <> nil) and (Grid.Columns.Count = 2) then
begin
Grid.Columns[1].Title.Caption := RSEventItems;
with Grid.Columns.Add do
begin
SizePriority := 0;
Width := 160;
Title.Caption := 'Category to be applied';
Title.Caption := RSAssignedCategory;
ButtonStyle := cbsPickList;
L := TStringList.Create;
try

View File

@ -20,11 +20,13 @@ inherited VpImportPreviewICalTaskForm: TVpImportPreviewICalTaskForm
PickList.Strings = ( )
ReadOnly = True
Title.Caption = 'Items'
Width = 634
Width = 630
end>
OnGetEditText = GridGetEditText
OnSetEditText = GridSetEditText
ColWidths = (
33
634
630
)
end
inherited ButtonPanel: TPanel

View File

@ -6,13 +6,17 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
VpData, VpBaseDS, VpImportPreview, VpICal;
VpData, VpBaseDS, VpImportPreview, VpICal, Grids;
type
{ TVpImportPreviewICalTaskForm }
TVpImportPreviewICalTaskForm = class(TVpImportPreviewForm)
procedure GridGetEditText(Sender: TObject; ACol, ARow: Integer;
var Value: string);
procedure GridSetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
private
FCalendar: TVpICalendar;
FDatastore: TVpCustomDatastore;
@ -32,7 +36,6 @@ type
property Calendar: TVpICalendar read FCalendar write SetCalendar;
property Datastore: TVpCustomDatastore read FDatastore write FDatastore;
property DefaultCategory: String read FDefaultCategory write FDefaultCategory;
// property Kind: TVpICalItemKind read FKind write SetKind;
end;
@ -44,7 +47,7 @@ implementation
{$R *.lfm}
uses
VpSR;
VpSR, VpConst;
constructor TVPImportPreviewICalTaskForm.Create(AOwner: TComponent);
begin
@ -66,39 +69,70 @@ end;
function TVpImportPreviewICalTaskForm.GetCellText(ACol, ARow: Integer): String;
var
item: TVpICalEntry;
task: TVpICalToDo;
begin
Result := '';
if (ACol = 1) and (ARow >= Grid.FixedRows) then
if (ARow >= Grid.FixedRows) then
begin
item := TVpICalEntry(FItems[ARow - Grid.FixedRows]);
if item <> nil then
Result := GetTaskText(TVpICalToDo(item));
task := TVpICalToDo(FItems[ARow - Grid.FixedRows]);
case ACol of
1: Result := GetTaskText(task);
2: Result := Grid.Columns[2].PickList[task.PickedCategory]
end;
end;
end;
procedure TVpImportPreviewICalTaskForm.GridGetEditText(Sender: TObject; ACol,
ARow: Integer; var Value: string);
var
task: TVpICalToDo;
begin
task := TVpICalToDo(FItems[Grid.Row - Grid.FixedRows]);
if task <> nil then
Value := Grid.Columns[2].PickList[task.PickedCategory];
end;
procedure TVpImportPreviewICalTaskForm.GridSetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: string);
var
task: TVpICalToDo;
begin
task:= TVpICalToDo(FItems[Grid.Row - Grid.FixedRows]);
if task <> nil then
task.PickedCategory := Grid.Columns[2].PickList.IndexOf(Value);;
end;
function TVpImportPreviewICalTaskForm.GetTaskText(AToDo: TVpICalToDo): String;
var
s: String;
cat: String;
dt: TDateTime;
begin
Result := RSDescriptionLbl + ' ' + AToDo.Summary + LineEnding +
RSDueDateLabel + ' ' + FormatDateTime(FTimeFormat, AToDo.DueTime[false]) + LineEnding +
RSCreatedOn + ' ' + FormatDateTime(FTimeFormat, AToDo.StartTime[false]);
Result := RSDescriptionLbl + ' ' + AToDo.Summary;
dt := AToDo.DueTime[false];
if dt <> NO_DATE then
s := FormatDateTime(FTimeFormat, dt)
else
s := RSNoneStr;
Result := Result + LineEnding + RSDueDateLabel + ' ' + s;
dt := AToDo.StartTime[false];
if dt <> NO_DATE then
s := FormatDateTime(FTimeFormat, dt)
else
s := RSNoneStr;
Result := Result + LineEnding + RSCreatedOn + ' ' + s;
case TVpTask.GetTaskPriority(AToDo.Priority) of
tpLow: s := RSLow;
tpNormal: s := RSNormal;
tpHigh: s := RSHigh;
end;
Result := Result + LineEnding + RSPriorityLabel + ' ' + s + LineEnding + RSCategoryLabel + ' ';
Result := Result + LineEnding + RSPriorityLabel + ' ' + s;
if Assigned(FDatastore) then
begin
cat := FDatastore.FindBestTaskCategory(AToDo.Categories);
if cat = '' then cat := FDefaultCategory;
Result := Result + cat;
end;
s := AToDo.Categories.CommaText;
if s = '' then s := RSNoneStr;
Result := Result + LineEnding + RSCategoryLabel + ' ' + s;
end;
function TVpImportPreviewICalTaskForm.IsChecked(ARow: Integer): Boolean;
@ -116,13 +150,50 @@ end;
procedure TVpImportPreviewICalTaskForm.PrepareItems;
var
i: Integer;
ct: TVpCategoryType;
cat: String;
L: TStrings;
task: TVpICalToDo;
begin
FItems.Clear;
if FCalendar <> nil then
for i := 0 to FCalendar.Count-1 do
if (FCalendar.Entry[i] is TVpICalToDo) then
FItems.Add(FCalendar.Entry[i]);
inherited;
if (FCalendar <> nil) and (FDataStore <> nil) and (Grid.Columns.Count = 2) then
begin
Grid.Columns[1].Title.Caption := RSTaskItems;
with Grid.Columns.Add do
begin
SizePriority := 0;
Width := 160;
Title.Caption := RSAssignedCategory;
ButtonStyle := cbsPickList;
L := TStringList.Create;
try
for ct in TVpCategoryType do
L.Add(CategoryLabel(ct));
PickList.Assign(L);
finally
L.Free;
end;
end;
for i := 0 to FItems.Count-1 do
begin
task := TVpICalToDo(FItems[i]);
cat := FDatastore.FindBestTaskCategory(task.Categories);
if cat = '' then cat := FDefaultCategory;
if cat <> '' then
task.PickedCategory := Grid.Columns[2].PickList.IndexOf(cat)
else
task.PickedCategory := ord(ctOther);
end;
end;
end;
procedure TVpImportPreviewICalTaskForm.SetCalendar(const AValue: TVpICalendar);

View File

@ -20,11 +20,11 @@ inherited VpImportPreviewVCardForm: TVpImportPreviewVCardForm
PickList.Strings = ( )
ReadOnly = True
Title.Caption = 'Items'
Width = 634
Width = 630
end>
ColWidths = (
33
634
630
)
end
inherited ButtonPanel: TPanel

View File

@ -79,39 +79,19 @@ begin
s := ACard.GetWorkAddress;
if s <> '' then
Result := Result + LineEnding + 'Work address: ' + s;
Result := Result + LineEnding + RSWorkAddress + ' ' + s;
s := ACard.GetHomeAddress;
if s <> '' then
Result := Result + LineEnding + 'Home address: ' + s;
Result := Result + LineEnding + RSHomeAddress + ' ' + s;
s := ACard.GetPhone;
if s <> '' then
Result := Result + LineEnding + 'Phone: ' + s;
Result := Result + LineEnding + RSPhone + ' ' + s;
s := ACard.GetEMail;
if s <> '' then
Result := Result + LineEnding + 'E-Mail: ' + s;
(*
Result := RSDescriptionLbl + ' ' + AToDo.Summary + LineEnding +
RSDueDateLabel + ' ' + FormatDateTime(FTimeFormat, AToDo.DueTime[false]) + LineEnding +
RSCreatedOn + ' ' + FormatDateTime(FTimeFormat, AToDo.StartTime[false]);
case TVpTask.GetTaskPriority(AToDo.Priority) of
tpLow: s := RSLow;
tpNormal: s := RSNormal;
tpHigh: s := RSHigh;
end;
Result := Result + LineEnding + RSPriorityLabel + ' ' + s + LineEnding + RSCategoryLabel + ' ';
if Assigned(FDatastore) then
begin
cat := FDatastore.FindBestTaskCategory(AToDo.Categories);
if cat = '' then cat := FDefaultCategory;
Result := Result + cat;
end;
*)
Result := Result + LineEnding + RSEMail + ': ' + s;
end;
function TVpImportPreviewVCardForm.IsChecked(ARow: Integer): Boolean;
@ -134,7 +114,10 @@ begin
if FVCards <> nil then
for i := 0 to FVCards.Count-1 do
FItems.Add(FVCards.Card[i]);
inherited;
Grid.Columns[1].Title.Caption := RSContactItems;
end;
procedure TVpImportPreviewVCardForm.SetVCards(const AValue: TVpVCards);