+
+ // refresh = delete from LocalReader cache (TODO: rename?)
+ void refresh(String luid) {
+ lib.delete(luid);
+ }
+
+ // delete from main library
+ void delete(String luid) {
+ lib.delete(luid);
+ Instance.getLibrary().delete(luid);
+ }
+
+ // 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;
+ }
+
+ 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() });
+
+ }
+ }