diff --git a/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java b/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java index 3109887..c5df832 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java +++ b/src/main/java/cz/kamma/kfmanager/ui/FilePanelTab.java @@ -751,6 +751,18 @@ public class FilePanelTab extends JPanel { // Close any active context menu or other popups MenuSelectionManager.defaultManager().clearSelectedPath(); } + } else if (e.getKeyCode() == java.awt.event.KeyEvent.VK_PAGE_DOWN && e.isControlDown()) { + int row = fileTable.getSelectedRow(); + if (row >= 0) { + FileItem item = (viewMode == ViewMode.BRIEF) ? tableModel.getItemFromBriefLayout(row, briefCurrentColumn) : tableModel.getItem(row); + if (item != null && (item.isDirectory() || isArchiveFile(item.getFile()))) { + openSelectedItem(); + } + } + e.consume(); + } else if (e.getKeyCode() == java.awt.event.KeyEvent.VK_PAGE_UP && e.isControlDown()) { + navigateUp(); + e.consume(); } else if (viewMode == ViewMode.BRIEF) { handleBriefKeyNavigation(e); } else if (viewMode == ViewMode.FULL) { diff --git a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java index 2b99efd..20cac25 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java +++ b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java @@ -1609,7 +1609,8 @@ public class MainWindow extends JFrame { FilePanel targetPanel = (activePanel == leftPanel) ? rightPanel : leftPanel; File targetDir = targetPanel.getCurrentDirectory(); - + FilePanel sourcePanel = activePanel; + int result = showConfirmWithBackground( String.format("Copy %d items to:\n%s", selectedItems.size(), targetDir.getAbsolutePath()), "Copy"); @@ -1618,11 +1619,11 @@ public class MainWindow extends JFrame { boolean background = (result == 1); if (background) { addOperationToQueue("Copy", String.format("Copy %d items to %s", selectedItems.size(), targetDir.getName()), - (cb) -> FileOperations.copy(selectedItems, targetDir, cb), targetPanel); + (cb) -> FileOperations.copy(selectedItems, targetDir, cb), () -> sourcePanel.unselectAll(), targetPanel); } else { performFileOperation((callback) -> { FileOperations.copy(selectedItems, targetDir, callback); - }, "Copy completed", false, true, targetPanel); + }, "Copy completed", false, true, () -> sourcePanel.unselectAll(), targetPanel); } } else { if (activePanel != null && activePanel.getFileTable() != null) { @@ -1820,6 +1821,7 @@ public class MainWindow extends JFrame { } final File finalTargetZip = targetZip; + final FilePanel sourcePanel = activePanel; int result = showConfirmWithBackground( String.format("Zip %d items to:\n%s", selectedItems.size(), targetZip.getAbsolutePath()), "Zip"); @@ -1828,11 +1830,11 @@ public class MainWindow extends JFrame { boolean background = (result == 1); if (background) { addOperationToQueue("Zip", String.format("Zip %d items to %s", selectedItems.size(), finalTargetZip.getName()), - (cb) -> FileOperations.zip(selectedItems, finalTargetZip, cb), targetPanel); + (cb) -> FileOperations.zip(selectedItems, finalTargetZip, cb), () -> sourcePanel.unselectAll(), targetPanel); } else { performFileOperation((callback) -> { FileOperations.zip(selectedItems, finalTargetZip, callback); - }, "Zipped into " + zipName, false, true, targetPanel); + }, "Zipped into " + zipName, false, true, () -> sourcePanel.unselectAll(), targetPanel); } } else { requestFocusInActivePanel(); @@ -1865,6 +1867,7 @@ public class MainWindow extends JFrame { FilePanel targetPanel = (activePanel == leftPanel) ? rightPanel : leftPanel; File targetDir = targetPanel.getCurrentDirectory(); + final FilePanel sourcePanel = activePanel; int result = showConfirmWithBackground( String.format("Unzip %s to:\n%s", zipFile.getName(), targetDir.getAbsolutePath()), @@ -1874,11 +1877,11 @@ public class MainWindow extends JFrame { boolean background = (result == 1); if (background) { addOperationToQueue("Unzip", String.format("Unzip %s to %s", zipFile.getName(), targetDir.getName()), - (cb) -> FileOperations.unzip(zipFile, targetDir, cb), targetPanel); + (cb) -> FileOperations.unzip(zipFile, targetDir, cb), () -> sourcePanel.unselectAll(), targetPanel); } else { performFileOperation((callback) -> { FileOperations.unzip(zipFile, targetDir, callback); - }, "Unzipped into " + targetDir.getName(), false, true, targetPanel); + }, "Unzipped into " + targetDir.getName(), false, true, () -> sourcePanel.unselectAll(), targetPanel); } } else { if (activePanel != null && activePanel.getFileTable() != null) { @@ -2789,6 +2792,10 @@ public class MainWindow extends JFrame { } private void addOperationToQueue(String title, String description, FileOperation operation, FilePanel... panelsToRefresh) { + addOperationToQueue(title, description, operation, null, panelsToRefresh); + } + + private void addOperationToQueue(String title, String description, FileOperation operation, Runnable postTask, FilePanel... panelsToRefresh) { FileOperationQueue.QueuedTask task = new FileOperationQueue.QueuedTask(title, description, (callback) -> { operation.execute(callback); @@ -2798,6 +2805,9 @@ public class MainWindow extends JFrame { panel.loadDirectory(panel.getCurrentDirectory(), false, false); } } + if (postTask != null) { + postTask.run(); + } }); });