From: Vincent van Ravesteijn Date: Mon, 7 Jun 2010 22:07:38 +0000 (+0000) Subject: Fix the storage of the last opened files list when having multiple windows. We need... X-Git-Tag: 2.0.0~3158 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a26a9be9bc6af29d948145ec53e398522f012782;p=lyx.git Fix the storage of the last opened files list when having multiple windows. We need to know whether a view is closed by the user pressing the x (clearing the last-opened list of previous closed windows), or whether the view is closed in a cascade of all views (no clearing of the last-opened list). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34621 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index ead359faa7..7a20361716 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1250,7 +1250,7 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) // clear the last opened list, because // maybe this will end the session theSession().lastOpened().clear(); - current_view_->close(); + current_view_->closeScheduled(); break; case LFUN_LYX_QUIT: @@ -2254,7 +2254,7 @@ bool GuiApplication::closeAllViews() QList views = d->views_.values(); foreach (GuiView * view, views) { - if (!view->close()) + if (!view->closeScheduled()) return false; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 7823cc9e8c..735919925f 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -663,6 +663,13 @@ void GuiView::showEvent(QShowEvent * e) } +bool GuiView::closeScheduled() +{ + closing_ = true; + return close(); +} + + /** Destroy only all tabbed WorkAreas. Destruction of other WorkAreas ** is responsibility of the container (e.g., dialog) **/ @@ -676,6 +683,10 @@ void GuiView::closeEvent(QCloseEvent * close_event) return; } + // If the user pressed the x (so we didn't call closeView + // programmatically), we want to clear all existing entries. + if (!closing_) + theSession().lastOpened().clear(); closing_ = true; writeSession(); diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 33f9fb3108..72a53dbdc6 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -71,6 +71,10 @@ public: ~GuiView(); + /// closes the view such that the view knows that is closed + /// programmatically and not by the user clicking the x. + bool closeScheduled(); + int id() const { return id_; } ///