+ fixes #0002047: Don't register recent files which can't be opened

This commit is contained in:
wmayer 2015-04-11 17:34:46 +02:00
parent c62319d2d9
commit 4e54841a75

View File

@ -595,9 +595,14 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
std::string code = str.str();
// the original file name is required
if (runPythonCode(code.c_str(), false))
getMainWindow()->appendRecentFile(QString::fromUtf8(File.filePath().c_str()));
if (runPythonCode(code.c_str(), false)) {
// search for a module that is able to open the exported file because otherwise
// it doesn't need to be added to the recent files list (#0002047)
std::map<std::string, std::string> importMap = App::GetApplication().getImportFilters(te.c_str());
if (!importMap.empty())
getMainWindow()->appendRecentFile(QString::fromUtf8(File.filePath().c_str()));
}
// allow exporters to pass _objs__ to submodules before deleting it
runPythonCode("del __objs__", false);
}