X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=ui.c;h=86259789b1b80019a473f70192b1781c56dc8d6a;hb=05b0f3753902043fa8476a59c9251ab176675945;hp=25c6ba1146448eb5b6e84177caeb36adb108ba1b;hpb=453d7cb813423efa8344c90b1a1a40ac947fd4d0;p=pkg%2Fabook.git diff --git a/ui.c b/ui.c index 25c6ba1..8625978 100644 --- a/ui.c +++ b/ui.c @@ -556,14 +556,35 @@ ui_print_database() { FILE *handle; char *command = options_get_str("print_command"); + int mode; - if(!statusline_ask_boolean("Print addressbook", FALSE)) + if( list_is_empty() ) return; + statusline_addstr("Print All/Selected/Cancel (a/s/C)?"); + + switch( tolower(getch()) ) { + case 'a': + mode = ENUM_ALL; + break; + case 's': + if( !selected_items() ) { + statusline_msg("No selected items"); + return; + } + mode = ENUM_SELECTED; + break; + default: + clear_statusline(); + return; + } + + clear_statusline(); + if( ! *command || (handle = popen(command, "w")) == NULL) return; - fexport("text", handle); + fexport("text", handle, mode); pclose(handle); }