From 18e40e0f4c45bf204571e548347e23b1bb5b4afd Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 12 Aug 2009 14:38:25 +0000 Subject: Make kbd_input() show a cancel splash to indicate user abort better and for better consistency all over the place. Change checking for its return value (style-wise) at some places too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22269 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/calendar.c | 4 ++-- apps/plugins/keybox.c | 12 ++++++------ apps/plugins/rockboy/menu.c | 2 +- apps/plugins/text_editor.c | 3 +-- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index e00afe1..cfb9290 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -568,7 +568,7 @@ static void add_memo(struct shown *shown, int type) { bool saved = false; if (rb->kbd_input(memos[memos_in_memory].message, - sizeof memos[memos_in_memory].message) != -1) + sizeof memos[memos_in_memory].message) == 0) { if (rb->strlen(memos[memos_in_memory].message)) { @@ -634,7 +634,7 @@ static bool edit_memo(int change, struct shown *shown) case 1: /* edit */ if(rb->kbd_input(memos[pointer_array[change]].message, - sizeof memos[pointer_array[change]].message) != -1) + sizeof memos[pointer_array[change]].message) == 0) save_memo(pointer_array[change],true,shown); return false; diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 6c59470..733c6e9 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -190,12 +190,12 @@ static void add_entry(int selected_item) rb->splash(HZ, "Enter title"); pw_list.entries[i].title[0] = '\0'; - if (rb->kbd_input(pw_list.entries[i].title, FIELD_LEN)) + if (rb->kbd_input(pw_list.entries[i].title, FIELD_LEN) < 0) return; rb->splash(HZ, "Enter name"); pw_list.entries[i].name[0] = '\0'; - if (rb->kbd_input(pw_list.entries[i].name, FIELD_LEN)) + if (rb->kbd_input(pw_list.entries[i].name, FIELD_LEN) < 0) { pw_list.entries[i].title[0] = '\0'; return; @@ -203,7 +203,7 @@ static void add_entry(int selected_item) rb->splash(HZ, "Enter password"); pw_list.entries[i].password[0] = '\0'; - if (rb->kbd_input(pw_list.entries[i].password, FIELD_LEN)) + if (rb->kbd_input(pw_list.entries[i].password, FIELD_LEN) < 0) { pw_list.entries[i].title[0] = '\0'; pw_list.entries[i].name[0] = '\0'; @@ -508,11 +508,11 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw) if (new_pw) { rb->splash(HZ, "Enter new master password"); - if (rb->kbd_input(buf[0], sizeof(buf[0]))) + if (rb->kbd_input(buf[0], sizeof(buf[0])) < 0) return -1; rb->splash(HZ, "Confirm master password"); - if (rb->kbd_input(buf[1], sizeof(buf[1]))) + if (rb->kbd_input(buf[1], sizeof(buf[1])) < 0) return -1; if (rb->strcmp(buf[0], buf[1])) @@ -529,7 +529,7 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw) } rb->splash(HZ, "Enter master password"); - if (rb->kbd_input(pw_buf, buflen)) + if (rb->kbd_input(pw_buf, buflen) < 0) return -1; hash_pw(&pwhash); return 0; diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c index 0978da0..290cac9 100644 --- a/apps/plugins/rockboy/menu.c +++ b/apps/plugins/rockboy/menu.c @@ -227,7 +227,7 @@ static bool do_slot(size_t slot_id, bool is_load) { /* if we're saving to a slot, then get a brief description */ if (!is_load) - if (rb->kbd_input(desc_buf, 20) || !strlen(desc_buf)) + if (rb->kbd_input(desc_buf, 20) || !strlen(desc_buf) < 0) { strlcpy(desc_buf, "Untitled", 20); } diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 06dc098..473bb68 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -182,10 +182,9 @@ bool save_changes(int overwrite) if (newfile || !overwrite) { - if(rb->kbd_input(filename,MAX_PATH)) + if(rb->kbd_input(filename,MAX_PATH) < 0) { newfile = true; - rb->splash(HZ, "Cancelled"); return false; } } -- cgit v1.1