summaryrefslogtreecommitdiff
path: root/apps/plugins/keybox.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
committerTeruaki Kawashima <teru@rockbox.org>2009-08-05 14:29:29 +0000
commite2e7ecf350a4d085f6f58052f55ba29e8fe77718 (patch)
treed5abd6a205b9d32cb11e1c2d0ea08602812248d4 /apps/plugins/keybox.c
parenteac0a5b840571a11b181fdfd463be61aca466976 (diff)
downloadrockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.tar.gz
rockbox-e2e7ecf350a4d085f6f58052f55ba29e8fe77718.zip
add playback control to more menu of plugins.
although it doesn't make much sense for some plugins like dice as the menu is only shown when you start that plugin. change star plugin to go back to menu when exit game instead of closing plugin so that above change makes useful. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22171 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/keybox.c')
-rw-r--r--apps/plugins/keybox.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 73fd138f09..448050938f 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -19,6 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playback_control.h"
22#include "lib/md5.h" 23#include "lib/md5.h"
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
@@ -29,7 +30,6 @@ PLUGIN_HEADER
29 30
30/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of 31/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
31 zeroes. After that comes the encrypted hash of the master password (16 bytes) */ 32 zeroes. After that comes the encrypted hash of the master password (16 bytes) */
32
33 33
34#define HEADER_LEN 24 34#define HEADER_LEN 24
35 35
@@ -106,9 +106,10 @@ static void decrypt(uint32_t* v, uint32_t* k)
106 106
107static int context_item_cb(int action, const struct menu_item_ex *this_item) 107static int context_item_cb(int action, const struct menu_item_ex *this_item)
108{ 108{
109 int i = (intptr_t)this_item;
109 if (action == ACTION_REQUEST_MENUITEM 110 if (action == ACTION_REQUEST_MENUITEM
110 && pw_list.num_entries == 0 111 && pw_list.num_entries == 0
111 && ((intptr_t)this_item) != 0) 112 && (i != 0 && i != 5))
112 { 113 {
113 return ACTION_EXIT_MENUITEM; 114 return ACTION_EXIT_MENUITEM;
114 } 115 }
@@ -117,8 +118,9 @@ static int context_item_cb(int action, const struct menu_item_ex *this_item)
117 118
118MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb, 119MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
119 "Add entry", 120 "Add entry",
120 "Edit title", "Edit user name", "Edit password", 121 "Edit title", "Edit user name", "Edit password",
121 "Delete entry") 122 "Delete entry",
123 "Playback Control");
122 124
123static char * kb_list_cb(int selected_item, void *data, 125static char * kb_list_cb(int selected_item, void *data,
124 char *buffer, size_t buffer_len) 126 char *buffer, size_t buffer_len)
@@ -133,7 +135,7 @@ static char * kb_list_cb(int selected_item, void *data,
133 } 135 }
134 if (!entry) 136 if (!entry)
135 return NULL; 137 return NULL;
136 138
137 rb->snprintf(buffer, buffer_len, "%s", entry->title); 139 rb->snprintf(buffer, buffer_len, "%s", entry->title);
138 140
139 return buffer; 141 return buffer;
@@ -161,7 +163,7 @@ static void delete_entry(int selected_item)
161 entry2 = entry->next; 163 entry2 = entry->next;
162 if (!entry2) 164 if (!entry2)
163 return; 165 return;
164 166
165 entry->next = entry2->next; 167 entry->next = entry2->next;
166 168
167 entry2->used = false; 169 entry2->used = false;
@@ -289,6 +291,9 @@ static void context_menu(int selected_item)
289 case 4: 291 case 4:
290 delete_entry(selected_item); 292 delete_entry(selected_item);
291 return; 293 return;
294 case 5:
295 playback_control(NULL);
296 return;
292 default: 297 default:
293 exit = true; 298 exit = true;
294 break; 299 break;
@@ -610,8 +615,9 @@ static int main_menu(void)
610 int selection, result, ret; 615 int selection, result, ret;
611 bool exit = false; 616 bool exit = false;
612 617
613 MENUITEM_STRINGLIST(menu,"Keybox", NULL, "Enter Keybox", 618 MENUITEM_STRINGLIST(menu, "Keybox", NULL,
614 "Reset Keybox", "Exit"); 619 "Enter Keybox", "Reset Keybox",
620 "Playback Control", "Exit");
615 621
616 do { 622 do {
617 result = rb->do_menu(&menu, &selection, NULL, false); 623 result = rb->do_menu(&menu, &selection, NULL, false);
@@ -625,6 +631,9 @@ static int main_menu(void)
625 reset(); 631 reset();
626 break; 632 break;
627 case 2: 633 case 2:
634 playback_control(NULL);
635 break;
636 case 3:
628 exit = true; 637 exit = true;
629 break; 638 break;
630 } 639 }