Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). OK, thanks for the clarification. I cannot tell anything about the behaviour on Windows. I'll try without the #ifdef to test it out. Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! Stephan
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I grant permission to license any and all contributions I've made to LyX under the Gnu GPL version 2 or later. Could one of the usual suspects add Stephan to the Contrib list please? Abdel. Author: younes Date: Mon Aug 27 08:35:24 2007 New Revision: 19824 URL: http://www.lyx.org/trac/changeset/19824 Log: New 'Save all on shutdown or cancel' feature from Stephan Witt. Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp lyx-devel/trunk/src/frontends/qt4/GuiApplication.h Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp?rev=19824 == --- lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp (original) +++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp Mon Aug 27 08:35:24 2007 @@ -27,6 +27,7 @@ #include support/os.h #include support/Package.h +#include BufferList.h #include BufferView.h #include Color.h #include debug.h @@ -43,6 +44,7 @@ #include QLocale #include QLibraryInfo #include QPixmapCache +#include QSessionManager #include QTextCodec #include QTimer #include QTranslator @@ -318,6 +320,20 @@ socket_callbacks_.erase(fd); } + +void GuiApplication::commitData(QSessionManager sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changing that to write all unsaved buffers... + if (sm.allowsInteraction() !theBufferList().quitWriteAll()) + sm.cancel(); +} + + // X11 specific stuff goes here... #ifdef Q_WS_X11 Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.h URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.h?rev=19824 == --- lyx-devel/trunk/src/frontends/qt4/GuiApplication.h (original) +++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.h Mon Aug 27 08:35:24 2007 @@ -25,6 +25,8 @@ #include QApplication #include QTranslator + +class QSessionManager; namespace lyx { @@ -74,9 +76,10 @@ void unregisterSocketCallback(int fd); //@} - /// Methods inherited from \c Application class + /// Methods inherited from \c QApplication class //@{ - virtual bool notify(QObject * receiver, QEvent * event); + bool notify(QObject * receiver, QEvent * event); + void commitData(QSessionManager sm); //@} ///
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Jürgen Spitzmüller wrote: José Matos wrote: With Jürgen coming soon I will let this decision to him. :-) So apart from style issues (that are easily fixed) this patch can go in devel. :-) OK for branch as well, if Abdel's testing revealed no problems. No problem on Windows too so I just committed it (without the #ifdef). Abdel.
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Could one of the usual suspects add Stephan to the Contrib list please? IMHO I'm on the the list already. Thanks again. Stephan
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) Abdel.
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) You know, it's not so easy to gain commit privileges ;) But I have not so many things to contribute anyway. Stephan
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) You know, it's not so easy to gain commit privileges ;) Don't tell me... But I have not so many things to contribute anyway. But I'm sure you could ;-) Abdel.
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). OK, thanks for the clarification. I cannot tell anything about the behaviour on Windows. I'll try without the #ifdef to test it out. Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! Stephan
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I grant permission to license any and all contributions I've made to LyX under the Gnu GPL version 2 or later. Could one of the usual suspects add Stephan to the Contrib list please? Abdel. Author: younes Date: Mon Aug 27 08:35:24 2007 New Revision: 19824 URL: http://www.lyx.org/trac/changeset/19824 Log: New 'Save all on shutdown or cancel' feature from Stephan Witt. Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp lyx-devel/trunk/src/frontends/qt4/GuiApplication.h Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp?rev=19824 == --- lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp (original) +++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.cpp Mon Aug 27 08:35:24 2007 @@ -27,6 +27,7 @@ #include "support/os.h" #include "support/Package.h" +#include "BufferList.h" #include "BufferView.h" #include "Color.h" #include "debug.h" @@ -43,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -318,6 +320,20 @@ socket_callbacks_.erase(fd); } + +void GuiApplication::commitData(QSessionManager & sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changing that to write all unsaved buffers... + if (sm.allowsInteraction() && !theBufferList().quitWriteAll()) + sm.cancel(); +} + + // X11 specific stuff goes here... #ifdef Q_WS_X11 Modified: lyx-devel/trunk/src/frontends/qt4/GuiApplication.h URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/frontends/qt4/GuiApplication.h?rev=19824 == --- lyx-devel/trunk/src/frontends/qt4/GuiApplication.h (original) +++ lyx-devel/trunk/src/frontends/qt4/GuiApplication.h Mon Aug 27 08:35:24 2007 @@ -25,6 +25,8 @@ #include #include + +class QSessionManager; namespace lyx { @@ -74,9 +76,10 @@ void unregisterSocketCallback(int fd); //@} - /// Methods inherited from \c Application class + /// Methods inherited from \c QApplication class //@{ - virtual bool notify(QObject * receiver, QEvent * event); + bool notify(QObject * receiver, QEvent * event); + void commitData(QSessionManager & sm); //@} ///
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Jürgen Spitzmüller wrote: José Matos wrote: With Jürgen coming soon I will let this decision to him. :-) So apart from style issues (that are easily fixed) this patch can go in devel. :-) OK for branch as well, if Abdel's testing revealed no problems. No problem on Windows too so I just committed it (without the #ifdef). Abdel.
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Could one of the usual suspects add Stephan to the Contrib list please? IMHO I'm on the the list already. Thanks again. Stephan
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) Abdel.
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) You know, it's not so easy to gain commit privileges ;) But I have not so many things to contribute anyway. Stephan
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Stephan Witt wrote: Abdelrazak Younes schrieb: Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Thank you! You are welcome. Please send a message to this list stating the following: I granted permission already in 2005. :) It was the 22nd of February 2005. Good, so why do I have to commit this for you? ;-) You know, it's not so easy to gain commit privileges ;) Don't tell me... But I have not so many things to contribute anyway. But I'm sure you could ;-) Abdel.
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
José Matos wrote: With Jürgen coming soon I will let this decision to him. :-) So apart from style issues (that are easily fixed) this patch can go in devel. :-) OK for branch as well, if Abdel's testing revealed no problems. Jürgen
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
José Matos wrote: > With Jürgen coming soon I will let this decision to him. :-) > > So apart from style issues (that are easily fixed) this patch can go in > devel. :-) OK for branch as well, if Abdel's testing revealed no problems. Jürgen
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changeing that to write all unsaved buffers... + if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the if (sm.allowsInteraction()) { style? Stephan
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Stephan Witt wrote: Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager sm) +{ +/// The implementation is required to avoid an application exit +/// when session state save is triggered by session manager. +/// The default implementation sends a close event to all +/// visible top level widgets when session managment allows +/// interaction. +/// We are changeing that to write all unsaved buffers... +if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the if (sm.allowsInteraction()) { style? Yes, that's what he meant. I'll go even further ;-) if (sm.allowsInteraction() !theBufferList().quitWriteAll()) sm.cancel(); I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. Abdel.
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager sm) +{ +/// The implementation is required to avoid an application exit +/// when session state save is triggered by session manager. +/// The default implementation sends a close event to all +/// visible top level widgets when session managment allows +/// interaction. +/// We are changeing that to write all unsaved buffers... +if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the if (sm.allowsInteraction()) { style? Yes, that's what he meant. I'll go even further ;-) if (sm.allowsInteraction() !theBufferList().quitWriteAll()) sm.cancel(); I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). I cannot tell anything about the behaviour on Windows. Do you need a new patch from me or will you change it yourself? I'm online next week again. Thanks, Stephan
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). OK, thanks for the clarification. I cannot tell anything about the behaviour on Windows. I'll try without the #ifdef to test it out. Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Any objection to this patch? Jose, do you want it for 1.5? Abdel.
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
On Fri, Aug 24, 2007 at 10:43:09AM +0200, Stephan Witt wrote: I'll provide a modified patch when there is a need for. Do you want the if (sm.allowsInteraction()) { style? Yes. Even if it's not everyones favourite it is very beneficial to have a uniform style to be able to do certain kinds of refactoring or searches scriptable. Andre'
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
On Friday 24 August 2007 12:57:23 Abdelrazak Younes wrote: Jose, do you want it for 1.5? With Jürgen coming soon I will let this decision to him. :-) So apart from style issues (that are easily fixed) this patch can go in devel. :-) Abdel. -- José Abílio
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager & sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changeing that to write all unsaved buffers... + if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the "if (sm.allowsInteraction()) {" style? Stephan
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Stephan Witt wrote: Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager & sm) +{ +/// The implementation is required to avoid an application exit +/// when session state save is triggered by session manager. +/// The default implementation sends a close event to all +/// visible top level widgets when session managment allows +/// interaction. +/// We are changeing that to write all unsaved buffers... +if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the "if (sm.allowsInteraction()) {" style? Yes, that's what he meant. I'll go even further ;-) if (sm.allowsInteraction() && !theBufferList().quitWriteAll()) sm.cancel(); I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. Abdel.
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Abdelrazak Younes schrieb: Stephan Witt wrote: Andre Poenitz schrieb: On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager & sm) +{ +/// The implementation is required to avoid an application exit +/// when session state save is triggered by session manager. +/// The default implementation sends a close event to all +/// visible top level widgets when session managment allows +/// interaction. +/// We are changeing that to write all unsaved buffers... +if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Thanks. Very clear. Did you try it? I'll provide a modified patch when there is a need for. Do you want the "if (sm.allowsInteraction()) {" style? Yes, that's what he meant. I'll go even further ;-) if (sm.allowsInteraction() && !theBufferList().quitWriteAll()) sm.cancel(); I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). I cannot tell anything about the behaviour on Windows. Do you need a new patch from me or will you change it yourself? I'm online next week again. Thanks, Stephan
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Stephan Witt wrote: Abdelrazak Younes schrieb: I am OK with the patch but I would like to know first if there are any drawbacks, I am not on X11. I tested this patch with Qt 4.1.2 and it is working without drawbacks. AFAIK older Qt versions are not supported anymore were I had problems with the popping up of the dialog asking the user to confirm the file save operation. So two years ago the patch did not work (with Qt 3.x). OK, thanks for the clarification. I cannot tell anything about the behaviour on Windows. I'll try without the #ifdef to test it out. Do you need a new patch from me or will you change it yourself? No, that's fine, I'll do it. Any objection to this patch? Jose, do you want it for 1.5? Abdel.
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
On Fri, Aug 24, 2007 at 10:43:09AM +0200, Stephan Witt wrote: > I'll provide a modified patch when there is a need for. > Do you want the "if (sm.allowsInteraction()) {" style? Yes. Even if it's not everyones favourite it is very beneficial to have a uniform style to be able to do certain kinds of refactoring or searches scriptable. Andre'
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
On Friday 24 August 2007 12:57:23 Abdelrazak Younes wrote: > Jose, do you want it for 1.5? With Jürgen coming soon I will let this decision to him. :-) So apart from style issues (that are easily fixed) this patch can go in devel. :-) > Abdel. -- José Abílio
[patch for [Bug 1656] command gnome-session-save kills lyx!]
Hi Richard, you moved the target milestone of bug 1656 to 1.5.x. Now I had the time and energy to check my proposal to fix the bug again. I modified the code to fit the new 1.5.x code base. My tests with OpenSuSE 10.2 and Qt 4.1.2 went well. The program isn't exiting prematurely anymore and in case of unsaved changes the user is asked for proper action just like on quit of LyX. The idea was: the default session save action of Qt is to send an close event to all windows (in method commitData()). I replaced it by an call to theBufferList().quitWriteAll(). This didn't work with older Qt versions apparently. Now I have no problem with my current Qt 4.1.2 anymore. The resulting patch is attached and in bugzilla too. Regards, Stephan Original-Nachricht Betreff: [Bug 1656] command gnome-session-save kills lyx! Datum: Mon, 20 Aug 2007 13:38:44 +0200 Von: [EMAIL PROTECTED] An: [EMAIL PROTECTED] http://bugzilla.lyx.org/show_bug.cgi?id=1656 [EMAIL PROTECTED] changed: What|Removed |Added Attachment #728 is|0 |1 obsolete|| --- Additional Comments From [EMAIL PROTECTED] 2007-08-20 13:38 --- Created an attachment (id=2110) -- (http://bugzilla.lyx.org/attachment.cgi?id=2110action=view) Updated patch for bad exit on gnome-session-save I've updated my patch for 1.5.X and tested it with activated (comments removed) code. The patch works with OpenSuSE 10.2 and Qt 4.1.2. Cannot test others environments. --- You are receiving this mail because: --- You are the assignee for the bug, or are watching the assignee. Index: src/frontends/qt4/GuiApplication.cpp === --- src/frontends/qt4/GuiApplication.cpp (Revision 19655) +++ src/frontends/qt4/GuiApplication.cpp (Arbeitskopie) @@ -28,6 +28,7 @@ #include support/Package.h #include BufferView.h +#include BufferList.h #include Color.h #include debug.h #include FuncRequest.h @@ -316,6 +317,22 @@ // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changeing that to write all unsaved buffers... + if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { + sm.cancel(); + } + } +} + bool GuiApplication::x11EventFilter(XEvent * xev) { if (!currentView()) Index: src/frontends/qt4/GuiApplication.h === --- src/frontends/qt4/GuiApplication.h (Revision 19655) +++ src/frontends/qt4/GuiApplication.h (Arbeitskopie) @@ -25,6 +25,7 @@ #include QApplication #include QTranslator +#include QSessionManager namespace lyx { @@ -106,6 +107,7 @@ std::mapint, boost::shared_ptrsocket_callback socket_callbacks_; #ifdef Q_WS_X11 + void commitData(QSessionManager sm); public: bool x11EventFilter (XEvent * ev); #endif
Re: [patch for [Bug 1656] command gnome-session-save kills lyx!]
On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changeing that to write all unsaved buffers... + if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { Spacing. Andre'
[patch for [Bug 1656] command "gnome-session-save" kills lyx!]
Hi Richard, you moved the target milestone of bug 1656 to 1.5.x. Now I had the time and energy to check my proposal to fix the bug again. I modified the code to fit the new 1.5.x code base. My tests with OpenSuSE 10.2 and Qt 4.1.2 went well. The program isn't exiting prematurely anymore and in case of unsaved changes the user is asked for proper action just like on quit of LyX. The idea was: the default session save action of Qt is to send an close event to all windows (in method commitData()). I replaced it by an call to theBufferList().quitWriteAll(). This didn't work with older Qt versions apparently. Now I have no problem with my current Qt 4.1.2 anymore. The resulting patch is attached and in bugzilla too. Regards, Stephan Original-Nachricht Betreff: [Bug 1656] command "gnome-session-save" kills lyx! Datum: Mon, 20 Aug 2007 13:38:44 +0200 Von: [EMAIL PROTECTED] An: [EMAIL PROTECTED] http://bugzilla.lyx.org/show_bug.cgi?id=1656 [EMAIL PROTECTED] changed: What|Removed |Added Attachment #728 is|0 |1 obsolete|| --- Additional Comments From [EMAIL PROTECTED] 2007-08-20 13:38 --- Created an attachment (id=2110) --> (http://bugzilla.lyx.org/attachment.cgi?id=2110=view) Updated patch for bad exit on gnome-session-save I've updated my patch for 1.5.X and tested it with activated (comments removed) code. The patch works with OpenSuSE 10.2 and Qt 4.1.2. Cannot test others environments. --- You are receiving this mail because: --- You are the assignee for the bug, or are watching the assignee. Index: src/frontends/qt4/GuiApplication.cpp === --- src/frontends/qt4/GuiApplication.cpp (Revision 19655) +++ src/frontends/qt4/GuiApplication.cpp (Arbeitskopie) @@ -28,6 +28,7 @@ #include "support/Package.h" #include "BufferView.h" +#include "BufferList.h" #include "Color.h" #include "debug.h" #include "FuncRequest.h" @@ -316,6 +317,22 @@ // X11 specific stuff goes here... #ifdef Q_WS_X11 + +void GuiApplication::commitData(QSessionManager & sm) +{ + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// We are changeing that to write all unsaved buffers... + if ( sm.allowsInteraction() ) { + if ( !theBufferList().quitWriteAll() ) { + sm.cancel(); + } + } +} + bool GuiApplication::x11EventFilter(XEvent * xev) { if (!currentView()) Index: src/frontends/qt4/GuiApplication.h === --- src/frontends/qt4/GuiApplication.h (Revision 19655) +++ src/frontends/qt4/GuiApplication.h (Arbeitskopie) @@ -25,6 +25,7 @@ #include #include +#include namespace lyx { @@ -106,6 +107,7 @@ std::map<int, boost::shared_ptr > socket_callbacks_; #ifdef Q_WS_X11 + void commitData(QSessionManager & sm); public: bool x11EventFilter (XEvent * ev); #endif
Re: [patch for [Bug 1656] command "gnome-session-save" kills lyx!]
On Tue, Aug 21, 2007 at 10:31:57AM +0200, Stephan Witt wrote: > > // X11 specific stuff goes here... > #ifdef Q_WS_X11 > + > +void GuiApplication::commitData(QSessionManager & sm) > +{ > + /// The implementation is required to avoid an application exit > + /// when session state save is triggered by session manager. > + /// The default implementation sends a close event to all > + /// visible top level widgets when session managment allows > + /// interaction. > + /// We are changeing that to write all unsaved buffers... > + if ( sm.allowsInteraction() ) { > + if ( !theBufferList().quitWriteAll() ) { Spacing. Andre'
Re: [Bug 1656] command gnome-session-save kills lyx!
Hello Lars, You had a simple fix that avoids the crash, didn't you Stephan? yes I have. Yesterday I came back to Berlin and since today I'm online again... After a vacation of 2 weeks I have to do some real work. But I'll provide the patch shortly. In Paris I failed to compile the patched version because of an incomplete update or bad precompiled headers or whatever, I don't know. So I didn't check it in (with Michaels account). Now it compiles again and I send you the patch. Regards, Stephan -- Index: src/frontends/qt2/lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.86 diff -u -p -r1.86 lyx_gui.C --- src/frontends/qt2/lyx_gui.C 2005/07/16 15:55:35 1.86 +++ src/frontends/qt2/lyx_gui.C 2005/07/22 11:38:42 @@ -51,6 +51,7 @@ #endif #include qapplication.h +#include qsessionmanager.h #if QT_VERSION = 0x030100 #include qeventloop.h #endif @@ -114,6 +115,7 @@ class LQApplication : public QApplicatio public: LQApplication(int argc, char ** argv); ~LQApplication(); + void commitData(QSessionManager sm); #ifdef Q_WS_X11 bool x11EventFilter (XEvent * ev) { return lyxX11EventFilter(ev); } #endif @@ -140,6 +142,28 @@ LQApplication::~LQApplication() if (locked()) unlock(); #endif +} + + +void LQApplication::commitData(QSessionManager sm) +{ + /// Maybe someone should do something sensible here. + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// + /// Following is a (currently not working) proposal... + /// The problem is a blocking application when + /// BufferList::quitWriteAll wants to open the question + /// alert message dialog. + /// Qt doesn't return from it and no box is opened. + /// if ( sm.allowsInteraction() ) { + /// if ( !bufferlist.quitWriteAll() ) { + /// sm.cancel(); + /// } + /// } }
Re: [Bug 1656] command "gnome-session-save" kills lyx!
Hello Lars, > You had a simple fix that avoids the crash, didn't you Stephan? yes I have. Yesterday I came back to Berlin and since today I'm online again... After a vacation of 2 weeks I have to do some real work. But I'll provide the patch shortly. In Paris I failed to compile the patched version because of an incomplete update or bad precompiled headers or whatever, I don't know. So I didn't check it in (with Michaels account). Now it compiles again and I send you the patch. Regards, Stephan -- Index: src/frontends/qt2/lyx_gui.C === RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v retrieving revision 1.86 diff -u -p -r1.86 lyx_gui.C --- src/frontends/qt2/lyx_gui.C 2005/07/16 15:55:35 1.86 +++ src/frontends/qt2/lyx_gui.C 2005/07/22 11:38:42 @@ -51,6 +51,7 @@ #endif #include +#include #if QT_VERSION >= 0x030100 #include #endif @@ -114,6 +115,7 @@ class LQApplication : public QApplicatio public: LQApplication(int & argc, char ** argv); ~LQApplication(); + void commitData(QSessionManager & sm); #ifdef Q_WS_X11 bool x11EventFilter (XEvent * ev) { return lyxX11EventFilter(ev); } #endif @@ -140,6 +142,28 @@ LQApplication::~LQApplication() if (locked()) unlock(); #endif +} + + +void LQApplication::commitData(QSessionManager & sm) +{ + /// Maybe someone should do something sensible here. + /// The implementation is required to avoid an application exit + /// when session state save is triggered by session manager. + /// The default implementation sends a close event to all + /// visible top level widgets when session managment allows + /// interaction. + /// + /// Following is a (currently not working) proposal... + /// The problem is a blocking application when + /// BufferList::quitWriteAll wants to open the question + /// alert message dialog. + /// Qt doesn't return from it and no box is opened. + /// if ( sm.allowsInteraction() ) { + /// if ( !bufferlist.quitWriteAll() ) { + /// sm.cancel(); + /// } + /// } }