From f08ee496f3caedb245bb80fa5efa29ea63544d20 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 9 Dec 2005 14:53:08 +0000 Subject: [PATCH] PAL10671 - ?Save? of preferences as soon as the user clicks ?Ok? --- src/LightApp/LightApp_Application.cxx | 6 +++++- src/LightApp/LightApp_PreferencesDlg.cxx | 4 +++- src/LightApp/LightApp_PreferencesDlg.h | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 24d546933..0e420e26b 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1250,7 +1250,11 @@ void LightApp_Application::onPreferences() if ( !prefDlg ) return; - prefDlg->exec(); + if ( ( prefDlg->exec() == QDialog::Accepted || prefDlg->isSaved() ) && resourceMgr() ) { + if ( desktop() ) + desktop()->saveGeometry( resourceMgr(), "desktop" ); + resourceMgr()->save(); + } delete prefDlg; } diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index d44586445..5d0f1ead4 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -31,7 +31,7 @@ */ LightApp_PreferencesDlg::LightApp_PreferencesDlg( LightApp_Preferences* prefs, QWidget* parent ) : QtxDialog( parent, 0, true, false, OK | Close | Apply ), -myPrefs( prefs ) +myPrefs( prefs ), mySaved ( false ) { setCaption( tr( "CAPTION" ) ); @@ -79,6 +79,7 @@ void LightApp_PreferencesDlg::accept() QtxDialog::accept(); myPrefs->store(); + mySaved = true; } /*!Reject. Restore preferences from backup.*/ @@ -99,4 +100,5 @@ void LightApp_PreferencesDlg::onApply() { myPrefs->store(); myPrefs->toBackup(); + mySaved = true; } diff --git a/src/LightApp/LightApp_PreferencesDlg.h b/src/LightApp/LightApp_PreferencesDlg.h index 95ffb79b6..ea7bf55fe 100644 --- a/src/LightApp/LightApp_PreferencesDlg.h +++ b/src/LightApp/LightApp_PreferencesDlg.h @@ -40,12 +40,16 @@ public: virtual void accept(); virtual void reject(); + bool isSaved() { return mySaved; } + void setSaved( bool saved ) { mySaved = saved; } + private slots: void onHelp(); void onApply(); private: LightApp_Preferences* myPrefs; + bool mySaved; }; #endif -- 2.39.2