summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichiel Van Der Kolk <not.valid@email.address>2005-05-08 15:53:19 +0000
committerMichiel Van Der Kolk <not.valid@email.address>2005-05-08 15:53:19 +0000
commit3176a665d85de39715ee096a1989f4daedc4635a (patch)
treea72d8cedb597139968ca05dd507743624f1133e4
parent517eb7efa21635e97241200c5c9d4e46aaa9028e (diff)
downloadrockbox-3176a665d85de39715ee096a1989f4daedc4635a.tar.gz
rockbox-3176a665d85de39715ee096a1989f4daedc4635a.zip
Ladida fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6435 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/databox/databox.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c
index fe4886f513..51ba86f421 100644
--- a/apps/plugins/databox/databox.c
+++ b/apps/plugins/databox/databox.c
@@ -217,7 +217,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_update();
editor.currentindex=editor.tokencount=readtstream(filename,editor.token,200);
editing.currentselection=0;
- editing.selecting=editor.currentindex==0 ? 1 : 0;
+ editing.selecting=0;
+ if(editor.currentindex==0) {
+ editor.valid=check_tokenstream(editor.token,editor.editingmode);
+ check_accepted(editor.token,editor.currentindex);
+ editing.selecting=1;
+ buildchoices(acceptedmask);
+ rb->memset(&editing.old_token,0,sizeof(struct token));
+ }
do {
rb->lcd_clear_display();
rb->lcd_update();
@@ -285,14 +292,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
editor.currentindex=(editor.currentindex +
editor.tokencount) % (editor.tokencount+1);
}
- if(button&BUTTON_RIGHT
+ else if(button&BUTTON_RIGHT
#if CONFIG_KEYPAD == IRIVER_H100_PAD
||button&BUTTON_UP
#endif
) {
editor.currentindex=(editor.currentindex+1) % (editor.tokencount+1);
}
- if(button&BUTTON_SELECT) {
+ else if(button&BUTTON_OFF) {
+ done=1;
+ }
+ else if(button&BUTTON_SELECT) {
editing.selecting=1;
editing.currentselection=0;
buildchoices(acceptedmask);
@@ -300,12 +310,18 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
}
} while (!done);
- if(writetstream(filename,editor.token)) {
- rb->splash(HZ*2,true,"Wrote file succesfully ^.^");
- return PLUGIN_OK;
+ if(editor.valid&&editor.tokencount>0) {
+ if(writetstream(filename,editor.token)) {
+ rb->splash(HZ*2,true,"Wrote file succesfully ^.^");
+ return PLUGIN_OK;
+ }
+ else {
+ rb->splash(HZ*2,true,"Error while writing file :(");
+ return PLUGIN_ERROR;
+ }
}
else {
- rb->splash(HZ*2,true,"Error while writing rsp :(");
- return PLUGIN_ERROR;
+ rb->splash(HZ*2,true,"Search query invalid, not saving.");
+ return PLUGIN_OK;
}
}