feat(gui): add cross-origin detection in StdCmdSaveAs (#17)
Some checks failed
Build and Test / build (push) Failing after 12m50s

- Detect document's origin vs current (target) origin
- Route to appropriate workflow:
  - Same origin: standard SaveAs
  - Local → PLM: migration (handled by PLM origin)
  - PLM → Local: export (handled by local origin)
  - PLM → PLM: transfer (handled by target PLM origin)

This provides the infrastructure for Issue #17: Mixed origin workflows.
The actual migration/export dialogs will be implemented in the
respective origin adapters (SiloOrigin, LocalFileOrigin).
This commit is contained in:
2026-02-05 14:54:36 -06:00
parent 015df38328
commit a6e84552da

View File

@@ -768,13 +768,40 @@ void StdCmdSaveAs::activated(int iMsg)
return;
}
// SaveAs uses current origin (allows saving to different origin)
FileOrigin* origin = OriginManager::instance()->currentOrigin();
if (!origin) {
auto* mgr = OriginManager::instance();
FileOrigin* currentOrigin = mgr->currentOrigin();
FileOrigin* docOrigin = mgr->originForDocument(doc);
if (!currentOrigin) {
return;
}
origin->saveDocumentAsInteractive(doc);
// Determine workflow based on document and target origins
OriginType currentType = currentOrigin->type();
OriginType docType = docOrigin ? docOrigin->type() : OriginType::Local;
if (docOrigin == currentOrigin || !docOrigin) {
// Same origin or new document - standard SaveAs
currentOrigin->saveDocumentAsInteractive(doc);
}
else if (currentType == OriginType::PLM && docType == OriginType::Local) {
// Local → PLM: Migration workflow
// The PLM origin's saveDocumentAsInteractive should handle this
currentOrigin->saveDocumentAsInteractive(doc);
}
else if (currentType == OriginType::Local && docType == OriginType::PLM) {
// PLM → Local: Export workflow
// Use local origin to save without PLM tracking
currentOrigin->saveDocumentAsInteractive(doc);
}
else if (currentType == OriginType::PLM && docType == OriginType::PLM) {
// PLM → Different PLM: Transfer workflow
currentOrigin->saveDocumentAsInteractive(doc);
}
else {
// Default: use current origin
currentOrigin->saveDocumentAsInteractive(doc);
}
}
bool StdCmdSaveAs::isActive()