diff --git a/source/net/filebot/mac/MacAppUtilities.java b/source/net/filebot/mac/MacAppUtilities.java index 15792276..4c99daae 100644 --- a/source/net/filebot/mac/MacAppUtilities.java +++ b/source/net/filebot/mac/MacAppUtilities.java @@ -3,6 +3,7 @@ package net.filebot.mac; import java.awt.Window; import java.io.File; import java.lang.reflect.Method; +import java.util.Collection; import java.util.logging.Level; import java.util.logging.Logger; @@ -85,4 +86,8 @@ public class MacAppUtilities { return folder.isDirectory() && !folder.canRead() && !folder.canWrite(); } + public static boolean askUnlockFolders(final Window owner, final Collection files) { + return DropToUnlock.showUnlockFoldersDialog(owner, files); + } + } diff --git a/source/net/filebot/ui/analyze/FileTreeTransferablePolicy.java b/source/net/filebot/ui/analyze/FileTreeTransferablePolicy.java index f59b2662..cd4647ac 100644 --- a/source/net/filebot/ui/analyze/FileTreeTransferablePolicy.java +++ b/source/net/filebot/ui/analyze/FileTreeTransferablePolicy.java @@ -14,7 +14,7 @@ import java.util.logging.Level; import javax.swing.tree.TreeNode; -import net.filebot.mac.DropToUnlock; +import net.filebot.mac.MacAppUtilities; import net.filebot.ui.analyze.FileTree.FileNode; import net.filebot.ui.analyze.FileTree.FolderNode; import net.filebot.ui.transfer.BackgroundFileTransferablePolicy; @@ -59,7 +59,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy elements) { Map renamePlan = getRenameMap(directory); if (isMacSandbox()) { - if (!DropToUnlock.showUnlockFoldersDialog(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) { + if (!MacAppUtilities.askUnlockFolders(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) { return; } } diff --git a/source/net/filebot/ui/rename/RenameAction.java b/source/net/filebot/ui/rename/RenameAction.java index 2e24319a..b2a9c53b 100644 --- a/source/net/filebot/ui/rename/RenameAction.java +++ b/source/net/filebot/ui/rename/RenameAction.java @@ -47,7 +47,7 @@ import net.filebot.HistorySpooler; import net.filebot.NativeRenameAction; import net.filebot.ResourceManager; import net.filebot.StandardRenameAction; -import net.filebot.mac.DropToUnlock; +import net.filebot.mac.MacAppUtilities; import net.filebot.media.MediaDetection; import net.filebot.similarity.Match; import net.filebot.util.ui.ProgressDialog; @@ -155,7 +155,7 @@ class RenameAction extends AbstractAction { private Map checkRenamePlan(List> renamePlan, Window parent) throws IOException { // ask for user permissions to output paths if (isMacSandbox()) { - if (!DropToUnlock.showUnlockFoldersDialog(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getKey(), resolveDestination(e.getKey(), e.getValue()))).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) { + if (!MacAppUtilities.askUnlockFolders(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getKey(), resolveDestination(e.getKey(), e.getValue()))).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) { return emptyMap(); } } diff --git a/source/net/filebot/ui/rename/RenamePanel.java b/source/net/filebot/ui/rename/RenamePanel.java index b05c337c..bc523d7f 100644 --- a/source/net/filebot/ui/rename/RenamePanel.java +++ b/source/net/filebot/ui/rename/RenamePanel.java @@ -55,7 +55,7 @@ import net.filebot.StandardRenameAction; import net.filebot.UserFiles; import net.filebot.WebServices; import net.filebot.format.MediaBindingBean; -import net.filebot.mac.DropToUnlock; +import net.filebot.mac.MacAppUtilities; import net.filebot.media.MediaDetection; import net.filebot.similarity.Match; import net.filebot.ui.rename.FormatDialog.Mode; @@ -665,7 +665,7 @@ public class RenamePanel extends JComponent { final boolean autodetection = !isShiftOrAltDown(evt); // skip name auto-detection if SHIFT is pressed if (isMacSandbox()) { - if (!DropToUnlock.showUnlockFoldersDialog(getWindow(RenamePanel.this), remainingFiles)) { + if (!MacAppUtilities.askUnlockFolders(getWindow(RenamePanel.this), remainingFiles)) { return; } } diff --git a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java index 215c0d0b..9b7566d4 100644 --- a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java +++ b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java @@ -60,7 +60,7 @@ import javax.swing.table.DefaultTableCellRenderer; import net.filebot.Analytics; import net.filebot.ResourceManager; -import net.filebot.mac.DropToUnlock; +import net.filebot.mac.MacAppUtilities; import net.filebot.similarity.EpisodeMetrics; import net.filebot.similarity.MetricCascade; import net.filebot.similarity.SimilarityMetric; @@ -270,7 +270,7 @@ class SubtitleAutoMatchDialog extends JDialog { // make sure we have access to the parent folder structure, not just the dropped file if (isMacSandbox()) { - DropToUnlock.showUnlockFoldersDialog(getWindow(evt.getSource()), mappingModel.getVideoFiles()); + MacAppUtilities.askUnlockFolders(getWindow(evt.getSource()), mappingModel.getVideoFiles()); } // collect the subtitles that will be fetched