diff options
author | Arno <am@disconnect.de> | 2013-06-03 09:32:41 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-06-03 09:32:41 +0200 |
commit | 35f5a0c5e13df3a0a41ef990b886a98ce2374a5c (patch) | |
tree | 6a72ab07c734f95af9d2e1b67cd3079e96e6e43a /archiveview.cpp | |
parent | 953a291517022deaf22ec682e2d0971e999508d5 (diff) | |
download | SheMov-35f5a0c5e13df3a0a41ef990b886a98ce2374a5c.tar.gz SheMov-35f5a0c5e13df3a0a41ef990b886a98ce2374a5c.tar.bz2 SheMov-35f5a0c5e13df3a0a41ef990b886a98ce2374a5c.zip |
Remove nodes
Implement remove nodes for ArchiveView. Only empty nodes without
children can be removed. Everything else is too dangerous :)
Diffstat (limited to 'archiveview.cpp')
-rw-r--r-- | archiveview.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/archiveview.cpp b/archiveview.cpp index 4d9e370..96bf01b 100644 --- a/archiveview.cpp +++ b/archiveview.cpp @@ -185,6 +185,18 @@ void ArchiveTree::rename(){ } } +void ArchiveTree::remove(){ + QModelIndex idx = currentIndex(); + QModelIndex realIdx = mProxy->mapToSource(idx); + QString warningMsg = QString("Really remove %1?").arg(idx.data().toString()); + int retval = QMessageBox::warning(this, tr("Question"), warningMsg, QMessageBox::Yes | QMessageBox::No); + if(retval == QMessageBox::Yes){ + if(!mModel->removeNode(realIdx)){ + impossible(); + } + } +} + void ArchiveTree::impossible(const QString msg){ QMessageBox::critical(this, tr("Error"), msg); } |