r19206 by craig - #12366: Disable embed image on last doc close, re-sort code in same section alphabetically

scribus-commit scribus-commit at lists.scribus.net
Wed Jun 11 18:54:51 UTC 2014


Author: craig
Date: Wed Jun 11 18:54:51 2014
New Revision: 19206

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19206
Log:
#12366: Disable embed image on last doc close, re-sort code in same section alphabetically

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19206&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Jun 11 18:54:51 2014
@@ -4453,67 +4453,66 @@
 
 void ScribusMainWindow::toogleInlineState()
 {
-	if (!doc->m_Selection->isEmpty())
-	{
-		PageItem *currItem = doc->m_Selection->itemAt(0);
-		if (currItem->itemType() == PageItem::ImageFrame)
-		{
-			if (currItem->PictureIsAvailable)
-			{
-				if (currItem->isImageInline())
-				{
-					QFileInfo fiB(currItem->Pfile);
-					QString fna = fiB.fileName();
-					PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
-					QString wdir = ".";
-					if (doc->hasName)
-					{
-						QFileInfo fi(doc->DocName);
-						wdir = QDir::fromNativeSeparators( fi.path() );
-					}
-					else
-					{
-						QString prefsDocDir = prefsManager->documentDir();
-						if (!prefsDocDir.isEmpty())
-							wdir = docContext->get("place_as", prefsDocDir);
-						else
-							wdir = docContext->get("place_as", ".");
-						wdir = QDir::fromNativeSeparators( wdir );
-					}
-					QString fileName = CFileDialog(wdir, tr("Filename and Path for Image"), tr("All Files (*)"), fna, fdHidePreviewCheckBox);
-					if (!fileName.isEmpty())
-					{
-						if (ScCore->fileWatcher->files().contains(currItem->Pfile) != 0)
-							ScCore->fileWatcher->removeFile(currItem->Pfile);
-						docContext->set("place_as", fileName.left(fileName.lastIndexOf("/")));
-						if (overwrite(this, fileName))
-						{
-							currItem->makeImageExternal(fileName);
-							ScCore->fileWatcher->addFile(currItem->Pfile);
-							bool fho = currItem->imageFlippedH();
-							bool fvo = currItem->imageFlippedV();
-							doc->loadPict(currItem->Pfile, currItem, true);
-							currItem->setImageFlippedH(fho);
-							currItem->setImageFlippedV(fvo);
-						}
-					}
-				}
-				else
-				{
-					if (ScCore->fileWatcher->files().contains(currItem->Pfile) != 0)
-						ScCore->fileWatcher->removeFile(currItem->Pfile);
-					currItem->makeImageInline();
-					ScCore->fileWatcher->addFile(currItem->Pfile);
-					bool fho = currItem->imageFlippedH();
-					bool fvo = currItem->imageFlippedV();
-					doc->loadPict(currItem->Pfile, currItem, true);
-					currItem->setImageFlippedH(fho);
-					currItem->setImageFlippedV(fvo);
-				}
-				scrActions["itemToggleInlineImage"]->setChecked(currItem->isImageInline());
-			}
-		}
-	}
+	if (!HaveDoc)
+		return;
+	if (doc->m_Selection->isEmpty())
+		return;
+	PageItem *currItem = doc->m_Selection->itemAt(0);
+	if (currItem->itemType() != PageItem::ImageFrame)
+		return;
+	if (!currItem->PictureIsAvailable)
+		return;
+	if (currItem->isImageInline())
+	{
+		QFileInfo fiB(currItem->Pfile);
+		QString fna = fiB.fileName();
+		PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
+		QString wdir = ".";
+		if (doc->hasName)
+		{
+			QFileInfo fi(doc->DocName);
+			wdir = QDir::fromNativeSeparators( fi.path() );
+		}
+		else
+		{
+			QString prefsDocDir = prefsManager->documentDir();
+			if (!prefsDocDir.isEmpty())
+				wdir = docContext->get("place_as", prefsDocDir);
+			else
+				wdir = docContext->get("place_as", ".");
+			wdir = QDir::fromNativeSeparators( wdir );
+		}
+		QString fileName = CFileDialog(wdir, tr("Filename and Path for Image"), tr("All Files (*)"), fna, fdHidePreviewCheckBox);
+		if (!fileName.isEmpty())
+		{
+			if (ScCore->fileWatcher->files().contains(currItem->Pfile) != 0)
+				ScCore->fileWatcher->removeFile(currItem->Pfile);
+			docContext->set("place_as", fileName.left(fileName.lastIndexOf("/")));
+			if (overwrite(this, fileName))
+			{
+				currItem->makeImageExternal(fileName);
+				ScCore->fileWatcher->addFile(currItem->Pfile);
+				bool fho = currItem->imageFlippedH();
+				bool fvo = currItem->imageFlippedV();
+				doc->loadPict(currItem->Pfile, currItem, true);
+				currItem->setImageFlippedH(fho);
+				currItem->setImageFlippedV(fvo);
+			}
+		}
+	}
+	else
+	{
+		if (ScCore->fileWatcher->files().contains(currItem->Pfile) != 0)
+			ScCore->fileWatcher->removeFile(currItem->Pfile);
+		currItem->makeImageInline();
+		ScCore->fileWatcher->addFile(currItem->Pfile);
+		bool fho = currItem->imageFlippedH();
+		bool fvo = currItem->imageFlippedV();
+		doc->loadPict(currItem->Pfile, currItem, true);
+		currItem->setImageFlippedH(fho);
+		currItem->setImageFlippedV(fvo);
+	}
+	scrActions["itemToggleInlineImage"]->setChecked(currItem->isImageInline());
 }
 
 void ScribusMainWindow::slotFileAppend()




More information about the scribus-commit mailing list