0.5.1
- sort by field command
+ - duplicate item command
+ - quit without saving command
- minor filter fixes
- tried to fix \" quotation problem with mutt import filter
- removed obsolete filesel_sort option from abookrc manual page
}
void
-quit_abook()
+quit_abook(int save_db)
{
- if(opt_get_bool(BOOL_AUTOSAVE))
- save_database();
- else if(statusline_ask_boolean("Save database", TRUE))
- save_database();
+ if(save_db) {
+ if(opt_get_bool(BOOL_AUTOSAVE))
+ save_database();
+ else if(statusline_ask_boolean("Save database", TRUE))
+ save_database();
+ } else if(!statusline_ask_boolean("Quit without saving", FALSE))
+ return;
free_opts();
close_database();
static void
quit_abook_sig(int i)
{
- quit_abook();
+ quit_abook(QUIT_SAVE);
}
int
get_commands();
- quit_abook();
+ quit_abook(QUIT_SAVE);
return 0;
}
if ( (ptr = malloc(size)) == NULL ) {
if( is_ui_initialized() )
- quit_abook();
+ quit_abook(QUIT_SAVE);
perror("malloc() failed");
exit(1);
}
if(ptr == NULL) {
if(is_ui_initialized())
- quit_abook();
+ quit_abook(QUIT_SAVE);
perror("realloc() failed");
exit(1);
}
void *abook_malloc(size_t size);
void *abook_realloc(void *ptr, size_t size);
FILE *abook_fopen (const char *path, const char *mode);
-void quit_abook();
+void quit_abook(int save_db);
void launch_wwwbrowser(int item);
void launch_mutt(int item);
void print_stderr(int item);
#define RCFILE "abookrc"
+#define QUIT_SAVE 1
+#define QUIT_DONTSAVE 0
+
/*
* some "abookwide" useful macros
*/
" ? help\n",
" q quit\n",
-" Q quit and print selected item(s) to stderr\n",
+" Q quit without saving\n",
+" P quit and print selected item(s) to stderr\n",
" ^L refresh screen\n",
"\n",
" arrows / j,k scroll list\n",
can_resize = FALSE; /* it's not safe to resize anymore */
switch( ch ) {
case 'q': return;
- case 'Q': print_stderr(selected_items() ?
+ case 'Q': quit_abook(QUIT_DONTSAVE); break;
+ case 'P': print_stderr(selected_items() ?
-1 : list_current_item());
return;
case '?':