From b3d76d7f60f43ff8df11092874054c9654cd47e3 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 12 Aug 2022 13:47:03 +0000 Subject: [PATCH] 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 --- components/tvplanit/languages/vpsr.de.po | 29 ++++- components/tvplanit/languages/vpsr.en.po | 29 ++++- components/tvplanit/languages/vpsr.fi.po | 20 ++++ components/tvplanit/languages/vpsr.fr.po | 20 ++++ components/tvplanit/languages/vpsr.nl.po | 20 ++++ components/tvplanit/languages/vpsr.pl.po | 20 ++++ components/tvplanit/languages/vpsr.pot | 20 ++++ components/tvplanit/languages/vpsr.ru.po | 20 ++++ components/tvplanit/source/include/vpsr.inc | 5 + components/tvplanit/source/vpdata.pas | 29 +++-- components/tvplanit/source/vpical.pas | 4 + .../tvplanit/source/vpimportpreview.lfm | 2 +- .../tvplanit/source/vpimportpreview.pas | 29 +---- .../source/vpimportpreview_icalevent.lfm | 1 - .../source/vpimportpreview_icalevent.pas | 36 ++---- .../source/vpimportpreview_icaltask.lfm | 6 +- .../source/vpimportpreview_icaltask.pas | 109 +++++++++++++++--- .../tvplanit/source/vpimportpreview_vcard.lfm | 4 +- .../tvplanit/source/vpimportpreview_vcard.pas | 31 ++--- 19 files changed, 309 insertions(+), 125 deletions(-) diff --git a/components/tvplanit/languages/vpsr.de.po b/components/tvplanit/languages/vpsr.de.po index b44b933ee..d51e8e4ed 100644 --- a/components/tvplanit/languages/vpsr.de.po +++ b/components/tvplanit/languages/vpsr.de.po @@ -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" - diff --git a/components/tvplanit/languages/vpsr.en.po b/components/tvplanit/languages/vpsr.en.po index aa5e14c08..a866caf14 100644 --- a/components/tvplanit/languages/vpsr.en.po +++ b/components/tvplanit/languages/vpsr.en.po @@ -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" - diff --git a/components/tvplanit/languages/vpsr.fi.po b/components/tvplanit/languages/vpsr.fi.po index 9695e7934..44c611db6 100644 --- a/components/tvplanit/languages/vpsr.fi.po +++ b/components/tvplanit/languages/vpsr.fi.po @@ -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 "" diff --git a/components/tvplanit/languages/vpsr.fr.po b/components/tvplanit/languages/vpsr.fr.po index e879d9889..9595ff077 100644 --- a/components/tvplanit/languages/vpsr.fr.po +++ b/components/tvplanit/languages/vpsr.fr.po @@ -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..." diff --git a/components/tvplanit/languages/vpsr.nl.po b/components/tvplanit/languages/vpsr.nl.po index 101f0cc5a..719b8fe61 100644 --- a/components/tvplanit/languages/vpsr.nl.po +++ b/components/tvplanit/languages/vpsr.nl.po @@ -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..." diff --git a/components/tvplanit/languages/vpsr.pl.po b/components/tvplanit/languages/vpsr.pl.po index eb786decf..4b13458a5 100644 --- a/components/tvplanit/languages/vpsr.pl.po +++ b/components/tvplanit/languages/vpsr.pl.po @@ -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..." diff --git a/components/tvplanit/languages/vpsr.pot b/components/tvplanit/languages/vpsr.pot index 8af433930..aba3c2566 100644 --- a/components/tvplanit/languages/vpsr.pot +++ b/components/tvplanit/languages/vpsr.pot @@ -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 "" diff --git a/components/tvplanit/languages/vpsr.ru.po b/components/tvplanit/languages/vpsr.ru.po index 4c29ecb3a..af108777e 100644 --- a/components/tvplanit/languages/vpsr.ru.po +++ b/components/tvplanit/languages/vpsr.ru.po @@ -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 "Добавит задачу..." diff --git a/components/tvplanit/source/include/vpsr.inc b/components/tvplanit/source/include/vpsr.inc index cd39ea035..256a18f3b 100644 --- a/components/tvplanit/source/include/vpsr.inc +++ b/components/tvplanit/source/include/vpsr.inc @@ -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'; diff --git a/components/tvplanit/source/vpdata.pas b/components/tvplanit/source/vpdata.pas index 261d551b3..fb9b45a35 100644 --- a/components/tvplanit/source/vpdata.pas +++ b/components/tvplanit/source/vpdata.pas @@ -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,15 +2922,20 @@ 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. } - FCategory :=ord(ctOther); - datastore := TVpCustomDatastore(Owner.Owner.Owner.Owner); - cat := datastore.FindBestTaskCategory(AEntry.Categories); - for ct in TVpCategoryType do - if cat = CategoryLabel(ct) then - begin - FCategory := ord(ct); - break; - end; + if AEntry.PickedCategory > -1 then + FCategory := AEntry.PickedCategory + else + begin + FCategory :=ord(ctOther); + datastore := TVpCustomDatastore(Owner.Owner.Owner.Owner); + cat := datastore.FindBestTaskCategory(AEntry.Categories); + for ct in TVpCategoryType do + if cat = CategoryLabel(ct) then + begin + FCategory := ord(ct); + break; + end; + end; end; procedure TVpTask.SetCategory(const Value: Integer); @@ -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 diff --git a/components/tvplanit/source/vpical.pas b/components/tvplanit/source/vpical.pas index f6fe90129..08a824723 100644 --- a/components/tvplanit/source/vpical.pas +++ b/components/tvplanit/source/vpical.pas @@ -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; diff --git a/components/tvplanit/source/vpimportpreview.lfm b/components/tvplanit/source/vpimportpreview.lfm index 8db4e9bf3..f2432178b 100644 --- a/components/tvplanit/source/vpimportpreview.lfm +++ b/components/tvplanit/source/vpimportpreview.lfm @@ -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 diff --git a/components/tvplanit/source/vpimportpreview.pas b/components/tvplanit/source/vpimportpreview.pas index 9b2726b81..c1626f501 100644 --- a/components/tvplanit/source/vpimportpreview.pas +++ b/components/tvplanit/source/vpimportpreview.pas @@ -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. diff --git a/components/tvplanit/source/vpimportpreview_icalevent.lfm b/components/tvplanit/source/vpimportpreview_icalevent.lfm index 933da93e1..3120e4386 100644 --- a/components/tvplanit/source/vpimportpreview_icalevent.lfm +++ b/components/tvplanit/source/vpimportpreview_icalevent.lfm @@ -23,7 +23,6 @@ inherited VpImportPreviewICalEventForm: TVpImportPreviewICalEventForm Width = 634 end> OnGetEditText = GridGetEditText - OnPickListSelect = GridPickListSelect OnSetEditText = GridSetEditText ColWidths = ( 33 diff --git a/components/tvplanit/source/vpimportpreview_icalevent.pas b/components/tvplanit/source/vpimportpreview_icalevent.pas index 8cded8ff2..8076ca436 100644 --- a/components/tvplanit/source/vpimportpreview_icalevent.pas +++ b/components/tvplanit/source/vpimportpreview_icalevent.pas @@ -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 @@ -65,7 +64,7 @@ begin exit; item := TVpICalEntry(FItems[ARow - Grid.FixedRows]); if item <> nil then - item.Skip := not AChecked; + item.Skip := not AChecked; end; function TVpImportPreviewICalEventForm.GetCellText(ACol, ARow: Integer): String; @@ -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 diff --git a/components/tvplanit/source/vpimportpreview_icaltask.lfm b/components/tvplanit/source/vpimportpreview_icaltask.lfm index 266da2526..805f35016 100644 --- a/components/tvplanit/source/vpimportpreview_icaltask.lfm +++ b/components/tvplanit/source/vpimportpreview_icaltask.lfm @@ -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 diff --git a/components/tvplanit/source/vpimportpreview_icaltask.pas b/components/tvplanit/source/vpimportpreview_icaltask.pas index c125601a7..4a396962b 100644 --- a/components/tvplanit/source/vpimportpreview_icaltask.pas +++ b/components/tvplanit/source/vpimportpreview_icaltask.pas @@ -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); diff --git a/components/tvplanit/source/vpimportpreview_vcard.lfm b/components/tvplanit/source/vpimportpreview_vcard.lfm index a90254590..27aa7c5bb 100644 --- a/components/tvplanit/source/vpimportpreview_vcard.lfm +++ b/components/tvplanit/source/vpimportpreview_vcard.lfm @@ -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 diff --git a/components/tvplanit/source/vpimportpreview_vcard.pas b/components/tvplanit/source/vpimportpreview_vcard.pas index 7e2633936..beac24641 100644 --- a/components/tvplanit/source/vpimportpreview_vcard.pas +++ b/components/tvplanit/source/vpimportpreview_vcard.pas @@ -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);