[Ktutorial-commits] SF.net SVN: ktutorial:[176] trunk/ktutorial/ktutorial-editor/src
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-03-22 18:31:04
|
Revision: 176 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=176&view=rev Author: danxuliu Date: 2010-03-22 18:30:57 +0000 (Mon, 22 Mar 2010) Log Message: ----------- When a step or reaction is added, if the dialog to set the data is cancelled the step or the reaction is removed. 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:13:49 UTC (rev 175) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-22 18:30:57 UTC (rev 176) @@ -245,11 +245,13 @@ mReactionActionDock->toggleViewAction()); } -void KTutorialEditor::showEditionDialog(EditionWidget* editionWidget) { +int KTutorialEditor::showEditionDialog(EditionWidget* editionWidget) { EditionDialog* dialog = new EditionDialog(editionWidget, this); dialog->setObjectName("editionDialog"); - dialog->exec(); + int dialogCode = dialog->exec(); dialog->deleteLater(); + + return dialogCode; } //private slots: @@ -332,7 +334,9 @@ Step* step = new Step(); mTutorial->addStep(step); - showEditionDialog(new StepDataWidget(step)); + if (showEditionDialog(new StepDataWidget(step)) == QDialog::Rejected) { + mTutorial->removeStep(step); + } } void KTutorialEditor::setStepData() { @@ -368,7 +372,9 @@ Reaction* reaction = new Reaction(); mCurrentStep->addReaction(reaction); - showEditionDialog(new ReactionWidget(reaction)); + if (showEditionDialog(new ReactionWidget(reaction)) == QDialog::Rejected) { + mCurrentStep->removeReaction(reaction); + } } void KTutorialEditor::setReactionData() { Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:13:49 UTC (rev 175) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-22 18:30:57 UTC (rev 176) @@ -98,8 +98,10 @@ * Shows an EditionDialog for the given EditionWidget. * * @param editionWidget The EditionWidget to wrap. + * @return QDialog::Accepted if the dialog was accepted, or + * QDialog::Rejected if the dialog was rejected. */ - void showEditionDialog(EditionWidget* editionWidget); + int showEditionDialog(EditionWidget* editionWidget); private Q_SLOTS: @@ -148,6 +150,7 @@ /** * Adds a new step to the tutorial and shows a StepDataWidget for it. + * The step is removed if the dialog is cancelled. */ void addStep(); @@ -174,6 +177,7 @@ /** * Adds a new reaction to the current step and shows a ReactionWidget for * it. + * The reaction is removed 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. |