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

scribus-commit scribus-commit at lists.scribus.net
Thu Aug 14 06:21:35 UTC 2014


Author: jghali
Date: Thu Aug 14 06:21:35 2014
New Revision: 19425

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

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/undomanager.h

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19425&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Aug 14 06:21:35 2014
@@ -3867,7 +3867,7 @@
 	t.start();
 	times(&tms1);
 #endif
-	undoManager->setUndoEnabled(false);
+	
 	QFileInfo fi(fileName);
 	if (!fi.exists())
 	{
@@ -3875,6 +3875,7 @@
 		                           CommonStrings::tr_OK);
 		return false;
 	}
+	
 	qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 	if (HaveDoc)
 		outlinePalette->buildReopenVals();
@@ -3909,6 +3910,7 @@
 		}
 	}
 
+	UndoBlocker undoBlocker;
 	if (!fileName.isEmpty())
 	{
 		QString FName = fi.absoluteFilePath();
@@ -3983,7 +3985,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;
@@ -3999,7 +4001,6 @@
 			mainWindowStatusLabel->setText("");
 			mainWindowProgressBar->reset();
 			ActWin = NULL;
-			undoManager->setUndoEnabled(true);
 			if (windows.count() != 0)
 			{
 				newActWin(ActWinOld->getSubWin());
@@ -4284,7 +4285,6 @@
 	undoManager->switchStack(doc->DocName);
 	pagePalette->Rebuild();
 	qApp->restoreOverrideCursor();
-	undoManager->setUndoEnabled(true);
 	doc->setModified(false);
 	foreach (NotesStyle* NS, doc->m_docNotesStylesList)
 		doc->updateNotesFramesStyles(NS);

Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19425&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Thu Aug 14 06:21:35 2014
@@ -778,4 +778,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