Exemplo n.º 1
0
Arquivo: tasknc.c Projeto: skn/tasknc
void key_command(const char *arg) /* {{{ */
{
	/* accept and attemt to execute a command string */
	char *cmdstr;

	if (arg==NULL)
	{
		/* prepare prompt */
		statusbar_message(-1, ":");
		set_curses_mode(NCURSES_MODE_STRING);

		/* get input */
		statusbar_getstr(&cmdstr, ":");
		wipe_statusbar();

		/* reset */
		set_curses_mode(NCURSES_MODE_STD);
	}
	else
		cmdstr = strdup(arg);

	/* run input command */
	if (cmdstr[0]!=0)
		handle_command(cmdstr);
	free(cmdstr);
} /* }}} */
Exemplo n.º 2
0
Arquivo: tasknc.c Projeto: skn/tasknc
void check_screen_size() /* {{{ */
{
	/* check for a screen thats too small */
	int count = 0;

	do
	{
		if (count)
		{
			if (count==1)
			{
				wipe_statusbar();
				wipe_tasklist();
			}
			wattrset(stdscr, get_colors(OBJECT_ERROR, NULL, NULL));
			mvaddstr(0, 0, "screen dimensions too small");
			wrefresh(stdscr);
			wattrset(stdscr, COLOR_PAIR(0));
			usleep(100000);
		}
		count++;
		rows = LINES;
		cols = COLS;
	} while (cols<DATELENGTH+20+cfg.fieldlengths.project || rows<5);
} /* }}} */
Exemplo n.º 3
0
void key_tasklist_filter(const char* arg) { /* {{{ */
    /* handle a keyboard direction to add a new filter
     * arg - string to filter by (pass NULL to prompt user)
     *       see the manual page for how filter strings are parsed
     */
    check_free(active_filter);

    if (arg == NULL) {
        statusbar_getstr(&active_filter, "filter by: ");
        wipe_statusbar();
    } else {
        active_filter = strdup(arg);
    }

    /* force reload of task list */
    statusbar_message(cfg.statusbar_timeout, "filter applied");
    reload = true;
} /* }}} */
Exemplo n.º 4
0
void key_tasklist_search(const char* arg) { /* {{{ */
    /* handle a keyboard direction to search
     * arg - the string to search for (pass NULL to prompt user)
     */
    check_free(searchstring);

    if (arg == NULL) {
        /* store search string  */
        statusbar_getstr(&searchstring, "/");
        wipe_statusbar();
    } else {
        searchstring = strdup(arg);
    }

    /* go to first result */
    find_next_search_result(head, get_task_by_position(selline));
    tasklist_check_curs_pos();
    redraw = true;
} /* }}} */
Exemplo n.º 5
0
void key_tasklist_modify(const char* arg) { /* {{{ */
    /* handle a keyboard direction to modify a task
     * arg - the modifications to apply (pass NULL to prompt user)
     *       this will be appended to `task UUID modify `
     */
    char* argstr;

    if (arg == NULL) {
        statusbar_getstr(&argstr, "modify: ");
        wipe_statusbar();
    } else {
        argstr = strdup(arg);
    }

    task_modify(argstr);
    free(argstr);

    statusbar_message(cfg.statusbar_timeout, "task modified");
    redraw = true;
} /* }}} */