|
|
@ -576,10 +576,11 @@ void PropertiesWidget::renameSelectedFile() { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool force_recheck = QFile::exists(h.save_path()+QDir::separator()+new_name); |
|
|
|
qDebug("Renaming %s to %s", old_name.toLocal8Bit().data(), new_name.toLocal8Bit().data()); |
|
|
|
qDebug("Renaming %s to %s", old_name.toLocal8Bit().data(), new_name.toLocal8Bit().data()); |
|
|
|
h.rename_file(file_index, new_name); |
|
|
|
h.rename_file(file_index, new_name); |
|
|
|
// Force recheck
|
|
|
|
// Force recheck
|
|
|
|
h.force_recheck(); |
|
|
|
if(force_recheck) h.force_recheck(); |
|
|
|
// Rename if torrent files model too
|
|
|
|
// Rename if torrent files model too
|
|
|
|
if(new_name_last.endsWith(".!qB")) |
|
|
|
if(new_name_last.endsWith(".!qB")) |
|
|
|
new_name_last.chop(4); |
|
|
|
new_name_last.chop(4); |
|
|
@ -613,18 +614,21 @@ void PropertiesWidget::renameSelectedFile() { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool force_recheck = false; |
|
|
|
// Replace path in all files
|
|
|
|
// Replace path in all files
|
|
|
|
for(int i=0; i<num_files; ++i) { |
|
|
|
for(int i=0; i<num_files; ++i) { |
|
|
|
QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string()); |
|
|
|
QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string()); |
|
|
|
if(current_name.startsWith(old_path)) { |
|
|
|
if(current_name.startsWith(old_path)) { |
|
|
|
QString new_name = current_name; |
|
|
|
QString new_name = current_name; |
|
|
|
new_name.replace(0, old_path.length(), new_path); |
|
|
|
new_name.replace(0, old_path.length(), new_path); |
|
|
|
|
|
|
|
if(!force_recheck && QFile::exists(h.save_path()+QDir::separator()+new_name)) |
|
|
|
|
|
|
|
force_recheck = true; |
|
|
|
qDebug("Rename %s to %s", current_name.toLocal8Bit().data(), new_name.toLocal8Bit().data()); |
|
|
|
qDebug("Rename %s to %s", current_name.toLocal8Bit().data(), new_name.toLocal8Bit().data()); |
|
|
|
h.rename_file(i, new_name); |
|
|
|
h.rename_file(i, new_name); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// Force recheck
|
|
|
|
// Force recheck
|
|
|
|
h.force_recheck(); |
|
|
|
if(force_recheck) h.force_recheck(); |
|
|
|
// Rename folder in torrent files model too
|
|
|
|
// Rename folder in torrent files model too
|
|
|
|
PropListModel->setData(index, new_name_last); |
|
|
|
PropListModel->setData(index, new_name_last); |
|
|
|
// Remove old folder
|
|
|
|
// Remove old folder
|
|
|
|