mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-07 14:42:47 -04:00
FileMan support for folder Cut & Paste and Timestamp Rename (#2055)
This commit is contained in:
parent
90ff1e62ce
commit
ba36680a7b
1 changed files with 7 additions and 4 deletions
|
@ -514,6 +514,9 @@ void FileManagerView::on_paste() {
|
||||||
fs::filesystem_error result;
|
fs::filesystem_error result;
|
||||||
|
|
||||||
if (clipboard_mode == ClipboardMode::Cut)
|
if (clipboard_mode == ClipboardMode::Cut)
|
||||||
|
if ((current_path / clipboard_path.filename()) == clipboard_path)
|
||||||
|
result = FR_OK; // Skip paste to avoid renaming if path is unchanged
|
||||||
|
else
|
||||||
result = rename_file(clipboard_path, current_path / new_name);
|
result = rename_file(clipboard_path, current_path / new_name);
|
||||||
|
|
||||||
else if (clipboard_mode == ClipboardMode::Copy)
|
else if (clipboard_mode == ClipboardMode::Copy)
|
||||||
|
@ -639,7 +642,7 @@ FileManagerView::FileManagerView(
|
||||||
};
|
};
|
||||||
|
|
||||||
button_cut.on_select = [this]() {
|
button_cut.on_select = [this]() {
|
||||||
if (selected_is_valid() && !get_selected_entry().is_directory) {
|
if (selected_is_valid()) {
|
||||||
clipboard_path = get_selected_full_path();
|
clipboard_path = get_selected_full_path();
|
||||||
clipboard_mode = ClipboardMode::Cut;
|
clipboard_mode = ClipboardMode::Cut;
|
||||||
} else
|
} else
|
||||||
|
@ -658,7 +661,7 @@ FileManagerView::FileManagerView(
|
||||||
if (clipboard_mode != ClipboardMode::None)
|
if (clipboard_mode != ClipboardMode::None)
|
||||||
on_paste();
|
on_paste();
|
||||||
else
|
else
|
||||||
nav_.display_modal("Paste", "Cut or copy a file first.");
|
nav_.display_modal("Paste", " Cut or copy a file,\n or cut a folder, first.");
|
||||||
};
|
};
|
||||||
|
|
||||||
button_new_dir.on_select = [this]() {
|
button_new_dir.on_select = [this]() {
|
||||||
|
@ -678,7 +681,7 @@ FileManagerView::FileManagerView(
|
||||||
};
|
};
|
||||||
|
|
||||||
button_rename_timestamp.on_select = [this]() {
|
button_rename_timestamp.on_select = [this]() {
|
||||||
if (selected_is_valid() && !get_selected_entry().is_directory) {
|
if (selected_is_valid()) {
|
||||||
on_rename(::truncate(to_string_timestamp(rtc_time::now()), 8));
|
on_rename(::truncate(to_string_timestamp(rtc_time::now()), 8));
|
||||||
} else
|
} else
|
||||||
nav_.display_modal("Timestamp Rename", "Can't rename that.");
|
nav_.display_modal("Timestamp Rename", "Can't rename that.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue