r15764 by fschmid - Fixed Bug #9465: "Closing the Paint Manager results in crash"

scribus-commit scribus-commit at lists.scribus.net
Thu Nov 4 18:02:40 CET 2010


Author: fschmid
Date: Thu Nov  4 17:02:40 2010
New Revision: 15764

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15764
Log:
Fixed Bug #9465: "Closing the Paint Manager results in crash"

Modified:
    trunk/Scribus/scribus/ui/paintmanager.cpp
    trunk/Scribus/scribus/ui/swatchcombo.cpp

Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15764&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Thu Nov  4 17:02:40 2010
@@ -87,8 +87,8 @@
 	csm.findUserPalettes(userSwatches);
 	customColSet = csm.userPaletteNames();
 	userSwatches->setExpanded(true);
-	QFileInfo fi(docColSet);
-	LoadColSet->setCurrentComboItem(fi.baseName());
+//	QFileInfo fi(docColSet);
+	LoadColSet->setCurrentComboItem(docColSet);
 	if (m_doc != 0)
 	{
 		label->setText( tr("Merge Color Set"));
@@ -1239,7 +1239,7 @@
 			QTreeWidgetItem *item = LoadColSet->addSubItem(name, userSwatches);
 			item->setData(0, Qt::UserRole, fi.absolutePath());
 			disconnect(LoadColSet, SIGNAL(activated(QTreeWidgetItem*)), this, SLOT(loadDefaults(QTreeWidgetItem*)));
-			LoadColSet->setCurrentComboItem(name);
+			LoadColSet->setCurrentComboItem(fi.absolutePath() + "/" + name);
 			connect(LoadColSet, SIGNAL(activated(QTreeWidgetItem*)), this, SLOT(loadDefaults(QTreeWidgetItem*)));
 		}
 	}
@@ -1247,8 +1247,12 @@
 
 QString PaintManagerDialog::getColorSetName()
 {
+	QString NameK;
 	QTreeWidgetItem* item = LoadColSet->currentItem();
-	QString NameK = item->data(0, Qt::UserRole).toString() + "/" + item->text(0);
+	if (item->text(0) == "Scribus Small")
+		NameK = "Scribus Small";
+	else
+		NameK = item->data(0, Qt::UserRole).toString() + "/" + item->text(0);
 	return NameK;
 }
 

Modified: trunk/Scribus/scribus/ui/swatchcombo.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15764&path=/trunk/Scribus/scribus/ui/swatchcombo.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/swatchcombo.cpp (original)
+++ trunk/Scribus/scribus/ui/swatchcombo.cpp Thu Nov  4 17:02:40 2010
@@ -82,20 +82,33 @@
 void SwatchCombo::setCurrentComboItem(QString text)
 {
 	QFontMetrics fm(font());
-	QString elText = fm.elidedText(text, Qt::ElideMiddle, width());
-	setText(elText);
 	setToolTip(text);
-	QList<QTreeWidgetItem*> lg = dataTree->findItems(text, Qt::MatchExactly | Qt::MatchRecursive);
-	if (lg.count() > 0)
+	QList<QTreeWidgetItem*> lg;
+	if (text == "Scribus Small")
 	{
-		for (int a = 0; a < lg.count(); a++)
+		QString elText = fm.elidedText(text, Qt::ElideMiddle, width());
+		setText(elText);
+		lg = dataTree->findItems(text, Qt::MatchExactly | Qt::MatchRecursive);
+		dataTree->setCurrentItem(lg[0]);
+		return;
+	}
+	else
+	{
+		QFileInfo fo(text);
+		QString txt = fo.baseName();
+		QString elText = fm.elidedText(txt, Qt::ElideMiddle, width());
+		setText(elText);
+		QString dText = fo.absolutePath();
+		lg = dataTree->findItems(txt, Qt::MatchExactly | Qt::MatchRecursive);
+		if (lg.count() > 0)
 		{
-			QString pText = lg[a]->data(0, Qt::UserRole).toString();
-			QFileInfo fi(pText);
-			if (fi.baseName() == lg[a]->text(0))
+			for (int a = 0; a < lg.count(); a++)
 			{
-				dataTree->setCurrentItem(lg[0]);
-				break;
+				if (dText == lg[a]->data(0, Qt::UserRole).toString())
+				{
+					dataTree->setCurrentItem(lg[0]);
+					break;
+				}
 			}
 		}
 	}




More information about the scribus-commit mailing list