Browse Source

- Forgot to move the torrent data when its label is deleted

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
da796c80c3
  1. 5
      src/bittorrent.cpp
  2. 3
      src/transferlistwidget.cpp

5
src/bittorrent.cpp

@ -1426,10 +1426,11 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
old_dir = QDir(path_items.join(QDir::separator())); old_dir = QDir(path_items.join(QDir::separator()));
} }
QString new_save_path; QString new_save_path;
if(new_label.isEmpty()) if(new_label.isEmpty()) {
new_save_path = old_dir.absolutePath(); new_save_path = old_dir.absolutePath();
else } else {
new_save_path = old_dir.absoluteFilePath(new_label); new_save_path = old_dir.absoluteFilePath(new_label);
}
TorrentPersistentData::saveSavePath(h.hash(), new_save_path); TorrentPersistentData::saveSavePath(h.hash(), new_save_path);
if(move_storage) { if(move_storage) {
// Move storage // Move storage

3
src/transferlistwidget.cpp

@ -919,9 +919,12 @@ void TransferListWidget::removeLabelFromRows(QString label) {
for(int i=0; i<listModel->rowCount(); ++i) { for(int i=0; i<listModel->rowCount(); ++i) {
if(listModel->data(listModel->index(i, TR_LABEL)) == label) { if(listModel->data(listModel->index(i, TR_LABEL)) == label) {
QString hash = getHashFromRow(i); QString hash = getHashFromRow(i);
QString old_label = proxyModel->data(listModel->index(i, TR_LABEL)).toString();
listModel->setData(listModel->index(i, TR_LABEL), "", Qt::DisplayRole); listModel->setData(listModel->index(i, TR_LABEL), "", Qt::DisplayRole);
TorrentPersistentData::saveLabel(hash, ""); TorrentPersistentData::saveLabel(hash, "");
emit torrentChangedLabel(label, ""); emit torrentChangedLabel(label, "");
// Update save path if necessary
BTSession->changeLabelInTorrentSavePath(BTSession->getTorrentHandle(hash), old_label, label);
} }
} }
} }

Loading…
Cancel
Save