When deleting temp files, remove from the recent file list. Closes #1540

* If the UI was launched with a filename as a parameter to open the capture, it
  will be added to the recent capture file list. Only later (relatively
  speaking) if we make a capture connection will we realise that it is temporary
  and potentially delete the file. If we do so, remove the capture from the
  recent file list.
This commit is contained in:
baldurk
2019-10-10 16:48:42 +01:00
parent 4a6235d9b7
commit e9dda8343f
9 changed files with 100 additions and 26 deletions
+10 -1
View File
@@ -809,7 +809,7 @@ void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const Repla
if(!temporary)
{
AddRecentFile(Config().RecentCaptureFiles, origFilename, 10);
AddRecentFile(Config().RecentCaptureFiles, origFilename);
Config().Save();
}
@@ -1076,7 +1076,10 @@ void CaptureContext::RecompressCapture()
if(tempCap)
tempCap->Shutdown();
if(!tempFilename.isEmpty())
{
m_MainWindow->RemoveRecentCapture(tempFilename);
QFile::remove(tempFilename);
}
return;
}
@@ -1134,7 +1137,10 @@ void CaptureContext::RecompressCapture()
if(tempCap)
tempCap->Shutdown();
if(!tempFilename.isEmpty())
{
m_MainWindow->RemoveRecentCapture(tempFilename);
QFile::remove(tempFilename);
}
}
bool CaptureContext::SaveCaptureTo(const rdcstr &captureFile)
@@ -1195,7 +1201,10 @@ bool CaptureContext::SaveCaptureTo(const rdcstr &captureFile)
// if it was a temporary capture, remove the old instnace
if(m_CaptureTemporary)
{
m_MainWindow->RemoveRecentCapture(m_CaptureFile);
QFile::remove(m_CaptureFile);
}
// Update the filename, and mark that it's local and not temporary now.
m_CaptureFile = captureFile;