when loading file by drag and drop then create the objects in the active document

if no document exists then use i18n to translate the document name
This commit is contained in:
wmayer
2018-09-15 19:05:08 +02:00
parent af7180270e
commit 506f50788b
2 changed files with 15 additions and 7 deletions

View File

@@ -1287,8 +1287,8 @@ void MainWindow::dropEvent (QDropEvent* e)
{
const QMimeData* data = e->mimeData();
if (data->hasUrls()) {
// pass no document to let create a new one if needed
loadUrls(0, data->urls());
// load the files into the active document if there is one, otherwise let create one
loadUrls(App::GetApplication().getActiveDocument(), data->urls());
}
else {
QMainWindow::dropEvent(e);
@@ -1538,7 +1538,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& url)
}
}
const char *docName = doc ? doc->getName() : "Unnamed";
QByteArray docName = doc ? doc->getName() : qApp->translate("StdCmdNew","Unnamed").toUtf8();
SelectModule::Dict dict = SelectModule::importHandler(files);
// load the files with the associated modules
for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) {