Fix bug 3236 and 3237.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17182 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-02-14 13:39:11 +00:00
parent aaf4cf6f9f
commit 2ab3247df4

View File

@ -243,12 +243,21 @@ void GuiView::closeEvent(QCloseEvent * close_event)
{
// we may have been called through the close window button
// which bypasses the LFUN machinery.
if (!quitting_by_menu_) {
if (!quitting_by_menu_ && theApp()->gui().viewIds().size() == 1) {
if (!theBufferList().quitWriteAll()) {
close_event->ignore();
return;
}
}
theApp()->gui().unregisterView(id());
if (!theApp()->gui().viewIds().empty()) {
// Just close the window and do nothing else if this is not the
// last window.
close_event->accept();
return;
}
if (view()->buffer()) {
// save cursor position for opened files to .lyx/session
LyX::ref().session().lastFilePos().save(
@ -256,17 +265,13 @@ void GuiView::closeEvent(QCloseEvent * close_event)
boost::tie(view()->cursor().pit(),
view()->cursor().pos()));
}
theApp()->gui().unregisterView(id());
if (theApp()->gui().viewIds().empty())
{
// this is the place where we leave the frontend.
// it is the only point at which we start quitting.
saveGeometry();
close_event->accept();
// quit the event loop
qApp->quit();
}
close_event->accept();
}