0.4.15
- new options --add-email and --add-email-quiet
- proper mutt alias import filter
+ - minor editor update
+ - don't handle extra_column and extra_alternative as numbers in abookrc
- mail.vim update in contrib directory
0.4.14
# Define the identity of the package.
PACKAGE=abook
-VERSION=0.4.15pre1
+VERSION=0.4.15pre2
cat >> confdefs.h <<EOF
#define PACKAGE "$PACKAGE"
EOF
dnl abook configure.in
AC_INIT(abook.c)
-AM_INIT_AUTOMAKE(abook, 0.4.15pre1)
+AM_INIT_AUTOMAKE(abook, 0.4.15pre2)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST
x = (EDITW_COLS - len) / 2;
mvwaddstr(editw, 0, x, header);
for(i = x; i < x + len; i++)
- mvwaddch(editw,1, i, '^');
+ mvwaddch(editw, 1, i, '^');
free(header);
}
static void
editor_print_data(int tab, int item)
{
- const int pos_x = EDITW_COLS > 70 ? 8:4;
- const int start_y = 5;
int i, j;
int y, x;
char emails[MAX_EMAILS][MAX_EMAIL_LEN];
split_emailstr(item, emails);
getyx(editw, y, x);
- mvwaddstr(editw, y+1, pos_x, "E-mail addresses:");
+ mvwaddstr(editw, y+1, TAB_START_X, "E-mail addresses:");
for(k = 0; k < MAX_EMAILS; k++) {
getyx(editw, y, x);
- mvwprintw(editw, y+1, pos_x,
- "%c -\t\t%s", '2' + k, emails[k] );
+ mvwprintw(editw, y+1, TAB_START_X,
+ "%c -", '2' + k);
+ mvwprintw(editw, y +1, TAB_COLON_POS,
+ ": %s", emails[k]);
}
continue;
}
if(j > 1) {
getyx(editw, y, x); y++;
} else
- y = start_y;
+ y = TAB_START_Y;
- mvwprintw(editw, y, pos_x, "%d - %s",
+ mvwprintw(editw, y, TAB_START_X, "%d - %s",
j,
abook_fields[i].name);
- mvwaddch(editw, y, 28, ':');
- mvwaddstr(editw, y, 30, safe_str(database[item][i]));
+ mvwaddch(editw, y, TAB_COLON_POS, ':');
+ mvwaddstr(editw, y, TAB_COLON_POS + 2,
+ safe_str(database[item][i]));
j++;
}
my_free(database[item][EMAIL]);
- for(i=0; i<MAX_EMAILS; i++) {
+ for(i = 0; i < MAX_EMAILS; i++) {
if( *emails[i] ) {
strcat(tmp, emails[i]);
strcat(tmp, ",");
int n = c - '1' + 1;
char *str;
- if(n < 1 || n > 6)
+ if(n < 1 || n > MAX_TAB_LINES)
return 0;
edit_undo(item, BACKUP_ITEM);
#define TABLINE 2
+#define MAX_TAB_LINES 7
+
+#define TAB_COLON_POS 28
+#define TAB_START_Y 5
+#define TAB_START_X (EDITW_COLS > 70 ? 8:4)
+
enum {
TAB_CONTACT,
TAB_ADDRESS,
#include "misc.h"
#include "options.h"
+#define MIN_EXTRA_COLUMN ADDRESS /* 2 */
+#define MAX_EXTRA_COLUMN LAST_FIELD
+
int curitem = -1;
int first_list_item = -1;
char *selected = NULL;
+int extra_column = -1;
+int extra_alternative = -1;
+
extern int items;
extern list_item *database;
extern struct abook_field abook_fields[];
void
init_list()
{
+ int i;
+ char *e_column_str = options_get_str("extra_column");
+ char *e_alternative_str = options_get_str("extra_alternative");
+
list = newwin(LIST_LINES, LIST_COLS, LIST_TOP, 0);
scrollok(list, TRUE);
+
+ /*
+ * init extra_column and extra alternative
+ */
+
+ if(e_column_str && *e_column_str) {
+ for(i = 0; i < ITEM_FIELDS; i++) {
+ if(!strcasecmp(e_column_str, abook_fields[i].key)) {
+ extra_column = i;
+ break;
+ }
+ }
+ if(extra_column < MIN_EXTRA_COLUMN ||
+ extra_column > MAX_EXTRA_COLUMN) {
+ extra_column = -1;
+ }
+ }
+
+ if(e_alternative_str && *e_alternative_str) {
+ for(i = 0; i < ITEM_FIELDS; i++) {
+ if(!strcasecmp(e_alternative_str,
+ abook_fields[i].key)) {
+ extra_alternative = i;
+ break;
+ }
+ }
+ if(extra_alternative < MIN_EXTRA_COLUMN ||
+ extra_alternative > MAX_EXTRA_COLUMN) {
+ extra_alternative = -1;
+ }
+ }
+
}
void
void
print_list_line(int i, int line)
{
+ int extra = extra_column;
char tmp[MAX_EMAILSTR_LEN];
- int extra_column = options_get_int("extra_column");
- int real_emaillen = (extra_column > 2 && extra_column < ITEM_FIELDS) ?
+ int real_emaillen = (extra_column > 0 || extra_alternative > 0) ?
EMAILLEN : COLS - EMAILPOS;
scrollok(list, FALSE);
mvwaddnstr(list, line, EMAILPOS, tmp, real_emaillen);
}
- if(extra_column > 2 && extra_column < ITEM_FIELDS) {
- if( !database[i][extra_column] ) {
- int extra_alternative =
- options_get_int("extra_alternative");
-
- if(extra_alternative > 2 &&
- extra_alternative < ITEM_FIELDS)
- extra_column = extra_alternative;
- }
+ if(extra < 0 || !database[i][extra])
+ extra = extra_alternative;
+ if(extra >= 0)
mvwaddnstr(list, line, EXTRAPOS,
- safe_str(database[i][extra_column]),
+ safe_str(database[i][extra]),
EXTRALEN);
- }
scrollok(list, TRUE);
}
void
list_headerline()
{
- int extra_column = options_get_int("extra_column");
-
attrset(A_BOLD);
mvaddstr(2, NAMEPOS, abook_fields[NAME].name);
mvaddstr(2, EMAILPOS, abook_fields[EMAIL].name);
- if( extra_column > 2 && extra_column < ITEM_FIELDS )
+ if(extra_column > 0)
mvaddnstr(2, EXTRAPOS, abook_fields[extra_column].name,
COLS-EXTRAPOS);
attrset(A_NORMAL);
emailpos=25
# Field to be used in the extra column
-extra_column=7
+extra_column=phone
# frequently used values:
-# -1 = disabled
-# 7 = Home Phone
-# 8 = Work Phone
-# 9 = Fax
-# 10 = Mobile Phone
-# 11 = Nick / Alias
-# 12 = URL
+# -1 disabled
+# phone Home Phone
+# workphone Work Phone
+# fax Fax
+# mobile Mobile Phone
+# nick Nick / Alias
+# url URL
# Specify an alternative field to be displayed in the extra
# column if there is no data for the field specified in