diff --git a/entry/src/main/ets/common/AccountStore.ets b/entry/src/main/ets/common/AccountStore.ets index 051b8a1..32c7854 100644 --- a/entry/src/main/ets/common/AccountStore.ets +++ b/entry/src/main/ets/common/AccountStore.ets @@ -77,6 +77,14 @@ export class CalSource { source: string = 'dav'; // 'dav' | 'system' | 'local' visible: boolean = true; writable: boolean = true; // 只读日历本中的日程只能查看详情,不能编辑 + /** + * 本支持哪些组件(来自服务器 COMP_SET 声明): + * 'event' 纯日历本(新建日程可选,新建待办不可选) + * 'todo' 纯待办本(反过来) + * 'both' 两者都可 + * 'unknown' 服务器未声明 → 两边都按可用处理(旧数据兼容) + */ + comps: string = 'unknown'; } /** 与 UI 无关的调色板 */ diff --git a/entry/src/main/ets/common/CalendarDataService.ets b/entry/src/main/ets/common/CalendarDataService.ets index ab58255..f9279d8 100644 --- a/entry/src/main/ets/common/CalendarDataService.ets +++ b/entry/src/main/ets/common/CalendarDataService.ets @@ -117,6 +117,9 @@ export class CalendarDataService { const detected: boolean = acc.calendarWritable.length > i ? acc.calendarWritable[i] !== '0' : true; s.writable = detected && !manualKeys.includes(s.calKey); + // 透传本支持的类型(新建待办/日程时据此过滤,避免把待办写进纯日历本) + s.comps = i < acc.calendarComps.length && acc.calendarComps[i] !== '' + ? acc.calendarComps[i] : 'unknown'; sources.push(s); } } diff --git a/entry/src/main/ets/pages/EventEditPage.ets b/entry/src/main/ets/pages/EventEditPage.ets index 492503f..ce61bfd 100644 --- a/entry/src/main/ets/pages/EventEditPage.ets +++ b/entry/src/main/ets/pages/EventEditPage.ets @@ -2159,6 +2159,13 @@ class CalendarDataBridge { if (!detected || manualKeys.includes(`${acc.id}_${i}`)) { continue; } + // ⭐ 只列**能放日程**的本:纯待办本(COMP_SET 只有 VTODO)写不进 VEVENT。 + // 'both' / 'unknown' 保留,理由同 Index.openTodoCreator。 + const comp: string = i < acc.calendarComps.length && acc.calendarComps[i] !== '' + ? acc.calendarComps[i] : 'unknown'; + if (comp === 'todo') { + continue; + } const s = new CalSourceWithHref(); s.calKey = `${acc.id}_${i}`; let name: string = i < acc.calendarNames.length ? acc.calendarNames[i] : ''; diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 71ff51f..1a0fb99 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -3174,6 +3174,11 @@ struct Index { if (!s.writable || s.source !== 'dav') { continue; } + // ⭐ 只列**能放待办**的本:纯日历本(COMP_SET 只有 VEVENT)写不进 VTODO。 + // 'both' / 'unknown' 都保留 —— unknown 是服务器未声明或旧数据,不能武断排除。 + if (s.comps === 'event') { + continue; + } // calKey 形如 "_" const us: number = s.calKey.lastIndexOf('_'); if (us <= 0) {