summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/shortcuts.c71
1 files changed, 69 insertions, 2 deletions
diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index a0b6327e54..c7e5755c1a 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -21,6 +21,7 @@
21 21
22#include <stdbool.h> 22#include <stdbool.h>
23#include <stdlib.h> 23#include <stdlib.h>
24#include <dir.h>
24#include "config.h" 25#include "config.h"
25#include "system.h" 26#include "system.h"
26#include "powermgmt.h" 27#include "powermgmt.h"
@@ -471,8 +472,74 @@ static int shortcut_menu_speak_item(int selected_item, void * data)
471{ 472{
472 (void)data; 473 (void)data;
473 struct shortcut *sc = get_shortcut(selected_item); 474 struct shortcut *sc = get_shortcut(selected_item);
474 if (sc && sc->talk_clip[0]) 475 if (sc)
475 talk_file(NULL, NULL, sc->talk_clip, NULL, NULL, false); 476 {
477 if (sc->talk_clip[0])
478 {
479 talk_file(NULL, NULL, sc->talk_clip, NULL, NULL, false);
480 }
481 else
482 {
483 switch (sc->type)
484 {
485 case SHORTCUT_BROWSER:
486 {
487 static char path[MAX_PATH];
488 DIR* dir;
489 struct dirent* entry;
490 char* filename = strrchr(sc->u.path, PATH_SEPCH) + 1;
491 if (*filename != '\0')
492 {
493 int dirlen = (filename - sc->u.path);
494 strlcpy(path, sc->u.path, dirlen + 1);
495 dir = opendir(path);
496 if (dir)
497 {
498 while (0 != (entry = readdir(dir)))
499 {
500 if (!strcmp(entry->d_name, filename))
501 {
502 struct dirinfo info = dir_get_info(dir, entry);
503 if (info.attribute & ATTR_DIRECTORY)
504 talk_dir_or_spell(sc->u.path, NULL, false);
505 else talk_file_or_spell(path, filename, NULL, false);
506 return 0;
507 }
508 }
509 }
510 }
511 else
512 {
513 talk_dir_or_spell(sc->u.path, NULL, false);
514 break;
515 }
516 talk_spell(sc->u.path, false);
517 }
518 break;
519 case SHORTCUT_FILE:
520 case SHORTCUT_PLAYLISTMENU:
521 talk_file_or_spell(NULL, sc->u.path, NULL, false);
522 break;
523 case SHORTCUT_SETTING:
524 talk_id(sc->u.setting->lang_id, false);
525 break;
526#if CONFIG_RTC
527 case SHORTCUT_TIME:
528 talk_id(LANG_TIME_MENU, false);
529 break;
530#endif
531 case SHORTCUT_SHUTDOWN:
532 if (!sc->name[0])
533 {
534 talk_spell(type_strings[SHORTCUT_SHUTDOWN], false);
535 break;
536 }
537 default:
538 talk_spell(sc->name[0] ? sc->name : sc->u.path, false);
539 break;
540 }
541 }
542 }
476 return 0; 543 return 0;
477} 544}
478 545