From 35f5a0c5e13df3a0a41ef990b886a98ce2374a5c Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 3 Jun 2013 09:32:41 +0200 Subject: Remove nodes Implement remove nodes for ArchiveView. Only empty nodes without children can be removed. Everything else is too dangerous :) --- archiveview.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'archiveview.cpp') 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); } -- cgit v1.2.3-70-g09d2