diff options
author | Arno <arno@disconnect.de> | 2017-12-19 07:08:32 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-12-19 07:08:32 +0100 |
commit | 56a97ec93598f3afdc37e9fece8eb045de5f4a22 (patch) | |
tree | 6605bdce0c2c9572aa440734e93b9d6ed6c022ab /torrentwidget.cpp | |
parent | fe7823d5d0ff884fee0436503fe5f2c9f52aab13 (diff) | |
download | ShemovCleaner-56a97ec93598f3afdc37e9fece8eb045de5f4a22.tar.gz ShemovCleaner-56a97ec93598f3afdc37e9fece8eb045de5f4a22.tar.bz2 ShemovCleaner-56a97ec93598f3afdc37e9fece8eb045de5f4a22.zip |
Don't gatherData() when deleting torrents
Just as before: delete the files and remove them from the view without a
full parse.
Diffstat (limited to 'torrentwidget.cpp')
-rw-r--r-- | torrentwidget.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/torrentwidget.cpp b/torrentwidget.cpp index 7f88eef..f93115b 100644 --- a/torrentwidget.cpp +++ b/torrentwidget.cpp @@ -223,9 +223,10 @@ void TorrentWidget::deleteFiles(){ } QString q = QString(tr("Really delete %1 file(s)?")).arg(QString::number(sel.count())); int res = QMessageBox::question(this, tr("Delete files..."), q); - int ctr = 0; if(res == QMessageBox::Yes){ - foreach(QModelIndex i, sel){ + int ctr = 0; + QStringList removed; + for(const QModelIndex &i : sel){ QString fp = i.data(FullPathRole).toString(); bool ok = QFile::remove(fp); if(ok){ @@ -235,10 +236,16 @@ void TorrentWidget::deleteFiles(){ QString msg = QString(tr("Shit: %1 vanished from under us!")).arg(fi.fileName()); QMessageBox::critical(this, tr("Error"), msg); } + 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 deleted %1 of %2 file(s)")).arg(QString::number(ctr)).arg(QString::number(sel.count())); emit statusMessage(msg); - gatherData(); emit freeSpaceChanged(mDir->text()); } } |