forked from len0rd/rockbox
Moved Create Directory to the ON+Play menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4360 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5c8e82e097
commit
642cce2e33
4 changed files with 71 additions and 62 deletions
|
|
@ -304,7 +304,7 @@ bool main_menu(void)
|
|||
int i = 0;
|
||||
|
||||
/* main menu */
|
||||
struct menu_items items[9];
|
||||
struct menu_items items[8];
|
||||
|
||||
items[i].desc = str(LANG_BOOKMARK_MENU);
|
||||
items[i++].function = bookmark_menu;
|
||||
|
|
@ -336,9 +336,6 @@ bool main_menu(void)
|
|||
items[i].desc = str(LANG_INFO);
|
||||
items[i++].function = info_menu;
|
||||
|
||||
items[i].desc = str(LANG_CREATE_DIR);
|
||||
items[i++].function = create_dir;
|
||||
|
||||
m=menu_init( items, i );
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
status_set_param(true);
|
||||
|
|
|
|||
|
|
@ -507,6 +507,34 @@ static bool vbr_fix(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool create_dir(void)
|
||||
{
|
||||
char dirname[MAX_PATH];
|
||||
char *cwd;
|
||||
int rc;
|
||||
int pathlen;
|
||||
|
||||
cwd = getcwd(NULL, 0);
|
||||
memset(dirname, 0, sizeof dirname);
|
||||
|
||||
snprintf(dirname, sizeof dirname, "%s/",
|
||||
cwd[1] ? cwd : "");
|
||||
|
||||
pathlen = strlen(dirname);
|
||||
rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen);
|
||||
if(rc < 0)
|
||||
return false;
|
||||
|
||||
rc = mkdir(dirname, 0);
|
||||
if(rc < 0) {
|
||||
splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED));
|
||||
} else {
|
||||
onplay_result = ONPLAY_RELOAD_DIR;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int onplay(char* file, int attr)
|
||||
{
|
||||
struct menu_items menu[5]; /* increase this if you add entries! */
|
||||
|
|
@ -514,36 +542,43 @@ int onplay(char* file, int attr)
|
|||
|
||||
onplay_result = ONPLAY_OK;
|
||||
|
||||
selected_file = file;
|
||||
selected_file_attr = attr;
|
||||
|
||||
if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
|
||||
(attr & ATTR_DIRECTORY) ||
|
||||
((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U))
|
||||
if(file)
|
||||
{
|
||||
menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST);
|
||||
menu[i].function = playlist_options;
|
||||
selected_file = file;
|
||||
selected_file_attr = attr;
|
||||
|
||||
if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
|
||||
(attr & ATTR_DIRECTORY) ||
|
||||
((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U))
|
||||
{
|
||||
menu[i].desc = str(LANG_PLAYINDICES_PLAYLIST);
|
||||
menu[i].function = playlist_options;
|
||||
i++;
|
||||
}
|
||||
|
||||
menu[i].desc = str(LANG_RENAME);
|
||||
menu[i].function = rename_file;
|
||||
i++;
|
||||
|
||||
if (!(attr & ATTR_DIRECTORY))
|
||||
{
|
||||
menu[i].desc = str(LANG_DELETE);
|
||||
menu[i].function = delete_file;
|
||||
i++;
|
||||
}
|
||||
|
||||
if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA)
|
||||
{
|
||||
menu[i].desc = str(LANG_VBRFIX);
|
||||
menu[i].function = vbr_fix;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
menu[i].desc = str(LANG_RENAME);
|
||||
menu[i].function = rename_file;
|
||||
menu[i].desc = str(LANG_CREATE_DIR);
|
||||
menu[i].function = create_dir;
|
||||
i++;
|
||||
|
||||
if (!(attr & ATTR_DIRECTORY))
|
||||
{
|
||||
menu[i].desc = str(LANG_DELETE);
|
||||
menu[i].function = delete_file;
|
||||
i++;
|
||||
}
|
||||
|
||||
if ((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA)
|
||||
{
|
||||
menu[i].desc = str(LANG_VBRFIX);
|
||||
menu[i].function = vbr_fix;
|
||||
i++;
|
||||
}
|
||||
|
||||
/* DIY menu handling, since we want to exit after selection */
|
||||
m = menu_init( menu, i );
|
||||
result = menu_show(m);
|
||||
|
|
|
|||
44
apps/tree.c
44
apps/tree.c
|
|
@ -773,16 +773,18 @@ static bool handle_on(int *ds, int *dc, int numentries, int tree_max_on_screen,
|
|||
int onplay_result;
|
||||
|
||||
if(!numentries)
|
||||
break;
|
||||
onplay_result = onplay(NULL, 0);
|
||||
else {
|
||||
if (currdir[1])
|
||||
snprintf(buf, sizeof buf, "%s/%s",
|
||||
currdir, dircache[dircursor+dirstart].name);
|
||||
else
|
||||
snprintf(buf, sizeof buf, "/%s",
|
||||
dircache[dircursor+dirstart].name);
|
||||
onplay_result = onplay(buf,
|
||||
dircache[dircursor+dirstart].attr);
|
||||
}
|
||||
|
||||
if (currdir[1])
|
||||
snprintf(buf, sizeof buf, "%s/%s",
|
||||
currdir, dircache[dircursor+dirstart].name);
|
||||
else
|
||||
snprintf(buf, sizeof buf, "/%s",
|
||||
dircache[dircursor+dirstart].name);
|
||||
onplay_result = onplay(buf,
|
||||
dircache[dircursor+dirstart].attr);
|
||||
switch (onplay_result)
|
||||
{
|
||||
case ONPLAY_OK:
|
||||
|
|
@ -1502,30 +1504,6 @@ bool create_playlist(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool create_dir(void)
|
||||
{
|
||||
char dirname[MAX_PATH];
|
||||
int rc;
|
||||
int pathlen;
|
||||
|
||||
memset(dirname, 0, sizeof dirname);
|
||||
|
||||
snprintf(dirname, sizeof dirname, "%s/",
|
||||
currdir[1] ? currdir : "");
|
||||
|
||||
pathlen = strlen(dirname);
|
||||
rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen);
|
||||
if(rc < 0)
|
||||
return false;
|
||||
|
||||
rc = mkdir(dirname, 0);
|
||||
if(rc < 0) {
|
||||
splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rockbox_browse(char *root, int dirfilter)
|
||||
{
|
||||
bool rc;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ void browse_root(void);
|
|||
void set_current_file(char *path);
|
||||
bool rockbox_browse(char *root, int dirfilter);
|
||||
bool create_playlist(void);
|
||||
bool create_dir(void);
|
||||
void resume_directory(char *dir);
|
||||
char *getcwd(char *buf, int size);
|
||||
void reload_directory(void);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue