mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
Lyx now starts and asks for reconfigure if no textclass is found (bug 2829)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20522 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7329719bec
commit
b762358eec
30
src/LyX.cpp
30
src/LyX.cpp
@ -615,6 +615,32 @@ void LyX::execBatchCommands()
|
||||
// aknowledged.
|
||||
restoreGuiSession();
|
||||
|
||||
// if reconfiguration is needed.
|
||||
if (textclasslist.empty()) {
|
||||
switch (Alert::prompt(
|
||||
_("No textclass is found"),
|
||||
_("LyX can not continue because no textclass is found. "
|
||||
"You can either reconfigure normally, or reconfigure using "
|
||||
"default text classes, or quit lyx."),
|
||||
0, 2,
|
||||
_("&Reconfigure"),
|
||||
_("&Use Default"),
|
||||
_("&Exit LyX")))
|
||||
{
|
||||
case 0:
|
||||
// regular reconfigure
|
||||
pimpl_->lyxfunc_.dispatch(FuncRequest(LFUN_RECONFIGURE, ""));
|
||||
break;
|
||||
case 1:
|
||||
// reconfigure --without-latex-config
|
||||
pimpl_->lyxfunc_.dispatch(FuncRequest(LFUN_RECONFIGURE,
|
||||
" --without-latex-config"));
|
||||
break;
|
||||
}
|
||||
pimpl_->lyxfunc_.dispatch(FuncRequest(LFUN_LYX_QUIT));
|
||||
return;
|
||||
}
|
||||
|
||||
// Execute batch commands if available
|
||||
if (batch_command.empty())
|
||||
return;
|
||||
@ -630,6 +656,10 @@ void LyX::restoreGuiSession()
|
||||
{
|
||||
LyXView * view = newLyXView();
|
||||
|
||||
// if there is no valid class list, do not load any file.
|
||||
if (textclasslist.empty())
|
||||
return;
|
||||
|
||||
// if some files were specified at command-line we assume that the
|
||||
// user wants to edit *these* files and not to restore the session.
|
||||
if (!pimpl_->files_to_load_.empty()) {
|
||||
|
@ -1200,7 +1200,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_RECONFIGURE:
|
||||
BOOST_ASSERT(lyx_view_);
|
||||
reconfigure(*lyx_view_);
|
||||
// argument is any additional parameter to the configure.py command
|
||||
reconfigure(*lyx_view_, argument);
|
||||
break;
|
||||
|
||||
case LFUN_HELP_OPEN: {
|
||||
|
@ -165,13 +165,15 @@ bool TextClassList::read()
|
||||
}
|
||||
LYXERR(Debug::TCLASS) << "End of parsing of textclass.lst" << endl;
|
||||
|
||||
if (classlist_.empty()) {
|
||||
// lyx will start with an empty classlist_, but only reconfigure is allowed
|
||||
// in this case. This gives users a second chance to configure lyx if
|
||||
// initial configuration fails. (c.f. bug 2829)
|
||||
if (classlist_.empty())
|
||||
lyxerr << "TextClassList::Read: no textclasses found!"
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
// Ok everything loaded ok, now sort the list.
|
||||
sort(classlist_.begin(), classlist_.end(), less_textclass_avail_desc());
|
||||
else
|
||||
// Ok everything loaded ok, now sort the list.
|
||||
sort(classlist_.begin(), classlist_.end(), less_textclass_avail_desc());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,8 @@ public:
|
||||
const_iterator begin() const { return classlist_.begin(); }
|
||||
///
|
||||
const_iterator end() const { return classlist_.end(); }
|
||||
///
|
||||
bool empty() const { return classlist_.empty(); }
|
||||
|
||||
/// Gets textclass number from name, -1 if textclass name does not exist
|
||||
std::pair<bool, textclass_type> const
|
||||
|
@ -436,14 +436,15 @@ docstring const getContentsOfPlaintextFile(BufferView * bv, string const & f,
|
||||
|
||||
// This function runs "configure" and then rereads lyx.defaults to
|
||||
// reconfigure the automatic settings.
|
||||
void reconfigure(LyXView & lv)
|
||||
void reconfigure(LyXView & lv, string const & option)
|
||||
{
|
||||
// emit message signal.
|
||||
lv.message(_("Running configure..."));
|
||||
|
||||
// Run configure in user lyx directory
|
||||
support::Path p(package().user_support());
|
||||
string const configure_command = package().configure_command();
|
||||
string configure_command = package().configure_command();
|
||||
configure_command += option;
|
||||
Systemcall one;
|
||||
one.startscript(Systemcall::Wait, configure_command);
|
||||
p.pop();
|
||||
|
@ -40,7 +40,7 @@ void insertPlaintextFile(BufferView * bv, std::string const & f, bool asParagrap
|
||||
docstring const getContentsOfPlaintextFile(BufferView * bv,
|
||||
std::string const & f, bool asParagraph);
|
||||
///
|
||||
void reconfigure(frontend::LyXView & lv);
|
||||
void reconfigure(frontend::LyXView & lv, std::string const & option);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user