]> git.deb.at Git - pkg/abook.git/blobdiff - ui.c
First attempt of the better interface for filters
[pkg/abook.git] / ui.c
diff --git a/ui.c b/ui.c
index 25c6ba1146448eb5b6e84177caeb36adb108ba1b..86259789b1b80019a473f70192b1781c56dc8d6a 100644 (file)
--- 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);
 }