Fix torrent import

This commit is contained in:
Christophe Dumez
2011-01-12 17:13:44 +00:00
parent d5aaf975dd
commit 1f2e34b828
2 changed files with 13 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.6.2 * Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.6.2
- BUGFIX: Do not report PeX as being disabled when DHT is - BUGFIX: Do not report PeX as being disabled when DHT is
- BUGFIX: Fix possible crash on adding magnet links - BUGFIX: Fix possible crash on adding magnet links
- BUGFIX: Fix torrent import
- I18N: Updated Greek, Croatian, Unkrainian and Bulgarian translations - I18N: Updated Greek, Croatian, Unkrainian and Bulgarian translations
- I18N: Added Armenian translation - I18N: Added Armenian translation
- I18N: Remove country flags from program preferences (language selection) - I18N: Remove country flags from program preferences (language selection)

View File

@@ -184,7 +184,10 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
void TorrentImportDlg::on_importBtn_clicked() void TorrentImportDlg::on_importBtn_clicked()
{ {
close(); saveSettings();
// Has to be accept() and not close()
// or the torrent won't be imported
accept();
} }
QString TorrentImportDlg::getTorrentPath() const QString TorrentImportDlg::getTorrentPath() const
@@ -199,15 +202,21 @@ QString TorrentImportDlg::getContentPath() const
void TorrentImportDlg::importTorrent() void TorrentImportDlg::importTorrent()
{ {
qDebug() << Q_FUNC_INFO << "ENTER";
TorrentImportDlg dlg; TorrentImportDlg dlg;
if(dlg.exec()) { if(dlg.exec()) {
qDebug() << "Loading the torrent file...";
boost::intrusive_ptr<libtorrent::torrent_info> t = dlg.torrent(); boost::intrusive_ptr<libtorrent::torrent_info> t = dlg.torrent();
if(!t->is_valid()) if(!t->is_valid())
return; return;
QString torrent_path = dlg.getTorrentPath(); QString torrent_path = dlg.getTorrentPath();
QString content_path = dlg.getContentPath(); QString content_path = dlg.getContentPath();
if(torrent_path.isEmpty() || content_path.isEmpty() || !QFile(torrent_path).exists()) return; if(torrent_path.isEmpty() || content_path.isEmpty() || !QFile(torrent_path).exists()) {
qWarning() << "Incorrect input, aborting." << torrent_path << content_path;
return;
}
const QString hash = misc::toQString(t->info_hash()); const QString hash = misc::toQString(t->info_hash());
qDebug() << "Torrent hash is" << hash;
TorrentTempData::setSavePath(hash, content_path); TorrentTempData::setSavePath(hash, content_path);
#if LIBTORRENT_VERSION_MINOR >= 15 #if LIBTORRENT_VERSION_MINOR >= 15
TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking()); TorrentTempData::setSeedingMode(hash, dlg.skipFileChecking());
@@ -220,6 +229,7 @@ void TorrentImportDlg::importTorrent()
settings.setValue("TorrentImport/LastContentDir", content_path); settings.setValue("TorrentImport/LastContentDir", content_path);
return; return;
} }
qDebug() << Q_FUNC_INFO << "EXIT";
return; return;
} }