mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
archive allow folders to be pinned
by WillyJL
This commit is contained in:
@@ -68,7 +68,7 @@ static inline const char* archive_get_default_path(ArchiveTabEnum tab) {
|
||||
}
|
||||
|
||||
inline bool archive_is_known_app(ArchiveFileTypeEnum type) {
|
||||
return type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown;
|
||||
return (type != ArchiveFileTypeUnknown);
|
||||
}
|
||||
|
||||
bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx);
|
||||
|
||||
@@ -158,7 +158,7 @@ bool archive_favorites_read(void* context) {
|
||||
need_refresh = true;
|
||||
}
|
||||
} else {
|
||||
if(storage_file_exists(storage, furi_string_get_cstr(buffer))) {
|
||||
if(storage_common_exists(storage, furi_string_get_cstr(buffer))) {
|
||||
storage_common_stat(storage, furi_string_get_cstr(buffer), &file_info);
|
||||
archive_add_file_item(
|
||||
browser, file_info_is_dir(&file_info), furi_string_get_cstr(buffer));
|
||||
|
||||
@@ -33,6 +33,8 @@ static const char* archive_get_flipper_app_name(ArchiveFileTypeEnum file_type) {
|
||||
return "UpdaterApp";
|
||||
case ArchiveFileTypeJS:
|
||||
return "JS Runner";
|
||||
case ArchiveFileTypeFolder:
|
||||
return "Archive";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -137,7 +139,11 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
||||
consumed = true;
|
||||
break;
|
||||
case ArchiveBrowserEventFileMenuRun:
|
||||
if(archive_is_known_app(selected->type)) {
|
||||
if(selected->type == ArchiveFileTypeFolder) {
|
||||
archive_switch_tab(browser, TAB_LEFT);
|
||||
archive_show_file_menu(browser, false);
|
||||
archive_enter_dir(browser, selected->path);
|
||||
} else if(archive_is_known_app(selected->type)) {
|
||||
archive_run_in_app(browser, selected);
|
||||
archive_show_file_menu(browser, false);
|
||||
}
|
||||
|
||||
@@ -111,11 +111,18 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
|
||||
// Folder
|
||||
//FURI_LOG_D(TAG, "Directory type");
|
||||
|
||||
// { Copy/Cut, Paste } NewDir, Rename, Delete
|
||||
model->menu_file_manage = true;
|
||||
model->menu_can_switch = false;
|
||||
//model->menu_file_manage = true;
|
||||
model->menu_can_switch = true;
|
||||
|
||||
if(model->menu_file_manage) {
|
||||
// { Copy/Cut, Paste } NewDir, Rename, Delete
|
||||
contex_menu_filemanager_init(model);
|
||||
} else {
|
||||
archive_menu_add_item(
|
||||
menu_array_push_raw(model->context_menu),
|
||||
item_pin,
|
||||
ArchiveBrowserEventFileMenuPin);
|
||||
}
|
||||
} else if(!archive_is_known_app(selected->type)) {
|
||||
// UnKnown app type
|
||||
//FURI_LOG_D(TAG, "Unknown type");
|
||||
@@ -489,8 +496,7 @@ static inline void
|
||||
ArchiveFile_t* selected =
|
||||
files_array_get(model->files, model->item_idx - model->array_offset);
|
||||
|
||||
if(selected->type != ArchiveFileTypeFolder &&
|
||||
model->tab_idx != ArchiveTabFavorites) {
|
||||
if(model->tab_idx != ArchiveTabFavorites) {
|
||||
model->menu_file_manage = !model->menu_file_manage;
|
||||
model->menu_idx = 0;
|
||||
menu_array_reset(model->context_menu);
|
||||
|
||||
Reference in New Issue
Block a user