[Ktutorial-commits] SF.net SVN: ktutorial:[212] trunk/ktutorial/ktutorial-editor/src
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-03-29 22:43:32
|
Revision: 212 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=212&view=rev Author: danxuliu Date: 2010-03-29 22:43:26 +0000 (Mon, 29 Mar 2010) Log Message: ----------- Make caption consistent with clean state: new tutorials start now showing a clean state and they no longer show "[not saved]" in the caption when they enter in an clean state (due to an undo). The editor doesn't warn the user before closing a new empty tutorial, so it shouldn't show "[not saved]" in the caption either. 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-29 22:24:45 UTC (rev 211) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.cpp 2010-03-29 22:43:26 UTC (rev 212) @@ -381,21 +381,23 @@ void KTutorialEditor::handleUndoStackCleanChanged(bool clean) { QString caption = captionFromTutorialUrl(); - if (clean && !mTutorialUrl.isEmpty()) { - actionCollection()->action("file_save")->setEnabled(false); + if (clean) { setCaption(caption); } else { - actionCollection()->action("file_save")->setEnabled(true); setCaption(i18nc("@title:window Wrapper for the window title when the \ tutorial was modified but not saved yet", "%1 [not saved]", caption)); } + + if (clean && !mTutorialUrl.isEmpty()) { + actionCollection()->action("file_save")->setEnabled(false); + } else { + actionCollection()->action("file_save")->setEnabled(true); + } } void KTutorialEditor::newTutorial() { setTutorialToBeEdited(); mTutorialUrl = KUrl(); - //Force unclean state, as clearing the stack returns it to the clean state - handleUndoStackCleanChanged(false); } void KTutorialEditor::openTutorial() { Modified: trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-29 22:24:45 UTC (rev 211) +++ trunk/ktutorial/ktutorial-editor/src/KTutorialEditor.h 2010-03-29 22:43:26 UTC (rev 212) @@ -176,10 +176,9 @@ /** * Modifies the caption and enables or disables Save action based on the * clean state of the stack. - * When the stack is not clean or the tutorial does not have an associated - * URL, "[not saved]" is added after the caption (the URL or "New file", - * depending on the case). Otherwise, the caption is the URL associated to - * the tutorial. + * When the stack is not clean, "[not saved]" is added after the caption + * (the URL or "New file", depending on the case). Otherwise, the caption is + * the URL associated to the tutorial. * * When the stack is clean and the tutorial has an associated URL, the Save * action is disabled. Otherwise, it is enabled, so if there is no @@ -192,7 +191,7 @@ /** * Creates a new empty tutorial replacing the current one, if any. - * The tutorial URL is cleared and an unclean state is forced. + * The tutorial URL is cleared. */ void newTutorial(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |