.ics Download und PDF Layout korrigiert
This commit is contained in:
1 parent
dc20d7ec5a
commit
cc2e85c111
11 files changed
+424
-73
No files matched your search
@@ -1265,6 +1265,28 @@ final class PlanModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// Saves one recipient's personal calendar file via a save panel. The file
|
||||
/// contains only that person's assignments, like the e-mail attachment.
|
||||
func exportDispatchCalendar(for recipient: DispatchRecipient) {
|
||||
let calendar = CalendarExport.ics(
|
||||
calendarName: "Gottesdienstplan \(range.shortTitle)",
|
||||
events: dispatchCalendarEvents(recipient.assignments)
|
||||
)
|
||||
let panel = NSSavePanel()
|
||||
panel.title = "Kalenderdatei sichern"
|
||||
panel.nameFieldStringValue = dispatchCalendarFilename(for: recipient)
|
||||
panel.allowedContentTypes = [UTType(filenameExtension: "ics") ?? .data]
|
||||
panel.canCreateDirectories = true
|
||||
guard panel.runModal() == .OK, let url = panel.url else { return }
|
||||
do {
|
||||
try Data(calendar.utf8).write(to: url, options: .atomic)
|
||||
showToast("Kalenderdatei gespeichert: \(url.lastPathComponent)", kind: .success)
|
||||
} catch {
|
||||
alertTitle = "Kalenderdatei konnte nicht gespeichert werden"
|
||||
alertMessage = error.localizedDescription
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds one printable PDF: for each print recipient an optional cover
|
||||
/// sheet followed by the selected plan variant.
|
||||
func createDispatchPrintPDF() {
|
||||
|
||||
Reference in new issue
Block a user