Merge latest fixes from stable branch

This commit is contained in:
Christophe Dumez 2010-06-03 20:08:19 +00:00
parent b67938aa3f
commit 4e1366bf0d
8 changed files with 69 additions and 29 deletions

View file

@ -483,17 +483,22 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
if(PropListModel->getType(index) == TFILE) {
int i = PropListModel->getFileIndex(index);
const QDir &saveDir(h.save_path());
const QString &filename = misc::toQString(h.get_torrent_info().file_at(i).path.string());
const QString &filename = misc::toQStringU(h.get_torrent_info().file_at(i).path.string());
const QString &file_path = QDir::cleanPath(saveDir.absoluteFilePath(filename));
qDebug("Trying to open file at %s", qPrintable(file_path));
#ifdef LIBTORRENT_0_15
// Flush data
h.flush_cache();
#endif
if(QFile::exists(file_path))
if(QFile::exists(file_path)) {
#ifdef Q_WS_WIN
QDesktopServices::openUrl(QUrl("file:///"+file_path));
#else
QDesktopServices::openUrl(QUrl("file://"+file_path));
else
#endif
} else {
QMessageBox::warning(this, tr("I/O Error"), tr("This file does not exist yet."));
}
} else {
// FOLDER
QStringList path_items;
@ -511,10 +516,15 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
// Flush data
h.flush_cache();
#endif
if(QFile::exists(file_path))
if(QFile::exists(file_path)) {
#ifdef Q_WS_WIN
QDesktopServices::openUrl(QUrl("file:///"+file_path));
#else
QDesktopServices::openUrl(QUrl("file://"+file_path));
else
#endif
} else {
QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet."));
}
}
}