Date:2010-11-10 13:30:07 (13 years 4 months ago)
Author:kyak
Commit:f995e57425a9c1be38a77d07e2e438475efe3385
Message:abook: now suitable for Ben term size

Files: abook/Makefile (2 diffs)
abook/files/abook.sh (1 diff)
abook/files/abookrc (1 diff)
abook/patches/001-term-size.patch (1 diff)
abook/patches/abook_h.patch (1 diff)

Change Details

abook/Makefile
1717    CATEGORY:=Utilities
1818    TITLE:=abook
1919    URL:=http://abook.sourceforge.net/
20    DEPENDS:=+libreadline +libncurses +setfont2
20    DEPENDS:=+libreadline +libncurses
2121endef
2222
2323define Package/abook/description
...... 
2727CONFIGURE_ARGS+="--with-curses=$(STAGING_DIR)/lib"
2828
2929define Package/abook/install
30    $(INSTALL_DIR) $(1)/usr/bin $(1)/etc
31    $(INSTALL_BIN) $(PKG_BUILD_DIR)/abook $(1)/usr/bin/abook.bin
32    $(INSTALL_BIN) $(FILES_DIR)/abook.sh $(1)/usr/bin/abook
33    $(INSTALL_DATA) $(FILES_DIR)/abookrc $(1)/etc
30    $(INSTALL_DIR) $(1)/usr/bin
31    $(INSTALL_BIN) $(PKG_BUILD_DIR)/abook $(1)/usr/bin
3432endef
3533
3634$(eval $(call BuildPackage,abook))
abook/files/abook.sh
1#!/bin/sh
2/usr/sbin/setfont2 /usr/share/setfont2/un-fuzzy-4x8-font.pnm
3/usr/bin/abook.bin -C /etc/abookrc $*
4/usr/sbin/setfont2 /usr/share/setfont2/un-fuzzy-6x10-font.pnm
abook/files/abookrc
1set use_ascii_only=true
abook/patches/001-term-size.patch
1diff -ur abook-0.5.6.orig/abook.h abook-0.5.6/abook.h
2--- abook-0.5.6.orig/abook.h 2010-11-09 22:02:43.433150687 +0300
3@@ -13,12 +13,12 @@
4 int strncasecmp (const char *, const char *, size_t);
5 #endif
6
7-#define MAIN_HELPLINE N_("q:quit ?:help a:add r:remove")
8+#define MAIN_HELPLINE N_("q:quit ?:help a:add r:remove")
9
10 #define Y_STATUSLINE (LINES - 2)
11
12-#define MIN_LINES 20
13-#define MIN_COLS 70
14+#define MIN_LINES 24
15+#define MIN_COLS 53
16
17 #define DEFAULT_UMASK 066
18 #define DIR_IN_HOME ".abook"
19diff -ur abook-0.5.6.orig/edit.c abook-0.5.6/edit.c
20--- abook-0.5.6.orig/edit.c 2010-11-09 22:02:43.428150554 +0300
21@@ -39,40 +39,39 @@
22 editor_tab(const int tab)
23 {
24     int i, j;
25- int x_pos = 2; /* current x pos */
26+ int x_pos = 0; /* current x pos */
27     static char *tab_names[] = {
28         N_("CONTACT"),
29         N_("ADDRESS"),
30- N_(" PHONE "),
31- N_(" OTHER "),
32- N_("CUSTOM ")
33+ N_("PHONE"),
34+ N_("OTHER"),
35+ N_("CUSTOM")
36     };
37
38     mvwhline(editw, TABLINE + 1, 0, UI_HLINE_CHAR, EDITW_COLS);
39
40     for(i = 0; i < TABS; i++) {
41- int width = strwidth(gettext(tab_names[i])) + 5;
42+ int width = strwidth(gettext(tab_names[i])) + 4;
43
44         if(x_pos + width + 1 > EDITW_COLS) {
45             statusline_msg(_("Tab name too wide for screen"));
46             break;
47         }
48-
49         mvwaddch(editw, TABLINE + 1, x_pos, UI_TEE_CHAR);
50- mvwaddch(editw, TABLINE + 1, x_pos + width - 2, UI_TEE_CHAR);
51+ mvwaddch(editw, TABLINE + 1, x_pos + width - 1, UI_TEE_CHAR);
52
53         mvwaddch(editw, TABLINE, x_pos, UI_ULCORNER_CHAR);
54         mvwaddch(editw, TABLINE, x_pos + 1, UI_LBOXLINE_CHAR);
55         mvwaddstr(editw, TABLINE, x_pos + 2, gettext(tab_names[i]));
56- mvwaddch(editw, TABLINE, x_pos + width - 3, UI_RBOXLINE_CHAR);
57- mvwaddch(editw, TABLINE, x_pos + width - 2, UI_URCORNER_CHAR);
58+ mvwaddch(editw, TABLINE, x_pos + width - 2, UI_RBOXLINE_CHAR);
59+ mvwaddch(editw, TABLINE, x_pos + width - 1, UI_URCORNER_CHAR);
60
61         if(i == tab) {
62             mvwaddch(editw, TABLINE + 1, x_pos, UI_LRCORNER_CHAR);
63- for(j = 0; j < width - 3; j++)
64+ for(j = 0; j < width - 2; j++)
65                 mvwaddstr(editw,
66                     TABLINE + 1, x_pos + j + 1, " ");
67- mvwaddch(editw, TABLINE + 1, x_pos + width - 2,
68+ mvwaddch(editw, TABLINE + 1, x_pos + width - 1,
69                 UI_LLCORNER_CHAR);
70         }
71         x_pos += width;
72diff -ur abook-0.5.6.orig/edit.h abook-0.5.6/edit.h
73--- abook-0.5.6.orig/edit.h 2010-11-09 22:02:43.432150660 +0300
74@@ -5,20 +5,20 @@
75 void get_first_email(char *str, int item);
76 void add_item();
77
78-#define EDITW_COLS (COLS - 6)
79+#define EDITW_COLS COLS
80 #define EDITW_LINES (LINES - 5)
81 #define EDITW_TOP 2
82-#define EDITW_X 3
83+#define EDITW_X 0
84
85-#define EDITOR_HELPLINE N_("?:help c:contact a:address p:phone o:other")
86+#define EDITOR_HELPLINE N_("?:help c:cont. a:addr. p:phone o:other")
87
88 #define TABLINE 1
89
90 #define MAX_TAB_FIELDS 7
91
92-#define TAB_COLON_POS 28
93+#define TAB_COLON_POS 19
94 #define FIELDS_START_Y 4
95-#define FIELDS_START_X 4
96+#define FIELDS_START_X 0
97
98 enum {
99     TAB_CONTACT,
100diff -ur abook-0.5.6.orig/help.h abook-0.5.6/help.h
101--- abook-0.5.6.orig/help.h 2010-11-09 22:02:43.432150660 +0300
102@@ -8,43 +8,43 @@
103 /* TODO gettext: handle key and description separately? */
104 static char *mainhelp[] = {
105
106-N_(" ? help\n"),
107-N_(" q quit\n"),
108-N_(" Q quit without saving\n"),
109-N_(" P quit and output selected item(s) to stderr\n"),
110-N_(" ^L refresh screen\n"),
111-"\n",
112-N_(" arrows / j,k scroll list\n"),
113-N_(" enter view/edit item\n"),
114-N_(" a add item\n"),
115-N_(" r / del remove selected items\n"),
116-N_(" D duplicate item\n"),
117-"\n",
118-N_(" space select item\n"),
119-N_(" + select all\n"),
120-N_(" - unselect all\n"),
121-N_(" * invert selection\n"),
122-"\n",
123-N_(" w write database to disk\n"),
124-N_(" l read database from disk\n"),
125-N_(" C clear whole database\n"),
126-N_(" i import database\n"),
127-N_(" e export database\n"),
128-N_(" p print database\n"),
129-N_(" o open database\n"),
130-"\n",
131-N_(" s sort database\n"),
132-N_(" S \"surname sort\"\n"),
133-N_(" F sort by field (defined in configuration file)\n"),
134+N_(" ? help\n"),
135+N_(" q quit\n"),
136+N_(" Q quit without saving\n"),
137+N_(" P quit and output selected item(s) to stderr\n"),
138+N_(" ^L refresh screen\n"),
139+"\n",
140+N_(" arrows / j,k scroll list\n"),
141+N_(" enter view/edit item\n"),
142+N_(" a add item\n"),
143+N_(" r / del remove selected items\n"),
144+N_(" D duplicate item\n"),
145+"\n",
146+N_(" space select item\n"),
147+N_(" + select all\n"),
148+N_(" - unselect all\n"),
149+N_(" * invert selection\n"),
150+"\n",
151+N_(" w write database to disk\n"),
152+N_(" l read database from disk\n"),
153+N_(" C clear whole database\n"),
154+N_(" i import database\n"),
155+N_(" e export database\n"),
156+N_(" p print database\n"),
157+N_(" o open database\n"),
158+"\n",
159+N_(" s sort database\n"),
160+N_(" S \"surname sort\"\n"),
161+N_(" F sort by field (defined in configuration file)\n"),
162 "\n",
163-N_(" / search\n"),
164-N_(" \\ search next occurrence\n"),
165+N_(" / search\n"),
166+N_(" \\ search next occurrence\n"),
167 "\n",
168-N_(" A move current item up\n"),
169-N_(" Z move current item down\n"),
170+N_(" A move current item up\n"),
171+N_(" Z move current item down\n"),
172 "\n",
173-N_(" m send mail with mutt\n"),
174-N_(" v view URL with web browser\n"),
175+N_(" m send mail with mutt\n"),
176+N_(" v view URL with web browser\n"),
177 NULL
178
179 };
180@@ -52,19 +52,19 @@
181 static char *editorhelp[] = {
182
183 "\n",
184-N_(" a,c,p,o,C/arrows/h,l change tab\n"),
185+N_(" a,c,p,o,C/arrows/h,l change tab\n"),
186 "\n",
187-N_(" 1 - 5 edit fields\n"),
188+N_(" 1 - 5 edit fields\n"),
189 "\n",
190-N_(" k or < previous item\n"),
191-N_(" j or > next item\n"),
192+N_(" k or < previous item\n"),
193+N_(" j or > next item\n"),
194 "\n",
195-N_(" r roll e-mail addresses\n"),
196+N_(" r roll e-mail addresses\n"),
197 "\n",
198-N_(" u undo\n"),
199+N_(" u undo\n"),
200 "\n",
201-N_(" m send mail with mutt\n"),
202-N_(" v view url with web browser\n"),
203+N_(" m send mail with mutt\n"),
204+N_(" v view url with web browser\n"),
205 "\n",
206 NULL
207
208diff -ur abook-0.5.6.orig/options.c abook-0.5.6/options.c
209--- abook-0.5.6.orig/options.c 2010-11-09 22:02:43.432150660 +0300
210@@ -49,10 +49,10 @@
211     { "autosave", OT_BOOL, BOOL_AUTOSAVE, TRUE },
212
213     { "show_all_emails", OT_BOOL, BOOL_SHOW_ALL_EMAILS, TRUE },
214- { "emailpos", OT_INT, INT_EMAILPOS, 25 },
215+ { "emailpos", OT_INT, INT_EMAILPOS, 16 },
216     { "extra_column", OT_STR, STR_EXTRA_COLUMN, UL "phone" },
217     { "extra_alternative", OT_STR, STR_EXTRA_ALTERNATIVE, UL "-1" },
218- { "extrapos", OT_INT, INT_EXTRAPOS, 65 },
219+ { "extrapos", OT_INT, INT_EXTRAPOS, 40 },
220
221     { "mutt_command", OT_STR, STR_MUTT_COMMAND, UL "mutt" },
222     { "mutt_return_all_emails", OT_BOOL, BOOL_MUTT_RETURN_ALL_EMAILS,
223@@ -64,7 +64,7 @@
224
225     { "address_style", OT_STR, STR_ADDRESS_STYLE, UL "eu" },
226
227- { "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, FALSE },
228+ { "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, TRUE },
229
230     { "add_email_prevent_duplicates", OT_BOOL, BOOL_ADD_EMAIL_PREVENT_DUPLICATES, FALSE },
231     { "sort_field", OT_STR, STR_SORT_FIELD, UL "nick" },
232diff -ur abook-0.5.6.orig/ui.c abook-0.5.6/ui.c
233--- abook-0.5.6.orig/ui.c 2010-11-09 22:02:43.427150520 +0300
234@@ -406,7 +406,7 @@
235         default:return;
236     }
237
238- helpw = newwin(LINES - 5, COLS - 6, 2, 3);
239+ helpw = newwin(LINES - 5, COLS, 2, 0);
240     erase();
241     headerline(_("help"));
242
243@@ -588,7 +588,7 @@
244 void
245 ui_print_number_of_items()
246 {
247- char *str = strdup_printf(" " "|%3d/%3d", selected_items(), items);
248+ char *str = strdup_printf(" " "|%3d/%3d", selected_items(), items);
249
250     mvaddstr(0, COLS-strlen(str), str);
251
abook/patches/abook_h.patch
1+++ abook-0.5.6m/abook.h 2010-09-08 19:50:56.316495243 +0200
2@@ -17,8 +17,8 @@
3
4 #define Y_STATUSLINE (LINES - 2)
5
6-#define MIN_LINES 20
7-#define MIN_COLS 70
8+#define MIN_LINES 15
9+#define MIN_COLS 40
10
11 #define DEFAULT_UMASK 066
12 #define DIR_IN_HOME ".abook"

Archive Download the corresponding diff file



interactive