Commit 1f5ac847 authored by Jonathan Colman's avatar Jonathan Colman Committed by Dmitry Kazakov
Browse files

Give meaningful name to Drag And Drop File Layer

Previously, File Layers made by dragging and dropping image where named
"File Layer <number>"; which isn't very meaningful. This commit names
Drag and Drop'd file layers by the name and format of the file.
i.e. "example.jpg"

BUG:427235
parent c7de321d
......@@ -51,6 +51,7 @@
#include <QStatusBar>
#include <QMoveEvent>
#include <QMdiSubWindow>
#include <QFileInfo>
#include <kis_image.h>
#include <kis_node.h>
......@@ -578,8 +579,9 @@ void KisView::dropEvent(QDropEvent *event)
}
else if (action == insertAsNewFileLayer || action == insertManyFileLayers) {
KisNodeCommandsAdapter adapter(viewManager());
QFileInfo fileInfo(url.toLocalFile());
KisFileLayer *fileLayer = new KisFileLayer(image(), "", url.toLocalFile(),
KisFileLayer::None, image()->nextLayerName(i18n("File Layer")), OPACITY_OPAQUE_U8);
KisFileLayer::None, fileInfo.fileName(), OPACITY_OPAQUE_U8);
adapter.addNode(fileLayer, viewManager()->activeNode()->parent(), viewManager()->activeNode());
}
else if (action == openInNewDocument || action == openManyDocuments) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment