r19424 by jghali - #12222: Opening a non compatible Scribus format disables "Action History"

scribus-commit scribus-commit at lists.scribus.net
Thu Aug 14 06:19:40 UTC 2014


Author: jghali
Date: Thu Aug 14 06:19:40 2014
New Revision: 19424

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19424
Log:
#12222: Opening a non compatible Scribus format disables "Action History"

Modified:
    branches/Version14x/Scribus/scribus/scribus.cpp
    branches/Version14x/Scribus/scribus/undomanager.h

Modified: branches/Version14x/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19424&path=/branches/Version14x/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scribus.cpp (original)
+++ branches/Version14x/Scribus/scribus/scribus.cpp Thu Aug 14 06:19:40 2014
@@ -3902,7 +3902,6 @@
 
 bool ScribusMainWindow::loadDoc(QString fileName)
 {
-	undoManager->setUndoEnabled(false);
 	QFileInfo fi(fileName);
 	if (!fi.exists())
 	{
@@ -3942,6 +3941,7 @@
 		}
 	}
 
+	UndoBlocker undoBlocker;
 	if (!fileName.isEmpty())
 	{
 		QString FName = fi.absoluteFilePath();
@@ -4001,7 +4001,7 @@
 		//This also gives the user the opportunity to cancel the load when finding theres a replacement required.
 		if (loadSuccess && ScCore->usingGUI())
 			loadSuccess = fileLoader->postLoad(doc);
-		if(!loadSuccess)
+		if (!loadSuccess)
 		{
 			view->close();
 			delete fileLoader;
@@ -4015,7 +4015,6 @@
 			mainWindowStatusLabel->setText("");
 			mainWindowProgressBar->reset();
 			ActWin = NULL;
-			undoManager->setUndoEnabled(true);
 			if (windows.count() != 0)
 				newActWin(ActWinOld);
 			return false;
@@ -4265,7 +4264,6 @@
 	undoManager->switchStack(doc->DocName);
 	pagePalette->Rebuild();
 	qApp->restoreOverrideCursor();
-	undoManager->setUndoEnabled(true);
 	doc->setModified(false);
 	return ret;
 }

Modified: branches/Version14x/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19424&path=/branches/Version14x/Scribus/scribus/undomanager.h
==============================================================================
--- branches/Version14x/Scribus/scribus/undomanager.h (original)
+++ branches/Version14x/Scribus/scribus/undomanager.h Thu Aug 14 06:19:40 2014
@@ -801,4 +801,16 @@
 
 typedef UndoManager Um;
 
+class SCRIBUS_API UndoBlocker
+{
+public:
+	UndoBlocker() {
+		UndoManager::instance()->setUndoEnabled(false);
+	}
+
+	~UndoBlocker() {
+		UndoManager::instance()->setUndoEnabled(true);
+	}
+};
+
 #endif




More information about the scribus-commit mailing list