Browse Source

Fix opening of samba shares

adaptive-webui-19844
Nick Tiskov 10 years ago
parent
commit
be99c45944
  1. 13
      src/properties/propertieswidget.cpp
  2. 6
      src/transferlistwidget.cpp

13
src/properties/propertieswidget.cpp

@ -429,9 +429,10 @@ void PropertiesWidget::openFile(const QModelIndex &index) { @@ -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 @@ -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."));
}

6
src/transferlistwidget.cpp

@ -633,8 +633,10 @@ void TransferListWidget::askNewLabelForSelection() { @@ -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() {

Loading…
Cancel
Save