mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Hack around QDesktopServices::openUrl to support network shares
This commit is contained in:
parent
6e77d12ac6
commit
bd9dcf1247
@ -419,7 +419,9 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
||||
// Flush data
|
||||
h.flush_cache();
|
||||
if (QFile::exists(file_path)) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(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 file does not exist yet."));
|
||||
}
|
||||
@ -439,7 +441,9 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
||||
// Flush data
|
||||
h.flush_cache();
|
||||
if (QFile::exists(file_path)) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(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."));
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ TorrentModel* TransferListWidget::getSourceModel() const {
|
||||
}
|
||||
|
||||
void TransferListWidget::previewFile(QString filePath) {
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(filePath));
|
||||
openUrl(filePath);
|
||||
}
|
||||
|
||||
void TransferListWidget::setRefreshInterval(int t) {
|
||||
@ -235,8 +235,8 @@ void TransferListWidget::torrentDoubleClicked(const QModelIndex& index) {
|
||||
}
|
||||
break;
|
||||
case OPEN_DEST:
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(h.root_path()));
|
||||
break;
|
||||
const QString path = h.root_path();
|
||||
openUrl(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ void TransferListWidget::openSelectedTorrentsFolder() const {
|
||||
qDebug("Opening path at %s", qPrintable(rootFolder));
|
||||
if (!pathsList.contains(rootFolder)) {
|
||||
pathsList.insert(rootFolder);
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(rootFolder));
|
||||
openUrl(rootFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -644,6 +644,13 @@ void TransferListWidget::askNewLabelForSelection() {
|
||||
}while(invalid);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
void TransferListWidget::renameSelectedTorrent() {
|
||||
const QModelIndexList selectedIndexes = selectionModel()->selectedRows();
|
||||
if (selectedIndexes.size() != 1) return;
|
||||
|
@ -106,6 +106,9 @@ protected slots:
|
||||
void toggleSelectedFirstLastPiecePrio() const;
|
||||
void askNewLabelForSelection();
|
||||
|
||||
private:
|
||||
bool openUrl(const QString& _path) const;
|
||||
|
||||
signals:
|
||||
void currentTorrentChanged(const QTorrentHandle &h);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user