[Uml-devel] [PATCH] TipOfDay issue fixed

Sebastian Stein s5228 at informatik.htw-dresden.de
Sun Jul 21 14:23:04 UTC 2002


Hi,

I fixed the problem with the TipOfDay dialog. The users wish to show it
again or not was not used, only the setting from the pref dialog.

The attached file fixes the current problem, but I think the problem lies
deeper. Because the configuration is stored 2 times and there are situations
where both versions run out of sync. The first version is the KConfig * config
datamember of class UMLApp and the other version is a datamember of class
UMLApp as well named SettingsDlg::OptionState optionState. As you can see
optionState is imported from another class and I think this is no good
design (bloated interface).

I had a look at KDevelop and they only use the KConfig * variable.

I don't really know at the moment if it is necessary to remove optionState,
because it would cause a lot of changes. But it would be the cleaner
solution and may prevent some bugs in the future.

Steinchen

PS: copy attached file to uml/uml/ and do diff -p1 < tip_of_day_patch.diff
-- 
http://www.hpfsc.de/ - die Seite rund um:
Assembler, Bundeswehr, TFT LCDs, Halle/Saale, Fahrradtouren,
Wanderstaat Mauma, Raumschiff USS Nathan, Enemy Room, MLCAD Tutorial
-------------- next part --------------
diff -u old/main.cpp new/main.cpp
--- old/main.cpp	Sun Jul 21 22:50:11 2002
+++ new/main.cpp	Sun Jul 21 22:36:36 2002
@@ -56,8 +56,8 @@
 		uml -> show();
 		//show tips if wanted
 		cfg -> setGroup( "TipOfDay");
-		if( cfg -> readBoolEntry( "RunOnStart", true ) )
-			KTipDialog::showTip();
+		KTipDialog::showTip();
+
 		KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 		if ( args -> count() )
 		{
diff -u old/uml.cpp new/uml.cpp
--- old/uml.cpp	Sun Jul 21 22:50:27 2002
+++ new/uml.cpp	Sun Jul 21 23:01:36 2002
@@ -324,6 +324,7 @@
 	else
 		config -> writeEntry( "lastFile", doc -> URL().prettyURL() );	
   config -> setGroup( "TipOfDay");
+  optionState.generalState.tip = config -> readBoolEntry( "RunOnStart", true );
   config -> writeEntry( "RunOnStart", optionState.generalState.tip );
 
   config -> setGroup( "UI Options" );
@@ -819,12 +820,22 @@
 
 void UMLApp::slotPrefs()
 {
-  //do this here as may add settings so that the list view may need to be called.
+  /* the KTipDialog may have changed the value */
+  config -> setGroup( "TipOfDay");
+  optionState.generalState.tip = config -> readBoolEntry( "RunOnStart", true );
+
+  //do this here as may add settings so that the list view may need to be
+  //called.
   SettingsDlg dlg( this, optionState );
   if( dlg.exec() == QDialog::Accepted && dlg.getChangesApplied() )
   {
        //changes made so let the document tell the views
        optionState = dlg.getOptionState();
+
+       /* we need this to sync both values */
+       config -> setGroup( "TipOfDay");
+       config -> writeEntry( "RunOnStart", optionState.generalState.tip );
+		 
 		if( optionState.uiState.showDocWindow != showDocumentation -> isChecked() )
 			slotShowDocWindow();
     doc -> settingsChanged( optionState );
Only in old/: uml.h


More information about the umbrello-devel mailing list