r23864 by jghali - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat May 30 23:31:56 UTC 2020


Author: jghali
Date: Sat May 30 23:31:56 2020
New Revision: 23864

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23864
Log:
Code cleanup

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23864&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sat May 30 23:31:56 2020
@@ -3970,12 +3970,9 @@
 	{
 		QString formatD(FormatsManager::instance()->fileDialogFormatList(FormatsManager::IMAGESIMGFRAME));
 
-		QString docDir = ".";
-		QString prefsDocDir=m_prefsManager.documentDir();
-		if (!prefsDocDir.isEmpty())
-			docDir = m_prefsManager.prefsFile->getContext("dirs")->get("images", prefsDocDir);
-		else
-			docDir = m_prefsManager.prefsFile->getContext("dirs")->get("images", ".");
+		QString prefsDocDir = m_prefsManager.documentDir();
+		PrefsContext *dirsContext = m_prefsManager.prefsFile->getContext("dirs");
+		QString docDir = dirsContext->get("images", prefsDocDir.isEmpty() ? "." : prefsDocDir);
 
 		QStringList fileNames;
 		CustomFDialog *dia = new CustomFDialog(qApp->activeWindow(), docDir, tr("Open"), formatD, fdShowPreview | fdExistingFilesI | fdDisableOk);
@@ -3985,9 +3982,9 @@
 		//QStringList fileNames = CFileDialog( docDir, tr("Open"), formatD, "", fdShowPreview | fdExistingFiles);
 		if (!fileNames.isEmpty())
 		{
-			m_prefsManager.prefsFile->getContext("dirs")->set("images", fileNames[0].left(fileNames[0].lastIndexOf("/")));
+			dirsContext->set("images", fileNames[0].left(fileNames[0].lastIndexOf("/")));
 			view->requestMode(modeImportImage);
-			CanvasMode_ImageImport* cii=dynamic_cast<CanvasMode_ImageImport*>(view->canvasMode());
+			CanvasMode_ImageImport* cii = dynamic_cast<CanvasMode_ImageImport*>(view->canvasMode());
 			if (cii)
 				cii->setImageList(fileNames);
 		}




More information about the scribus-commit mailing list