summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/player/keyboard.c9
-rw-r--r--apps/playlist_viewer.c2
-rw-r--r--apps/plugins/calendar.c4
-rw-r--r--apps/plugins/keybox.c12
-rw-r--r--apps/plugins/rockboy/menu.c2
-rw-r--r--apps/plugins/text_editor.c3
-rw-r--r--apps/recorder/keyboard.c8
-rw-r--r--apps/settings.c1
-rw-r--r--apps/tagtree.c2
9 files changed, 24 insertions, 19 deletions
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index 114b3fdf24..4f8a8b09e5 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -112,6 +112,7 @@ int kbd_input(char* text, int buflen)
112 unsigned char *utf8; 112 unsigned char *utf8;
113 113
114 int button, lastbutton = 0; 114 int button, lastbutton = 0;
115 int ret;
115 116
116 editpos = utf8length(text); 117 editpos = utf8length(text);
117 118
@@ -185,7 +186,7 @@ int kbd_input(char* text, int buflen)
185 switch (button) 186 switch (button)
186 { 187 {
187 case BUTTON_STOP: /* abort */ 188 case BUTTON_STOP: /* abort */
188 return -1; 189 ret = -1; done = true;
189 break; 190 break;
190 191
191 case BUTTON_MENU: /* page flip */ 192 case BUTTON_MENU: /* page flip */
@@ -245,7 +246,7 @@ int kbd_input(char* text, int buflen)
245 246
246 case BUTTON_PLAY | BUTTON_REPEAT: 247 case BUTTON_PLAY | BUTTON_REPEAT:
247 /* accepts what was entered and continues */ 248 /* accepts what was entered and continues */
248 done = true; 249 ret = 0; done = true;
249 break; 250 break;
250 251
251 case BUTTON_PLAY | BUTTON_REL: 252 case BUTTON_PLAY | BUTTON_REL:
@@ -304,6 +305,8 @@ int kbd_input(char* text, int buflen)
304 lastbutton = button; 305 lastbutton = button;
305 } 306 }
306 307
307 return 0; 308 if (ret < 0)
309 splash(HZ/2, ID2P(LANG_CANCEL));
310 return ret;
308} 311}
309 312
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 1e1aab8c54..7d3ff4ef9e 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -802,7 +802,7 @@ bool search_playlist(void)
802 802
803 if (!playlist_viewer_init(&viewer, 0, false)) 803 if (!playlist_viewer_init(&viewer, 0, false))
804 return ret; 804 return ret;
805 if (kbd_input(search_str, sizeof(search_str)) == -1) 805 if (kbd_input(search_str, sizeof(search_str)) < 0)
806 return ret; 806 return ret;
807 lcd_clear_display(); 807 lcd_clear_display();
808 playlist_count = playlist_amount_ex(viewer.playlist); 808 playlist_count = playlist_amount_ex(viewer.playlist);
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index e00afe19b6..cfb92909bf 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -568,7 +568,7 @@ static void add_memo(struct shown *shown, int type)
568{ 568{
569 bool saved = false; 569 bool saved = false;
570 if (rb->kbd_input(memos[memos_in_memory].message, 570 if (rb->kbd_input(memos[memos_in_memory].message,
571 sizeof memos[memos_in_memory].message) != -1) 571 sizeof memos[memos_in_memory].message) == 0)
572 { 572 {
573 if (rb->strlen(memos[memos_in_memory].message)) 573 if (rb->strlen(memos[memos_in_memory].message))
574 { 574 {
@@ -634,7 +634,7 @@ static bool edit_memo(int change, struct shown *shown)
634 634
635 case 1: /* edit */ 635 case 1: /* edit */
636 if(rb->kbd_input(memos[pointer_array[change]].message, 636 if(rb->kbd_input(memos[pointer_array[change]].message,
637 sizeof memos[pointer_array[change]].message) != -1) 637 sizeof memos[pointer_array[change]].message) == 0)
638 save_memo(pointer_array[change],true,shown); 638 save_memo(pointer_array[change],true,shown);
639 return false; 639 return false;
640 640
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 6c59470fa4..733c6e95cd 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -190,12 +190,12 @@ static void add_entry(int selected_item)
190 190
191 rb->splash(HZ, "Enter title"); 191 rb->splash(HZ, "Enter title");
192 pw_list.entries[i].title[0] = '\0'; 192 pw_list.entries[i].title[0] = '\0';
193 if (rb->kbd_input(pw_list.entries[i].title, FIELD_LEN)) 193 if (rb->kbd_input(pw_list.entries[i].title, FIELD_LEN) < 0)
194 return; 194 return;
195 195
196 rb->splash(HZ, "Enter name"); 196 rb->splash(HZ, "Enter name");
197 pw_list.entries[i].name[0] = '\0'; 197 pw_list.entries[i].name[0] = '\0';
198 if (rb->kbd_input(pw_list.entries[i].name, FIELD_LEN)) 198 if (rb->kbd_input(pw_list.entries[i].name, FIELD_LEN) < 0)
199 { 199 {
200 pw_list.entries[i].title[0] = '\0'; 200 pw_list.entries[i].title[0] = '\0';
201 return; 201 return;
@@ -203,7 +203,7 @@ static void add_entry(int selected_item)
203 203
204 rb->splash(HZ, "Enter password"); 204 rb->splash(HZ, "Enter password");
205 pw_list.entries[i].password[0] = '\0'; 205 pw_list.entries[i].password[0] = '\0';
206 if (rb->kbd_input(pw_list.entries[i].password, FIELD_LEN)) 206 if (rb->kbd_input(pw_list.entries[i].password, FIELD_LEN) < 0)
207 { 207 {
208 pw_list.entries[i].title[0] = '\0'; 208 pw_list.entries[i].title[0] = '\0';
209 pw_list.entries[i].name[0] = '\0'; 209 pw_list.entries[i].name[0] = '\0';
@@ -508,11 +508,11 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw)
508 if (new_pw) 508 if (new_pw)
509 { 509 {
510 rb->splash(HZ, "Enter new master password"); 510 rb->splash(HZ, "Enter new master password");
511 if (rb->kbd_input(buf[0], sizeof(buf[0]))) 511 if (rb->kbd_input(buf[0], sizeof(buf[0])) < 0)
512 return -1; 512 return -1;
513 513
514 rb->splash(HZ, "Confirm master password"); 514 rb->splash(HZ, "Confirm master password");
515 if (rb->kbd_input(buf[1], sizeof(buf[1]))) 515 if (rb->kbd_input(buf[1], sizeof(buf[1])) < 0)
516 return -1; 516 return -1;
517 517
518 if (rb->strcmp(buf[0], buf[1])) 518 if (rb->strcmp(buf[0], buf[1]))
@@ -529,7 +529,7 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw)
529 } 529 }
530 530
531 rb->splash(HZ, "Enter master password"); 531 rb->splash(HZ, "Enter master password");
532 if (rb->kbd_input(pw_buf, buflen)) 532 if (rb->kbd_input(pw_buf, buflen) < 0)
533 return -1; 533 return -1;
534 hash_pw(&pwhash); 534 hash_pw(&pwhash);
535 return 0; 535 return 0;
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index 0978da0b09..290cac98de 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) {
227 227
228 /* if we're saving to a slot, then get a brief description */ 228 /* if we're saving to a slot, then get a brief description */
229 if (!is_load) 229 if (!is_load)
230 if (rb->kbd_input(desc_buf, 20) || !strlen(desc_buf)) 230 if (rb->kbd_input(desc_buf, 20) || !strlen(desc_buf) < 0)
231 { 231 {
232 strlcpy(desc_buf, "Untitled", 20); 232 strlcpy(desc_buf, "Untitled", 20);
233 } 233 }
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 06dc098501..473bb68ead 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -182,10 +182,9 @@ bool save_changes(int overwrite)
182 182
183 if (newfile || !overwrite) 183 if (newfile || !overwrite)
184 { 184 {
185 if(rb->kbd_input(filename,MAX_PATH)) 185 if(rb->kbd_input(filename,MAX_PATH) < 0)
186 { 186 {
187 newfile = true; 187 newfile = true;
188 rb->splash(HZ, "Cancelled");
189 return false; 188 return false;
190 } 189 }
191 } 190 }
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 32933cdcfd..7eb798143e 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -297,6 +297,7 @@ int kbd_input(char* text, int buflen)
297 unsigned short ch; 297 unsigned short ch;
298 unsigned char *utf8; 298 unsigned char *utf8;
299 bool cur_blink = true; /* Cursor on/off flag */ 299 bool cur_blink = true; /* Cursor on/off flag */
300 int ret;
300#ifdef KBD_MORSE_INPUT 301#ifdef KBD_MORSE_INPUT
301 bool morse_reading = false; 302 bool morse_reading = false;
302 unsigned char morse_code = 0; 303 unsigned char morse_code = 0;
@@ -779,7 +780,7 @@ int kbd_input(char* text, int buflen)
779 global_settings.buttonbar=buttonbar_config; 780 global_settings.buttonbar=buttonbar_config;
780#endif 781#endif
781 viewportmanager_set_statusbar(oldbars); 782 viewportmanager_set_statusbar(oldbars);
782 return -1; 783 ret = -1; done = true;
783 break; 784 break;
784 785
785 case ACTION_KBD_PAGE_FLIP: 786 case ACTION_KBD_PAGE_FLIP:
@@ -1000,6 +1001,7 @@ int kbd_input(char* text, int buflen)
1000 1001
1001 case ACTION_KBD_DONE: 1002 case ACTION_KBD_DONE:
1002 /* accepts what was entered and continues */ 1003 /* accepts what was entered and continues */
1004 ret = 0;
1003 done = true; 1005 done = true;
1004 break; 1006 break;
1005 1007
@@ -1249,5 +1251,7 @@ int kbd_input(char* text, int buflen)
1249 screens[l].setfont(FONT_UI); 1251 screens[l].setfont(FONT_UI);
1250 viewportmanager_set_statusbar(oldbars); 1252 viewportmanager_set_statusbar(oldbars);
1251 1253
1252 return 0; 1254 if (ret < 0)
1255 splash(HZ/2, ID2P(LANG_CANCEL));
1256 return ret;
1253} 1257}
diff --git a/apps/settings.c b/apps/settings.c
index 6a761ecdd9..bd2958e4e2 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -652,7 +652,6 @@ bool settings_save_config(int options)
652 break; 652 break;
653 } 653 }
654 else { 654 else {
655 splash(HZ, ID2P(LANG_CANCEL));
656 return false; 655 return false;
657 } 656 }
658 } 657 }
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 5d61589eab..de75223e0b 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1483,7 +1483,7 @@ int tagtree_enter(struct tree_context* c)
1483 else 1483 else
1484 { 1484 {
1485 rc = kbd_input(searchstring, SEARCHSTR_SIZE); 1485 rc = kbd_input(searchstring, SEARCHSTR_SIZE);
1486 if (rc == -1 || !searchstring[0]) 1486 if (rc < 0 || !searchstring[0])
1487 { 1487 {
1488 tagtree_exit(c); 1488 tagtree_exit(c);
1489 return 0; 1489 return 0;