mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-13 03:40:34 +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/branches/BRANCH_1_5_X@20521 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
abe07b71dd
commit
4493a50d41
30
src/LyX.cpp
30
src/LyX.cpp
@ -611,6 +611,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;
|
||||
@ -626,6 +652,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()) {
|
||||
|
@ -1178,7 +1178,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: {
|
||||
|
@ -164,13 +164,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
|
||||
|
@ -434,14 +434,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();
|
||||
|
@ -37,7 +37,7 @@ void insertPlaintextFile(BufferView * bv, std::string const & f, bool asParagrap
|
||||
docstring const getContentsOfPlaintextFile(BufferView * bv,
|
||||
std::string const & f, bool asParagraph);
|
||||
///
|
||||
void reconfigure(LyXView & lv);
|
||||
void reconfigure(LyXView & lv, std::string const & option);
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
|
@ -99,6 +99,9 @@ What's new
|
||||
|
||||
- Fix LaTeX error with captions in Program Listings (bug 4182).
|
||||
|
||||
- Reconfiguration failure will no longer result in empty textclass lists.
|
||||
Lyx now starts and asks for reconfigure if no textclass is found (bug 2829).
|
||||
|
||||
* USER INTERFACE:
|
||||
|
||||
- Fix a crash when closing a LyX window with document tabs (bug 4123).
|
||||
@ -205,4 +208,4 @@ What's new
|
||||
|
||||
- Allow the use of a snapshot version of scons.
|
||||
|
||||
- Fix usage display for lib/doc_toc.py (bug 3798).
|
||||
- Fix usage display for lib/doc_toc.py (bug 3798).
|
||||
|
Loading…
Reference in New Issue
Block a user