summaryrefslogtreecommitdiff
path: root/src/downloadmanager.cpp
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-07-16 20:56:47 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-07-16 20:56:47 +0200
commit2524d65441e99cbb14037144b8af60e1d25e1179 (patch)
treeaba253edda27662b694d44d8377f968209ebe6c6 /src/downloadmanager.cpp
parent5efddbd5156f914de9406775f06111b899060177 (diff)
Added "Open in Folder" option to downloads tab.
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index 9761fee4..1a2934a5 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -911,6 +911,31 @@ void DownloadManager::visitOnNexus(int index)
}
}
+void DownloadManager::openInDownloadsFolder(int index)
+{
+ if ((index < 0) || (index >= m_ActiveDownloads.size())) {
+ reportError(tr("VisitNexus: invalid download index %1").arg(index));
+ return;
+ }
+ QString params = "/select,\"";
+ QDir path = QDir(m_OutputDirectory);
+ if (path.exists(getFileName(index))) {
+ params = params + QDir::toNativeSeparators(getFilePath(index)) + "\"";
+
+ ::ShellExecuteW(nullptr, nullptr, L"explorer", ToWString(params).c_str(), nullptr, SW_SHOWNORMAL);
+ return;
+ }
+ else if (path.exists(getFileName(index) + ".unfinished")) {
+ params = params + QDir::toNativeSeparators(getFilePath(index)+".unfinished") + "\"";
+
+ ::ShellExecuteW(nullptr, nullptr, L"explorer", ToWString(params).c_str(), nullptr, SW_SHOWNORMAL);
+ return;
+ }
+
+ ::ShellExecuteW(nullptr, L"explore", ToWString(QDir::toNativeSeparators(m_OutputDirectory)).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
+ return;
+}
+
int DownloadManager::numTotalDownloads() const
{