App: call setActiveDocument when reverting document

This commit is contained in:
Zheng, Lei
2019-09-04 12:58:27 +08:00
committed by wmayer
parent e64b1a7826
commit 84f2cc4a17

View File

@@ -2371,7 +2371,9 @@ void Document::restore (const char *filename,
clearUndos();
d->activeObject = 0;
bool signal = false;
if(d->objectArray.size()) {
signal = true;
GetApplication().signalDeleteDocument(*this);
d->objectArray.clear();
for(auto &v : d->objectMap) {
@@ -2380,7 +2382,6 @@ void Document::restore (const char *filename,
}
d->objectMap.clear();
d->objectIdMap.clear();
GetApplication().signalNewDocument(*this,false);
}
Base::FlagToggler<> flag(_IsRestoring,false);
@@ -2393,6 +2394,11 @@ void Document::restore (const char *filename,
d->objectIdMap.clear();
d->lastObjectId = 0;
if(signal) {
GetApplication().signalNewDocument(*this,true);
GetApplication().setActiveDocument(this);
}
if(!filename)
filename = FileName.getValue();
Base::FileInfo fi(filename);