| 3506 | } |
| 3507 | |
| 3508 | bool UBDocumentController::isOKToOpenDocument(std::shared_ptr<UBDocumentProxy> proxy) |
| 3509 | { |
| 3510 | static UBWidgetUpgradeAdaptor widgetUpgradeAdaptor; |
| 3511 | |
| 3512 | if (isBrokenDocument(proxy)) |
| 3513 | { |
| 3514 | showBrokenDocumentWarning(); |
| 3515 | return false; |
| 3516 | } |
| 3517 | |
| 3518 | //check version |
| 3519 | QString docVersion = proxy->metaData(UBSettings::documentVersion).toString(); |
| 3520 | |
| 3521 | if (docVersion.isEmpty() || docVersion.startsWith("4.1") || docVersion.startsWith("4.2") |
| 3522 | || docVersion.startsWith("4.3") || docVersion.startsWith("4.4") || docVersion.startsWith("4.5") |
| 3523 | || docVersion.startsWith("4.6") || docVersion.startsWith("4.8")) // TODO UB 4.7 update if necessary |
| 3524 | { |
| 3525 | // Invoke widget upgrader |
| 3526 | widgetUpgradeAdaptor.upgradeWidgets(proxy); |
| 3527 | return true; |
| 3528 | } |
| 3529 | else |
| 3530 | { |
| 3531 | const auto converter{UBDocumentVersionConverter{proxy}}; |
| 3532 | const auto result = converter.convert(); |
| 3533 | return result == UBDocumentVersionConverter::CONVERTED || result == UBDocumentVersionConverter::SKIPPED; |
| 3534 | } |
| 3535 | } |
| 3536 | |
| 3537 | |
| 3538 | void UBDocumentController::showMessage(const QString& message, bool showSpinningWheel) |
nothing calls this directly
no test coverage detected