summaryrefslogtreecommitdiffstats
path: root/shemov.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shemov.cpp')
-rw-r--r--shemov.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/shemov.cpp b/shemov.cpp
index 1837dac..5b8b789 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -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){