[Ktutorial-commits] SF.net SVN: ktutorial:[220] trunk/ktutorial/ktutorial-editor/src
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-03-30 07:25:54
|
Revision: 220 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=220&view=rev Author: danxuliu Date: 2010-03-30 07:25:48 +0000 (Tue, 30 Mar 2010) Log Message: ----------- Fix keeping the tutorial but changing the tutorial URL when the current tutorial was tried to be closed and the user cancelled the operation. 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-30 07:12:38 UTC (rev 219) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-30 07:25:48 UTC (rev 220) @@ -84,6 +84,10 @@ //urlSelected(KUrl) signal emitted by mRecentFilesAction, it is removed in //mRecentFilesAction->addUrl(KUrl), which leads to a crash void KTutorialEditor::loadTutorialFromUrl(KUrl url) { + if (!queryCloseTutorial()) { + return; + } + Tutorial* tutorial; try { tutorial = Serialization(this).loadTutorial(url); @@ -154,10 +158,6 @@ } void KTutorialEditor::setTutorialToBeEdited(Tutorial* tutorial) { - if (!queryCloseTutorial()) { - return; - } - if (!tutorial) { tutorial = new Tutorial(this); } @@ -449,6 +449,10 @@ } void KTutorialEditor::newTutorial() { + if (!queryCloseTutorial()) { + return; + } + setTutorialToBeEdited(); mTutorialUrl = KUrl(); //Force clean state, as clearing an empty stack would not emit Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-30 07:12:38 UTC (rev 219) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-30 07:25:48 UTC (rev 220) @@ -58,6 +58,8 @@ * clean state is forced. * An error message is shown if the tutorial couldn't be opened. * + * Nothing is done if the current tutorial, if any, should not be closed. + * * @param url The URL to load the tutorial from. */ void loadTutorialFromUrl(KUrl url); @@ -163,8 +165,6 @@ * * If the tutorial is null, a new empty tutorial is set. * - * Nothing is done if the previous tutorial should not be closed. - * * @param tutorial The tutorial to set. */ void setTutorialToBeEdited(Tutorial* tutorial = 0); @@ -236,6 +236,8 @@ /** * Creates a new empty tutorial replacing the current one, if any. * The tutorial URL is cleared. + * + * Nothing is done if the current tutorial, if any, should not be closed. */ void newTutorial(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |