Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 19152 → Rev 19153

/trunk/Scribus/scribus/CMakeLists.txt
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
/trunk/Scribus/scribus/ui/filedialogeventcatcher.cpp
0,0 → 1,63
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include <QDebug>
#include <QDropEvent>
#include <QFileInfo>
#include <QKeyEvent>
#include <QMimeData>
 
#include "filedialogeventcatcher.h"
 
FileDialogEventCatcher::FileDialogEventCatcher(QObject* parent)
: QObject(parent)
{
}
 
bool FileDialogEventCatcher::eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::KeyPress)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
if (keyEvent->key() == Qt::Key_Escape)
{
emit escapePressed();
return true;
}
}
else
if (e->type() == QEvent::DragEnter)
{
e->accept();
return true;
}
else
if (e->type() == QEvent::Drop)
{
QDropEvent *dropEvent = static_cast<QDropEvent *>(e);
if (dropEvent)
{
if ( dropEvent->mimeData()->hasFormat("text/uri-list"))
{
QString fileUrl;
QList<QUrl> fileUrls = dropEvent->mimeData()->urls();
if (fileUrls.count()>0)
{
fileUrl = fileUrls[0].toLocalFile();
if (fileUrls[0].isLocalFile())
{
QFileInfo fi(fileUrl);
emit dropLocation(fi.absolutePath());
}
}
}
}
e->accept();
return true;
}
return QObject::eventFilter(o, e);
}
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: Scribus/scribus/ui/filedialogeventcatcher.h
===================================================================
--- Scribus/scribus/ui/filedialogeventcatcher.h (nonexistent)
+++ Scribus/scribus/ui/filedialogeventcatcher.h (revision 19153)
@@ -0,0 +1,29 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef FILEDIALOGEVENTCATCHER_H
+#define FILEDIALOGEVENTCATCHER_H
+
+#include <QObject>
+
+#include "scribusapi.h"
+
+class SCRIBUS_API FileDialogEventCatcher : public QObject
+{
+ Q_OBJECT
+
+public:
+ FileDialogEventCatcher(QObject* parent);
+
+protected:
+ virtual bool eventFilter(QObject *o, QEvent *e);
+
+signals:
+ void escapePressed();
+ void dropLocation(QString dl);
+};
+
+#endif
/Scribus/scribus/ui/filedialogeventcatcher.h
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: Scribus/scribus/ui/newfile.cpp
===================================================================
--- Scribus/scribus/ui/newfile.cpp (revision 19152)
+++ Scribus/scribus/ui/newfile.cpp (revision 19153)
@@ -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);
+}
+
/trunk/Scribus/scribus/ui/newfile.h
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;
/trunk/Scribus/scribus/ui/scfilewidget.cpp
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);
}
/trunk/Scribus/scribus/ui/scfilewidget.h
33,6 → 33,7
 
public slots:
void accept();
void locationDropped(QString dl);
};
 
#endif