diff options
Diffstat (limited to 'newmoviewizard.cpp')
-rw-r--r-- | newmoviewizard.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index 3e5ca9b..427f1ad 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -292,6 +292,20 @@ void NewMovieWizard::accept(){ } db.commit(); mInfoPage->saveData(); + const QStringList &origins = mInfoPage->origins(); + if(!origins.isEmpty()){ + QString q = QString("<p>Also delete origins?</p><ul>"); + for(const QString &o : origins){ + q.append(QString("<li>%1</li>").arg(o)); + } + q.append("</ul>"); + int qRes = QMessageBox::question(this, tr("Delete other files"), q); + if(qRes == QMessageBox::Yes){ + for(const QString &o : origins){ + QFile::remove(o); + } + } + } QWizard::accept(); } @@ -387,6 +401,7 @@ void MovieInfoPage::initializePage(){ restoreData(); } mFileModel->clear(); + mOrigins.clear(); } void MovieInfoPage::addFile(const QString &file){ @@ -491,6 +506,7 @@ void MovieInfoPage::addOld(){ QModelIndex realIdx = mProxy->mapToSource(curIdxList[0]); mFileModel->appendRow(itemData, realIdx); mFileView->expandAll(); + mOrigins << fullPath; } oldFileDlg->deleteLater(); } @@ -521,6 +537,20 @@ void MovieInfoPage::removeFile(){ for(const QPersistentModelIndex &pi : curSel){ QModelIndex cur = mProxy->mapToSource(pi); if(cur.isValid()){ + int type = cur.data(WizardTreeModel::FileTypeRole).toInt(); + if(type == FT_ORIGIN){ + mOrigins.removeAll(pi.data(WizardTreeModel::FullPathRole).toString()); + }else{ + for(int i = 0; i < mProxy->rowCount(pi); ++i){ + QModelIndex child = mProxy->index(0, pi.column(), pi); + if(child.isValid()){ + int type = child.data(WizardTreeModel::FileTypeRole).toInt(); + if(type == FT_ORIGIN){ + mOrigins.removeAll(child.data(WizardTreeModel::FullPathRole).toString()); + } + } + } + } mFileModel->removeRow(cur.row(), cur.parent()); } } |