X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2Ftui%2FTuiReaderApplication.java;h=6f7ed3cbddc61f003d286ce231c0b4d0daeb41d0;hb=b31a0db030e164bc1d9a8620e71b595dad31adb6;hp=8cd5c0b90ce99ed820ba16725e45fb9ced3530ad;hpb=cd6b47c9288524cde80df6e90843293b2fe0677d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java index 8cd5c0b..6f7ed3c 100644 --- a/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java +++ b/src/be/nikiroo/fanfix/reader/tui/TuiReaderApplication.java @@ -25,6 +25,7 @@ import be.nikiroo.fanfix.library.BasicLibrary; import be.nikiroo.fanfix.reader.BasicReader; import be.nikiroo.fanfix.reader.Reader; import be.nikiroo.fanfix.reader.tui.TuiReaderMainWindow.Mode; +import be.nikiroo.fanfix.supported.SupportType; import be.nikiroo.utils.Progress; /** @@ -56,9 +57,8 @@ class TuiReaderApplication extends TApplication implements Reader { super(backend); init(reader); - MetaData meta = getMeta(); - if (meta != null) { - read(); + if (getMeta() != null) { + read(false); } } @@ -72,8 +72,8 @@ class TuiReaderApplication extends TApplication implements Reader { } @Override - public void read() throws IOException { - read(getStory(null)); + public void read(boolean sync) throws IOException { + read(getStory(null), sync); } @Override @@ -126,7 +126,37 @@ class TuiReaderApplication extends TApplication implements Reader { reader.setChapter(chapter); } - public void read(Story story) throws IOException { + @Override + public void search(boolean sync) throws IOException { + reader.search(sync); + } + + @Override + public void search(SupportType searchOn, String keywords, int page, + int item, boolean sync) throws IOException { + reader.search(searchOn, keywords, page, item, sync); + } + + @Override + public void searchTag(SupportType searchOn, int page, int item, + boolean sync, Integer... tags) throws IOException { + reader.searchTag(searchOn, page, item, sync, tags); + } + + /** + * Open the given {@link Story} for reading. This may or may not start an + * external program to read said {@link Story}. + * + * @param story + * the {@link Story} to read + * @param sync + * execute the process synchronously (wait until it is terminated + * before returning) + * + * @throws IOException + * in case of I/O errors + */ + public void read(Story story, boolean sync) throws IOException { if (story == null) { throw new IOException("No story to read"); } @@ -137,7 +167,7 @@ class TuiReaderApplication extends TApplication implements Reader { window.maximize(); } else { try { - openExternal(getLibrary(), story.getMeta().getLuid()); + openExternal(getLibrary(), story.getMeta().getLuid(), sync); } catch (IOException e) { messageBox("Error when trying to open the story", e.getMessage(), TMessageBox.Type.OK); @@ -230,7 +260,7 @@ class TuiReaderApplication extends TApplication implements Reader { try { openfile = fileOpenBox("."); reader.setMeta(BasicReader.getUrl(openfile), null); - read(); + read(false); } catch (IOException e) { // TODO: i18n error("Fail to open file" @@ -342,8 +372,9 @@ class TuiReaderApplication extends TApplication implements Reader { } @Override - public void openExternal(BasicLibrary lib, String luid) throws IOException { - reader.openExternal(lib, luid); + public void openExternal(BasicLibrary lib, String luid, boolean sync) + throws IOException { + reader.openExternal(lib, luid, sync); } /**