r22695 by jghali - refactor FileDialogEventCatcher::eventFilter()

scribus-commit scribus-commit at lists.scribus.net
Sun Sep 16 19:27:21 UTC 2018


Author: jghali
Date: Sun Sep 16 19:27:21 2018
New Revision: 22695

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22695
Log:
refactor FileDialogEventCatcher::eventFilter()

Modified:
    trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp

Modified: trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22695&path=/trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp	(original)
+++ trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp	Sun Sep 16 19:27:21 2018
@@ -57,34 +57,32 @@
 				break;
 		}
 	}
-	else
-		if (e->type() == QEvent::DragEnter)
+	else if (e->type() == QEvent::DragEnter)
+	{
+		e->accept();
+		return true;
+	}
+	else if (e->type() == QEvent::Drop)
+	{
+		QDropEvent *dropEvent = static_cast<QDropEvent *>(e);
+		if (dropEvent)
 		{
-			e->accept();
-			return true;
-		}
-		else
-			if (e->type() == QEvent::Drop)
+			if (dropEvent->mimeData()->hasFormat("text/uri-list"))
 			{
-				QDropEvent *dropEvent = static_cast<QDropEvent *>(e);
-				if (dropEvent)
+				QString fileUrl;
+				QList<QUrl> fileUrls = dropEvent->mimeData()->urls();
+				if (fileUrls.count() > 0)
 				{
-					if ( dropEvent->mimeData()->hasFormat("text/uri-list"))
+					fileUrl = fileUrls[0].toLocalFile();
+					if (fileUrls[0].isLocalFile())
 					{
-						QString fileUrl;
-						QList<QUrl> fileUrls = dropEvent->mimeData()->urls();
-						if (fileUrls.count()>0)
-						{
-							fileUrl = fileUrls[0].toLocalFile();
-							if (fileUrls[0].isLocalFile())
-							{
-								emit dropLocation(fileUrl);
-							}
-						}
+						emit dropLocation(fileUrl);
 					}
 				}
-				e->accept();
-				return true;
 			}
+		}
+		e->accept();
+		return true;
+	}
 	return QObject::eventFilter(o, e);
 }




More information about the scribus-commit mailing list