diff options
Diffstat (limited to 'apps/shortcuts.c')
-rw-r--r-- | apps/shortcuts.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index c64976c46c..a32c298f6d 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -61,6 +61,7 @@ static const char * const type_strings[SHORTCUT_TYPE_COUNT] = { | |||
61 | [SHORTCUT_PLAYLISTMENU] = "playlist menu", | 61 | [SHORTCUT_PLAYLISTMENU] = "playlist menu", |
62 | [SHORTCUT_SEPARATOR] = "separator", | 62 | [SHORTCUT_SEPARATOR] = "separator", |
63 | [SHORTCUT_SHUTDOWN] = "shutdown", | 63 | [SHORTCUT_SHUTDOWN] = "shutdown", |
64 | [SHORTCUT_REBOOT] = "reboot", | ||
64 | [SHORTCUT_TIME] = "time", | 65 | [SHORTCUT_TIME] = "time", |
65 | }; | 66 | }; |
66 | 67 | ||
@@ -189,6 +190,7 @@ static bool verify_shortcut(struct shortcut* sc) | |||
189 | case SHORTCUT_DEBUGITEM: | 190 | case SHORTCUT_DEBUGITEM: |
190 | case SHORTCUT_SEPARATOR: | 191 | case SHORTCUT_SEPARATOR: |
191 | case SHORTCUT_SHUTDOWN: | 192 | case SHORTCUT_SHUTDOWN: |
193 | case SHORTCUT_REBOOT: | ||
192 | default: | 194 | default: |
193 | break; | 195 | break; |
194 | } | 196 | } |
@@ -362,6 +364,7 @@ static int readline_cb(int n, char *buf, void *parameters) | |||
362 | break; | 364 | break; |
363 | case SHORTCUT_SEPARATOR: | 365 | case SHORTCUT_SEPARATOR: |
364 | case SHORTCUT_SHUTDOWN: | 366 | case SHORTCUT_SHUTDOWN: |
367 | case SHORTCUT_REBOOT: | ||
365 | break; | 368 | break; |
366 | } | 369 | } |
367 | } | 370 | } |
@@ -444,10 +447,11 @@ static const char * shortcut_menu_get_name(int selected_item, void * data, | |||
444 | } | 447 | } |
445 | return sc->name; | 448 | return sc->name; |
446 | } | 449 | } |
447 | else if (sc->type == SHORTCUT_SHUTDOWN && sc->name[0] == '\0') | 450 | else if ((sc->type == SHORTCUT_SHUTDOWN || sc->type == SHORTCUT_REBOOT) && |
451 | sc->name[0] == '\0') | ||
448 | { | 452 | { |
449 | /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ | 453 | /* No translation support as only soft_shutdown has LANG_SHUTDOWN defined */ |
450 | return type_strings[SHORTCUT_SHUTDOWN]; | 454 | return type_strings[sc->type]; |
451 | } | 455 | } |
452 | else if (sc->type == SHORTCUT_BROWSER && sc->name[0] == '\0' && (sc->u.path)[0] != '\0') | 456 | else if (sc->type == SHORTCUT_BROWSER && sc->name[0] == '\0' && (sc->u.path)[0] != '\0') |
453 | { | 457 | { |
@@ -524,6 +528,7 @@ static enum themable_icons shortcut_menu_get_icon(int selected_item, void * data | |||
524 | case SHORTCUT_PLAYLISTMENU: | 528 | case SHORTCUT_PLAYLISTMENU: |
525 | return Icon_Playlist; | 529 | return Icon_Playlist; |
526 | case SHORTCUT_SHUTDOWN: | 530 | case SHORTCUT_SHUTDOWN: |
531 | case SHORTCUT_REBOOT: | ||
527 | return Icon_System_menu; | 532 | return Icon_System_menu; |
528 | case SHORTCUT_TIME: | 533 | case SHORTCUT_TIME: |
529 | return Icon_Menu_functioncall; | 534 | return Icon_Menu_functioncall; |
@@ -605,11 +610,13 @@ static int shortcut_menu_speak_item(int selected_item, void * data) | |||
605 | talk_spell(sc->name, false); | 610 | talk_spell(sc->name, false); |
606 | break; | 611 | break; |
607 | case SHORTCUT_SHUTDOWN: | 612 | case SHORTCUT_SHUTDOWN: |
613 | case SHORTCUT_REBOOT: | ||
608 | if (!sc->name[0]) | 614 | if (!sc->name[0]) |
609 | { | 615 | { |
610 | talk_spell(type_strings[SHORTCUT_SHUTDOWN], false); | 616 | talk_spell(type_strings[sc->type], false); |
611 | break; | 617 | break; |
612 | } | 618 | } |
619 | /* fall-through */ | ||
613 | default: | 620 | default: |
614 | talk_spell(sc->name[0] ? sc->name : sc->u.path, false); | 621 | talk_spell(sc->name[0] ? sc->name : sc->u.path, false); |
615 | break; | 622 | break; |
@@ -736,6 +743,14 @@ int do_shortcut_menu(void *ignored) | |||
736 | #endif | 743 | #endif |
737 | sys_poweroff(); | 744 | sys_poweroff(); |
738 | break; | 745 | break; |
746 | case SHORTCUT_REBOOT: | ||
747 | #if CONFIG_CHARGING | ||
748 | if (charger_inserted()) | ||
749 | charging_splash(); | ||
750 | else | ||
751 | #endif | ||
752 | sys_reboot(); | ||
753 | break; | ||
739 | case SHORTCUT_TIME: | 754 | case SHORTCUT_TIME: |
740 | #if CONFIG_RTC | 755 | #if CONFIG_RTC |
741 | if (!sc->u.timedata.talktime) | 756 | if (!sc->u.timedata.talktime) |