r15496 by craig - #9382: Fix 1 old crash in old/new font prefs, fix 1 new in new font prefs, rewrite new font prefs pane to store data until prefs pane is closed, allowing cancellation of changes

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 4 22:01:46 CEST 2010


Author: craig
Date: Mon Oct  4 20:01:46 2010
New Revision: 15496

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15496
Log:
#9382: Fix 1 old crash in old/new font prefs, fix 1 new in new font prefs, rewrite new font prefs pane to store data until prefs pane is closed, allowing cancellation of changes

Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    trunk/Scribus/scribus/colorsetmanager.cpp
    trunk/Scribus/scribus/colorsetmanager.h
    trunk/Scribus/scribus/plugins/CMakeLists.txt
    trunk/Scribus/scribus/scpaths.cpp
    trunk/Scribus/scribus/scpaths.h
    trunk/Scribus/scribus/ui/colorm.cpp
    trunk/Scribus/scribus/ui/colorm.h
    trunk/Scribus/scribus/ui/fontprefs.cpp
    trunk/Scribus/scribus/ui/prefs_fonts.cpp
    trunk/Scribus/scribus/ui/prefs_fonts.h

Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Mon Oct  4 20:01:46 2010
@@ -1062,21 +1062,27 @@
 ENDIF(HAVE_BOOST)
 
 # Now build plugins
-SET(PLUGIN_LIBRARIES)
+SET(PLUGIN_LIBRARIES
+  ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}
+  ${LIBXML2_LIBRARIES}
+  ${ZLIB_LIBRARIES}
+)
 IF(WIN32)
   # IF your plugin needs more than this, please link them privately
   # in the CMakeLists.txt for your plugin.
   SET(PLUGIN_LIBRARIES
 #    ${QT_LIBRARIES} part of #7210
-    ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}
-    ${LIBXML2_LIBRARIES}
-    ${ZLIB_LIBRARIES}
+	${PLUGIN_LIBRARIES}
     ${EXE_NAME}
     )
 ENDIF(WIN32)
 IF(APPLE)
-  SET(PLUGIN_LIBRARIES "-undefined dynamic_lookup")
+  SET(PLUGIN_LIBRARIES
+	${PLUGIN_LIBRARIES}
+	"-undefined dynamic_lookup"
+  )
 ENDIF(APPLE)
+MESSAGE(STATUS ${PLUGIN_LIBRARIES})
 
 ADD_SUBDIRECTORY(plugins)
 

Modified: trunk/Scribus/scribus/colorsetmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/colorsetmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.cpp (original)
+++ trunk/Scribus/scribus/colorsetmanager.cpp Mon Oct  4 20:01:46 2010
@@ -111,14 +111,27 @@
 {
 	paletteLocations.clear();
 	QStringList locations=ScPaths::instance().getSystemCreateSwatchesDirs();
-	locations << ScPaths::instance().getSystemXDGDirs("swatches");
-	locations << ScPaths::instance().libDir()+"swatches/";
+	locations << ScPaths::instance().shareDir()+"swatches/";
+	locations << ScPaths::instance().getDirsFromEnvVar("XDG_DATA_HOME", "scribus/swatches/");
 	for ( QStringList::Iterator it = locations.begin(); it != locations.end(); ++it )
 	{
-		QFile createDir(*it);
-		if (createDir.exists())
+		QFile paletteDir(*it);
+		if (paletteDir.exists())
+		{
 			paletteLocations << (*it);
-    }
+			paletteLocationLocks.insert((*it), false);
+		}
+	}
+	QStringList xdgSysLocations=ScPaths::instance().getDirsFromEnvVar("XDG_DATA_DIRS", "scribus/swatches/");
+	for ( QStringList::Iterator it = xdgSysLocations.begin(); it != xdgSysLocations.end(); ++it )
+	{
+		QFile paletteDir(*it);
+		if (paletteDir.exists())
+		{
+			paletteLocations << (*it);
+			paletteLocationLocks.insert((*it), true);
+		}
+	}
 }
 
 void ColorSetManager::findPalettes()
@@ -130,6 +143,7 @@
 		path=(*it);
 		QDir dir(path , "*.xml *.gpl *.eps *.ai *.sla *.soc", QDir::Name, QDir::Files | QDir::NoSymLinks);
 		if (dir.exists() && (dir.count() != 0))
+		{
 			for (uint i = 0; i < dir.count(); ++i) 
 			{
 				QFileInfo file(path + dir[i]);
@@ -137,6 +151,7 @@
 				setName.replace("_", " ");
 				palettes.insert(setName, file.absoluteFilePath());
 			}
+		}
 	}
 }
 
@@ -154,3 +169,9 @@
 		return palettes[paletteName];
 	return QString();
 }
+
+bool ColorSetManager::paletteLocationLocked(const QString& palettePath)
+{
+	return (paletteLocationLocks.contains(palettePath) && paletteLocationLocks.value(palettePath)==true);
+}
+

Modified: trunk/Scribus/scribus/colorsetmanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/colorsetmanager.h
==============================================================================
--- trunk/Scribus/scribus/colorsetmanager.h (original)
+++ trunk/Scribus/scribus/colorsetmanager.h Mon Oct  4 20:01:46 2010
@@ -30,9 +30,11 @@
 		void findPalettes();
 		QStringList paletteNames();
 		QString paletteFileFromName(const QString& paletteName);
+		bool paletteLocationLocked(const QString& palettePath);
 		
 	protected:
 		QStringList paletteLocations;
 		QMap<QString, QString> palettes;
+		QMap<QString, bool> paletteLocationLocks;
 };
 #endif

Modified: trunk/Scribus/scribus/plugins/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/plugins/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/CMakeLists.txt Mon Oct  4 20:01:46 2010
@@ -7,6 +7,7 @@
 # ADD_SUBDIRECTORY(newfromtemplateplugin)
 ADD_SUBDIRECTORY(pixmapexport)
 ADD_SUBDIRECTORY(saveastemplateplugin)
+
 IF(NOT WANT_SCRIPTER2)
   #scripter1
   IF(NOT WIN32)

Modified: trunk/Scribus/scribus/scpaths.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/scpaths.cpp
==============================================================================
--- trunk/Scribus/scribus/scpaths.cpp (original)
+++ trunk/Scribus/scribus/scpaths.cpp Mon Oct  4 20:01:46 2010
@@ -272,52 +272,33 @@
 	return iccProfDirs;
 }
 
-QStringList ScPaths::getSystemXDGDirs(const QString dirToFind)
+QStringList ScPaths::getDirsFromEnvVar(const QString envVar, const QString dirToFind)
 {
 	QChar sep(':');
 #ifdef _WIN32
 	sep=';';
 #endif
-	QStringList xdgDirs;
+	QStringList dirs;
 #if defined(Q_OS_MAC) or defined(Q_OS_UNIX)
-	//qDebug()<<"Searching for XDG locations...";
-	//Get $XDG_DATA_HOME
-	QStringList env = QProcess::systemEnvironment();
-	QString path_xdg_home,path_xdg_data;
+	QStringList env(QProcess::systemEnvironment());
+	QString path_data;
 	foreach (QString line, env)
 	{
-		if (line.indexOf("XDG_DATA_HOME") == 0)
-			path_xdg_home = line.mid(14); //Strip "XDG_DATA_HOME="
-		if (line.indexOf("XDG_DATA_DIRS") == 0)
-			path_xdg_data = line.mid(14); //Strip "XDG_DATA_DIRS="
-	}
-	QStringList splitpath_home,splitpath_data;
-	splitpath_home = path_xdg_home.split(sep, QString::SkipEmptyParts);
-	splitpath_data = path_xdg_data.split(sep, QString::SkipEmptyParts);
-	//qDebug()<<"splitpath_home: "<<splitpath_home;
-	//qDebug()<<"splitpath_data: "<<splitpath_data;
-	QString dirSuffix("scribus/"+dirToFind);
-	foreach (QString dir, splitpath_home)
-	{
-		QFileInfo info(dir+dirSuffix);
+		if (line.indexOf(envVar) == 0)
+			path_data = line.mid(envVar.length()+1); //eg, Strip "XDG_DATA_DIRS="
+	}
+	QStringList splitpath_data(path_data.split(sep, QString::SkipEmptyParts));
+	foreach (QString dir, splitpath_data)
+	{
+		QFileInfo info(dir+dirToFind);
 		if (info.exists())
-		{
-			//qDebug()<<"XDG_HOME:"<<dir+dirSuffix;
-			xdgDirs.append(dir+dirSuffix);
-		}
-	}
-	foreach (QString dir, splitpath_data)
-	{
-		QFileInfo info(dir+dirSuffix);
-		if (info.exists())
-		{
-			//qDebug()<<"XDG_DATA:"<<dir+dirSuffix;
-			xdgDirs.append(dir+dirSuffix);
-		}
-	}
-#endif
-	return xdgDirs;
-}
+			dirs.append(dir+dirToFind);
+	}
+#endif
+	return dirs;
+}
+
+
 QStringList ScPaths::getSystemCreateSwatchesDirs(void)
 {
 	QStringList createDirs;

Modified: trunk/Scribus/scribus/scpaths.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/scpaths.h
==============================================================================
--- trunk/Scribus/scribus/scpaths.h (original)
+++ trunk/Scribus/scribus/scpaths.h Mon Oct  4 20:01:46 2010
@@ -60,8 +60,8 @@
 	static QStringList getSystemProfilesDirs(void);
 	/** @brief Return paths to system create project directories*/
 	static QStringList getSystemCreateSwatchesDirs(void);
-	/** @brief Return paths to system XDG directories*/
-	static QStringList getSystemXDGDirs(const QString dirToFind);
+	/** @brief Return paths to directories held in an environment variable*/
+	static QStringList getDirsFromEnvVar(const QString envVar, const QString dirToFind);
 	/** @brief Return path to application data dir*/
 	static QString getApplicationDataDir(void);
 	/** @brief Return path to image cache dir*/

Modified: trunk/Scribus/scribus/ui/colorm.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/ui/colorm.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorm.cpp (original)
+++ trunk/Scribus/scribus/ui/colorm.cpp Mon Oct  4 20:01:46 2010
@@ -48,7 +48,10 @@
 
 
 ColorManager::ColorManager(QWidget* parent, ColorList doco, ScribusDoc* doc, QString docColSet, QStringList custColSet)
-		: QDialog( parent ), EditColors(doc, true), UsedC(doc, true)
+		: QDialog( parent ),
+		EditColors(doc, true),
+		UsedC(doc, true),
+		paletteLocked(false)
 {
 	setModal(true);
 	setWindowTitle( tr( "Colors" ) );
@@ -262,6 +265,7 @@
 		EditColors.insert("Red", ScColor(0, 255, 255, 0));
 		EditColors.insert("Yellow", ScColor(0, 0, 255, 0));
 		EditColors.insert("Magenta", ScColor(0, 255, 0, 0));
+		paletteLocked=false;
 	}
 	else
 	{
@@ -274,6 +278,9 @@
 			Fname += ".xml";
 			pfadC2 = QDir::convertSeparators(ScPaths::getApplicationDataDir()+Fname);
 		}
+
+		QFileInfo fi(pfadC2);
+		paletteLocked=csm.paletteLocationLocked(fi.absolutePath()+"/");
 	}
 	if (txt != "Scribus Small")
 	{
@@ -455,46 +462,62 @@
 
 void ColorManager::selColor(QListWidgetItem *c)
 {
-	sColor = c->text();
-	ScColor tmpColor = EditColors[sColor];
-	bool enableEdit = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor());
-	bool enableDel  = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
-	editColorButton->setEnabled(enableEdit);
-	duplicateColorButton->setEnabled(sColor != "Registration");
-	deleteColorButton->setEnabled(enableDel);
-}
-
-void ColorManager::selEditColor(QListWidgetItem *c)
-{
-	sColor = c->text();
-	ScColor tmpColor = EditColors[sColor];
-	bool enableEdit = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor());
-	bool enableDel  = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
-	editColorButton->setEnabled(enableEdit);
-	duplicateColorButton->setEnabled(!tmpColor.isRegistrationColor());
-	deleteColorButton->setEnabled(enableDel);
-	if(enableEdit)
-		editColor();
-}
-
-void ColorManager::updateButtons()
-{
-	ColorPixmapItem* currItem = dynamic_cast<ColorPixmapItem*>(colorListBox->currentItem());
-	if (currItem)
-	{
-		QString curCol = currItem->text();
-		ScColor tmpColor = EditColors[curCol];
-		bool enableDel  = (curCol != "Black" && curCol != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
-		bool enableEdit = (curCol != "Black" && curCol != "White" && !tmpColor.isRegistrationColor());
+	if (!paletteLocked)
+	{
+		sColor = c->text();
+		ScColor tmpColor = EditColors[sColor];
+		bool enableEdit = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor());
+		bool enableDel  = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
+		editColorButton->setEnabled(enableEdit);
 		duplicateColorButton->setEnabled(sColor != "Registration");
 		deleteColorButton->setEnabled(enableDel);
+	}
+}
+
+void ColorManager::selEditColor(QListWidgetItem *c)
+{
+	if (!paletteLocked)
+	{
+		sColor = c->text();
+		ScColor tmpColor = EditColors[sColor];
+		bool enableEdit = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor());
+		bool enableDel  = (sColor != "Black" && sColor != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
 		editColorButton->setEnabled(enableEdit);
-	}
-	else
-	{
-		duplicateColorButton->setEnabled(false);
-		editColorButton->setEnabled(false);
-		deleteColorButton->setEnabled(false);
+		duplicateColorButton->setEnabled(!tmpColor.isRegistrationColor());
+		deleteColorButton->setEnabled(enableDel);
+		if(enableEdit)
+			editColor();
+	}
+}
+
+void ColorManager::updateButtons()
+{
+	deleteColorButton->setEnabled(!paletteLocked);
+	newColorButton->setEnabled(!paletteLocked);
+	editColorButton->setEnabled(!paletteLocked);
+	duplicateColorButton->setEnabled(!paletteLocked);
+	saveButton->setEnabled(!paletteLocked);
+	importColorsButton->setEnabled(!paletteLocked);
+
+	if (!paletteLocked)
+	{
+		ColorPixmapItem* currItem = dynamic_cast<ColorPixmapItem*>(colorListBox->currentItem());
+		if (currItem)
+		{
+			QString curCol = currItem->text();
+			ScColor tmpColor = EditColors[curCol];
+			bool enableDel  = (curCol != "Black" && curCol != "White" && !tmpColor.isRegistrationColor()) && (EditColors.count() > 1);
+			bool enableEdit = (curCol != "Black" && curCol != "White" && !tmpColor.isRegistrationColor());
+			duplicateColorButton->setEnabled(sColor != "Registration");
+			deleteColorButton->setEnabled(enableDel);
+			editColorButton->setEnabled(enableEdit);
+		}
+		else
+		{
+			duplicateColorButton->setEnabled(false);
+			editColorButton->setEnabled(false);
+			deleteColorButton->setEnabled(false);
+		}
 	}
 }
 

Modified: trunk/Scribus/scribus/ui/colorm.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/ui/colorm.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorm.h (original)
+++ trunk/Scribus/scribus/ui/colorm.h Mon Oct  4 20:01:46 2010
@@ -79,6 +79,7 @@
 	QColor tmpColor;
 	QStringList DontChange;
 	ScribusDoc* m_Doc;
+	bool paletteLocked;
 
 private slots:
 	void saveDefaults();

Modified: trunk/Scribus/scribus/ui/fontprefs.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/ui/fontprefs.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/fontprefs.cpp (original)
+++ trunk/Scribus/scribus/ui/fontprefs.cpp Mon Oct  4 20:01:46 2010
@@ -224,7 +224,7 @@
 	{
 		dirs->set("fontprefs", s.left(s.lastIndexOf("/", -2)));
 		if( s.endsWith("/") )
-			s = s.left(s.length()-1);
+			s.chop(1);
 		QString s2 = QDir::convertSeparators(s);
 		if (PathList->findItems(s2, Qt::MatchExactly).count() != 0)
 			return;
@@ -248,8 +248,8 @@
 	if (!s.isEmpty())
 	{
 		if( s.endsWith("/") )
-			s = s.left(s.length()-1);
-		QString s2 = QDir::convertSeparators(s2);
+			s.chop(1);
+		QString s2 = QDir::convertSeparators(s);
 		if (PathList->findItems(s2, Qt::MatchExactly).count() != 0)
 			return;
 		QString path = PathList->currentItem()->text();

Modified: trunk/Scribus/scribus/ui/prefs_fonts.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/ui/prefs_fonts.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.cpp Mon Oct  4 20:01:46 2010
@@ -16,6 +16,7 @@
 #include <QTableWidget>
 #include <QHeaderView>
 #include <QLabel>
+#include <QDir>
 #include <QFileDialog>
 #include <QFileInfo>
 #include <QFile>
@@ -121,7 +122,8 @@
 void Prefs_Fonts::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
 	// 	SCFonts* availFonts=&(PrefsManager::instance()->appPrefs.AvailFonts);
-		fontListTableView->setFonts(prefsData->fontPrefs.AvailFonts);
+	m_availFonts=prefsData->fontPrefs.AvailFonts;
+		fontListTableView->setFonts(m_availFonts);
 		/*
 		DON'T REMOVE THIS COMMENTS, PLEASE! (Petr)
 		It's just a performance vs. functionality test.
@@ -184,7 +186,8 @@
 	// 	UsedFonts.sort();
 		FlagsRepl.clear();
 		fontSubstitutionsTableWidget->clearContents();
-		fontSubstitutionsTableWidget->setRowCount(prefsData->fontPrefs.GFontSub.count());
+		m_GFontSub=prefsData->fontPrefs.GFontSub;
+		fontSubstitutionsTableWidget->setRowCount(m_GFontSub.count());
 		int a = 0;
 		QMap<QString,QString>::Iterator itfsu;
 		for (itfsu = RList.begin(); itfsu != RList.end(); ++itfsu)
@@ -200,11 +203,12 @@
 			FlagsRepl.append(item);
 			a++;
 		}
-		updateFontList(prefsData);
+		updateFontList();
 }
 
 void Prefs_Fonts::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
 {
+	writePaths();
 	prefsData->fontPrefs.GFontSub.clear();
 	uint a = 0;
 	for (QMap<QString,QString>::ConstIterator itfsu = RList.begin(); itfsu != RList.end(); ++itfsu)
@@ -217,19 +221,17 @@
 	deleteSubstitutionButton->setEnabled(true);
 }
 
-void Prefs_Fonts::updateFontList(struct ApplicationPrefs *prefsData)
-{
+void Prefs_Fonts::updateFontList()
+{
+	UsedFonts.clear();
+	SCFontsIterator it(m_availFonts);
+	for ( ; it.hasNext() ; it.next())
+	{
+		if (m_availFonts[it.currentKey()].usable())
+			UsedFonts.append(it.currentKey());
+	}
+	UsedFonts.sort();
 	QString tmp;
-	UsedFonts.clear();
-	SCFonts fonts = prefsData->fontPrefs.AvailFonts;
-	SCFontsIterator it(fonts);
-	for ( ; it.hasNext() ; it.next())
-	{
-		if (fonts[it.currentKey()].usable())
-			UsedFonts.append(it.currentKey());
-	}
-	UsedFonts.sort();
-
 	for (int b = 0; b < FlagsRepl.count(); ++b)
 	{
 		tmp = FlagsRepl.at(b)->currentText();
@@ -262,7 +264,7 @@
 		pathListWidget->addItem( QDir::convertSeparators(fontPathTable->get(i,0)) );
 }
 
-void Prefs_Fonts::writePaths()
+void Prefs_Fonts::writePaths() const
 {
 	Q_ASSERT(m_doc==0); // should never be called in doc-specific prefs
 	PrefsContext *fontPrefsContext = PrefsManager::instance()->prefsFile->getContext("Fonts");
@@ -292,20 +294,19 @@
 	{
 		dirs->set("fontprefs", s.left(s.lastIndexOf("/", -2)));
 		if( s.endsWith("/") )
-			s = s.left(s.length()-1);
+			s.chop(1);
 		QString s2 = QDir::convertSeparators(s);
 		if (pathListWidget->findItems(s2, Qt::MatchExactly).count() != 0)
 			return;
 		pathListWidget->addItem(s2);
-		writePaths();
+		//writePaths();
 		changeButton->setEnabled(false);
 		removeButton->setEnabled(false);
 		CurrentPath = s;
-		SCFonts* availFonts=&(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
-		QString dir = QDir::fromNativeSeparators(s2);
-		availFonts->AddScalableFonts(dir +"/");
-		availFonts->updateFontMap();
-		restoreDefaults(NULL);
+		QString dir(QDir::fromNativeSeparators(s2));
+		m_availFonts.AddScalableFonts(dir +"/");
+		m_availFonts.updateFontMap();
+		updateFontList();
 	}
 }
 
@@ -316,28 +317,27 @@
 	if (!s.isEmpty())
 	{
 		if( s.endsWith("/") )
-			s = s.left(s.length()-1);
-		QString s2 = QDir::convertSeparators(s2);
+			s.chop(1);
+		QString s2 = QDir::convertSeparators(s);
 		if (pathListWidget->findItems(s2, Qt::MatchExactly).count() != 0)
 			return;
 		QString path = pathListWidget->currentItem()->text();
-		SCFonts* availFonts=&(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
-		SCFontsIterator it(*availFonts);
+		SCFontsIterator it(m_availFonts);
 		for ( ; it.hasNext(); it.next())
 		{
 			if (it.current().isNone())
 				continue;
 			QFileInfo fi(it.current().fontFilePath());
 			if (fi.absolutePath() == path)
-				availFonts->remove(it.currentKey());
+				m_availFonts.remove(it.currentKey());
 		}
 		pathListWidget->currentItem()->setText(s2);
-		writePaths();
+		//writePaths();
 		CurrentPath = s;
 		QString dir = QDir::fromNativeSeparators(s2);
-		availFonts->AddScalableFonts(dir +"/");
-		availFonts->updateFontMap();
-		restoreDefaults(NULL);
+		m_availFonts.AddScalableFonts(dir +"/");
+		m_availFonts.updateFontMap();
+		updateFontList();
 		changeButton->setEnabled(false);
 		removeButton->setEnabled(false);
 	}
@@ -354,23 +354,22 @@
 			pathListWidget->clear();
 		else
 			delete pathListWidget->takeItem(pathListWidget->currentRow());
-		writePaths();
+		//writePaths();
 	}
 	else
 		return;
-	SCFonts* availFonts=&(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts);
-	SCFontsIterator it(*availFonts);
+	SCFontsIterator it(m_availFonts);
 	for ( ; it.hasNext(); it.next())
 	{
 		if (it.current().isNone())
 			continue;
 		QFileInfo fi(it.current().fontFilePath());
 		if (fi.absolutePath() == path)
-			availFonts->remove(it.currentKey());
-	}
-	availFonts->updateFontMap();
+			m_availFonts.remove(it.currentKey());
+	}
+	m_availFonts.updateFontMap();
 	CurrentPath = "";
-	restoreDefaults(NULL);
+	updateFontList();
 	changeButton->setEnabled(false);
 	removeButton->setEnabled(false);
 }

Modified: trunk/Scribus/scribus/ui/prefs_fonts.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15496&path=/trunk/Scribus/scribus/ui/prefs_fonts.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_fonts.h (original)
+++ trunk/Scribus/scribus/ui/prefs_fonts.h Mon Oct  4 20:01:46 2010
@@ -31,7 +31,7 @@
 	public slots:
 		void languageChange();
 		void ReplaceSel(int r, int c);
-		void updateFontList(struct ApplicationPrefs *prefsData);
+		void updateFontList();
 		void DelEntry();
 		void SelectPath(QListWidgetItem *c);
 		void AddPath();
@@ -40,7 +40,7 @@
 
 	protected:
 		void readPaths();
-		void writePaths();
+		void writePaths() const;
 
 		QMap<QString,QString> RList;
 		QList<ScComboBox*> FlagsRepl;
@@ -48,6 +48,11 @@
 		QStringList UsedFonts;
 		QString CurrentPath;
 		ScribusDoc* m_doc;
+
+
+		SCFonts m_availFonts; //! Fonts that Scribus has available to it, or the current document has available to use
+		bool m_askBeforeSubstitute; //! Request that the user confirms a font substitution or not
+		QMap<QString,QString> m_GFontSub;
 };
 
 #endif // PREFS_FONTS_H




More information about the scribus-commit mailing list