feat: system settings stored as applets in virtual folder
This commit is contained in:
@@ -10,7 +10,8 @@ namespace filemanager {
|
||||
|
||||
void filemanager_do_copy(FileManagerState* fm) {
|
||||
if (fm->selected < 0 || fm->selected >= fm->entry_count) return;
|
||||
if (fm->at_drives_root || fm->entry_types[fm->selected] == 3) return;
|
||||
if (filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm) ||
|
||||
fm->entry_types[fm->selected] == FM_ENTRY_DRIVE) return;
|
||||
|
||||
filemanager_build_fullpath(fm->clipboard_path, 256,
|
||||
fm->current_path, fm->entry_names[fm->selected]);
|
||||
@@ -20,7 +21,8 @@ void filemanager_do_copy(FileManagerState* fm) {
|
||||
|
||||
void filemanager_do_cut(FileManagerState* fm) {
|
||||
if (fm->selected < 0 || fm->selected >= fm->entry_count) return;
|
||||
if (fm->at_drives_root || fm->entry_types[fm->selected] == 3) return;
|
||||
if (filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm) ||
|
||||
fm->entry_types[fm->selected] == FM_ENTRY_DRIVE) return;
|
||||
|
||||
filemanager_build_fullpath(fm->clipboard_path, 256,
|
||||
fm->current_path, fm->entry_names[fm->selected]);
|
||||
@@ -29,7 +31,7 @@ void filemanager_do_cut(FileManagerState* fm) {
|
||||
}
|
||||
|
||||
void filemanager_do_paste(FileManagerState* fm) {
|
||||
if (!fm->clipboard_has_data || fm->at_drives_root) return;
|
||||
if (!fm->clipboard_has_data || filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm)) return;
|
||||
|
||||
const char* basename = path_basename(fm->clipboard_path);
|
||||
char dst[512];
|
||||
@@ -59,7 +61,8 @@ void filemanager_do_paste(FileManagerState* fm) {
|
||||
|
||||
void filemanager_start_rename(FileManagerState* fm) {
|
||||
if (fm->selected < 0 || fm->selected >= fm->entry_count) return;
|
||||
if (fm->at_drives_root || fm->entry_types[fm->selected] == 3) return;
|
||||
if (filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm) ||
|
||||
fm->entry_types[fm->selected] == FM_ENTRY_DRIVE) return;
|
||||
|
||||
fm->rename_active = true;
|
||||
fm->rename_idx = fm->selected;
|
||||
@@ -100,7 +103,7 @@ void filemanager_cancel_rename(FileManagerState* fm) {
|
||||
}
|
||||
|
||||
void filemanager_new_folder(FileManagerState* fm) {
|
||||
if (fm->at_drives_root) return;
|
||||
if (filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm)) return;
|
||||
|
||||
// Find a unique name
|
||||
char name[64] = "New Folder";
|
||||
@@ -130,7 +133,8 @@ void filemanager_new_folder(FileManagerState* fm) {
|
||||
|
||||
void filemanager_delete_selected(FileManagerState* fm) {
|
||||
if (fm->selected < 0 || fm->selected >= fm->entry_count) return;
|
||||
if (fm->at_drives_root || fm->entry_types[fm->selected] == 3) return;
|
||||
if (filemanager_is_computer_view(fm) || filemanager_is_virtual_view(fm) ||
|
||||
fm->entry_types[fm->selected] == FM_ENTRY_DRIVE) return;
|
||||
|
||||
char fullpath[512];
|
||||
filemanager_build_fullpath(fullpath, 512,
|
||||
@@ -152,8 +156,10 @@ void filemanager_open_ctx_menu(FileManagerState* fm, int local_x, int local_y, i
|
||||
|
||||
if (target_idx >= 0 && target_idx < fm->entry_count) {
|
||||
int tt = fm->entry_types[target_idx];
|
||||
if ((fm->at_drives_root && (tt == 3 || tt == 4 || tt == 5 || tt == 7)) ||
|
||||
(fm->at_apps_view && tt == 6)) {
|
||||
if ((filemanager_is_computer_view(fm)
|
||||
&& (tt == FM_ENTRY_DRIVE || tt == FM_ENTRY_HOME || tt == FM_ENTRY_APPS_ROOT
|
||||
|| tt == FM_ENTRY_SPECIAL_DIR || tt == FM_ENTRY_SYSTEM_TOOLS_ROOT))
|
||||
|| (filemanager_is_virtual_view(fm) && tt == FM_ENTRY_VIRTUAL_APP)) {
|
||||
// Drive, Home, Apps shortcut, or app entry: only Open
|
||||
fm->ctx_items[fm->ctx_item_count++] = CTX_OPEN;
|
||||
} else {
|
||||
@@ -165,6 +171,10 @@ void filemanager_open_ctx_menu(FileManagerState* fm, int local_x, int local_y, i
|
||||
}
|
||||
} else {
|
||||
// Background click
|
||||
if (filemanager_is_virtual_view(fm)) {
|
||||
fm->ctx_open = false;
|
||||
return;
|
||||
}
|
||||
if (fm->clipboard_has_data)
|
||||
fm->ctx_items[fm->ctx_item_count++] = CTX_PASTE;
|
||||
fm->ctx_items[fm->ctx_item_count++] = CTX_NEW_FOLDER;
|
||||
|
||||
Reference in New Issue
Block a user