BUGFIX: Fix issue when altering files priorities of a seeding torrent (closes #665799)

This commit is contained in:
Christophe Dumez 2010-10-24 08:06:56 +00:00
parent 166dad51d5
commit b98d0282ce

View file

@ -481,6 +481,32 @@ void QTorrentHandle::prioritize_files(const std::vector<int> &v) {
if(was_seed && !is_seed()) {
// Reset seed status
TorrentPersistentData::saveSeedStatus(*this);
// Move to temp folder if necessary
if(Preferences::isTempPathEnabled()) {
QString tmp_path = Preferences::getTempPath();
QString root_folder = TorrentPersistentData::getRootFolder(hash());
if(!root_folder.isEmpty())
tmp_path = QDir(tmp_path).absoluteFilePath(root_folder);
move_storage(tmp_path);
}
}
}
void QTorrentHandle::file_priority(int index, int priority) const {
Q_ASSERT(torrent_handle::is_valid());
bool was_seed = is_seed();
torrent_handle::file_priority(index, priority);
if(was_seed && !is_seed()) {
// Save seed status
TorrentPersistentData::saveSeedStatus(*this);
// Move to temp folder if necessary
if(Preferences::isTempPathEnabled()) {
QString tmp_path = Preferences::getTempPath();
QString root_folder = TorrentPersistentData::getRootFolder(hash());
if(!root_folder.isEmpty())
tmp_path = QDir(tmp_path).absoluteFilePath(root_folder);
move_storage(tmp_path);
}
}
}
@ -500,13 +526,6 @@ void QTorrentHandle::move_storage(QString new_path) const {
torrent_handle::move_storage(new_path.toLocal8Bit().constData());
}
void QTorrentHandle::file_priority(int index, int priority) const {
Q_ASSERT(torrent_handle::is_valid());
torrent_handle::file_priority(index, priority);
// Save seed status
TorrentPersistentData::saveSeedStatus(*this);
}
bool QTorrentHandle::save_torrent_file(QString path) {
if(!torrent_handle::has_metadata()) return false;
QFile met_file(path);