diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index d3871781b7..b36273d0b9 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -554,14 +554,22 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch activeDocument()->setModified(false); } else { - Command::doCommand(Command::App, "%s.insert(u\"%s\",\"%s\")" - , Module, unicodepath.c_str(), DocName); + if (DocName) { + Command::doCommand(Command::App, "%s.insert(u\"%s\",\"%s\")" + , Module, unicodepath.c_str(), DocName); + } + else { + Command::doCommand(Command::App, "%s.insert(u\"%s\")" + , Module, unicodepath.c_str()); + } ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath ("User parameter:BaseApp/Preferences/View"); if (hGrp->GetBool("AutoFitToView", true)) Command::doCommand(Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); - if (getDocument(DocName)) - getDocument(DocName)->setModified(true); + Gui::Document* doc = activeDocument(); + if (DocName) doc = getDocument(DocName); + if (doc) + doc->setModified(true); } // the original file name is required diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index aea5651005..2ea3da0c06 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -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& 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) {