From 586b3cd04e0f2048e085b9a997f76b93ed953f7a Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 20 Aug 2020 17:40:46 +0200 Subject: Added Open Meta File context action to downloads --- src/downloadmanager.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 4defd96b..ce60c8e1 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -1091,6 +1091,29 @@ void DownloadManager::openFile(int index) return; } +void DownloadManager::openMetaFile(int index) { + if (index < 0 || index >= m_ActiveDownloads.size()) { + reportError(tr("OpenMetaFile: invalid download index %1").arg(index)); + return; + } + + auto path = QDir(m_OutputDirectory); + auto metaPath = getFilePath(index) + ".meta"; + if (path.exists(metaPath)) { + shell::Open(metaPath); + return; + } + + auto info = m_ActiveDownloads[index]; + info->m_FileInfo->repository = "Nexus"; + + if (path.exists(metaPath)) { + shell::Open(metaPath); + } else { + shell::Explore(m_OutputDirectory); + } +} + void DownloadManager::openInDownloadsFolder(int index) { if ((index < 0) || (index >= m_ActiveDownloads.size())) { -- cgit v1.3.1