App: fix Link document restore

This fixes issue #0004224
This commit is contained in:
Zheng, Lei
2019-12-14 11:55:52 +08:00
committed by wmayer
parent 47f16467db
commit 51cf93012f
3 changed files with 15 additions and 0 deletions

View File

@@ -703,6 +703,9 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
_pendingDocMap.clear();
Base::SequencerLauncher seq("Postprocessing...", newDocs.size());
for (auto &v : newDocs)
PropertyXLink::restoreDocument(*v.first);
for (auto &v : newDocs) {
FC_TIME_INIT(t1);
v.first->afterRestore(true);

View File

@@ -2641,6 +2641,13 @@ public:
}
}
static void restoreDocument(const App::Document &doc) {
auto it = _DocInfoMap.find(getFullPath(doc.FileName.getValue()));
if(it==_DocInfoMap.end())
return;
it->second->slotFinishRestoreDocument(doc);
}
void slotFinishRestoreDocument(const App::Document &doc) {
if(pcDoc) return;
QString fullpath(getFullPath());
@@ -3423,6 +3430,10 @@ bool PropertyXLink::hasXLink(
return ret;
}
void PropertyXLink::restoreDocument(const App::Document &doc) {
DocInfo::restoreDocument(doc);
}
std::map<App::Document*,std::set<App::Document*> >
PropertyXLink::getDocumentOutList(App::Document *doc) {
std::map<App::Document*,std::set<App::Document*> > ret;

View File

@@ -1107,6 +1107,7 @@ public:
static bool hasXLink(const std::vector<App::DocumentObject*> &objs, std::vector<App::Document*> *unsaved=0);
static std::map<App::Document*,std::set<App::Document*> > getDocumentOutList(App::Document *doc=0);
static std::map<App::Document*,std::set<App::Document*> > getDocumentInList(App::Document *doc=0);
static void restoreDocument(const App::Document &doc);
virtual void updateElementReference(
DocumentObject *feature,bool reverse=false, bool notify=false) override;