diff framework/MainWindowBase.cpp @ 601:021d42e6c8cb

Avoid setting the session file path when loading an incomplete document, so that the default-file save-on-exit and File->Save are not activated (to avoid losing references to unfound audio files)
author Chris Cannam
date Mon, 18 Jun 2018 14:16:06 +0100
parents a558a3fb44fc
children d767bdf4879b
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Mon Jun 11 14:40:56 2018 +0100
+++ b/framework/MainWindowBase.cpp	Mon Jun 18 14:16:06 2018 +0100
@@ -669,7 +669,7 @@
     emit canClearSelection(haveSelection);
     emit canEditSelection(haveSelection && haveCurrentEditableLayer);
     emit canSave(m_sessionFile != "" && m_documentModified);
-    emit canSaveAs(haveMainModel);
+    emit canSaveAs(haveMainModel); // possibly used only in Tony, not SV
     emit canSelectPreviousPane(havePrevPane);
     emit canSelectNextPane(haveNextPane);
     emit canSelectPreviousLayer(havePrevLayer);
@@ -2096,7 +2096,15 @@
                        .arg(QApplication::applicationName())
                        .arg(source.getLocation()));
 
-        if (!source.isRemote()) m_sessionFile = source.getLocalFilename();
+        if (!source.isRemote() && !m_document->isIncomplete()) {
+            // Setting the session file path enables the Save (as
+            // opposed to Save As...) option. We can't do this if we
+            // don't have a local path to save to, but we also don't
+            // want to do it if we failed to find an audio file or
+            // similar on load, as the audio reference would then end
+            // up being lost from any saved or auto-saved-on-exit copy
+            m_sessionFile = source.getLocalFilename();
+        }
 
         setupMenus();
         findTimeRulerLayer();