Commit ccac43494f

ccac43494f6c8e322c4946d97c9056502683d30a

parent: a866e469a3

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-10 19:51 UTC

iOS agenda: Delete… in an entry's menu

Removes the heading and everything under it (org-cut-subtree), after asking.

Layout: unified · split

Sources/OrgstarMobile/AgendaScreen.swift +13
@@ -29,6 +29,7 @@ struct AgendaScreen: View, Equatable {
29 @State private var prompt: EditorScreen.PromptRequest? 29 @State private var prompt: EditorScreen.PromptRequest?
30 @State private var refiling: AgendaItem? 30 @State private var refiling: AgendaItem?
31 @State private var archiving: AgendaItem? 31 @State private var archiving: AgendaItem?
32 @State private var deleting: AgendaItem?
32 /// The day, week or month shown; nil for `org-agenda-span` and `org-agenda-start-day`. 33 /// The day, week or month shown; nil for `org-agenda-span` and `org-agenda-start-day`.
33 @State private var range: SpanRange? 34 @State private var range: SpanRange?
34 /// The mode `range` set, to notice when something else changes the view. 35 /// The mode `range` set, to notice when something else changes the view.
@@ -185,6 +186,15 @@ struct AgendaScreen: View, Equatable {
185 } message: { 186 } message: {
186 Text(archiving?.text ?? "") 187 Text(archiving?.text ?? "")
187 } 188 }
189 .confirmationDialog("Delete this entry?", isPresented: Binding { deleting != nil } set: { if !$0 { deleting = nil } }, titleVisibility: .visible) {
190 Button("Delete", role: .destructive) {
191 // `org-cut-subtree`: the heading and everything under it.
192 if let item = deleting { run(CopySubtree(cut: true), on: item) }
193 deleting = nil
194 }
195 } message: {
196 Text("\(deleting?.text ?? "")\n\nThe heading and every line under it are removed from the file.")
197 }
188 .refreshable { 198 .refreshable {
189 await workspace.refresh() 199 await workspace.refresh()
190 await agenda.refresh(open: session.openTexts) 200 await agenda.refresh(open: session.openTexts)
@@ -509,6 +519,9 @@ struct AgendaScreen: View, Equatable {
509 Divider() 519 Divider()
510 Button("Refile…", systemImage: "arrow.turn.down.right") { refiling = item } 520 Button("Refile…", systemImage: "arrow.turn.down.right") { refiling = item }
511 Button("Archive…", systemImage: "archivebox") { archiving = item } 521 Button("Archive…", systemImage: "archivebox") { archiving = item }
522 if item.headingLine != nil {
523 Button("Delete…", systemImage: "trash", role: .destructive) { deleting = item }
524 }
512 } 525 }
513 } 526 }
514 } 527 }
docs/manual/guide/07-agenda.org +1 −1
@@ -569,7 +569,7 @@ The Agenda tab shows the same views from the same files, using the settings in t
569- Tap an entry to open it. Tap a calendar event to open Calendar on the event's day; iOS can't open Calendar at one event. 569- Tap an entry to open it. Tap a calendar event to open Calendar on the event's day; iOS can't open Calendar at one event.
570- Swipe left on an open TODO entry for Done, which sets the first done keyword of its sequence, and Next State, which moves to the next keyword. The sequence is the one the file defines: the default keywords from =config.toml=, the file's own =#+TODO= lines, and those of its setup files, with unsaved edits in an open buffer included. 570- Swipe left on an open TODO entry for Done, which sets the first done keyword of its sequence, and Next State, which moves to the next keyword. The sequence is the one the file defines: the default keywords from =config.toml=, the file's own =#+TODO= lines, and those of its setup files, with unsaved edits in an open buffer included.
571- Swipe right on a scheduled entry, a deadline, a habit or a TODO entry, when it isn't done, for Tomorrow, Next Week and Pick Date. Tomorrow is the day after today and Next Week is next Monday. On a deadline row these move the deadline; on other rows they set the scheduled date. A timed row keeps its times. 571- Swipe right on a scheduled entry, a deadline, a habit or a TODO entry, when it isn't done, for Tomorrow, Next Week and Pick Date. Tomorrow is the day after today and Next Week is next Monday. On a deadline row these move the deadline; on other rows they set the scheduled date. A timed row keeps its times.
572- Touch and hold an entry for TODO State…, Reschedule (Tomorrow, Next Week, Pick Date…), Schedule…, Deadline…, Tags…, Priority…, Clock In, Refile… and Archive…. 572- Touch and hold an entry for TODO State…, Reschedule (Tomorrow, Next Week, Pick Date…), Schedule…, Deadline…, Tags…, Priority…, Clock In, Refile…, Archive… and Delete…, which removes the heading and everything under it.
573- Marking an entry done and rescheduling one give haptic feedback. 573- Marking an entry done and rescheduling one give haptic feedback.
574- Log Mode, in the span menu, turns log mode on and off. The widgets never show log mode's entries. 574- Log Mode, in the span menu, turns log mode on and off. The widgets never show log mode's entries.
575- There are no keyboard commands or bulk marks. 575- There are no keyboard commands or bulk marks.
docs/manual/guide/14-ios.org +1 −1
@@ -161,7 +161,7 @@ The Agenda tab shows the agenda over all your folders, with the span and start d
161- Tap :: an entry to read it, at its heading. 161- Tap :: an entry to read it, at its heading.
162- Swipe left :: on a TODO entry for Done, which sets the first done keyword of its sequence, or Next State. 162- Swipe left :: on a TODO entry for Done, which sets the first done keyword of its sequence, or Next State.
163- Swipe right :: for Tomorrow, Next Week (next Monday) or Pick Date, which move the entry's scheduled date, or its deadline on a deadline row. 163- Swipe right :: for Tomorrow, Next Week (next Monday) or Pick Date, which move the entry's scheduled date, or its deadline on a deadline row.
164- Touch and hold :: an entry for TODO State…, Reschedule, Schedule…, Deadline…, Tags…, Priority…, Clock In, Refile…, and Archive…. Refile… lists files; the entry goes to the end of the one you choose. Refiling under a heading is Mac only. 164- Touch and hold :: an entry for TODO State…, Reschedule, Schedule…, Deadline…, Tags…, Priority…, Clock In, Refile…, Archive…, and Delete…. Delete… removes the heading and every line under it, after asking. Refile… lists files; the entry goes to the end of the one you choose. Refiling under a heading is Mac only.
165 165
166Commands from the agenda change the file directly when it isn't open, and through the editor when it is. If the heading changed since the agenda was built, nothing runs. 166Commands from the agenda change the file directly when it isn't open, and through the editor when it is. If the heading changed since the agenda was built, nothing runs.
167 167