mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Fix a lot of String encoding issues on non-unicode systems
Renaming a folder causes the old folder to be removed Fix some path separator issues on Win32 Fix file/folder opening in file browser on Win32
This commit is contained in:
@@ -474,17 +474,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;
|
||||
@@ -502,10 +507,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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user