X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Freader%2FGuiReader.java;h=8559cf112eb34b47dd923cf14b0011c2c4ae561b;hb=99ccbdf63b539f1f40e070f5833f2d15fcf79830;hp=0faea6e031d9fb712ad6a04bc0a6cfb8adfa2dc9;hpb=211f7ddb50f68aa8a999023ef6d63d5756bdace6;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/reader/GuiReader.java b/src/be/nikiroo/fanfix/reader/GuiReader.java index 0faea6e..8559cf1 100644 --- a/src/be/nikiroo/fanfix/reader/GuiReader.java +++ b/src/be/nikiroo/fanfix/reader/GuiReader.java @@ -93,21 +93,8 @@ class GuiReader extends BasicReader { * in case of I/O error */ public void imprt(String luid, Progress pg) throws IOException { - Progress pgGetStory = new Progress(); - Progress pgSave = new Progress(); - if (pg != null) { - pg.setMax(2); - pg.addProgress(pgGetStory, 1); - pg.addProgress(pgSave, 1); - } - try { - Story story = getLibrary().getStory(luid, pgGetStory); - if (story != null) { - story = localLibrary.save(story, luid, pgSave); - } else { - throw new IOException("Cannot find story in Library: " + luid); - } + localLibrary.imprt(getLibrary(), luid, pg); } catch (IOException e) { throw new IOException( "Cannot import story from library to LocalReader library: " @@ -205,7 +192,9 @@ class GuiReader extends BasicReader { // delete from main library void delete(String luid) { try { - localLibrary.delete(luid); + if (localLibrary.getInfo(luid) != null) { + localLibrary.delete(luid); + } getLibrary().delete(luid); } catch (IOException e) { Instance.syserr(e); @@ -226,7 +215,9 @@ class GuiReader extends BasicReader { void changeType(String luid, String newSource) { try { - localLibrary.changeSource(luid, newSource, null); + if (localLibrary.getInfo(luid) != null) { + localLibrary.changeSource(luid, newSource, null); + } getLibrary().changeSource(luid, newSource, null); } catch (IOException e) { Instance.syserr(e);