From afaca423cc2e8a6ff75872ee2ad2aac9307f1b54 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 25 Jul 2010 15:30:26 +0000 Subject: [PATCH] Minor Windows bug fixes --- src/bittorrent.cpp | 4 ++++ src/engineselectdlg.cpp | 4 ++++ src/transferlistwidget.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 575e14a39..1395b74a4 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -967,7 +967,11 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr } } // Processing torrents +#ifdef Q_WS_WIN + const QString file = path.trimmed().replace("file:///", "", Qt::CaseInsensitive); +#else const QString file = path.trimmed().replace("file://", "", Qt::CaseInsensitive); +#endif if(file.isEmpty()) { return h; } diff --git a/src/engineselectdlg.cpp b/src/engineselectdlg.cpp index 9a9543702..4f15639f4 100644 --- a/src/engineselectdlg.cpp +++ b/src/engineselectdlg.cpp @@ -81,7 +81,11 @@ void engineSelectDlg::dropEvent(QDropEvent *event) { QString file; foreach(file, files) { qDebug("dropped %s", qPrintable(file)); +#ifdef Q_WS_WIN + file = file.replace("file:///", ""); +#else file = file.replace("file://", ""); +#endif if(file.startsWith("http://", Qt::CaseInsensitive) || file.startsWith("https://", Qt::CaseInsensitive) || file.startsWith("ftp://", Qt::CaseInsensitive)) { setCursor(QCursor(Qt::WaitCursor)); downloader->downloadUrl(file); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index d13293abf..bccecb18a 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -314,7 +314,11 @@ void TransferListWidget::updateMetadata(QTorrentHandle &h) { } void TransferListWidget::previewFile(QString filePath) { +#ifdef Q_WS_WIN + QDesktopServices::openUrl(QUrl(QString("file:///")+filePath)); +#else QDesktopServices::openUrl(QUrl(QString("file://")+filePath)); +#endif } int TransferListWidget::updateTorrent(int row) {