diff options
Diffstat (limited to 'shemov.cpp')
-rw-r--r-- | shemov.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -51,6 +51,7 @@ #include "filestreemodel.h" #include "consistencycheck.h" #include "mappingtableeditor.h" +#include "mappingtablemodel.h" #include "dbanalyzer.h" SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), mOpenWithGroupFS(0), mOpenWithGroupAV(0) { @@ -986,9 +987,31 @@ void SheMov::checkConsistency(){ void SheMov::analyzeDb(){ DbAnalyzerDialog d(this); connect(&d, SIGNAL(partClicked(int, int)), mATree, SLOT(selectMoviePart(int, int))); + connect(&d, SIGNAL(delItems(int,QList<int>&)), this, SLOT(analyzeDelete(int,QList<int>&))); d.exec(); } +void SheMov::analyzeDelete(int mode, QList<int> &ids){ + QString message = QString(tr("Really delete %1 items?")).arg(QString::number(ids.count())); + int res = QMessageBox::question(this, tr("Delete items"), message, QMessageBox::Yes | QMessageBox::No); + if(res != QMessageBox::Yes){ + return; + } + MappingTableModel *model = 0; + switch(mode){ + case DbAnalyzerDialog::Actors: + model = qobject_cast<MappingTableModel*>(SmGlobals::instance()->model("actors")); + break; + case DbAnalyzerDialog::Genres: + model = qobject_cast<MappingTableModel*>(SmGlobals::instance()->model("genres")); + break; + default: + ; + } + Q_ASSERT(model); + model->deleteItems(ids); +} + void SheMov::toggleHover(QObject *object){ QAction *action = qobject_cast<QAction*>(object); if(action){ |