From 60c430650288217a0bca8d3c307a9ad960d79be8 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 5 Oct 2014 16:19:21 +0400 Subject: [PATCH 1/3] Fix missing icon for open action in file list --- src/properties/propertieswidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 7d0669232c8..a7f5004b07c 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -477,7 +477,7 @@ void PropertiesWidget::displayFilesListMenu(const QPoint&) { QAction *actOpenContainingFolder = 0; QAction *actRename = 0; if (selectedRows.size() == 1) { - actOpen = myFilesLlistMenu.addAction(tr("Open")); + actOpen = myFilesLlistMenu.addAction(IconProvider::instance()->getIcon("folder-documents"), tr("Open")); actOpenContainingFolder = myFilesLlistMenu.addAction(IconProvider::instance()->getIcon("inode-directory"), tr("Open Containing Folder")); actRename = myFilesLlistMenu.addAction(IconProvider::instance()->getIcon("edit-rename"), tr("Rename...")); myFilesLlistMenu.addSeparator(); From 997b16a24a5623c4f87e3071815bd1ba1f14b36d Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Thu, 4 Jul 2013 14:49:28 +0400 Subject: [PATCH 2/3] Implement open & select file in file manager [Windows only] --- src/properties/propertieswidget.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index a7f5004b07c..ccf2eb8f940 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -449,21 +449,36 @@ void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_fold } if (path_items.isEmpty()) return; + +#ifndef Q_OS_WIN if (containing_folder) path_items.removeLast(); +#endif + const QDir saveDir(h.save_path()); const QString filename = path_items.join("/"); const QString file_path = fsutils::expandPath(saveDir.absoluteFilePath(filename)); qDebug("Trying to open folder at %s", qPrintable(file_path)); // Flush data h.flush_cache(); - if (QFile::exists(file_path)) { - // Hack to access samba shares with QDesktopServices::openUrl - const QString p = file_path.startsWith("//") ? QString("file:") + file_path : file_path; - QDesktopServices::openUrl(QUrl::fromLocalFile(p)); + +#ifdef Q_OS_WIN + if (containing_folder) { + // Syntax is: explorer /select, "C:\Folder1\Folder2\file_to_select" + // Dir separators MUST be win-style slashes + QProcess::startDetached("explorer.exe", QStringList() << "/select," << fsutils::toNativePath(file_path)); } else { - QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet.")); +#endif + if (QFile::exists(file_path)) { + // Hack to access samba shares with QDesktopServices::openUrl + const QString p = file_path.startsWith("//") ? QString("file:") + file_path : file_path; + QDesktopServices::openUrl(QUrl::fromLocalFile(p)); + } else { + QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet.")); + } +#ifdef Q_OS_WIN } +#endif } void PropertiesWidget::displayFilesListMenu(const QPoint&) { From be99c459444981512dc8ef075146a389dbdfc8ef Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Sun, 5 Oct 2014 17:34:58 +0400 Subject: [PATCH 3/3] Fix opening of samba shares --- src/properties/propertieswidget.cpp | 13 ++++++++----- src/transferlistwidget.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index ccf2eb8f940..33781d6f523 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -429,9 +429,10 @@ void PropertiesWidget::openFile(const QModelIndex &index) { // Flush data h.flush_cache(); if (QFile::exists(file_path)) { - // Hack to access samba shares with QDesktopServices::openUrl - const QString p = file_path.startsWith("//") ? QString("file:") + file_path : file_path; - QDesktopServices::openUrl(QUrl::fromLocalFile(p)); + if (file_path.startsWith("//")) + QDesktopServices::openUrl(fsutils::toNativePath("file:" + file_path)); + else + QDesktopServices::openUrl(QUrl::fromLocalFile(file_path)); } else { QMessageBox::warning(this, tr("I/O Error"), tr("This file does not exist yet.")); @@ -471,8 +472,10 @@ void PropertiesWidget::openFolder(const QModelIndex &index, bool containing_fold #endif if (QFile::exists(file_path)) { // Hack to access samba shares with QDesktopServices::openUrl - const QString p = file_path.startsWith("//") ? QString("file:") + file_path : file_path; - QDesktopServices::openUrl(QUrl::fromLocalFile(p)); + if (file_path.startsWith("//")) + QDesktopServices::openUrl(fsutils::toNativePath("file:" + file_path)); + else + QDesktopServices::openUrl(QUrl::fromLocalFile(file_path)); } else { QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet.")); } diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 00a99ac6164..2b9a09614da 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -633,8 +633,10 @@ void TransferListWidget::askNewLabelForSelection() { bool TransferListWidget::openUrl(const QString &_path) const { const QString path = fsutils::fromNativePath(_path); // Hack to access samba shares with QDesktopServices::openUrl - const QString p = path.startsWith("//") ? QString("file:") + path : path; - return QDesktopServices::openUrl(QUrl::fromLocalFile(p)); + if (path.startsWith("//")) + return QDesktopServices::openUrl(fsutils::toNativePath("file:" + path)); + else + return QDesktopServices::openUrl(QUrl::fromLocalFile(path)); } void TransferListWidget::renameSelectedTorrent() {