More Alert/ error message fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6629 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-03-29 11:34:53 +00:00
parent 31dabbd890
commit 4bd79eda68
5 changed files with 117 additions and 85 deletions

View File

@ -2,6 +2,9 @@
* bufferview_funcs.C: remove pointless Alert * bufferview_funcs.C: remove pointless Alert
* buffer.C: fix confusing error message when
a template is chmoded 000
2003-03-29 John Levon <levon@movementarian.org> 2003-03-29 John Levon <levon@movementarian.org>
* BufferView.C: * BufferView.C:

View File

@ -501,10 +501,28 @@ bool Buffer::readFile(LyXLex & lex, string const & filename)
// FIXME: all the below Alerts should give the filename.. // FIXME: all the below Alerts should give the filename..
bool Buffer::readFile(LyXLex & lex, string const & filename, ParagraphList::iterator pit) bool Buffer::readFile(LyXLex & lex, string const & filename, ParagraphList::iterator pit)
{ {
if (lex.isOK()) { if (!lex.isOK()) {
Alert::error(_("Document could not be read"),
_("The specified document could not be read."));
return false;
}
lex.next(); lex.next();
string const token(lex.getString()); string const token(lex.getString());
if (token == "\\lyxformat") { // the first token _must_ be...
if (!lex.isOK()) {
Alert::error(_("Document could not be read"),
_("The specified document could not be read."));
return false;
}
// the first token _must_ be...
if (token != "\\lyxformat") {
Alert::error(_("Document format failure"),
_("The specified document is not a LyX document."));
return false;
}
lex.eatLine(); lex.eatLine();
string tmp_format = lex.getString(); string tmp_format = lex.getString();
//lyxerr << "LyX Format: `" << tmp_format << '\'' << endl; //lyxerr << "LyX Format: `" << tmp_format << '\'' << endl;
@ -573,15 +591,6 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, ParagraphList::iter
"that it is probably corrupted.")); "that it is probably corrupted."));
} }
return true; return true;
} else {
Alert::error(_("Document format failure"),
_("The specified document is not a LyX document."));
}
} else {
Alert::error(_("Document could not be read"),
_("The specified document could not be read."));
}
return false;
} }

View File

@ -331,8 +331,16 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
FileInfo fileInfo2(s); FileInfo fileInfo2(s);
if (!fileInfo2.exist()) { if (!fileInfo2.exist()) {
Alert::alert(_("Error!"), _("Cannot open file"), string const file = MakeDisplayPath(s, 50);
MakeDisplayPath(s)); #if USE_BOOST_FORMAT
boost::format fmt(_("The specified document\n%1$s\ncould not be read."));
fmt % file;
string text = fmt.str();
#else
string text = _("The specified document\n");
text += file + _(" could not be read.");
#endif
Alert::error(_("Could not read document"), text);
return 0; return 0;
} }
@ -463,8 +471,16 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
} }
} }
if (!templateok) { if (!templateok) {
Alert::alert(_("Error!"), _("Unable to open template"), string const file = MakeDisplayPath(tname, 50);
MakeDisplayPath(tname)); #if USE_BOOST_FORMAT
boost::format fmt(_("The specified document template\n%1$s\ncould not be read."));
fmt % file;
string text = fmt.str();
#else
string text = _("The specified document template\n");
text += file + _(" could not be read.");
#endif
Alert::error(_("Could not read template"), text);
// no template, start with empty buffer // no template, start with empty buffer
b->paragraphs.set(new Paragraph); b->paragraphs.set(new Paragraph);
b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout()); b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout());

View File

@ -1,3 +1,7 @@
2003-03-29 John Levon <levon@movementarian.org>
* ControlSpellchecker.C: Alert cleanup
2003-03-29 John Levon <levon@movementarian.org> 2003-03-29 John Levon <levon@movementarian.org>
* helper_funcs.C: Alert cleanup * helper_funcs.C: Alert cleanup

View File

@ -115,7 +115,7 @@ void ControlSpellchecker::startSession()
message = _("The spell-checker could not be started.\n" message = _("The spell-checker could not be started.\n"
"Maybe it is mis-configured."); "Maybe it is mis-configured.");
Alert::alert(_("The spell-checker has failed"), message); Alert::error(_("The spell-checker has failed"), message);
speller_.reset(0); speller_.reset(0);
} }
@ -208,7 +208,7 @@ bool ControlSpellchecker::checkAlive()
view().hide(); view().hide();
speller_.reset(0); speller_.reset(0);
Alert::alert(_("The spell-checker has failed"), message); Alert::error(_("The spell-checker has failed"), message);
return false; return false;
} }
@ -239,7 +239,7 @@ void ControlSpellchecker::showSummary()
#endif #endif
view().hide(); view().hide();
Alert::alert(_("Spell-checking is complete"), message); Alert::information(_("Spell-checking is complete"), message);
} }