r15531 by jghali - merge trunk revisions up to r15528

scribus-commit scribus-commit at lists.scribus.net
Wed Oct 13 12:39:26 CEST 2010


Author: jghali
Date: Wed Oct 13 10:39:26 2010
New Revision: 15531

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15531
Log:
merge trunk revisions up to r15528

Modified:
    branches/ScribusOIF/scribus/actionmanager.cpp
    branches/ScribusOIF/scribus/canvasmode_edit.cpp
    branches/ScribusOIF/scribus/filewatcher.cpp
    branches/ScribusOIF/scribus/filewatcher.h
    branches/ScribusOIF/scribus/hyphenator.cpp
    branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.cpp
    branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.h
    branches/ScribusOIF/scribus/plugins/scriptplugin/scriptplugin.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/ui/contextmenu.cpp
    branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
    branches/ScribusOIF/scribus/ui/scrapbookpalette.h
    branches/ScribusOIF/scribus/util_formats.h

Modified: branches/ScribusOIF/scribus/actionmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/actionmanager.cpp
==============================================================================
--- branches/ScribusOIF/scribus/actionmanager.cpp (original)
+++ branches/ScribusOIF/scribus/actionmanager.cpp Wed Oct 13 10:39:26 2010
@@ -416,8 +416,6 @@
 	scrActions->insert(name, new ScrAction(loadIcon("16/go-down.png"), loadIcon("22/go-down.png"), "", defaultKey(name), mainWindow));
 	name="itemRaise";
 	scrActions->insert(name, new ScrAction(loadIcon("16/go-up.png"), loadIcon("22/go-up.png"), "", defaultKey(name), mainWindow));
-//	name="itemSendToScrapbook";
-//	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemSendToPattern";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="itemImageInfo";
@@ -488,7 +486,6 @@
 	connect( (*scrActions)["itemUngroup"], SIGNAL(triggered()), mainWindow, SLOT(UnGroupObj()) );
 	connect( (*scrActions)["itemPDFAnnotationProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
 	connect( (*scrActions)["itemPDFFieldProps"], SIGNAL(triggered()), mainWindow, SLOT(ModifyAnnot()) );
-//	connect( (*scrActions)["itemSendToScrapbook"], SIGNAL(triggered()), mainWindow, SLOT(PutScrap()) );
 	connect( (*scrActions)["itemSendToPattern"], SIGNAL(triggered()), mainWindow, SLOT(PutToPatterns()) );
 	connect( (*scrActions)["itemAttributes"], SIGNAL(triggered()), mainWindow, SLOT(objectAttributes()) );
 	connect( (*scrActions)["itemShapeEdit"], SIGNAL(triggered()), mainWindow, SLOT(toggleNodeEdit()) );
@@ -1377,7 +1374,6 @@
 	(*scrActions)["itemRaiseToTop"]->setTexts( tr("Raise to &Top"));
 	(*scrActions)["itemLower"]->setTexts( tr("&Lower"));
 	(*scrActions)["itemRaise"]->setTexts( tr("&Raise"));
-//	(*scrActions)["itemSendToScrapbook"]->setTexts( tr("Send to S&crapbook"));
 	(*scrActions)["itemSendToPattern"]->setTexts( tr("Send to Patterns"));
 	(*scrActions)["itemAttributes"]->setTexts( tr("&Attributes..."));
 	(*scrActions)["itemImageInfo"]->setTexts( tr("More Info..."));
@@ -1800,7 +1796,6 @@
 		<< "itemLower" 
 		<< "itemRaiseToTop" 
 		<< "itemLowerToBottom" 
-//		<< "itemSendToScrapbook" 
 		<< "itemSendToPattern" 
 		<< "itemAttributes" 
 		<< "itemPDFIsAnnotation" 

Modified: branches/ScribusOIF/scribus/canvasmode_edit.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_edit.cpp (original)
+++ branches/ScribusOIF/scribus/canvasmode_edit.cpp Wed Oct 13 10:39:26 2010
@@ -418,7 +418,8 @@
 		else
 		{	//Double click in a frame to select a word
 			oldCp = currItem->CPos;
-			currItem->CPos = currItem->itemText.selectWord(currItem->CPos);
+			currItem->CPos   = currItem->itemText.selectWord(currItem->CPos);
+			currItem->HasSel = (currItem->itemText.lengthOfSelection() > 0);
 		}
 	}
 	else

Modified: branches/ScribusOIF/scribus/filewatcher.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/filewatcher.cpp
==============================================================================
--- branches/ScribusOIF/scribus/filewatcher.cpp (original)
+++ branches/ScribusOIF/scribus/filewatcher.cpp Wed Oct 13 10:39:26 2010
@@ -53,7 +53,7 @@
 	return m_timeOut;
 }
 
-void FileWatcher::addFile(QString fileName)
+void FileWatcher::addFile(QString fileName, bool fast)
 {
 	watchTimer->stop();
 	if (!watchedFiles.contains(fileName))
@@ -64,6 +64,8 @@
 		fi.pendingCount = 0;
 		fi.pending = false;
 		fi.refCount = 1;
+		fi.isDir = fi.info.isDir();
+		fi.fast = fast;
 		watchedFiles.insert(fileName, fi);
 	}
 	else
@@ -85,9 +87,9 @@
 		watchTimer->start(m_timeOut);
 }
 
-void FileWatcher::addDir(QString fileName)
-{
-	addFile(fileName);
+void FileWatcher::addDir(QString fileName, bool fast)
+{
+	addFile(fileName, fast);
 }
 
 void FileWatcher::removeDir(QString fileName)
@@ -146,22 +148,9 @@
 				break;
 			if (!it.value().pending)
 			{
-				it.value().pendingCount = 5;
-				it.value().pending = true;
-				emit statePending(it.key());
-				continue;
-			}
-			else
-			{
-				if (it.value().pendingCount != 0)
-				{
-					it.value().pendingCount--;
-					continue;
-				}
-				else
-				{
-					it.value().pending = false;
-					if (it.value().info.isDir())
+				if (it.value().fast)
+				{
+					if (it.value().isDir)
 						emit dirDeleted(it.key());
 					else
 						emit fileDeleted(it.key());
@@ -172,6 +161,35 @@
 						toRemove.append(it.key());
 					continue;
 				}
+				else
+				{
+					it.value().pendingCount = 5;
+					it.value().pending = true;
+					emit statePending(it.key());
+					continue;
+				}
+			}
+			else
+			{
+				if (it.value().pendingCount != 0)
+				{
+					it.value().pendingCount--;
+					continue;
+				}
+				else
+				{
+					it.value().pending = false;
+					if (it.value().isDir)
+						emit dirDeleted(it.key());
+					else
+						emit fileDeleted(it.key());
+					if (m_stateFlags & FileCheckMustStop)
+						break;
+					it.value().refCount--;
+					if (it.value().refCount == 0)
+						toRemove.append(it.key());
+					continue;
+				}
 			}
 		}
 		else
@@ -180,7 +198,7 @@
 			time = it.value().info.lastModified();
 			if (time != it.value().timeInfo)
 			{
-				if (it.value().info.isDir())
+				if (it.value().isDir)
 				{
 					it.value().timeInfo = time;
 					if (!(m_stateFlags & FileCheckMustStop))

Modified: branches/ScribusOIF/scribus/filewatcher.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/filewatcher.h
==============================================================================
--- branches/ScribusOIF/scribus/filewatcher.h (original)
+++ branches/ScribusOIF/scribus/filewatcher.h Wed Oct 13 10:39:26 2010
@@ -34,11 +34,11 @@
 	
 public slots:
 	//Add a file to the watch list for monitoring
-	void addFile(QString fileName);
+	void addFile(QString fileName, bool fast = false);
 	//Remove a file from the watch list
 	void removeFile(QString fileName);
 	//Add a directory to the watch list for monitoring
-	void addDir(QString fileName);
+	void addDir(QString fileName, bool fast = false);
 	//Remove a directory from the watch list
 	void removeDir(QString fileName);
 	//Start the watcher's timer for file monitoring
@@ -56,6 +56,8 @@
 		int pendingCount;
 		bool pending;
 		int refCount;
+		bool isDir;
+		bool fast;
 	};
 
 	typedef enum

Modified: branches/ScribusOIF/scribus/hyphenator.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/hyphenator.cpp
==============================================================================
--- branches/ScribusOIF/scribus/hyphenator.cpp (original)
+++ branches/ScribusOIF/scribus/hyphenator.cpp Wed Oct 13 10:39:26 2010
@@ -193,7 +193,7 @@
 	QByteArray te;
 
 	int startC = 0;
-	if (it->HasSel)
+	if (it->itemText.lengthOfSelection() > 0)
 	{
 		startC = it->itemText.startOfSelection();
 		text = it->itemText.text(startC, it->itemText.lengthOfSelection());
@@ -401,7 +401,7 @@
 	if (!(it->asTextFrame()) || (it ->itemText.length() == 0))
 		return;
 
-	if (it->HasSel)
+	if (it->itemText.lengthOfSelection() > 0)
 	{
 //		int start = it->itemText.startOfSelection();
 		it->itemText.hyphenateWord(it->itemText.startOfSelection(), it->itemText.lengthOfSelection(), NULL);

Modified: branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.cpp Wed Oct 13 10:39:26 2010
@@ -571,6 +571,45 @@
 //	return Py_None;
 	Py_RETURN_NONE;
 }
+PyObject *scribus_flipobject(PyObject* /* self */, PyObject* args)
+{
+	char *Name = const_cast<char*>("");
+	double h, v;
+	if (!PyArg_ParseTuple(args, "dd|es", &h, &v, "utf-8", &Name))
+		return NULL;
+	if(!checkHaveDocument())
+		return NULL;
+	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
+	if (item == NULL)
+		return NULL;
+	
+	// Grab the old selection - but use it only where is there any
+	Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
+	bool hadOrigSelection = (tempSelection.count() != 0);
+
+	ScCore->primaryMainWindow()->doc->m_Selection->clear();
+	// Clear the selection
+	ScCore->primaryMainWindow()->view->Deselect();
+	// Select the item, which will also select its group if
+	// there is one.
+	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
+
+	// flip
+	if (h == 1) {
+		ScCore->primaryMainWindow()->doc->itemSelection_FlipH();
+		}
+	if (v == 1) {
+		ScCore->primaryMainWindow()->doc->itemSelection_FlipV();
+		}
+	// Now restore the selection.
+	ScCore->primaryMainWindow()->view->Deselect();
+	if (hadOrigSelection)
+		*ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
+
+//	Py_INCREF(Py_None);
+//	return Py_None;
+	Py_RETURN_NONE;
+}
 
 /*! HACK: this removes "warning: 'blah' defined but not used" compiler warnings
 with header files structure untouched (docstrings are kept near declarations)
@@ -586,5 +625,6 @@
 	  << scribus_ungroupobj__doc__ << scribus_scalegroup__doc__
 	  << scribus_loadimage__doc__ << scribus_scaleimage__doc__
 	  << scribus_setimagescale__doc__ << scribus_lockobject__doc__
-	  << scribus_islocked__doc__ << scribus_setscaleimagetoframe__doc__ << scribus_setimagebrightness__doc__ << scribus_setimagegrayscale__doc__ << scribus_setimageoffset__doc__;
-}
+	  << scribus_islocked__doc__ << scribus_setscaleimagetoframe__doc__ << scribus_setimagebrightness__doc__ << scribus_setimagegrayscale__doc__ << scribus_setimageoffset__doc__
+	  << scribus_flipobject__doc__;
+}

Modified: branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.h
==============================================================================
--- branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.h (original)
+++ branches/ScribusOIF/scribus/plugins/scriptplugin/cmdmani.h Wed Oct 13 10:39:26 2010
@@ -252,4 +252,14 @@
 "));
 PyObject *scribus_setscaleimagetoframe(PyObject * /*self*/, PyObject* args, PyObject* kwargs);
 
+/*! docstring */
+PyDoc_STRVAR(scribus_flipobject__doc__,
+QT_TR_NOOP("flipObject(H,V,[\"name\"])\n\
+\n\
+Toggle the object \"name\" horizontal and/or vertical flip.\n\
+If \"name\" is not given the currently selected item is used.\n\
+"));
+/*! Flip the object 2010/5/18.*/
+PyObject *scribus_flipobject(PyObject * /*self*/, PyObject* args);
+
 #endif

Modified: branches/ScribusOIF/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/scriptplugin/scriptplugin.cpp Wed Oct 13 10:39:26 2010
@@ -329,6 +329,7 @@
 	{const_cast<char*>("editMasterPage"), scribus_editmasterpage, METH_VARARGS, tr(scribus_editmasterpage__doc__)},
 	{const_cast<char*>("fileDialog"), (PyCFunction)scribus_filedia, METH_VARARGS|METH_KEYWORDS, tr(scribus_filedia__doc__)},
 	{const_cast<char*>("fileQuit"), scribus_filequit, METH_VARARGS, tr(scribus_filequit__doc__)},
+	{const_cast<char*>("flipObject"), scribus_flipobject, METH_VARARGS, tr(scribus_flipobject__doc__)},
 	{const_cast<char*>("getActiveLayer"), (PyCFunction)scribus_getactlayer, METH_NOARGS, tr(scribus_getactlayer__doc__)},
 	{const_cast<char*>("getAllObjects"), scribus_getallobj, METH_VARARGS, tr(scribus_getallobj__doc__)},
 	{const_cast<char*>("getAllStyles"), (PyCFunction)scribus_getstylenames, METH_NOARGS, tr(scribus_getstylenames__doc__)},

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Wed Oct 13 10:39:26 2010
@@ -605,9 +605,12 @@
 	if (scrapbookFileInfo.exists())
 		scrapbookPalette->readContents(scrapbookFile);
 	scrapbookPalette->setScrapbookFileName(scrapbookFile);
+	ScCore->fileWatcher->addDir(scrapbookFile, true);
 	scrapbookPalette->setOpenScrapbooks(prefsManager->appPrefs.scrapbookPrefs.RecentScrapbooks);
 	rebuildRecentPasteMenu();
 	connect(scrapbookPalette, SIGNAL(updateRecentMenue()), this, SLOT(rebuildRecentPasteMenu()));
+	connect(ScCore->fileWatcher, SIGNAL(dirChanged(QString )), scrapbookPalette, SLOT(reloadLib(QString )));
+	connect(ScCore->fileWatcher, SIGNAL(dirDeleted(QString )), scrapbookPalette, SLOT(closeOnDel(QString )));
 }
 
 

Modified: branches/ScribusOIF/scribus/ui/contextmenu.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/ui/contextmenu.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/contextmenu.cpp (original)
+++ branches/ScribusOIF/scribus/ui/contextmenu.cpp Wed Oct 13 10:39:26 2010
@@ -92,7 +92,6 @@
 	QMenu *menuInfo = new QMenu(this);
 	QMenu *menuLayer = new QMenu(this);
 	QMenu *menuLevel = new QMenu(this);
-	QMenu *menuScrap = new QMenu(this);
 	QMenu *menuPDF = new QMenu(this);
 	QMenu *menuResolution = new QMenu(this);
 	

Modified: branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/scrapbookpalette.cpp Wed Oct 13 10:39:26 2010
@@ -34,17 +34,22 @@
 #include <QProgressDialog>
 
 #include "commonstrings.h"
+#include "cmsettings.h"
+#include "filewatcher.h"
 #include "prefsfile.h"
 #include "prefsmanager.h"
 #include "query.h"
 #include "scpreview.h"
+#include "scimage.h"
 #include "scribuscore.h"
 #include "stencilreader.h"
 #include "fileloader.h"
 #include "loadsaveplugin.h"
 #include "plugins/formatidlist.h"
 #include "util.h"
+#include "util_color.h"
 #include "util_file.h"
+#include "util_formats.h"
 #include "util_icon.h"
 //CB TODO bring in the prefsManager instance locally here too
 
@@ -73,6 +78,8 @@
  void BibView::startDrag(Qt::DropActions supportedActions)
  {
 	QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+	QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
+	QStringList rasterFiles = formatD.split("|");
 	QString dt = objectMap[currentItem()->text()].Data;
 	QFileInfo fi(dt);
 	QMimeData *mimeData = new QMimeData;
@@ -106,7 +113,7 @@
 			mimeData->setUrls(urlList);
 		}
 	}
-	else if (vectorFiles.contains(fi.suffix().toLower()))
+	else if ((vectorFiles.contains(fi.suffix().toLower())) || (rasterFiles.contains(fi.suffix().toLower())))
 	{
 		if ( fi.exists() )
 		{
@@ -154,6 +161,8 @@
 	else if ( e->mimeData()->hasFormat("text/uri-list"))
 	{
 		QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
+		QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
+		QStringList rasterFiles = formatD.split("|");
 		QList<QUrl> fileUrls = e->mimeData()->urls();
 		e->acceptProposedAction();
 		for( int i = 0; i < fileUrls.count(); ++i )
@@ -168,15 +177,19 @@
 				if ((testResult != -1) && (testResult >= FORMATID_ODGIMPORT) && (fi.exists()))
 					emit fileDropped(url.path(), testResult);
 			}
+			else if (rasterFiles.contains(fi.suffix().toLower()))
+				emit fileDropped(url.path(), 9999);
 		}
 	}
 	else
 		e->ignore();
 }
 
-void BibView::AddObj(QString name, QString daten, QPixmap Bild)
+void BibView::AddObj(QString name, QString daten, QPixmap Bild, bool isDir, bool isRaster)
 {
 	struct Elem DrElem;
+	DrElem.isDir = false;
+	DrElem.isRaster = false;
 	DrElem.Data = daten;
 	DrElem.Preview = Bild;
 	objectMap.insert(name, DrElem);
@@ -302,6 +315,12 @@
 
 void BibView::SaveContents(QString name, QString oldName)
 {
+	QDir thumbs(name);
+	if (thumbs.exists())
+	{
+		if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+			thumbs.mkdir(".ScribusThumbs");
+	}
 	QDir d(oldName, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
 	if ((d.exists()) && (d.count() != 0))
 	{
@@ -313,9 +332,9 @@
 			QString ff = QString::fromUtf8(cf.data());
 			QPixmap pm;
 			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
 			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
 			else
 			{
 				QString f;
@@ -329,7 +348,7 @@
 			}
 			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])));
 			if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-				pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/"+fi3.baseName()+".png")), "PNG");
+				pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/.ScribusThumbs/"+fi3.baseName()+".png")), "PNG");
 			checkAndChange(ff, QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])), QDir::cleanPath(QDir::convertSeparators(name)));
 		}
 	}
@@ -418,9 +437,9 @@
 				fil.close();
 				QPixmap pm;
 				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
 				if (fi2.exists())
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
 				else
 				{
 					FileLoader *fileLoader = new FileLoader(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
@@ -438,8 +457,49 @@
 					}
 				}
 				QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/"+fi3.baseName()+".png")), "PNG");
+				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+					pm.save(QDir::cleanPath(QDir::convertSeparators(fi3.path()+"/.ScribusThumbs/"+fi3.fileName()+".png")), "PNG");
+			}
+		}
+	}
+	QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
+	QStringList rasterFiles = formatD.split("|");
+	for (int v = 0; v < rasterFiles.count(); v++)
+	{
+		QString ext = "*." + rasterFiles[v];
+		QDir d5(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
+		if ((d5.exists()) && (d5.count() != 0))
+		{
+			for (uint dc = 0; dc < d5.count(); ++dc)
+			{
+				QByteArray cf;
+				if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(oldName + "/" + d5[dc])), cf))
+					continue;
+				QFile fil(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])));
+				if(!fil.open(QIODevice::WriteOnly))
+					continue ;
+				QDataStream s(&fil);
+				s.writeRawData(cf.data(), cf.length());
+				fil.close();
+				QPixmap pm;
+				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])));
+				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
+				if (fi2.exists())
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
+				else
+				{
+					bool mode = false;
+					ScImage im;
+					CMSettings cms(0, "", Intent_Perceptual);
+					cms.allowColorManagement(false);
+					if (im.loadPicture(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])), 1, cms, ScImage::Thumbnail, 72, &mode))
+					{
+						QImage img = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+						if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+							img.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")), "PNG");
+						pm = QPixmap::fromImage(img);
+					}
+				}
 			}
 		}
 	}
@@ -493,12 +553,19 @@
 		nd = name.left(name.length()-1);
 	int fileCount = 0;
 	int readCount = 0;
+	QDir thumbs(name);
+	if (thumbs.exists())
+	{
+		if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+			thumbs.mkdir(".ScribusThumbs");
+		thumbs.cd(".ScribusThumbs");
+	}
 	QDir d(name, "*.sce", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-		fileCount += d.count();
+	fileCount += d.count();
 	QDir d2(name, "*.sml", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-		fileCount += d2.count();
+	fileCount += d2.count();
 	QDir d3(name, "*.shape", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-		fileCount += d3.count();
+	fileCount += d3.count();
 	QStringList vectorFiles = LoadSavePlugin::getExtensionsForPreview(FORMATID_ODGIMPORT);
 	for (int v = 0; v < vectorFiles.count(); v++)
 	{
@@ -506,7 +573,17 @@
 		QDir d4(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
 		fileCount += d4.count();
 	}
+	QString formatD(FormatsManager::instance()->extensionListForFormat(FormatsManager::RASTORIMAGES, 1));
+	QStringList rasterFiles = formatD.split("|");
+	for (int v = 0; v < rasterFiles.count(); v++)
+	{
+		QString ext = "*." + rasterFiles[v];
+		QDir d5(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
+		fileCount += d5.count();
+	}
 	QProgressDialog *pgDia = NULL;
+	QStringList previewFiles;
+	previewFiles.clear();
 	if (ScCore->initialized())
 	{
 		pgDia = new QProgressDialog("Reading Files...", QString(), 0, fileCount, this);
@@ -526,22 +603,29 @@
 			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])), cf))
 				continue;
 			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
+			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
 			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
 			else
 			{
-				QString f;
-				if (cf.left(16) == "<SCRIBUSELEMUTF8")
-					f = QString::fromUtf8(cf.data());
+				if (fi3.exists())
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
 				else
-					f = cf.data();
-				ScPreview *pre = new ScPreview();
-				pm = QPixmap::fromImage(pre->createPreview(f));
-				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")), "PNG");
-				delete pre;
-			}
+				{
+					QString f;
+					if (cf.left(16) == "<SCRIBUSELEMUTF8")
+						f = QString::fromUtf8(cf.data());
+					else
+						f = cf.data();
+					ScPreview *pre = new ScPreview();
+					pm = QPixmap::fromImage(pre->createPreview(f));
+					if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+						pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")), "PNG");
+					delete pre;
+				}
+			}
+			previewFiles.append(fi.baseName()+".png");
 			AddObj(fi.baseName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d[dc])), pm);
 		}
 	}
@@ -559,18 +643,25 @@
 			if (!loadRawText(QDir::cleanPath(QDir::convertSeparators(name + "/" + d2[dc])), cf))
 				continue;
 			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d2[dc])));
-			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
+			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
 			if (fi2.exists())
-				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
 			else
 			{
-				QString f = QString::fromUtf8(cf.data());
-				StencilReader *pre = new StencilReader();
-				pm = pre->createPreview(f);
-				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")), "PNG");
-				delete pre;
-			}
+				if (fi3.exists())
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				else
+				{
+					QString f = QString::fromUtf8(cf.data());
+					StencilReader *pre = new StencilReader();
+					pm = pre->createPreview(f);
+					if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+						pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")), "PNG");
+					delete pre;
+				}
+			}
+			previewFiles.append(fi.baseName()+".png");
 			AddObj(fi.baseName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d2[dc])), pm);
 		}
 	}
@@ -590,12 +681,24 @@
 			QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d3[dc])));
 			QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
 			QFileInfo fi2p(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".xpm")));
-			if ((fi2.exists()) || (fi2p.exists()))
-			{
-				if (fi2.exists())
+			QFileInfo fi3(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
+			if ((fi2.exists()) || (fi2p.exists()) || (fi3.exists()))
+			{
+				if (fi3.exists())
+				{
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")));
+					previewFiles.append(fi.baseName()+".png");
+				}
+				else if (fi2.exists())
+				{
 					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
-				else
+					previewFiles.append(fi.baseName()+".png");
+				}
+				else if (fi2p.exists())
+				{
 					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".xpm")));
+					previewFiles.append(fi.baseName()+".xpm");
+				}
 			}
 			else
 			{
@@ -605,7 +708,7 @@
 				ScPreview *pre2 = new ScPreview();
 				pm = QPixmap::fromImage(pre2->createPreview(f2));
 				if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-					pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")), "PNG");
+					pm.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.baseName()+".png")), "PNG");
 				delete pre;
 				delete pre2;
 			}
@@ -627,9 +730,9 @@
 				}
 				QPixmap pm;
 				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
-				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
 				if (fi2.exists())
-					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")));
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
 				else
 				{
 					FileLoader *fileLoader = new FileLoader(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
@@ -643,12 +746,50 @@
 							QImage im = fmt->readThumbnail(QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])));
 							im = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 							if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
-								im.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/"+fi.baseName()+".png")), "PNG");
+								im.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")), "PNG");
 							pm = QPixmap::fromImage(im);
 						}
 					}
 				}
-				AddObj(fi.baseName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])), pm);
+				AddObj(fi.fileName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d4[dc])), pm);
+			}
+		}
+	}
+	for (int v = 0; v < rasterFiles.count(); v++)
+	{
+		QString ext = "*." + rasterFiles[v];
+		QDir d5(name, ext, QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
+		if ((d5.exists()) && (d5.count() != 0))
+		{
+			for (uint dc = 0; dc < d5.count(); ++dc)
+			{
+				if (pgDia)
+				{
+					pgDia->setValue(readCount);
+					readCount++;
+				}
+				if (previewFiles.contains(d5[dc]))
+					continue;
+				QPixmap pm;
+				QFileInfo fi(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])));
+				QFileInfo fi2(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
+				if (fi2.exists())
+					pm.load(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")));
+				else
+				{
+					bool mode = false;
+					ScImage im;
+					CMSettings cms(0, "", Intent_Perceptual);
+					cms.allowColorManagement(false);
+					if (im.loadPicture(QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])), 1, cms, ScImage::Thumbnail, 72, &mode))
+					{
+						QImage img = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+						if ((canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+							img.save(QDir::cleanPath(QDir::convertSeparators(fi.path()+"/.ScribusThumbs/"+fi.fileName()+".png")), "PNG");
+						pm = QPixmap::fromImage(img);
+					}
+				}
+				AddObj(fi.fileName(), QDir::cleanPath(QDir::convertSeparators(name + "/" + d5[dc])), pm, false, true);
 			}
 		}
 	}
@@ -687,10 +828,10 @@
 	newButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
 	newButton->setIcon(loadIcon("16/document-new.png"));
 	newButton->setIconSize(QSize(16, 16));
-	loadButton = new QToolButton(this);
-	loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
-	loadButton->setIcon(loadIcon("16/document-open.png"));
-	loadButton->setIconSize(QSize(16, 16));
+//	loadButton = new QToolButton(this);
+//	loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+//	loadButton->setIcon(loadIcon("16/document-open.png"));
+//	loadButton->setIconSize(QSize(16, 16));
 	saveAsButton = new QToolButton(this);
 	saveAsButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
 	saveAsButton->setIcon(loadIcon("16/document-save-as.png"));
@@ -704,7 +845,7 @@
 	closeButton->setIcon(loadIcon("16/close.png"));
 	closeButton->setIconSize(QSize(16, 16));
 	buttonLayout->addWidget( newButton );
-	buttonLayout->addWidget( loadButton );
+//	buttonLayout->addWidget( loadButton );
 	buttonLayout->addWidget( saveAsButton );
 	buttonLayout->addWidget( importButton );
 	buttonLayout->addWidget( closeButton );
@@ -726,7 +867,7 @@
 	languageChange();
 
 	connect(newButton, SIGNAL(clicked()), this, SLOT(NewLib()));
-	connect(loadButton, SIGNAL(clicked()), this, SLOT(Load()));
+//	connect(loadButton, SIGNAL(clicked()), this, SLOT(Load()));
 	connect(saveAsButton, SIGNAL(clicked()), this, SLOT(SaveAs()));
 	connect(importButton, SIGNAL(clicked()), this, SLOT(Import()));
 	connect(closeButton, SIGNAL(clicked()), this, SLOT(closeLib()));
@@ -757,6 +898,7 @@
 			activeBView->ReadContents(fileName);
 			activeBView->ScFilename = fileName;
 			activeBView->visibleName = d.dirName();
+			ScCore->fileWatcher->addDir(d.absolutePath(), true);
 			activeBView->scrollToTop();
 		}
 	}
@@ -866,6 +1008,7 @@
 		activeBView->ScFilename = fileName;
 		activeBView->visibleName = d.dirName();
 		Frame3->setCurrentWidget(activeBView);
+		ScCore->fileWatcher->addDir(d.absolutePath(), true);
 		d.cdUp();
 		dirs->set("scrap_load", d.absolutePath());
 		activeBView->scrollToTop();
@@ -876,7 +1019,7 @@
 		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 	}
 }
-
+/*
 void Biblio::Load()
 {
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -907,6 +1050,7 @@
 		activeBView->ScFilename = fileName;
 		activeBView->visibleName = d.dirName();
 		Frame3->setCurrentWidget(activeBView);
+		ScCore->fileWatcher->addDir(d.absolutePath());
 		d.cdUp();
 		dirs->set("scrap_load", d.absolutePath());
 		activeBView->scrollToTop();
@@ -917,7 +1061,7 @@
 		connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 	}
 }
-
+*/
 void Biblio::Import()
 {
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
@@ -974,6 +1118,8 @@
 		disconnect(activeBView, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleMouse(QPoint)));
 		disconnect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 		disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+		QFileInfo fi(activeBView->ScFilename);
+		ScCore->fileWatcher->removeDir(fi.absolutePath());
 		Frame3->removeItem(Frame3->indexOf(activeBView));
 		delete activeBView;  // currently disabled as the whole TabWidget vanishes when executing that delete????? -> seems to be fixed in Qt-4.3.3
 		activeBView = (BibView*)Frame3->widget(0);
@@ -999,6 +1145,50 @@
 	connect(activeBView, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
 }
 
+void Biblio::closeOnDel(QString libName)
+{
+	BibView* bv = NULL;
+	int libIndex = 0;
+	for (int a = 0; a < Frame3->count(); a++)
+	{
+		bv = (BibView*)Frame3->widget(a);
+		if (libName == bv->ScFilename)
+		{
+			libIndex = a;
+			break;
+		}
+	}
+	if ((libIndex == 0) || (libIndex == 1))
+		return;
+	if (bv == activeBView)
+		closeLib();
+	else
+	{
+		disconnect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+		QFileInfo fi(bv->ScFilename);
+		ScCore->fileWatcher->removeDir(fi.absolutePath());
+		Frame3->removeItem(Frame3->indexOf(bv));
+		delete bv;
+		connect(Frame3, SIGNAL(currentChanged(int)), this, SLOT(libChanged(int )));
+	}
+}
+
+void Biblio::reloadLib(QString fileName)
+{
+	for (int a = 0; a < Frame3->count(); a++)
+	{
+		BibView* bv = (BibView*)Frame3->widget(a);
+		if (bv->ScFilename == fileName)
+		{
+			bv->ReadContents(fileName);
+			bv->ScFilename = fileName;
+			QDir d(fileName);
+			bv->visibleName = d.dirName();
+			bv->scrollToTop();
+		}
+	}
+}
+
 void Biblio::handleDoubleClick(QListWidgetItem *ite)
 {
 	emit pasteToActualPage(ite->text());
@@ -1122,6 +1312,12 @@
 		return false;
 	pm = activeBView->objectMap[ite->text()].Preview;
 	QString dt = activeBView->objectMap[ite->text()].Data;
+	QDir thumbs(bv->ScFilename);
+	if (thumbs.exists())
+	{
+		if ((bv->canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+			thumbs.mkdir(".ScribusThumbs");
+	}
 	QFileInfo fi(dt);
 	QFile f(QDir::cleanPath(QDir::convertSeparators(bv->ScFilename + "/" + nam + "." + fi.completeSuffix().toLower())));
 	if(!f.open(QIODevice::WriteOnly))
@@ -1131,7 +1327,7 @@
 	s.writeRawData(cf.data(), cf.length());
 	f.close();
 	bv->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(bv->ScFilename + "/" + nam + "." + fi.completeSuffix().toLower())), pm);
-	pm.save(QDir::cleanPath(QDir::convertSeparators(bv->ScFilename + "/" + nam +".png")), "PNG");
+	pm.save(QDir::cleanPath(QDir::convertSeparators(bv->ScFilename + "/.ScribusThumbs/" + nam +".png")), "PNG");
 	QFileInfo fiD(QDir::convertSeparators(activeBView->ScFilename + "/" + fi.baseName()));
 	if ((fiD.exists()) && (fiD.isDir()))
 	{
@@ -1167,10 +1363,10 @@
 			it = tempBView->objectMap.begin();
 			QFile f(it.value().Data);
 			f.remove();
-			QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+			QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 			if (fi.exists())
 			{
-				QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+				QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 				f2.remove();
 			}
 			QFileInfo fiD(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
@@ -1217,9 +1413,9 @@
 	QListWidgetItem *ite = actItem;
 	QString name = ite->text();
 	QFile::remove(activeBView->objectMap[name].Data);
-	QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/" + name + ".png"));
+	QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + name + ".png"));
 	if (fi.exists())
-		QFile::remove(QDir::convertSeparators(activeBView->ScFilename + "/" + name + ".png"));
+		QFile::remove(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + name + ".png"));
 	QFileInfo fiD(QDir::convertSeparators(activeBView->ScFilename + "/" + name));
 	if ((fiD.exists()) && (fiD.isDir()))
 	{
@@ -1254,10 +1450,10 @@
 	{
 		QFile f(it.value().Data);
 		f.remove();
-		QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/" + it.key() + ".png"));
+		QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 		if (fi.exists())
 		{
-			QFile f2(QDir::convertSeparators(activeBView->ScFilename + "/" + it.key() + ".png"));
+			QFile f2(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 			f2.remove();
 		}
 		QFileInfo fiD(QDir::convertSeparators(activeBView->ScFilename + "/" + it.key()));
@@ -1309,9 +1505,9 @@
 	ObjPreview = activeBView->objectMap[OldName].Preview;
 	QDir d = QDir();
 	d.rename(ObjData, QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + ite->text() + ".sce")));
-	QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/" + OldName + ".png"));
+	QFileInfo fi(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + OldName + ".png"));
 	if (fi.exists())
-		d.rename(QDir::convertSeparators(activeBView->ScFilename + "/" + OldName + ".png"), QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + ite->text() + ".png")));
+		d.rename(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + OldName + ".png"), QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + ite->text() + ".png")));
 	QFileInfo fiD(QDir::convertSeparators(activeBView->ScFilename + "/" + OldName));
 	if ((fiD.exists()) && (fiD.isDir()))
 	{
@@ -1435,72 +1631,93 @@
 			delete dia;
 			return;
 		}
-		const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
-		if( fmt )
-		{
-			QImage im = fmt->readThumbnail(path);
-			im = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-			QByteArray cf;
-			if (!loadRawText(path, cf))
-				return;
-			QPixmap pm = QPixmap::fromImage(im);
-			QFile f(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + "." + fi.completeSuffix())));
-			if(!f.open(QIODevice::WriteOnly))
-				return;
-			QDataStream s;
-			s.setDevice(&f);
-			s.writeRawData(cf.data(), cf.length());
-			f.close();
-			if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-				im.save(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam +".png")), "PNG");
-			activeBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + "." + fi.completeSuffix())), pm);
-			QPixmap pm2(60, 60);
-			pm2.fill(palette().color(QPalette::Base));
-			QPainter p;
-			p.begin(&pm2);
-			p.drawPixmap(30 - pm.width() / 2, 30 - pm.height() / 2, pm);
-			p.end();
-			new QListWidgetItem(QIcon(pm2), nam, activeBView);
-			if (Frame3->currentIndex() == 1)
-			{
-				if (tempBView->objectMap.count() > PrefsManager::instance()->appPrefs.scrapbookPrefs.numScrapbookCopies)
-				{
-					QMap<QString,BibView::Elem>::Iterator it;
-					it = tempBView->objectMap.begin();
-					QFile f(it.value().Data);
-					f.remove();
-					QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
-					if (fi.exists())
+		QImage img;
+		if (testResult == 9999)
+		{
+			bool mode = false;
+			ScImage im;
+			CMSettings cms(0, "", Intent_Perceptual);
+			cms.allowColorManagement(false);
+			if (im.loadPicture(path, 1, cms, ScImage::Thumbnail, 72, &mode))
+				img = im.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+		}
+		else
+		{
+			const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
+			if( fmt )
+			{
+				img = fmt->readThumbnail(path);
+				img = img.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+			}
+		}
+		QByteArray cf;
+		if (!loadRawText(path, cf))
+			return;
+		QPixmap pm = QPixmap::fromImage(img);
+		QFile f(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + "." + fi.completeSuffix())));
+		if(!f.open(QIODevice::WriteOnly))
+			return;
+		QDataStream s;
+		s.setDevice(&f);
+		s.writeRawData(cf.data(), cf.length());
+		f.close();
+		if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
+		{
+			QDir thumbs(activeBView->ScFilename);
+			if (thumbs.exists())
+			{
+				if ((activeBView->canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+					thumbs.mkdir(".ScribusThumbs");
+			}
+			img.save(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + nam +".png")), "PNG");
+		}
+		activeBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + "." + fi.completeSuffix())), pm);
+		QPixmap pm2(60, 60);
+		pm2.fill(palette().color(QPalette::Base));
+		QPainter p;
+		p.begin(&pm2);
+		p.drawPixmap(30 - pm.width() / 2, 30 - pm.height() / 2, pm);
+		p.end();
+		new QListWidgetItem(QIcon(pm2), nam, activeBView);
+		if (Frame3->currentIndex() == 1)
+		{
+			if (tempBView->objectMap.count() > PrefsManager::instance()->appPrefs.scrapbookPrefs.numScrapbookCopies)
+			{
+				QMap<QString,BibView::Elem>::Iterator it;
+				it = tempBView->objectMap.begin();
+				QFile f(it.value().Data);
+				f.remove();
+				QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
+				if (fi.exists())
+				{
+					QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
+					f2.remove();
+				}
+				QFileInfo fiD(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
+				if ((fiD.exists()) && (fiD.isDir()))
+				{
+					QDir dd = QDir(QDir::convertSeparators(tempBView->ScFilename));
+					QDir d(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()), "*", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
+					if ((d.exists()) && (d.count() != 0))
 					{
-						QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
-						f2.remove();
+						for (uint dc = 0; dc < d.count(); ++dc)
+						{
+							QFile::remove(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + "/" + d[dc]));
+						}
 					}
-					QFileInfo fiD(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
-					if ((fiD.exists()) && (fiD.isDir()))
-					{
-						QDir dd = QDir(QDir::convertSeparators(tempBView->ScFilename));
-						QDir d(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()), "*", QDir::Name, QDir::Files | QDir::Readable | QDir::NoSymLinks);
-						if ((d.exists()) && (d.count() != 0))
-						{
-							for (uint dc = 0; dc < d.count(); ++dc)
-							{
-								QFile::remove(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + "/" + d[dc]));
-							}
-						}
-						dd.rmdir(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
-					}
-					QString name = it.key();
-					tempBView->objectMap.erase(it);
-					QList<QListWidgetItem *> itL = tempBView->findItems(name, Qt::MatchExactly);
-					if (itL.count() > 0)
-					{
-						QListWidgetItem *ite = itL.at(0);
-						delete tempBView->takeItem(tempBView->row(ite));
-					}
-					tempBView->sortItems();
-				}
-				emit updateRecentMenue();
-			}
+					dd.rmdir(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
+				}
+				QString name = it.key();
+				tempBView->objectMap.erase(it);
+				QList<QListWidgetItem *> itL = tempBView->findItems(name, Qt::MatchExactly);
+				if (itL.count() > 0)
+				{
+					QListWidgetItem *ite = itL.at(0);
+					delete tempBView->takeItem(tempBView->row(ite));
+				}
+				tempBView->sortItems();
+			}
+			emit updateRecentMenue();
 		}
 	}
 }
@@ -1547,7 +1764,15 @@
 	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
 	activeBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + ".sce")), pm);
 	if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-		pm.save(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam +".png")), "PNG");
+	{
+		QDir thumbs(activeBView->ScFilename);
+		if (thumbs.exists())
+		{
+			if ((activeBView->canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+				thumbs.mkdir(".ScribusThumbs");
+		}
+		pm.save(QDir::cleanPath(QDir::convertSeparators(activeBView->ScFilename + "/.ScribusThumbs/" + nam +".png")), "PNG");
+	}
 	pm = pm.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 	QPixmap pm2(60, 60);
 	pm2.fill(palette().color(QPalette::Base));
@@ -1565,10 +1790,10 @@
 			it = tempBView->objectMap.begin();
 			QFile f(it.value().Data);
 			f.remove();
-			QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+			QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 			if (fi.exists())
 			{
-				QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+				QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 				f2.remove();
 			}
 			QFileInfo fiD(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
@@ -1615,7 +1840,15 @@
 	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
 	tempBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(tempBView->ScFilename + "/" + nam + ".sce")), pm);
 	if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-		pm.save(QDir::cleanPath(QDir::convertSeparators(tempBView->ScFilename + "/" + nam +".png")), "PNG");
+	{
+		QDir thumbs(tempBView->ScFilename);
+		if (thumbs.exists())
+		{
+			if ((tempBView->canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+				thumbs.mkdir(".ScribusThumbs");
+		}
+		pm.save(QDir::cleanPath(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + nam +".png")), "PNG");
+	}
 	pm = pm.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 	QPixmap pm2(60, 60);
 	pm2.fill(palette().color(QPalette::Base));
@@ -1631,10 +1864,10 @@
 		it = tempBView->objectMap.begin();
 		QFile f(it.value().Data);
 		f.remove();
-		QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+		QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 		if (fi.exists())
 		{
-			QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
+			QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/.ScribusThumbs/" + it.key() + ".png"));
 			f2.remove();
 		}
 		QFileInfo fiD(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key()));
@@ -1698,7 +1931,15 @@
 	QPixmap pm = QPixmap::fromImage(pre->createPreview(ff));
 	actBView->AddObj(nam, QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam + ".sce")), pm);
 	if (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews)
-		pm.save(QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/" + nam +".png")), "PNG");
+	{
+		QDir thumbs(actBView->ScFilename);
+		if (thumbs.exists())
+		{
+			if ((actBView->canWrite) && (PrefsManager::instance()->appPrefs.scrapbookPrefs.writePreviews))
+				thumbs.mkdir(".ScribusThumbs");
+		}
+		pm.save(QDir::cleanPath(QDir::convertSeparators(actBView->ScFilename + "/.ScribusThumbs/" + nam +".png")), "PNG");
+	}
 	pm = pm.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation);
 	QPixmap pm2(60, 60);
 	pm2.fill(palette().color(QPalette::Base));
@@ -1752,7 +1993,7 @@
 {
 	setWindowTitle( tr( "Scrapbook" ) );
  	newButton->setToolTip( tr( "Create a new scrapbook page" ) );
- 	loadButton->setToolTip( tr( "Load an existing scrapbook" ) );
+ //	loadButton->setToolTip( tr( "Load an existing scrapbook" ) );
  	saveAsButton->setToolTip( tr( "Save the selected scrapbook" ) );
  	importButton->setToolTip( tr( "Import a scrapbook file from Scribus <=1.3.2" ) );
  	closeButton->setToolTip( tr( "Close the selected scrapbook" ) );

Modified: branches/ScribusOIF/scribus/ui/scrapbookpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/ui/scrapbookpalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/scrapbookpalette.h (original)
+++ branches/ScribusOIF/scribus/ui/scrapbookpalette.h Wed Oct 13 10:39:26 2010
@@ -32,13 +32,15 @@
 public:
 	BibView( QWidget* parent);
 	~BibView() {};
-	void AddObj(QString name, QString daten, QPixmap Bild);
+	void AddObj(QString name, QString daten, QPixmap Bild, bool isDir = false, bool isRaster = false);
 	void checkAndChange(QString &text, QString nam, QString dir);
 	void SaveContents(QString name, QString oldName);
 	void ReadOldContents(QString, QString newName);
 	void ReadContents(QString name);
 	struct Elem
 	{
+		bool isDir;
+		bool isRaster;
 		QString Data;
 		QPixmap Preview;
 	};
@@ -95,6 +97,8 @@
 	void ObjFromFile(QString path, int testResult);
 	void ObjFromMenu(QString text);
 	void ObjFromMainMenu(QString text, int scrapID);
+	void closeOnDel(QString libName);
+	void reloadLib(QString fileName);
 
 private slots:
 	void handleDoubleClick(QListWidgetItem *ite);
@@ -106,7 +110,7 @@
 	void deleteAllObj();
 	void renameObj();
 	void NewLib();
-	void Load();
+//	void Load();
 	void SaveAs();
 	void closeLib();
 	void libChanged(int index);
@@ -123,7 +127,7 @@
 	QString OldName;
 	QHBoxLayout* buttonLayout;
 	QToolButton* newButton;
-	QToolButton* loadButton;
+//	QToolButton* loadButton;
 	QToolButton* saveAsButton;
 	QToolButton* importButton;
 	QToolButton* closeButton;

Modified: branches/ScribusOIF/scribus/util_formats.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15531&path=/branches/ScribusOIF/scribus/util_formats.h
==============================================================================
--- branches/ScribusOIF/scribus/util_formats.h (original)
+++ branches/ScribusOIF/scribus/util_formats.h Wed Oct 13 10:39:26 2010
@@ -44,7 +44,7 @@
 			IMAGESIMGFRAME	= 1|2|4|16|32|64|128|256|512,  // all Types suitable for Image Frames
 #endif
 			VECTORIMAGES	= 1|64|1024|2048|16384|32768|131072|262144,  // All pure vector image types
-			RASTORIMAGES	= 2|4|8|32|512|65536,  // All pure rastor image types
+			RASTORIMAGES	= 2|4|8|32|128|256|512|65536,  // All pure rastor image types
 			EPS				= 1,      // Encapsulated PostScript
 			GIF				= 2,      // GIF files
 			JPEG			= 4,      // JPEG




More information about the scribus-commit mailing list