From 3990095c4ac65c7f6e10b2fa074f763d048a92eb Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Sun, 27 May 2001 09:07:01 +0000 Subject: [PATCH 1/1] Changed launch_lynx to launch_wwwbrowser --- abook.c | 14 ++++++-------- abook.h | 4 ++-- edit.c | 14 +++++++++----- help.h | 5 ++++- ui.c | 8 ++++++-- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/abook.c b/abook.c index 8366cfd..c80ea53 100644 --- a/abook.c +++ b/abook.c @@ -320,14 +320,14 @@ quit_mutt_query(int status) void -launch_mutt() +launch_mutt(int item) { int i; char email[MAX_EMAIL_LEN]; char *cmd; char *tmp = options_get_str("mutt_command"); - if( list_is_empty() ) + if( !is_valid_item(item) ) return; cmd = strconcat(tmp, " '", NULL ); @@ -356,21 +356,20 @@ launch_mutt() system(cmd); free(cmd); - refresh_screen(); } void -launch_lynx() +launch_wwwbrowser(int item) { char *cmd = NULL; - if( list_is_empty() ) + if( !is_valid_item(item) ) return; - if( database[list_current_item()][URL] ) + if( database[item][URL] ) cmd = mkstr("%s '%s'", options_get_str("www_command"), - safe_str(database[list_current_item()][URL])); + safe_str(database[item][URL])); else return; @@ -378,7 +377,6 @@ launch_lynx() system(cmd); free(cmd); - refresh_screen(); } void * diff --git a/abook.h b/abook.h index e09145f..bcebcaa 100644 --- a/abook.h +++ b/abook.h @@ -7,8 +7,8 @@ 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 launch_lynx(); -void launch_mutt(); +void launch_wwwbrowser(int item); +void launch_mutt(int item); #ifdef _AIX int strcasecmp (const char *, const char *); int strncasecmp (const char *, const char *, size_t); diff --git a/edit.c b/edit.c index 9ce4a88..ae7643e 100644 --- a/edit.c +++ b/edit.c @@ -146,6 +146,7 @@ static void editor_print_data(int tab, int item) { const int pos_x = EDITW_COLS > 70 ? 8:4; + const int start_y = 4; int i, j; for(i = 0, j = 1; i < ITEM_FIELDS; i++) { @@ -156,18 +157,19 @@ editor_print_data(int tab, int item) int k; char emails[MAX_EMAILS][MAX_EMAIL_LEN]; split_emailstr(item, emails); - mvwaddstr(editw, (LINES > 21 ? 7:6), pos_x, "E-mail addresses:"); + mvwaddstr(editw, 6, pos_x, "E-mail addresses:"); for(k=0; k < MAX_EMAILS; k++) - mvwprintw(editw, (LINES > 21 ? 9:7)+k*2, pos_x, + mvwprintw(editw, 7 + k, pos_x, "%c -\t\t%s", '2' + k, emails[k] ); continue; } - mvwprintw(editw, 3+j*2, pos_x, "%d - %s", + mvwprintw(editw, start_y + j, pos_x, "%d - %s", j, abook_fields[i].name); - mvwaddch(editw, 3+j*2, 28, ':'); - mvwaddstr(editw, 3+j*2, 30, safe_str(database[item][i])); + mvwaddch(editw, start_y + j, 28, ':'); + mvwaddstr(editw, start_y + j, 30, safe_str(database[item][i])); + j++; } } @@ -375,6 +377,8 @@ edit_loop(int item) case 'r': roll_emails(item); break; case '?': display_help(HELP_EDITOR); break; case 'u': edit_undo(item, RESTORE_ITEM); break; + case 'm': launch_mutt(item); + case 'v': launch_wwwbrowser(item); case 12 : clearok(stdscr, 1); break; /* ^L (refresh screen) */ default: return edit_field(tab, c, item); } diff --git a/help.h b/help.h index 8fe0aa4..2f1120d 100644 --- a/help.h +++ b/help.h @@ -39,7 +39,7 @@ static char *mainhelp[] = { " Z move current item down\n", "\n", " m send mail with mutt\n", -" u view URL with lynx\n", +" u view URL with www browser\n", NULL }; @@ -55,6 +55,9 @@ static char *editorhelp[] = { "\n", " u undo\n", "\n", +" m send mail with mutt\n", +" v view url with WWW browser\n", +"\n", NULL }; diff --git a/ui.c b/ui.c index 8625978..7c60b06 100644 --- a/ui.c +++ b/ui.c @@ -472,11 +472,15 @@ get_commands() case 'Z': move_curitem(MOVE_ITEM_DOWN); break; - case 'm': launch_mutt(); break; + case 'm': launch_mutt(list_current_item()); + refresh_screen(); + break; case 'p': ui_print_database(); break; - case 'u': launch_lynx(); break; + case 'u': launch_wwwbrowser(list_current_item()); + refresh_screen(); + break; } } } -- 2.39.2