]> git.deb.at Git - pkg/abook.git/commitdiff
Changed launch_lynx to launch_wwwbrowser
authorJaakko Heinonen <jheinonen@users.sourceforge.net>
Sun, 27 May 2001 09:07:01 +0000 (09:07 +0000)
committerJaakko Heinonen <jheinonen@users.sourceforge.net>
Sun, 27 May 2001 09:07:01 +0000 (09:07 +0000)
abook.c
abook.h
edit.c
help.h
ui.c

diff --git a/abook.c b/abook.c
index 8366cfdd1a3c6058314e68800dbf377ad2335389..c80ea53f034609cea3d33bed60e9cdcd84dad831 100644 (file)
--- 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 e09145f95c23f14d8d5fd14253db72cda22ceb34..bcebcaab071f680db1aa9a3bd5f67807f341b61d 100644 (file)
--- 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 9ce4a8837c8cafd5fa83619c67e52c5cf9b2df4e..ae7643ea95ef12f060fd15003fbc11f22a9521b8 100644 (file)
--- 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 8fe0aa4fa57b2ea28fcb19af3fb6bc8400472a4a..2f1120d8cb0d66fc83c69bbccdab8f50a933bcda 100644 (file)
--- 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 86259789b1b80019a473f70192b1781c56dc8d6a..7c60b0681c11f3b370435f06d241a896e62036e7 100644 (file)
--- 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;
                }
        }
 }