You've already forked lazarus-ccr
tvplanit: TVpWeekView supports export of events to ical files.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8403 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -2411,9 +2411,7 @@ end;
|
||||
procedure TVpDayview.ExportICalFile(const AFileName: String;
|
||||
const AEvents: TVpEventArr);
|
||||
begin
|
||||
if (not Assigned(Datastore)) or (not Assigned(Datastore.Resource)) then
|
||||
exit;
|
||||
|
||||
if Assigned(Datastore) and Assigned(Datastore.Resource) then
|
||||
Datastore.Resource.Schedule.ExportICalFile(AFileName, AEvents);
|
||||
end;
|
||||
|
||||
|
@ -205,10 +205,12 @@ type
|
||||
|
||||
{ Popup }
|
||||
function GetPopupMenu: TPopupMenu; override;
|
||||
procedure InitializeDefaultPopup;
|
||||
procedure PopupAddEvent(Sender: TObject);
|
||||
procedure PopupAddFromICalFile(Sender: TObject);
|
||||
procedure PopupDeleteEvent(Sender: TObject);
|
||||
procedure PopupEditEvent(Sender: TObject);
|
||||
procedure PopupExportToICalFile(Sender: TObject);
|
||||
procedure PopupImportFromICalFile(Sender: TObject);
|
||||
procedure PopupToday(Sender: TObject);
|
||||
procedure PopupNextWeek(Sender: TObject);
|
||||
procedure PopupPrevWeek(Sender: TObject);
|
||||
@ -218,7 +220,6 @@ type
|
||||
procedure PopupPrevYear(Sender: TObject);
|
||||
procedure PopupCustomDate(Sender: TObject);
|
||||
procedure PopupPickResourceGroupEvent(Sender: TObject);
|
||||
procedure InitializeDefaultPopup;
|
||||
|
||||
{ internal methods }
|
||||
procedure SpinButtonClick(Sender: TObject);
|
||||
@ -279,6 +280,7 @@ type
|
||||
procedure LoadLanguage;
|
||||
procedure DeleteActiveEvent(Verify: Boolean);
|
||||
procedure DragDrop(Source: TObject; X, Y: Integer); override;
|
||||
procedure ExportICalFile(const AFileName: String; const AEvents: TVpEventArr);
|
||||
function ImportICalFile(const AFileName: String; APreview: Boolean = false;
|
||||
ADefaultCategory: Integer = -1): TVpEventArr;
|
||||
procedure Invalidate; override;
|
||||
@ -1106,6 +1108,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.ExportICalFile(const AFileName: String;
|
||||
const AEvents: TVpEventArr);
|
||||
begin
|
||||
if Assigned(Datastore) and Assigned(Datastore.Resource) then
|
||||
Datastore.Resource.Schedule.ExportICalFile(AFileName, AEvents);
|
||||
end;
|
||||
|
||||
{ Reads the events listed in the specified ical file and adds them to the
|
||||
day view control. All events imported are collected in the Result array.
|
||||
ADefaultCategory is the category to which the event is assigned if no fitting
|
||||
@ -1230,11 +1239,19 @@ begin
|
||||
if RSPopupImportEventFromICal <> '' then begin
|
||||
NewItem := TVpMenuItem.Create(Self);
|
||||
NewItem.Kind := mikImportEventFromICal; // Import from iCal
|
||||
NewItem.OnClick := PopupAddFromICalFile;
|
||||
NewItem.OnClick := PopupImportFromICalFile;
|
||||
NewItem.Tag := 0;
|
||||
FDefaultPopup.Items.Add(NewItem);
|
||||
end;
|
||||
|
||||
if RSPopupExportEventToICal <> '' then begin
|
||||
NewItem := TVpMenuItem.Create(Self);
|
||||
NewItem.Kind := mikExportEventToICal; // Export to iCal
|
||||
NewItem.OnClick := PopupExportToICalFile;
|
||||
NewItem.Tag := 1;
|
||||
FDefaultPopup.Items.Add(NewItem);
|
||||
end;
|
||||
|
||||
NewItem := TVpMenuItem.Create(Self); // ---
|
||||
NewItem.Kind := mikSeparator;
|
||||
FDefaultPopup.Items.Add(NewItem);
|
||||
@ -1352,9 +1369,47 @@ begin
|
||||
{ edit this new event }
|
||||
wvSpawnEventEditDialog(True);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpWeekView.PopupAddFromICalFile(Sender: TObject);
|
||||
procedure TVpWeekView.PopupDeleteEvent(Sender: TObject);
|
||||
begin
|
||||
if ReadOnly then
|
||||
Exit;
|
||||
if ActiveEvent <> nil then
|
||||
DeleteActiveEvent (True);
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.PopupEditEvent(Sender: TObject);
|
||||
begin
|
||||
if ReadOnly then
|
||||
Exit;
|
||||
if ActiveEvent <> nil then
|
||||
{ edit this Event }
|
||||
wvSpawnEventEditDialog(False);
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.PopupExportToICalFile(Sender: TObject);
|
||||
var
|
||||
dlg: TSaveDialog;
|
||||
begin
|
||||
if (not Assigned(Datastore)) or (not Assigned(Datastore.Resource)) or
|
||||
(FActiveEvent = nil)
|
||||
then
|
||||
exit;
|
||||
|
||||
dlg := TSaveDialog.Create(nil);
|
||||
try
|
||||
dlg.Title := RSSaveICalTitle;
|
||||
dlg.Filter := RSICalFilter;
|
||||
dlg.FileName := '';
|
||||
dlg.Options := dlg.Options - [ofAllowMultiSelect] + [ofOverwritePrompt];
|
||||
if dlg.Execute then
|
||||
ExportICalFile(dlg.FileName, [FActiveEvent]);
|
||||
finally
|
||||
dlg.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.PopupImportFromICalFile(Sender: TObject);
|
||||
var
|
||||
dlg: TOpenDialog;
|
||||
fn: String;
|
||||
@ -1379,25 +1434,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.PopupDeleteEvent(Sender: TObject);
|
||||
begin
|
||||
if ReadOnly then
|
||||
Exit;
|
||||
if ActiveEvent <> nil then
|
||||
DeleteActiveEvent (True);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpWeekView.PopupEditEvent(Sender: TObject);
|
||||
begin
|
||||
if ReadOnly then
|
||||
Exit;
|
||||
if ActiveEvent <> nil then
|
||||
{ edit this Event }
|
||||
wvSpawnEventEditDialog(False);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpWeekView.EditSelectedEvent(IsNewEvent: Boolean = false);
|
||||
begin
|
||||
if ActiveEvent <> nil then
|
||||
|
Reference in New Issue
Block a user