r23701 by jghali - When importing pages, generate new line style names according to new schema ("StyleName (CopyNumber)")

scribus-commit scribus-commit at lists.scribus.net
Tue May 5 21:03:12 UTC 2020


Author: jghali
Date: Tue May  5 21:03:12 2020
New Revision: 23701

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23701
Log:
When importing pages, generate new line style names according to new schema ("StyleName (CopyNumber)")

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23701&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp	Tue May  5 21:03:12 2020
@@ -1935,19 +1935,12 @@
 					ml.push_back(sl);
 					MuLn = MuLn.nextSibling();
 				}
-				QString Nam = pg.attribute("Name");
-				QString Nam2 = Nam;
-				int copyC = 1;
-				QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.find(Nam2);
+				QString mlName = pg.attribute("Name");
+				QString mlName2 = mlName;
+				QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.find(mlName2);
 				if (mlit != m_Doc->MLineStyles.constEnd() && ml != mlit.value())
-				{
-					while (m_Doc->MLineStyles.contains(Nam2))
-					{
-						Nam2 = tr("Copy #%1 of ").arg(copyC)+Nam;
-						copyC++;
-					}
-				}
-				m_Doc->MLineStyles.insert(Nam2, ml);
+					mlName2 = getUniqueName(mlName2, m_Doc->MLineStyles);
+				m_Doc->MLineStyles.insert(mlName2, ml);
 			}
 			if ((pg.tagName() == "PAGE") && (pg.attribute("NUM").toInt() == pageNumber))
 			{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23701&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp	Tue May  5 21:03:12 2020
@@ -3290,16 +3290,9 @@
 			QString mlName  = attrs.valueAsString("Name");
 			QString mlName2 = mlName;
 			readMultiline(ml, reader);
-			int copyC = 1;
 			QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.constFind(mlName2);
 			if (mlit != m_Doc->MLineStyles.constEnd() && ml != mlit.value())
-			{
-				while (m_Doc->MLineStyles.contains(mlName2))
-				{
-					mlName2 = QObject::tr("Copy #%1 of ").arg(copyC)+mlName;
-					copyC++;
-				}
-			}
+					mlName2 = getUniqueName(mlName2, m_Doc->MLineStyles);
 			m_Doc->MLineStyles.insert(mlName2, ml);
 		}
 		if (tagName == "Pattern")

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23701&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp	Tue May  5 21:03:12 2020
@@ -2159,19 +2159,12 @@
 					ml.push_back(sl);
 					MuLn = MuLn.nextSibling();
 				}
-				QString Nam = pg.attribute("Name");
-				QString Nam2 = Nam;
-				int copyC = 1;
-				QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.find(Nam2);
+				QString mlName = pg.attribute("Name");
+				QString mlName2 = mlName;
+				QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.find(mlName2);
 				if (mlit != m_Doc->MLineStyles.constEnd() && ml != mlit.value())
-				{
-					while (m_Doc->MLineStyles.contains(Nam2))
-					{
-						Nam2 = QObject::tr("Copy #%1 of ").arg(copyC)+Nam;
-						copyC++;
-					}
-				}
-				m_Doc->MLineStyles.insert(Nam2, ml);
+					mlName2 = getUniqueName(mlName2, m_Doc->MLineStyles);
+				m_Doc->MLineStyles.insert(mlName2, ml);
 			}
 			if (pg.tagName() == "Arrows")
 			{

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23701&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp	Tue May  5 21:03:12 2020
@@ -6291,13 +6291,7 @@
 			int copyC = 1;
 			QHash<QString,multiLine>::ConstIterator mlit = m_Doc->MLineStyles.find(mlName2);
 			if (mlit != m_Doc->MLineStyles.end() && ml != mlit.value())
-			{
-				while (m_Doc->MLineStyles.contains(mlName2))
-				{
-					mlName2 = QObject::tr("Copy #%1 of ").arg(copyC)+mlName;
-					copyC++;
-				}
-			}
+					mlName2 = getUniqueName(mlName2, m_Doc->MLineStyles);
 			m_Doc->MLineStyles.insert(mlName2, ml);
 		}
 		if (tagName == "Pattern")




More information about the scribus-commit mailing list