r19153 by craig - #12310: Allow dropping of files/directories on file widgets to allow setting of location

scribus-commit scribus-commit at lists.scribus.net
Thu May 29 15:15:49 UTC 2014


Author: craig
Date: Thu May 29 15:15:49 2014
New Revision: 19153

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19153
Log:
#12310: Allow dropping of files/directories on file widgets to allow setting of location

Added:
    trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp   (with props)
    trunk/Scribus/scribus/ui/filedialogeventcatcher.h   (with props)
Modified:
    trunk/Scribus/scribus/CMakeLists.txt
    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/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19153&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Thu May 29 15:15:49 2014
@@ -308,6 +308,7 @@
 	ui/editor.h
 	ui/effectsdialog.h
 	ui/extimageprops.h
+	ui/filedialogeventcatcher.h
 	ui/fontcombo.h
 	ui/fontlistview.h
 	ui/fontreplacedialog.h
@@ -760,6 +761,7 @@
 	ui/editor.cpp
 	ui/effectsdialog.cpp
 	ui/extimageprops.cpp
+	ui/filedialogeventcatcher.cpp
 	ui/fontlistview.cpp
 	ui/fontreplacedialog.cpp
 	ui/gradientaddedit.cpp

Modified: trunk/Scribus/scribus/ui/newfile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19153&path=/trunk/Scribus/scribus/ui/newfile.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.cpp (original)
+++ trunk/Scribus/scribus/ui/newfile.cpp Thu May 29 15:15:49 2014
@@ -38,7 +38,7 @@
 #include "prefsfile.h"
 #include "prefsmanager.h"
 #include "sccombobox.h"
-#include "scescapecatcher.h"
+#include "filedialogeventcatcher.h"
 #include "scrspinbox.h"
 #include "units.h"
 #include "util_icon.h"
@@ -369,7 +369,6 @@
 	fileDialog->setOption(QFileDialog::DontUseNativeDialog);
 	fileDialog->setNameFilterDetailsVisible(false);
 	fileDialog->setReadOnly(true);
-
 	fileDialog->setSizeGripEnabled(false);
 	fileDialog->setModal(false);
 	QList<QPushButton *> b = fileDialog->findChildren<QPushButton *>();
@@ -379,13 +378,13 @@
 	fileDialog->setWindowFlags(Qt::Widget);
 	openDocLayout->addWidget(fileDialog);
 
-	ScEscapeCatcher* keyCatcher = new ScEscapeCatcher(this);
+	FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this);
 	QList<QListView *> lv = fileDialog->findChildren<QListView *>();
 	QListIterator<QListView *> lvi(lv);
 	while (lvi.hasNext())
 		lvi.next()->installEventFilter(keyCatcher);
 	connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
-
+	connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
 	connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile()));
 	connect(fileDialog, SIGNAL(rejected()), this, SLOT(reject()));
 }
@@ -692,3 +691,9 @@
  	else
 		setWindowTitle( tr( "New Document" ) );
 }
+
+void NewDoc::locationDropped(QString dl)
+{
+	fileDialog->setDirectory(dl);
+}
+

Modified: trunk/Scribus/scribus/ui/newfile.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19153&path=/trunk/Scribus/scribus/ui/newfile.h
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.h (original)
+++ trunk/Scribus/scribus/ui/newfile.h Thu May 29 15:15:49 2014
@@ -8,6 +8,10 @@
 #define NEWDOC_H
 
 #include <QDialog>
+#include <QDropEvent>
+#include <QDragEnterEvent>
+#include <QDragLeaveEvent>
+#include <QDragMoveEvent>
 #include <QListWidget>
 class QFormLayout;
 class QGridLayout;
@@ -67,7 +71,6 @@
 	void createOpenDocPage();
 	void createRecentDocPage();
 	void setSize(QString gr);
-
 	QTabWidget* tabWidget;
 	QFrame* newDocFrame;
 	PageLayoutsWidget* layoutsView;
@@ -142,6 +145,7 @@
 	void recentDocListBox_doubleClicked();
 	void openFile();
 	void adjustTitles(int tab);
+	void locationDropped(QString dl);
 
 protected:
 	QVBoxLayout* TabbedNewDocLayout;

Modified: trunk/Scribus/scribus/ui/scfilewidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19153&path=/trunk/Scribus/scribus/ui/scfilewidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scfilewidget.cpp (original)
+++ trunk/Scribus/scribus/ui/scfilewidget.cpp Thu May 29 15:15:49 2014
@@ -10,7 +10,7 @@
 #include <QPushButton>
 #include <QUrl>
 
-#include "scescapecatcher.h"
+#include "filedialogeventcatcher.h"
 #include "scfilewidget.h"
 
 
@@ -34,12 +34,13 @@
 	setSidebarUrls(urls);
 #endif
 
-	ScEscapeCatcher* keyCatcher = new ScEscapeCatcher(this);
+	FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this);
 	QList<QListView *> lv = findChildren<QListView *>();
 	QListIterator<QListView *> lvi(lv);
 	while (lvi.hasNext())
 		lvi.next()->installEventFilter(keyCatcher);
 	connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
+	connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
 
 	QList<QPushButton *> b = findChildren<QPushButton *>();
 	QListIterator<QPushButton *> i(b);
@@ -65,3 +66,8 @@
 	QFileDialog::accept();
 #endif
 }
+
+void ScFileWidget::locationDropped(QString dl)
+{
+	setDirectory(dl);
+}

Modified: trunk/Scribus/scribus/ui/scfilewidget.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19153&path=/trunk/Scribus/scribus/ui/scfilewidget.h
==============================================================================
--- trunk/Scribus/scribus/ui/scfilewidget.h (original)
+++ trunk/Scribus/scribus/ui/scfilewidget.h Thu May 29 15:15:49 2014
@@ -33,6 +33,7 @@
 
 public slots:
 	void accept();
+	void locationDropped(QString dl);
 };
 
 #endif




More information about the scribus-commit mailing list