Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp	(revision 31384)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp	(revision 31385)
@@ -1051,5 +1051,5 @@
 }
 
-bool VBoxProblemReporter::confirmMachineDeletion (const CMachine &machine)
+int VBoxProblemReporter::confirmMachineDeletion(const CMachine &machine)
 {
     QString msg;
@@ -1059,10 +1059,19 @@
     if (machine.GetAccessible())
     {
-        name = machine.GetName();
-        msg = tr ("<p>Are you sure you want to permanently delete "
-                  "the virtual machine <b>%1</b>?</p>"
-                  "<p>This operation cannot be undone.</p>")
-                  .arg (name);
-        button = tr ("Delete", "machine");
+        return message(&vboxGlobal().selectorWnd(), Question,
+        tr("<p>Are you sure you want to permanently delete the virtual "
+           "machine <b>%1</b>?</p>"
+           "<p>This operation <i>cannot</i> be undone.</p>"
+           "<p>If you select <b>Delete All</b> everything gets removed. This "
+           "includes the machine itself, but also all virtual disks attached "
+           "to it. If you want preserve the virtual disks for later use, "
+           "select <b>Keep Harddisks</b>.</p>")
+        .arg(machine.GetName()),
+        0, /* aAutoConfirmId */
+        QIMessageBox::No,
+        QIMessageBox::Yes,
+        QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
+        tr("Keep Harddisks", "machine"),
+        tr("Delete All", "machine"));
     }
     else
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h	(revision 31384)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h	(revision 31385)
@@ -236,5 +236,5 @@
     int cannotEnterSeamlessMode();
 
-    bool confirmMachineDeletion (const CMachine &machine);
+    int confirmMachineDeletion(const CMachine &machine);
     bool confirmDiscardSavedState (const CMachine &machine);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 31384)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp	(revision 31385)
@@ -638,62 +638,25 @@
     AssertMsgReturnVoid (item, ("Item must be always selected here"));
 
-    if (vboxProblem().confirmMachineDeletion (item->machine()))
-    {
-        CVirtualBox vbox = vboxGlobal().virtualBox();
-        QString id = item->id();
-        bool ok = false;
-        if (item->accessible())
-        {
-            /* Open a direct session to modify VM settings */
-            CSession session = vboxGlobal().openSession (id);
-            if (session.isNull())
-                return;
-            CMachine machine = session.GetMachine();
-            /* Detach all attached Hard Disks */
-            CMediumAttachmentVector vec = machine.GetMediumAttachments();
-            for (int i = 0; i < vec.size(); ++ i)
+    int rc = vboxProblem().confirmMachineDeletion(item->machine());
+    if (rc != QIMessageBox::Cancel)
+    {
+        CMachine machine = item->machine();
+        QVector<CMedium> aMedia = machine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);          //  @todo replace with DetachAllReturnHardDisksOnly once a progress dialog is in place below
+        if (machine.isOk() && item->accessible())
+        {
+            /* If not Yes, we don't want touch the harddisks */
+            if (rc == QIMessageBox::No)
+                aMedia.clear();
+            /* delete machine settings */
+            CProgress progress = machine.Delete(aMedia);
+            if (machine.isOk())
             {
-                CMediumAttachment hda = vec [i];
-                const QString ctlName = hda.GetController();
-
-                machine.DetachDevice(ctlName, hda.GetPort(), hda.GetDevice());
-                if (!machine.isOk())
-                {
-                    CStorageController ctl = machine.GetStorageControllerByName(ctlName);
-                    vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk,
-                        vboxGlobal().getMedium (CMedium (hda.GetMedium())).location(),
-                        ctl.GetBus(), hda.GetPort(), hda.GetDevice());
-                }
+                vboxProblem().showModalProgressDialog(progress, item->name(), 0, 0);
+                if (progress.GetResultCode() != 0)
+                    vboxProblem().cannotDeleteMachine(machine);
             }
-            /* Commit changes */
-            machine.SaveSettings();
-            if (!machine.isOk())
-                vboxProblem().cannotSaveMachineSettings (machine);
-            else
-                ok = true;
-            session.UnlockMachine();
-        }
-        else
-            ok = true;
-
-        if (ok)
-        {
-            CMachine machine = item->machine();
-            QVector<CMedium> aMedia = machine.Unregister(KCleanupMode_UnregisterOnly);          //  @todo replace with DetachAllReturnHardDisksOnly once a progress dialog is in place below
-            if (machine.isOk() && item->accessible())
-            {
-                /* delete machine settings */
-                CProgress progress = machine.Delete(aMedia);
-                progress.WaitForCompletion(-1);         // @todo do this nicely with a progress dialog, this can delete many files!
-
-                /* remove the item shortly: cmachine it refers to is no longer valid! */
-                int row = mVMModel->rowById (item->id());
-                mVMModel->removeItem (item);
-                delete item;
-                mVMListView->ensureSomeRowSelected (row);
-            }
-            if (!machine.isOk())
-                vboxProblem().cannotDeleteMachine(machine);
-        }
+        }
+        if (!machine.isOk())
+            vboxProblem().cannotDeleteMachine(machine);
     }
 }
@@ -1205,5 +1168,5 @@
         /* enable/disable modify actions */
         mVmConfigAction->setEnabled (modifyEnabled);
-        mVmDeleteAction->setEnabled (modifyEnabled);
+        mVmDeleteAction->setEnabled (!running);
         mVmDiscardAction->setEnabled (state == KMachineState_Saved && !running);
         mVmPauseAction->setEnabled (   state == KMachineState_Running
@@ -1627,5 +1590,5 @@
 
         /* Delete */
-        mVmDeleteAction->setEnabled (modifyEnabled);
+        mVmDeleteAction->setEnabled (!running);
 
         /* Discard */
