* external variables
*/
-extern int curitem;
-extern int items;
extern char *datafile;
extern bool alternative_datafile;
}
char *
-ui_readline(char *prompt, char *s, size_t limit, bool use_completion)
+ui_readline(const char *prompt, char *s, size_t limit, bool use_completion)
{
int y, x;
char *ret;
}
int
-statusline_ask_boolean(char *msg, int def)
+statusline_ask_boolean(const char *msg, int def)
{
int ret;
char *msg2 = strconcat(msg, def ? _(" (Y/n)?") : _(" (y/N)?"), NULL);
}
char *
-ask_filename(char *prompt)
+ask_filename(const char *prompt)
{
char *buf = NULL;
*/
extern char *selected;
-extern int curitem;
void
get_commands()
case 'q': return;
case 'Q': quit_abook(QUIT_DONTSAVE); break;
case 'P': print_stderr(selected_items() ?
- -1 : list_current_item());
+ -1 : list_get_curitem());
return;
case '?':
display_help(HELP_MAIN);
case '/': ui_find(0); break;
case '\\': ui_find(1); break;
- case ' ': if(curitem >= 0) {
- selected[curitem] = !selected[curitem];
+ case ' ': if(list_get_curitem() >= 0) {
+ list_invert_curitem_selection();
ui_print_number_of_items();
refresh_list();
}
break;
case 'm': launch_mutt(selected_items() ?
- -1 : list_current_item());
+ -1 : list_get_curitem());
refresh_screen();
break;
case 'p': ui_print_database(); break;
- case 'v': launch_wwwbrowser(list_current_item());
+ case 'v': launch_wwwbrowser(list_get_curitem());
refresh_screen();
break;
}
refresh_screen();
}
- if( (item = find_item(findstr, curitem + !!next, search_fields)) < 0 &&
+ if( (item = find_item(findstr, list_get_curitem() + !!next,
+ search_fields)) < 0 &&
(item = find_item(findstr, 0, search_fields)) >= 0)
statusline_addstr(_("Search hit bottom, continuing at top"));
if(item >= 0) {
- curitem = item;
+ list_set_curitem(item);
refresh_list();
}
}
void
ui_print_number_of_items()
{
- char *str = strdup_printf(" " "|%3d/%3d", selected_items(), items);
+ char *str = strdup_printf(" " "|%3d/%3d",
+ selected_items(), db_n_items());
mvaddstr(0, COLS-strlen(str), str);
{
char *msg;
- if(items > 0) {
+ if(!list_is_empty()) {
msg = strdup_printf(_("Your current data will be lost - "
"Press '%c' to continue"),
*(S_("keybinding for yes|y")));
load_database(filename);
- if(items == 0) {
+ if(list_is_empty()) {
statusline_msg(_("Sorry, the specified file appears not to be a valid abook addressbook"));
load_database(datafile);
} else {