[Ktutorial-commits] SF.net SVN: ktutorial:[177] trunk/ktutorial/ktutorial-editor/src
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-03-22 18:39:52
|
Revision: 177 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=177&view=rev Author: danxuliu Date: 2010-03-22 18:39:46 +0000 (Mon, 22 Mar 2010) Log Message: ----------- After a second thought, the behavior in the previous commit was rather silly. Instead of always adding and removing when cancelled, only add when accepted! Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:30:57 UTC (rev 176) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:39:46 UTC (rev 177) @@ -332,10 +332,11 @@ void KTutorialEditor::addStep() { Step* step = new Step(); - mTutorial->addStep(step); - if (showEditionDialog(new StepDataWidget(step)) == QDialog::Rejected) { - mTutorial->removeStep(step); + if (showEditionDialog(new StepDataWidget(step)) == QDialog::Accepted) { + mTutorial->addStep(step); + } else { + delete step; } } @@ -370,10 +371,11 @@ Q_ASSERT(mCurrentStep); Reaction* reaction = new Reaction(); - mCurrentStep->addReaction(reaction); - if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Rejected) { - mCurrentStep->removeReaction(reaction); + if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Accepted) { + mCurrentStep->addReaction(reaction); + } else { + delete reaction; } } Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:30:57 UTC (rev 176) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:39:46 UTC (rev 177) @@ -149,8 +149,8 @@ void setTutorialTearDown(); /** - * Adds a new step to the tutorial and shows a StepDataWidget for it. - * The step is removed if the dialog is cancelled. + * Adds a new step to the tutorial after showing a StepDataWidget for it. + * The step isn't added if the dialog is cancelled. */ void addStep(); @@ -175,9 +175,9 @@ void removeStep(); /** - * Adds a new reaction to the current step and shows a ReactionWidget for - * it. - * The reaction is removed if the dialog is cancelled. + * Adds a new reaction to the current step after showing a ReactionWidget + * for it. + * The reaction isn't added if the dialog is cancelled. */ void addReaction(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |