r19168 by craig - #12310: Also select the file if a file is dropped on the file dialog

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 2 19:05:33 UTC 2014


Author: craig
Date: Mon Jun  2 19:05:32 2014
New Revision: 19168

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19168
Log:
#12310: Also select the file if a file is dropped on the file dialog

Modified:
    trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
    trunk/Scribus/scribus/ui/newfile.cpp
    trunk/Scribus/scribus/ui/newfile.h
    trunk/Scribus/scribus/ui/scfilewidget.cpp
    trunk/Scribus/scribus/ui/scfilewidget.h

Modified: trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19168&path=/trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp (original)
+++ trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp Mon Jun  2 19:05:32 2014
@@ -7,7 +7,6 @@
 
 #include <QDebug>
 #include <QDropEvent>
-#include <QFileInfo>
 #include <QKeyEvent>
 #include <QMimeData>
 
@@ -50,11 +49,7 @@
 					fileUrl = fileUrls[0].toLocalFile();
 					if (fileUrls[0].isLocalFile())
 					{
-						QFileInfo fi(fileUrl);
-						if (fi.isDir())
-							emit dropLocation(fi.absoluteFilePath());
-						else
-							emit dropLocation(fi.absolutePath());
+						emit dropLocation(fileUrl);
 					}
 				}
 			}

Modified: trunk/Scribus/scribus/ui/newfile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19168&path=/trunk/Scribus/scribus/ui/newfile.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.cpp (original)
+++ trunk/Scribus/scribus/ui/newfile.cpp Mon Jun  2 19:05:32 2014
@@ -692,8 +692,15 @@
 		setWindowTitle( tr( "New Document" ) );
 }
 
-void NewDoc::locationDropped(QString dl)
-{
-	fileDialog->setDirectory(dl);
-}
-
+void NewDoc::locationDropped(QString fileUrl)
+{
+	QFileInfo fi(fileUrl);
+	if (fi.isDir())
+		fileDialog->setDirectory(fi.absoluteFilePath());
+	else
+	{
+		fileDialog->setDirectory(fi.absolutePath());
+		fileDialog->selectFile(fi.fileName());
+	}
+}
+

Modified: trunk/Scribus/scribus/ui/newfile.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19168&path=/trunk/Scribus/scribus/ui/newfile.h
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.h (original)
+++ trunk/Scribus/scribus/ui/newfile.h Mon Jun  2 19:05:32 2014
@@ -145,7 +145,7 @@
 	void recentDocListBox_doubleClicked();
 	void openFile();
 	void adjustTitles(int tab);
-	void locationDropped(QString dl);
+	void locationDropped(QString fileUrl);
 
 protected:
 	QVBoxLayout* TabbedNewDocLayout;

Modified: trunk/Scribus/scribus/ui/scfilewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19168&path=/trunk/Scribus/scribus/ui/scfilewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scfilewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/scfilewidget.cpp Mon Jun  2 19:05:32 2014
@@ -67,7 +67,14 @@
 #endif
 }
 
-void ScFileWidget::locationDropped(QString dl)
+void ScFileWidget::locationDropped(QString fileUrl)
 {
-	setDirectory(dl);
+	QFileInfo fi(fileUrl);
+	if (fi.isDir())
+		setDirectory(fi.absoluteFilePath());
+	else
+	{
+		setDirectory(fi.absolutePath());
+		selectFile(fi.fileName());
+	}
 }

Modified: trunk/Scribus/scribus/ui/scfilewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19168&path=/trunk/Scribus/scribus/ui/scfilewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/scfilewidget.h (original)
+++ trunk/Scribus/scribus/ui/scfilewidget.h Mon Jun  2 19:05:32 2014
@@ -33,7 +33,7 @@
 
 public slots:
 	void accept();
-	void locationDropped(QString dl);
+	void locationDropped(QString fileUrl);
 };
 
 #endif




More information about the scribus-commit mailing list