X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FLocalReader.java;h=2b92e721db959fc52aa46af7ebb7799daa4afec5;hb=0d781e306746cf460f1f41338eb437f32cf9db33;hp=29a840f3300d77c49ece90df927b23cc3d596a0f;hpb=754a5bc205f6a50f3fe3fe7c2dfb09d8a8dd09bb;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/reader/LocalReader.java b/src/be/nikiroo/fanfix/reader/LocalReader.java index 29a840f..2b92e72 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReader.java +++ b/src/be/nikiroo/fanfix/reader/LocalReader.java @@ -16,7 +16,6 @@ import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.Library; import be.nikiroo.fanfix.VersionCheck; import be.nikiroo.fanfix.bundles.UiConfig; -import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.utils.Progress; @@ -111,29 +110,6 @@ class LocalReader extends BasicReader { } } - /** - * Get the target file related to this {@link Story}. - * - * @param luid - * the LUID of the {@link Story} - * @param pg - * the optional progress reporter - * - * @return the target file - * - * @throws IOException - * in case of I/O error - */ - public File getTarget(String luid, Progress pg) throws IOException { - File file = lib.getFile(luid); - if (file == null) { - imprt(luid, pg); - file = lib.getFile(luid); - } - - return file; - } - /** * Check if the {@link Story} denoted by this Library UID is present in the * {@link LocalReader} cache. @@ -224,34 +200,17 @@ class LocalReader extends BasicReader { // open the given book void open(String luid, Progress pg) throws IOException { - MetaData meta = Instance.getLibrary().getInfo(luid); - File target = getTarget(luid, pg); - - String program = null; - if (meta.isImageDocument()) { - program = Instance.getUiConfig().getString( - UiConfig.IMAGES_DOCUMENT_READER); - } else { - program = Instance.getUiConfig().getString( - UiConfig.NON_IMAGES_DOCUMENT_READER); - } - - if (program != null && program.trim().isEmpty()) { - program = null; + File file = lib.getFile(luid); + if (file == null) { + imprt(luid, pg); + file = lib.getFile(luid); } - if (program == null) { - try { - Desktop.getDesktop().browse(target.toURI()); - } catch (UnsupportedOperationException e) { - Runtime.getRuntime().exec( - new String[] { "xdg-open", target.getAbsolutePath() }); - - } - } else { - Runtime.getRuntime().exec( - new String[] { program, target.getAbsolutePath() }); + open(Instance.getLibrary().getInfo(luid), file); + } - } + void changeType(String luid, String newType) { + lib.changeType(luid, newType); + Instance.getLibrary().changeType(luid, newType); } }