r24224 by jghali - #16323: Starting page not stored

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 11 13:20:53 UTC 2020


Author: jghali
Date: Wed Nov 11 13:20:53 2020
New Revision: 24224

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24224
Log:
#16323: Starting page not stored

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

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24224&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Wed Nov 11 13:20:53 2020
@@ -1467,8 +1467,6 @@
 	deMiscellaneous.setAttribute("saveEmergencyFile", static_cast<int>(appPrefs.miscPrefs.saveEmergencyFile));
 	elem.appendChild(deMiscellaneous);
 
-
-
 	QDomElement deSE = docu.createElement("StoryEditor");
 	deSE.setAttribute("Font", appPrefs.storyEditorPrefs.guiFont);
 	deSE.setAttribute("FontColorBackground", appPrefs.storyEditorPrefs.guiFontColorBackground.name());
@@ -2352,42 +2350,47 @@
 
 		if (dc.tagName() == "PageSets")
 		{
-			QDomNode pgs = DOC.firstChild();
-			if (!pgs.namedItem("PageNames").isNull())
+			QList<PageSet> newPageSets;
+			for (QDomNode pgs = DOC.firstChild(); !pgs.isNull(); pgs = pgs.nextSibling())
 			{
-				appPrefs.pageSets.clear();
-				while (!pgs.isNull())
+				QDomElement pgsAttr = pgs.toElement();
+				if (pgsAttr.tagName() != "Set")
+					continue;
+
+				struct PageSet pageS;
+				pageS.Name = pgsAttr.attribute("Name");
+				pageS.FirstPage = pgsAttr.attribute("FirstPage", "0").toInt();
+				pageS.Rows = pgsAttr.attribute("Rows", "1").toInt();
+				pageS.Columns = pgsAttr.attribute("Columns", "1").toInt();
+//				pageS.GapHorizontal = pgsAttr.attribute("GapHorizontal", "0").toDouble();
+//				pageS.GapVertical = pgsAttr.attribute("GapVertical", "0").toDouble();
+//				pageS.GapBelow = pgsAttr.attribute("GapBelow", "0").toDouble();
+				pageS.pageNames.clear();
+
+				for (QDomNode pgsN = pgs.firstChild(); !pgsN.isNull(); pgsN = pgsN.nextSibling())
 				{
-					QDomElement pgsAttr = pgs.toElement();
-					if (pgsAttr.tagName() == "Set")
-					{
-						struct PageSet pageS;
-						pageS.Name = pgsAttr.attribute("Name");
-						pageS.FirstPage = pgsAttr.attribute("FirstPage", "0").toInt();
-						pageS.Rows = pgsAttr.attribute("Rows", "1").toInt();
-						pageS.Columns = pgsAttr.attribute("Columns", "1").toInt();
-//						pageS.GapHorizontal = pgsAttr.attribute("GapHorizontal", "0").toDouble();
-//						pageS.GapVertical = pgsAttr.attribute("GapVertical", "0").toDouble();
-//						pageS.GapBelow = pgsAttr.attribute("GapBelow", "0").toDouble();
-						pageS.pageNames.clear();
-						QDomNode pgsN = pgs.firstChild();
-						while (!pgsN.isNull())
-						{
-							QDomElement PgsAttrN = pgsN.toElement();
-							if (PgsAttrN.tagName() == "PageNames")
-								pageS.pageNames.append(PgsAttrN.attribute("Name"));
-							pgsN = pgsN.nextSibling();
-						}
-						appPrefs.pageSets.append(pageS);
-						if ((appPrefs.pageSets.count() == appPrefs.docSetupPrefs.pagePositioning) && ((appPrefs.displayPrefs.pageGapHorizontal < 0) && (appPrefs.displayPrefs.pageGapVertical < 0)))
-						{
-							appPrefs.displayPrefs.pageGapHorizontal = ScCLocale::toDoubleC(pgsAttr.attribute("GapHorizontal"), 0.0);
-							appPrefs.displayPrefs.pageGapVertical   = ScCLocale::toDoubleC(pgsAttr.attribute("GapBelow"), 40.0);
-						}
-					}
-					pgs = pgs.nextSibling();
+					QDomElement pgsAttrN = pgsN.toElement();
+					if (pgsAttrN.tagName() == "PageNames")
+						pageS.pageNames.append(pgsAttrN.attribute("Name"));
+				}
+
+				int pagesPerSpread = pageS.Rows * pageS.Columns;
+				if (pagesPerSpread < 0)
+					continue;
+				if ((pagesPerSpread == 1) && (pageS.pageNames.count() > 1))
+					continue;
+				if ((pagesPerSpread > 1) && (pagesPerSpread != pageS.pageNames.count()))
+					continue;
+				newPageSets.append(pageS);
+
+				if ((newPageSets.count() == appPrefs.docSetupPrefs.pagePositioning) && ((appPrefs.displayPrefs.pageGapHorizontal < 0) && (appPrefs.displayPrefs.pageGapVertical < 0)))
+				{
+					appPrefs.displayPrefs.pageGapHorizontal = ScCLocale::toDoubleC(pgsAttr.attribute("GapHorizontal"), 0.0);
+					appPrefs.displayPrefs.pageGapVertical   = ScCLocale::toDoubleC(pgsAttr.attribute("GapBelow"), 40.0);
 				}
 			}
+			if (newPageSets.count() > 0)
+				appPrefs.pageSets = newPageSets;
 		}
 
 		if (dc.tagName() == "ColorManagement")

Modified: trunk/Scribus/scribus/prefsmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24224&path=/trunk/Scribus/scribus/prefsmanager.h
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.h	(original)
+++ trunk/Scribus/scribus/prefsmanager.h	Wed Nov 11 13:20:53 2020
@@ -99,7 +99,7 @@
 
 	/*! \brief Read the preferences.
 	\param fname optional filename with preferences. If is not given,
-	the defualt is used. */
+	the default is used. */
 	void ReadPrefs();
 	void ReadPrefsXML();
 
@@ -120,6 +120,7 @@
 	\param ho a file name to write
 	\retval bool true on success, false on write error */
 	bool ReadPref(const QString& ho);
+
 	void setGhostscriptExecutable(const QString&);
 	void setImageEditorExecutable(const QString&);
 	void setExtBrowserExecutable(const QString&);




More information about the scribus-commit mailing list