diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-07-07 16:57:16 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-07-09 15:32:32 +0200 |
commit | 89b8c9d523b567eb4c35093e112657f5642a4c46 (patch) | |
tree | f78ae0779896e6462067d7f46cfa54f436fa80ec | |
parent | 8273b899e90f9e1dfbffd63483a2d20c9c79fce9 (diff) | |
download | qt-creator-89b8c9d523b567eb4c35093e112657f5642a4c46.tar.gz |
EditorManager: Support dropping files on specific split
It was opening files in whatever split was "active".
As a side effect this also fixes dropping files on extra editor windows
(which did nothing).
Change-Id: I9db9f731eba8718313d3cc43e35609676bcffdc3
Task-number: QTCREATORBUG-9023
Reviewed-by: David Schulz <david.schulz@digia.com>
-rw-r--r-- | src/plugins/coreplugin/editormanager/editorview.cpp | 17 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/editorview.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index cfe715b7e2..2ca9f1613c 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -37,8 +37,8 @@ #include <coreplugin/infobar.h> #include <coreplugin/minisplitter.h> #include <coreplugin/editormanager/ieditor.h> - #include <coreplugin/findplaceholder.h> +#include <utils/fileutils.h> #include <utils/qtcassert.h> #include <QDebug> @@ -118,6 +118,10 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) : m_container->addWidget(empty); m_widgetEditorMap.insert(empty, 0); + auto dropSupport = new Utils::FileDropSupport(this); + connect(dropSupport, SIGNAL(filesDropped(QStringList)), + this, SLOT(openDroppedFiles(QStringList))); + updateNavigatorActions(); } @@ -330,6 +334,17 @@ void EditorView::closeSplit() EditorManager::updateActions(); } +void EditorView::openDroppedFiles(const QStringList &files) +{ + const int count = files.size(); + for (int i = 0; i < count; ++i) { + EditorManager::openEditor(this, files.at(i), Id(), + i < count - 1 ? EditorManager::DoNotChangeCurrentEditor + | EditorManager::DoNotMakeVisible + : EditorManager::NoFlags); + } +} + void EditorView::setParentSplitterOrView(SplitterOrView *splitterOrView) { m_parentSplitterOrView = splitterOrView; diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index 68aec837c7..592f3e1426 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -115,6 +115,7 @@ private slots: void splitVertically(); void splitNewWindow(); void closeSplit(); + void openDroppedFiles(const QStringList &files); private: friend class SplitterOrView; // for setParentSplitterOrView |