multiple file type association

This commit is contained in:
Radek Davidek 2026-01-23 13:41:44 +01:00
parent ed3ca4cceb
commit 2035ca4fa5
2 changed files with 18 additions and 5 deletions

View File

@ -1377,11 +1377,17 @@ public class FilePanelTab extends JPanel {
String command = null;
for (cz.kamma.kfmanager.config.AppConfig.OpenWithEntry entry : owEntries) {
if (entry.type != null && entry.type.equalsIgnoreCase(ext)) {
if (entry.type != null) {
String[] types = entry.type.split("[,;]");
for (String t : types) {
if (t.trim().equalsIgnoreCase(ext)) {
command = entry.command;
break; // Use the first matching entry
break;
}
}
}
if (command != null) break; // Use the first matching entry
}
if (command != null && !command.trim().isEmpty()) {
runExternalCommand(command, file);
@ -1570,8 +1576,14 @@ public class FilePanelTab extends JPanel {
java.util.List<AppConfig.OpenWithEntry> filtered = new java.util.ArrayList<>();
for (AppConfig.OpenWithEntry e : owEntries) {
if (e.type != null && e.type.equalsIgnoreCase(itemType)) {
if (e.type != null) {
String[] types = e.type.split("[,;]");
for (String t : types) {
if (t.trim().equalsIgnoreCase(itemType)) {
filtered.add(e);
break;
}
}
}
}

View File

@ -648,6 +648,7 @@ public class SettingsDialog extends JDialog {
p.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
JLabel hint = new JLabel("<html>Use <b>directory</b> or <b>extension</b> (e.g. txt) for Type.<br>" +
"Multiple extensions can be separated by <b>,</b> or <b>;</b> (e.g. mp4;mkv).<br>" +
"Use <b>%f</b> for full path, <b>%n</b> for filename. " +
"If no placeholder is used, path is appended to the end.</html>");
p.add(hint, BorderLayout.NORTH);