[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Mon May 1 07:59:37 CEST 2006


SVN commit 536049 by harris:

Moved code related to saving config data from KStars::~KStars() to 
KStars::slotAboutToClose(), a new slot connected to 
QApplication::aboutToClose().  

I don't know why, but it seems that the code in ~KStars() isn't getting 
executed anymore.  I added a kDebug() to the top of the function; it 
never gets reported.  I first noticed the problem because the Startup 
wizard kept opening on every startup...it should open only on the first 
startup, after which it gets suppressed by a config option 
(Options::setRunStartupWizard(false)).  This led me to the realization 
that the Config related code in ~KStars() wasn't getting executed.

CCMAIL: kstars-devel at kde.org
  



 M  +9 -27     kstars.cpp  
 M  +3 -0      kstars.h  
 M  +23 -0     kstarsactions.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/kstars.cpp #536048:536049
@@ -58,6 +58,8 @@
 	// we're nowhere near ready to take dcop calls
 	kapp->dcopClient()->suspend();
 
+	connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( slotAboutToQuit() ) );
+
 	kstarsData = new KStarsData();
 	connect( kstarsData, SIGNAL( initFinished(bool) ), this, SLOT( datainitFinished(bool) ) );
 
@@ -96,9 +98,9 @@
 	//store original color scheme
 	OriginalPalette = QApplication::palette();
 
-        //Initialize QActionGroups
-        fovGroup = new QActionGroup( this );
-        cschemeGroup = new QActionGroup( this );
+	//Initialize QActionGroups
+	fovGroup = new QActionGroup( this );
+	cschemeGroup = new QActionGroup( this );
 
 #if ( __GLIBC__ >= 2 &&__GLIBC_MINOR__ >= 1  && !defined(__UCLIBC__) )
 	kDebug() << "glibc >= 2.1 detected.  Using GNU extension sincos()" << endl;
@@ -109,42 +111,22 @@
 
 KStars::~KStars()
 {
-	//store focus values in Options
-	Options::setFocusRA( skymap->focus()->ra()->Hours() );
-	Options::setFocusDec( skymap->focus()->dec()->Degrees() );
-
-	//Store Window geometry in Options object
-	Options::setWindowWidth( width() );
-	Options::setWindowHeight( height() );
-
-	//explicitly save the colorscheme data to the config file
-	data()->colorScheme()->saveToConfig( KGlobal::config() );
-
-	//explicitly save toolbar settings to config file
-	toolBar( "kstarsToolBar" )->saveSettings( KGlobal::config(), "MainToolBar" );
-	toolBar( "viewToolBar" )->saveSettings( KGlobal::config(), "ViewToolBar" );
-
-	//synch the config file with the Config object
-	Options::writeConfig();
-
-	clearCachedFindDialog();
-
 	delete skymap;
 	delete AAVSODialog;
 	delete indimenu;
 	delete indidriver;
 	delete indiseq;
 
-        delete fovGroup;
-        delete cschemeGroup;
+	delete fovGroup;
+	delete cschemeGroup;
 
 	skymap = 0;
 	AAVSODialog = 0;
 	indimenu = 0;
 	indidriver = 0;
 	indiseq = 0;
-        fovGroup = 0;
-        cschemeGroup = 0;
+	fovGroup = 0;
+	cschemeGroup = 0;
 }
 
 void KStars::clearCachedFindDialog() {
--- trunk/KDE/kdeedu/kstars/kstars/kstars.h #536048:536049
@@ -605,6 +605,9 @@
 		/**Toggle to and from full screen mode */
 		void slotFullScreen();
 
+		/**Save data to config file before exiting.*/
+		void slotAboutToQuit();
+
 	private:
 		/**
 			*Initialize Menu bar, toolbars and all Actions.
--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #536048:536049
@@ -1012,3 +1012,26 @@
 	  indidriver = new INDIDriver(this);
 }
 
+void KStars::slotAboutToQuit()
+{
+	//store focus values in Options
+	Options::setFocusRA( skymap->focus()->ra()->Hours() );
+	Options::setFocusDec( skymap->focus()->dec()->Degrees() );
+
+	//Store Window geometry in Options object
+	Options::setWindowWidth( width() );
+	Options::setWindowHeight( height() );
+
+	//explicitly save the colorscheme data to the config file
+	data()->colorScheme()->saveToConfig( KGlobal::config() );
+
+	//explicitly save toolbar settings to config file
+	toolBar( "kstarsToolBar" )->saveSettings( KGlobal::config(), "MainToolBar" );
+	toolBar( "viewToolBar" )->saveSettings( KGlobal::config(), "ViewToolBar" );
+
+	//synch the config file with the Config object
+	writeConfig();
+
+	clearCachedFindDialog();
+}
+


More information about the Kstars-devel mailing list