summaryrefslogtreecommitdiffstats
path: root/torrentwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'torrentwidget.cpp')
-rw-r--r--torrentwidget.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp
index 16e70e8..7f88eef 100644
--- a/torrentwidget.cpp
+++ b/torrentwidget.cpp
@@ -254,7 +254,8 @@ void TorrentWidget::moveFiles(){
if(!dir.isEmpty()){
s.setValue("dirs/movedir", dir);
int ctr = 0;
- foreach(QModelIndex i, sel){
+ QStringList removed;
+ for(const QModelIndex &i : sel){
QFileInfo fp(i.data(FullPathRole).toString());
QString newfn = QString("%1/%2").arg(dir).arg(fp.fileName());
bool ok = QFile::rename(fp.absoluteFilePath(), newfn);
@@ -268,10 +269,16 @@ void TorrentWidget::moveFiles(){
++ctr;
}
}
+ removed << i.data().toString();
+ }
+ for(const QString& f : removed){
+ QList<QStandardItem*> res = mModel->findItems(f, Qt::MatchExactly, NameColumn);
+ if(!res.isEmpty()){
+ mModel->removeRow(res.at(0)->row());
+ }
}
QString msg = QString(tr("Successfully moved %1 of %2 file(s)")).arg(QString::number(ctr)).arg(QString::number(sel.count()));
emit statusMessage(msg);
- gatherData();
emit freeSpaceChanged(mDir->text());
}
}