public boolean Chk(Xowe_wiki wiki) { if (!wiki.App().App_type().Uid_is_gui()) return true; // NOTE: ignore during Server / Console modes; DATE:2015-04-01 if (in_progress_hash.Has(wiki.Domain_bry())) return true; // NOTE: ignore if currently building; different bldr commands call // wiki.Init_assert() which may lead to fals checks; Io_url url = url_(wiki); if (!Io_mgr.I.ExistsFil(url)) return true; Xoae_app app = wiki.Appe(); app.Usr_dlg().Log_many("", "", "import.marker: marker found: url=~{0}", url.Raw()); byte[] incompete_msg_bry = app.Usere() .Msg_mgr() .Val_by_key_args(Bry_.new_a7("api-xowa.import.core.incomplete"), wiki.Domain_str()); int rslt = app.Gui_mgr().Kit().Ask_yes_no_cancel("", "", String_.new_u8(incompete_msg_bry)); switch (rslt) { case Gfui_dlg_msg_.Btn_yes: Xob_cleanup_cmd.Delete_wiki_sql(wiki); End(wiki); return false; // delete wiki case Gfui_dlg_msg_.Btn_no: End(wiki); return true; // delete marker case Gfui_dlg_msg_.Btn_cancel: return true; // noop default: throw Err_.unhandled(rslt); } }
public void Save_as() { if (this.Active_tab_is_null()) return; Xog_tab_itm tab = win.Tab_mgr().Active_tab(); String file_name = Xoa_app_.Utl__encoder_mgr() .Fsys_safe() .Encode_str(String_.new_u8(tab.Page().Ttl().Full_url())) + ".html"; String file_url = app.Gui_mgr() .Kit() .New_dlg_file(Gfui_kit_.File_dlg_type_save, "Select file to save to:") .Init_file_(file_name) .Ask(); if (String_.Len_eq_0(file_url)) return; Io_mgr.I.SaveFilStr(file_url, tab.Html_box().Text()); app.Usr_dlg().Prog_many("", "", "saved page: file=~{0}", file_url); }
public void End(Xowe_wiki wiki) { in_progress_hash.Del(wiki.Domain_bry()); Io_mgr.I.DeleteFil_args(url_(wiki)).MissingFails_off().Exec(); }
public void Bgn(Xowe_wiki wiki) { in_progress_hash.Add_as_key_and_val(wiki.Domain_bry()); Io_mgr.I.SaveFilStr( url_(wiki), "XOWA has created this file to indicate that an import is in progress. This file will be deleted once the import is completed."); }