r22385 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Feb 6 22:51:13 UTC 2018


Author: jghali
Date: Tue Feb  6 22:51:13 2018
New Revision: 22385

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22385
Log:
#11926: it’s possible to create various objects with the same name

Modified:
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22385&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Tue Feb  6 22:51:13 2018
@@ -360,9 +360,18 @@
 	hatchForegroundQ(other.hatchForegroundQ)
 {
 	QString tmp;
-	m_imageVisible=m_Doc->guidesPrefs().showPic;
+	m_imageVisible = m_Doc->guidesPrefs().showPic;
 	m_Doc->TotalItems++;
+	
+	QString oldName(AnName);
+	int nameNum = m_Doc->TotalItems;
 	AnName += tmp.setNum(m_Doc->TotalItems);
+	while (m_Doc->itemNameExists(AnName))
+	{
+		++nameNum;
+		AnName = oldName + tmp.setNum(nameNum);
+	}
+	
 	uniqueNr = m_Doc->TotalItems;
 	invalid = true;
 	if (other.isInlineImage)
@@ -613,7 +622,16 @@
 		break;
 	}
 	m_Doc->TotalItems++;
-	AnName += tmp.setNum(m_Doc->TotalItems); // +" "+QDateTime::currentDateTime().toString();
+	
+	QString oldName(AnName);
+	int nameNum = m_Doc->TotalItems;
+	AnName += tmp.setNum(m_Doc->TotalItems);
+	while (m_Doc->itemNameExists(AnName))
+	{
+		++nameNum;
+		AnName = oldName + tmp.setNum(nameNum);
+	}
+	
 	uniqueNr = m_Doc->TotalItems;
 	AutoName = true;
 	setUName(AnName);




More information about the scribus-commit mailing list