summaryrefslogtreecommitdiff
path: root/src/interaction.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-02-14 10:26:45 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2013-02-14 10:28:31 +0100
commit267bf0fc1c3ef59b232ea60e7ccdede664a667e8 (patch)
treee195a200a6895c4f623429e79230f2f84d1d4ca8 /src/interaction.c
parent720189d03fb9166a28e14cbf19d3b7ec46fa197a (diff)
downloadcalcurse-267bf0fc1c3ef59b232ea60e7ccdede664a667e8.zip
Split out UI functions for todo items
* Move todo-related UI functions from "interaction.c" to a new compilation unit "ui-todo.c". * Rename all todo-related UI functions to todo_ui_*(). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/interaction.c')
-rw-r--r--src/interaction.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/interaction.c b/src/interaction.c
index 49ebac5..486ad75 100644
--- a/src/interaction.c
+++ b/src/interaction.c
@@ -594,108 +594,6 @@ void interact_day_item_delete(unsigned *nb_events, unsigned *nb_apoints,
apoint_hilt_set(0);
}
-/* Request user to enter a new todo item. */
-void interact_todo_add(void)
-{
- int ch = 0;
- const char *mesg = _("Enter the new ToDo item : ");
- const char *mesg_id =
- _("Enter the ToDo priority [1 (highest) - 9 (lowest)] :");
- char todo_input[BUFSIZ] = "";
-
- status_mesg(mesg, "");
- if (getstring(win[STA].p, todo_input, BUFSIZ, 0, 1) == GETSTRING_VALID) {
- while ((ch < '1') || (ch > '9')) {
- status_mesg(mesg_id, "");
- ch = wgetch(win[KEY].p);
- }
- todo_add(todo_input, ch - '0', NULL);
- todo_set_nb(todo_nb() + 1);
- }
-}
-
-/* Delete an item from the ToDo list. */
-void interact_todo_delete(void)
-{
- const char *del_todo_str = _("Do you really want to delete this task ?");
- const char *erase_warning =
- _("This item has a note attached to it. "
- "Delete (t)odo or just its (n)ote ?");
- const char *erase_choice = _("[tn]");
- const int nb_erase_choice = 2;
- int answer;
-
- if ((todo_nb() <= 0) ||
- (conf.confirm_delete && (status_ask_bool(del_todo_str) != 1))) {
- wins_erase_status_bar();
- return;
- }
-
- /* This todo item doesn't have any note associated. */
- if (todo_get_item(todo_hilt())->note == NULL)
- answer = 1;
- else
- answer = status_ask_choice(erase_warning, erase_choice, nb_erase_choice);
-
- switch (answer) {
- case 1:
- todo_delete(todo_get_item(todo_hilt()));
- todo_set_nb(todo_nb() - 1);
- if (todo_hilt() > 1)
- todo_hilt_decrease(1);
- if (todo_nb() == 0)
- todo_hilt_set(0);
- if (todo_hilt_pos() < 0)
- todo_first_decrease(1);
- break;
- case 2:
- todo_delete_note(todo_get_item(todo_hilt()));
- break;
- default:
- wins_erase_status_bar();
- return;
- }
-}
-
-/* Edit the description of an already existing todo item. */
-void interact_todo_edit(void)
-{
- struct todo *i;
- const char *mesg = _("Enter the new ToDo description :");
-
- status_mesg(mesg, "");
- i = todo_get_item(todo_hilt());
- updatestring(win[STA].p, &i->mesg, 0, 1);
-}
-
-/* Pipe a todo item to an external program. */
-void interact_todo_pipe(void)
-{
- char cmd[BUFSIZ] = "";
- char const *arg[] = { cmd, NULL };
- int pout;
- int pid;
- FILE *fpout;
- struct todo *todo;
-
- status_mesg(_("Pipe item to external command:"), "");
- if (getstring(win[STA].p, cmd, BUFSIZ, 0, 1) != GETSTRING_VALID)
- return;
-
- wins_prepare_external();
- if ((pid = shell_exec(NULL, &pout, *arg, arg))) {
- fpout = fdopen(pout, "w");
-
- todo = todo_get_item(todo_hilt());
- todo_write(todo, fpout);
-
- fclose(fpout);
- child_wait(NULL, &pout, pid);
- press_any_key();
- }
- wins_unprepare_external();
-}
-
/*
* Ask user for repetition characteristics:
* o repetition type: daily, weekly, monthly, yearly