Example code of propagating the result of the partial restore

This commit is contained in:
Abdullah Tahiri
2018-11-16 18:04:08 +01:00
committed by wmayer
parent 714604e58f
commit 1b152ee689
6 changed files with 50 additions and 7 deletions

View File

@@ -187,7 +187,7 @@ void PropertyGeometryList::Restore(Base::XMLReader &reader)
values.push_back(newG);
reader.readEndElement("Geometry");
}
catch(Base::RestoreError e) {
catch(Base::RestoreError &e) {
e.ReportException();
@@ -214,8 +214,8 @@ void PropertyGeometryList::Restore(Base::XMLReader &reader)
// assignment
setValues(values);
/*if(partialrestore)
THROWMT(Base::RestoreError, QT_TRANSLATE_NOOP("Exceptions","There were errors during the restoring process. Some geometry objects may not correspond to the version that was saved or might have been deleted."));*/
if(partialrestore)
THROW(Base::RestoreError);
}
App::Property *PropertyGeometryList::Copy(void) const

View File

@@ -325,6 +325,13 @@ void BrowserView::onLinkClicked (const QUrl & url)
// Gui::Command::doCommand(Gui::Command::Gui,"execfile('%s')",(const char*) fi.absoluteFilePath(). toLocal8Bit());
Gui::Command::doCommand(Gui::Command::Gui,"exec(open('%s').read())",(const char*) fi.absoluteFilePath() .toLocal8Bit());
}
catch (const Base::RestoreError& e) {
e.ReportException();
if(e.getTranslatable()) {
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Error loading file"),
QObject::tr(e.getMessage().c_str()));
}
}
catch (const Base::Exception& e) {
QMessageBox::critical(this, tr("Error"), QString::fromUtf8(e.what()));
}