Index: /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp	(revision 96659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.cpp	(revision 96660)
@@ -89,5 +89,6 @@
     UISnapshotItem(UISnapshotPane *pSnapshotWidget,
                    QITreeWidget *pTreeWidget,
-                   const CSnapshot &comSnapshot);
+                   const CSnapshot &comSnapshot,
+                   bool fExtendedNameRequired);
     /** Constructs normal snapshot item (child of tree-widget-item). */
     UISnapshotItem(UISnapshotPane *pSnapshotWidget,
@@ -98,5 +99,6 @@
     UISnapshotItem(UISnapshotPane *pSnapshotWidget,
                    QITreeWidget *pTreeWidget,
-                   const CMachine &comMachine);
+                   const CMachine &comMachine,
+                   bool fExtendedNameRequired);
     /** Constructs "current state" item (child of tree-widget-item). */
     UISnapshotItem(UISnapshotPane *pSnapshotWidget,
@@ -106,4 +108,6 @@
     /** Returns item machine. */
     CMachine machine() const { return m_comMachine; }
+    /** Returns item machine ID. */
+    QUuid machineID() const { return m_uMachineID; }
     /** Returns item snapshot. */
     CSnapshot snapshot() const { return m_comSnapshot; }
@@ -140,4 +144,7 @@
 private:
 
+    /** Holds whether this item requires extended name. */
+    bool  m_fExtendedNameRequired;
+
     /** Holds the pointer to the snapshot-widget this item belongs to. */
     QPointer<UISnapshotPane>  m_pSnapshotWidget;
@@ -153,4 +160,6 @@
     CMachine   m_comMachine;
 
+    /** Holds the machine ID. */
+    QUuid  m_uMachineID;
     /** Holds the "current snapshot" ID. */
     QUuid  m_uSnapshotID;
@@ -210,6 +219,8 @@
 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
                                QITreeWidget *pTreeWidget,
-                               const CSnapshot &comSnapshot)
+                               const CSnapshot &comSnapshot,
+                               bool fExtendedNameRequired)
     : QITreeWidgetItem(pTreeWidget)
+    , m_fExtendedNameRequired(fExtendedNameRequired)
     , m_pSnapshotWidget(pSnapshotWidget)
     , m_fCurrentStateItem(false)
@@ -226,4 +237,5 @@
                                const CSnapshot &comSnapshot)
     : QITreeWidgetItem(pRootItem)
+    , m_fExtendedNameRequired(false)
     , m_pSnapshotWidget(pSnapshotWidget)
     , m_fCurrentStateItem(false)
@@ -238,6 +250,8 @@
 UISnapshotItem::UISnapshotItem(UISnapshotPane *pSnapshotWidget,
                                QITreeWidget *pTreeWidget,
-                               const CMachine &comMachine)
+                               const CMachine &comMachine,
+                               bool fExtendedNameRequired)
     : QITreeWidgetItem(pTreeWidget)
+    , m_fExtendedNameRequired(fExtendedNameRequired)
     , m_pSnapshotWidget(pSnapshotWidget)
     , m_fCurrentStateItem(true)
@@ -262,4 +276,5 @@
                                const CMachine &comMachine)
     : QITreeWidgetItem(pRootItem)
+    , m_fExtendedNameRequired(false)
     , m_pSnapshotWidget(pSnapshotWidget)
     , m_fCurrentStateItem(true)
@@ -314,9 +329,13 @@
         /* Fetch machine information: */
         AssertReturnVoid(m_comMachine.isNotNull());
+        m_uMachineID = m_comMachine.GetId();
         m_fCurrentStateModified = m_comMachine.GetCurrentStateModified();
         m_strName = m_fCurrentStateModified
                   ? tr("Current State (changed)", "Current State (Modified)")
                   : tr("Current State", "Current State (Unmodified)");
-        setText(Column_Name, m_strName);
+        const QString strFinalName = m_fExtendedNameRequired
+                                   ? QString("%1 (%2)").arg(m_strName, m_comMachine.GetName())
+                                   : m_strName;
+        setText(Column_Name, strFinalName);
         m_strDescription = m_fCurrentStateModified
                          ? tr("The current state differs from the state stored in the current snapshot")
@@ -330,7 +349,12 @@
         /* Fetch snapshot information: */
         AssertReturnVoid(m_comSnapshot.isNotNull());
+        const CMachine comMachine = m_comSnapshot.GetMachine();
+        m_uMachineID = comMachine.GetId();
         m_uSnapshotID = m_comSnapshot.GetId();
         m_strName = m_comSnapshot.GetName();
-        setText(Column_Name, m_strName);
+        const QString strFinalName = m_fExtendedNameRequired
+                                   ? QString("%1 (%2)").arg(m_strName, comMachine.GetName())
+                                   : m_strName;
+        setText(Column_Name, strFinalName);
         m_fOnline = m_comSnapshot.GetOnline();
         setIcon(Column_Name, *m_pSnapshotWidget->snapshotItemIcon(m_fOnline));
@@ -505,6 +529,4 @@
     , m_pActionPool(pActionPool)
     , m_fShowToolbar(fShowToolbar)
-    , m_enmSessionState(KSessionState_Null)
-    , m_fShapshotOperationsAllowed(false)
     , m_pLockReadWrite(0)
     , m_pIconSnapshotOffline(0)
@@ -514,6 +536,4 @@
     , m_pToolBar(0)
     , m_pSnapshotTree(0)
-    , m_pCurrentSnapshotItem(0)
-    , m_pCurrentStateItem(0)
     , m_pDetailsWidget(0)
 {
@@ -528,19 +548,26 @@
 void UISnapshotPane::setMachineItems(const QList<UIVirtualMachineItem*> &items)
 {
-    /* Cache passed machine: */
-    m_comMachine = items.isEmpty() ? CMachine() : items.first()->toLocal()->machine();
-
-    /* Cache machine details: */
-    if (m_comMachine.isNull())
-    {
-        m_uMachineId = QUuid();
-        m_enmSessionState = KSessionState_Null;
-        m_fShapshotOperationsAllowed = false;
-    }
-    else
-    {
-        m_uMachineId = m_comMachine.GetId();
-        m_enmSessionState = m_comMachine.GetSessionState();
-        m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(m_uMachineId);
+    /* Wipe out old stuff: */
+    m_machines.clear();
+    m_sessionStates.clear();
+    m_operationAllowed.clear();
+
+    /* For each machine item: */
+    foreach (UIVirtualMachineItem *pItem, items)
+    {
+        /* Parse machine details: */
+        AssertPtrReturnVoid(pItem);
+        CMachine comMachine = pItem->toLocal()->machine();
+
+        /* Cache passed machine: */
+        if (!comMachine.isNull())
+        {
+            const QUuid uMachineId = comMachine.GetId();
+            const KSessionState enmSessionState = comMachine.GetSessionState();
+            const bool fAllowance = gEDataManager->machineSnapshotOperationsEnabled(uMachineId);
+            m_machines[uMachineId] = comMachine;
+            m_sessionStates[uMachineId] = enmSessionState;
+            m_operationAllowed[uMachineId] = fAllowance;
+        }
     }
 
@@ -556,5 +583,6 @@
 bool UISnapshotPane::isCurrentStateItemSelected() const
 {
-    return m_pCurrentStateItem && m_pSnapshotTree->currentItem() == m_pCurrentStateItem;
+    UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
+    return m_currentStateItems.values().contains(pSnapshotItem);
 }
 
@@ -606,5 +634,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -613,5 +641,5 @@
 
     /* Recache "current state" item data: */
-    m_pCurrentStateItem->recache();
+    m_currentStateItems.value(uMachineId)->recache();
 
     /* Choose current item again (to update details-widget): */
@@ -622,5 +650,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -629,6 +657,6 @@
 
     /* Recache "current state" item data and machine-state: */
-    m_pCurrentStateItem->recache();
-    m_pCurrentStateItem->setMachineState(enmState);
+    m_currentStateItems.value(uMachineId)->recache();
+    m_currentStateItems.value(uMachineId)->setMachineState(enmState);
 }
 
@@ -636,5 +664,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -643,5 +671,5 @@
 
     /* Recache current session-state: */
-    m_enmSessionState = enmState;
+    m_sessionStates[uMachineId] = enmState;
 
     /* Update action states: */
@@ -652,5 +680,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -664,11 +692,14 @@
         QWriteLocker locker(m_pLockReadWrite);
 
+        /* Acquire corresponding machine: */
+        CMachine comMachine = m_machines.value(uMachineId);
+
         /* Search for corresponding snapshot: */
-        CSnapshot comSnapshot = m_comMachine.FindSnapshot(uSnapshotId.toString());
-        fSuccess = m_comMachine.isOk() && !comSnapshot.isNull();
+        CSnapshot comSnapshot = comMachine.FindSnapshot(uSnapshotId.toString());
+        fSuccess = comMachine.isOk() && !comSnapshot.isNull();
 
         /* Show error message if necessary: */
         if (!fSuccess)
-            UINotificationMessage::cannotFindSnapshotById(m_comMachine, uSnapshotId);
+            UINotificationMessage::cannotFindSnapshotById(comMachine, uSnapshotId);
         else
         {
@@ -697,8 +728,8 @@
             /* Make sure this parent-item is a parent of "current state" item as well: */
             if (fSuccess)
-                fSuccess = qobject_cast<UISnapshotItem*>(m_pCurrentStateItem->parentItem()) == pParentItem;
+                fSuccess = qobject_cast<UISnapshotItem*>(m_currentStateItems.value(uMachineId)->parentItem()) == pParentItem;
             /* Make sure this parent-item is a "current snapshot" item as well: */
             if (fSuccess)
-                fSuccess = m_pCurrentSnapshotItem == pParentItem;
+                fSuccess = m_currentSnapshotItems.value(uMachineId) == pParentItem;
 
             /* Create new item: */
@@ -706,28 +737,26 @@
             {
                 /* Delete "current state" item first of all: */
-                UISnapshotItem *pCurrentStateItem = m_pCurrentStateItem;
-                m_pCurrentStateItem = 0;
+                UISnapshotItem *pCurrentStateItem = m_currentStateItems.value(uMachineId);
+                m_currentStateItems[uMachineId] = 0;
                 delete pCurrentStateItem;
                 pCurrentStateItem = 0;
 
                 /* Create "current snapshot" item for a newly taken snapshot: */
-                if (m_pCurrentSnapshotItem)
-                    m_pCurrentSnapshotItem->setCurrentSnapshotItem(false);
-                m_pCurrentSnapshotItem = pParentItem
-                                       ? new UISnapshotItem(this, pParentItem, comSnapshot)
-                                       : new UISnapshotItem(this, m_pSnapshotTree, comSnapshot);
-                /* Mark it as editable: */
-                m_pCurrentSnapshotItem->setFlags(m_pCurrentSnapshotItem->flags() | Qt::ItemIsEditable);
+                if (m_currentSnapshotItems.value(uMachineId))
+                    m_currentSnapshotItems.value(uMachineId)->setCurrentSnapshotItem(false);
+                m_currentSnapshotItems[uMachineId] = pParentItem
+                                                   ? new UISnapshotItem(this, pParentItem, comSnapshot)
+                                                   : new UISnapshotItem(this, m_pSnapshotTree, comSnapshot, m_machines.size() > 1);
                 /* Mark it as current: */
-                m_pCurrentSnapshotItem->setCurrentSnapshotItem(true);
+                m_currentSnapshotItems.value(uMachineId)->setCurrentSnapshotItem(true);
                 /* And recache it's content: */
-                m_pCurrentSnapshotItem->recache();
+                m_currentSnapshotItems.value(uMachineId)->recache();
 
                 /* Create "current state" item as a child of "current snapshot" item: */
-                m_pCurrentStateItem = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
+                m_currentStateItems[uMachineId] = new UISnapshotItem(this, m_currentSnapshotItems.value(uMachineId), comMachine);
                 /* Recache it's content: */
-                m_pCurrentStateItem->recache();
+                m_currentStateItems.value(uMachineId)->recache();
                 /* And choose is as current one: */
-                m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
+                m_pSnapshotTree->setCurrentItem(m_currentStateItems.value(uMachineId));
                 sltHandleCurrentItemChange();
 
@@ -748,5 +777,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -806,9 +835,9 @@
         if (fSuccess)
         {
-            if (pItem == m_pCurrentSnapshotItem)
+            if (pItem == m_currentSnapshotItems.value(uMachineId))
             {
-                m_pCurrentSnapshotItem = UISnapshotItem::toSnapshotItem(pParent);
-                if (m_pCurrentSnapshotItem)
-                    m_pCurrentSnapshotItem->setCurrentSnapshotItem(true);
+                m_currentSnapshotItems[uMachineId] = UISnapshotItem::toSnapshotItem(pParent);
+                if (m_currentSnapshotItems.value(uMachineId))
+                    m_currentSnapshotItems.value(uMachineId)->setCurrentSnapshotItem(true);
             }
             delete pItem;
@@ -830,5 +859,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -870,5 +899,5 @@
 {
     /* Make sure it's our VM: */
-    if (uMachineId != m_uMachineId)
+    if (!m_machines.keys().contains(uMachineId))
         return;
 
@@ -890,20 +919,20 @@
         {
             /* Delete "current state" item first of all: */
-            UISnapshotItem *pCurrentStateItem = m_pCurrentStateItem;
-            m_pCurrentStateItem = 0;
+            UISnapshotItem *pCurrentStateItem = m_currentStateItems.value(uMachineId);
+            m_currentStateItems[uMachineId] = 0;
             delete pCurrentStateItem;
             pCurrentStateItem = 0;
 
             /* Move the "current snapshot" token from one to another: */
-            AssertPtrReturnVoid(m_pCurrentSnapshotItem);
-            m_pCurrentSnapshotItem->setCurrentSnapshotItem(false);
-            m_pCurrentSnapshotItem = pItem;
-            m_pCurrentSnapshotItem->setCurrentSnapshotItem(true);
+            AssertPtrReturnVoid(m_currentSnapshotItems.value(uMachineId));
+            m_currentSnapshotItems.value(uMachineId)->setCurrentSnapshotItem(false);
+            m_currentSnapshotItems[uMachineId] = pItem;
+            m_currentSnapshotItems.value(uMachineId)->setCurrentSnapshotItem(true);
 
             /* Create "current state" item as a child of "current snapshot" item: */
-            m_pCurrentStateItem = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
-            m_pCurrentStateItem->recache();
+            m_currentStateItems[uMachineId] = new UISnapshotItem(this, m_currentSnapshotItems.value(uMachineId), m_machines.value(uMachineId));
+            m_currentStateItems.value(uMachineId)->recache();
             /* And choose is as current one: */
-            m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
+            m_pSnapshotTree->setCurrentItem(m_currentStateItems.value(uMachineId));
             sltHandleCurrentItemChange();
 
@@ -957,8 +986,8 @@
         if (pSnapshotItem->isCurrentStateItem())
         {
-            if (m_comMachine.isNull())
+            if (m_machines.value(pSnapshotItem->machineID()).isNull())
                 m_pDetailsWidget->clearData();
             else
-                m_pDetailsWidget->setData(m_comMachine);
+                m_pDetailsWidget->setData(m_machines.value(pSnapshotItem->machineID()));
         }
         else
@@ -983,5 +1012,5 @@
 
         /* Take snapshot: */
-        UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(m_comMachine,
+        UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(m_machines.value(pSnapshotItem->machineID()),
                                                                                                    newData.name(),
                                                                                                    newData.description());
@@ -1006,8 +1035,8 @@
         /* Open a session (this call will handle all errors): */
         CSession comSession;
-        if (m_enmSessionState != KSessionState_Unlocked)
-            comSession = uiCommon().openExistingSession(m_uMachineId);
+        if (m_sessionStates.value(pSnapshotItem->machineID()) != KSessionState_Unlocked)
+            comSession = uiCommon().openExistingSession(pSnapshotItem->machineID());
         else
-            comSession = uiCommon().openSession(m_uMachineId);
+            comSession = uiCommon().openSession(pSnapshotItem->machineID());
         if (comSession.isNotNull())
         {
@@ -1075,8 +1104,9 @@
         if (pSnapshotItem->isCurrentStateItem())
         {
-            if (m_comMachine.isNull())
+            CMachine comMachine = m_machines.value(pSnapshotItem->machineID());
+            if (comMachine.isNull())
                 m_pDetailsWidget->clearData();
             else
-                m_pDetailsWidget->setData(m_comMachine);
+                m_pDetailsWidget->setData(comMachine);
         }
         else
@@ -1105,5 +1135,5 @@
     QMenu menu;
     /* For snapshot item: */
-    if (m_pCurrentSnapshotItem && !pSnapshotItem->isCurrentStateItem())
+    if (m_currentSnapshotItems.value(pSnapshotItem->machineID()) && !pSnapshotItem->isCurrentStateItem())
     {
         menu.addAction(m_pActionPool->action(UIActionIndexMN_M_Snapshot_S_Delete));
@@ -1375,6 +1405,6 @@
     QWriteLocker locker(m_pLockReadWrite);
 
-    /* If VM is null, just updated the current item: */
-    if (m_comMachine.isNull())
+    /* If VM list is empty, just updated the current item: */
+    if (m_machines.isEmpty())
     {
         /* Clear the tree: */
@@ -1396,44 +1426,50 @@
     m_pSnapshotTree->clear();
 
-    /* If machine has snapshots: */
-    if (m_comMachine.GetSnapshotCount() > 0)
-    {
-        /* Get the first snapshot: */
-        const CSnapshot comSnapshot = m_comMachine.FindSnapshot(QString());
-
-        /* Populate snapshot tree: */
-        populateSnapshots(comSnapshot, 0);
-        /* And make sure it has "current snapshot" item: */
-        Assert(m_pCurrentSnapshotItem);
-
-        /* Add the "current state" item as a child to "current snapshot" item: */
-        m_pCurrentStateItem = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
-        m_pCurrentStateItem->recache();
-
-        /* Search for a previously selected item: */
-        UISnapshotItem *pCurrentItem = findItem(uSelectedItem);
-        if (pCurrentItem == 0)
-            pCurrentItem = findItem(uFirstChildOfSelectedItem);
-        if (pCurrentItem == 0)
-            pCurrentItem = m_pCurrentStateItem;
-
-        /* Choose current item: */
-        m_pSnapshotTree->scrollToItem(pCurrentItem);
-        m_pSnapshotTree->setCurrentItem(pCurrentItem);
-        sltHandleCurrentItemChange();
-    }
-    /* If machine has no snapshots: */
-    else
-    {
-        /* There is no "current snapshot" item: */
-        m_pCurrentSnapshotItem = 0;
-
-        /* Add the "current state" item as a child of snapshot tree: */
-        m_pCurrentStateItem = new UISnapshotItem(this, m_pSnapshotTree, m_comMachine);
-        m_pCurrentStateItem->recache();
-
-        /* Choose current item: */
-        m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
-        sltHandleCurrentItemChange();
+    /* Iterates over all the machines: */
+    foreach (const QUuid &uMachineId, m_machines.keys())
+    {
+        CMachine comMachine = m_machines.value(uMachineId);
+
+        /* If machine has snapshots: */
+        if (comMachine.GetSnapshotCount() > 0)
+        {
+            /* Get the first snapshot: */
+            const CSnapshot comSnapshot = comMachine.FindSnapshot(QString());
+
+            /* Populate snapshot tree: */
+            populateSnapshots(uMachineId, comSnapshot, 0);
+            /* And make sure it has "current snapshot" item: */
+            Assert(m_currentSnapshotItems.value(uMachineId));
+
+            /* Add the "current state" item as a child to "current snapshot" item: */
+            m_currentStateItems[uMachineId] = new UISnapshotItem(this, m_currentSnapshotItems.value(uMachineId), comMachine);
+            m_currentStateItems.value(uMachineId)->recache();
+
+            /* Search for a previously selected item: */
+            UISnapshotItem *pCurrentItem = findItem(uSelectedItem);
+            if (pCurrentItem == 0)
+                pCurrentItem = findItem(uFirstChildOfSelectedItem);
+            if (pCurrentItem == 0)
+                pCurrentItem = m_currentStateItems.value(uMachineId);
+
+            /* Choose current item: */
+            m_pSnapshotTree->scrollToItem(pCurrentItem);
+            m_pSnapshotTree->setCurrentItem(pCurrentItem);
+            sltHandleCurrentItemChange();
+        }
+        /* If machine has no snapshots: */
+        else
+        {
+            /* There is no "current snapshot" item: */
+            m_currentSnapshotItems[uMachineId] = 0;
+
+            /* Add the "current state" item as a child of snapshot tree: */
+            m_currentStateItems[uMachineId] = new UISnapshotItem(this, m_pSnapshotTree, comMachine, m_machines.size() > 1);
+            m_currentStateItems.value(uMachineId)->recache();
+
+            /* Choose current item: */
+            m_pSnapshotTree->setCurrentItem(m_currentStateItems.value(uMachineId));
+            sltHandleCurrentItemChange();
+        }
     }
 
@@ -1445,28 +1481,26 @@
 }
 
-void UISnapshotPane::populateSnapshots(const CSnapshot &comSnapshot, QITreeWidgetItem *pItem)
+void UISnapshotPane::populateSnapshots(const QUuid &uMachineId, const CSnapshot &comSnapshot, QITreeWidgetItem *pItem)
 {
     /* Create a child of passed item: */
     UISnapshotItem *pSnapshotItem = pItem ? new UISnapshotItem(this, pItem, comSnapshot)
-                                          : new UISnapshotItem(this, m_pSnapshotTree, comSnapshot);
+                                          : new UISnapshotItem(this, m_pSnapshotTree, comSnapshot, m_machines.size() > 1);
     /* And recache it's content: */
     pSnapshotItem->recache();
 
     /* Mark snapshot item as "current" and remember it: */
-    CSnapshot comCurrentSnapshot = m_comMachine.GetCurrentSnapshot();
+    CSnapshot comCurrentSnapshot = m_machines.value(uMachineId).GetCurrentSnapshot();
     if (!comCurrentSnapshot.isNull() && comCurrentSnapshot.GetId() == comSnapshot.GetId())
     {
         pSnapshotItem->setCurrentSnapshotItem(true);
-        m_pCurrentSnapshotItem = pSnapshotItem;
+        m_currentSnapshotItems[uMachineId] = pSnapshotItem;
     }
 
     /* Walk through the children recursively: */
     foreach (const CSnapshot &comIteratedSnapshot, comSnapshot.GetChildren())
-        populateSnapshots(comIteratedSnapshot, pSnapshotItem);
+        populateSnapshots(uMachineId, comIteratedSnapshot, pSnapshotItem);
 
     /* Expand the newly created item: */
     pSnapshotItem->setExpanded(true);
-    /* And mark it as editable: */
-    pSnapshotItem->setFlags(pSnapshotItem->flags() | Qt::ItemIsEditable);
 }
 
@@ -1497,10 +1531,11 @@
 
     /* Check whether another direct session is opened: */
-    const bool fBusy = m_enmSessionState != KSessionState_Unlocked;
+    const bool fBusy = !pSnapshotItem || m_sessionStates.value(pSnapshotItem->machineID()) != KSessionState_Unlocked;
 
     /* Acquire machine-state of the "current state" item: */
     KMachineState enmState = KMachineState_Null;
-    if (m_pCurrentStateItem)
-        enmState = m_pCurrentStateItem->machineState();
+    if (   pSnapshotItem
+        && m_currentStateItems.value(pSnapshotItem->machineID()))
+        enmState = m_currentStateItems.value(pSnapshotItem->machineID())->machineState();
 
     /* Determine whether taking or deleting snapshots is possible: */
@@ -1515,18 +1550,18 @@
     /* Update 'Take' action: */
     m_pActionPool->action(UIActionIndexMN_M_Snapshot_S_Take)->setEnabled(
-           m_fShapshotOperationsAllowed
+           pSnapshotItem
+        && m_operationAllowed.value(pSnapshotItem->machineID())
         && (   (   fCanTakeDeleteSnapshot
-                && m_pCurrentSnapshotItem
-                && pSnapshotItem
+                && m_currentSnapshotItems.value(pSnapshotItem->machineID())
                 && pSnapshotItem->isCurrentStateItem())
-            || (   pSnapshotItem
-                && !m_pCurrentSnapshotItem))
+            || (!m_currentSnapshotItems.value(pSnapshotItem->machineID())))
     );
 
     /* Update 'Delete' action: */
     m_pActionPool->action(UIActionIndexMN_M_Snapshot_S_Delete)->setEnabled(
-           m_fShapshotOperationsAllowed
+           pSnapshotItem
+        && m_operationAllowed.value(pSnapshotItem->machineID())
         && fCanTakeDeleteSnapshot
-        && m_pCurrentSnapshotItem
+        && m_currentSnapshotItems.value(pSnapshotItem->machineID())
         && pSnapshotItem
         && !pSnapshotItem->isCurrentStateItem()
@@ -1536,6 +1571,6 @@
     m_pActionPool->action(UIActionIndexMN_M_Snapshot_S_Restore)->setEnabled(
            !fBusy
-        && m_pCurrentSnapshotItem
         && pSnapshotItem
+        && m_currentSnapshotItems.value(pSnapshotItem->machineID())
         && !pSnapshotItem->isCurrentStateItem()
     );
@@ -1556,4 +1591,11 @@
 bool UISnapshotPane::takeSnapshot(bool fAutomatically /* = false */)
 {
+    /* Acquire "current snapshot" item: */
+    const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
+    AssertPtrReturn(pSnapshotItem, false);
+
+    /* Acquire machine: */
+    const CMachine comMachine = m_machines.value(pSnapshotItem->machineID());
+
     /* Search for a maximum existing snapshot index: */
     int iMaximumIndex = 0;
@@ -1581,11 +1623,11 @@
         /* Create take-snapshot dialog: */
         QWidget *pDlgParent = windowManager().realParentWindow(this);
-        QPointer<UITakeSnapshotDialog> pDlg = new UITakeSnapshotDialog(pDlgParent, m_comMachine);
+        QPointer<UITakeSnapshotDialog> pDlg = new UITakeSnapshotDialog(pDlgParent, comMachine);
         windowManager().registerNewParent(pDlg, pDlgParent);
 
         /* Assign corresponding icon: */
-        QIcon icon = generalIconPool().userMachineIcon(m_comMachine);
+        QIcon icon = generalIconPool().userMachineIcon(comMachine);
         if (icon.isNull())
-            icon = generalIconPool().guestOSTypeIcon(m_comMachine.GetOSTypeId());
+            icon = generalIconPool().guestOSTypeIcon(comMachine.GetOSTypeId());
         pDlg->setIcon(icon);
 
@@ -1610,5 +1652,5 @@
 
     /* Take snapshot: */
-    UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(m_comMachine,
+    UINotificationProgressSnapshotTake *pNotification = new UINotificationProgressSnapshotTake(comMachine,
                                                                                                strFinalName,
                                                                                                strFinalDescription);
@@ -1624,4 +1666,7 @@
     const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
     AssertPtrReturn(pSnapshotItem, false);
+
+    /* Acquire machine: */
+    const CMachine comMachine = m_machines.value(pSnapshotItem->machineID());
 
     /* Get corresponding snapshot: */
@@ -1643,5 +1688,5 @@
 
     /* Delete snapshot: */
-    UINotificationProgressSnapshotDelete *pNotification = new UINotificationProgressSnapshotDelete(m_comMachine,
+    UINotificationProgressSnapshotDelete *pNotification = new UINotificationProgressSnapshotDelete(comMachine,
                                                                                                    pSnapshotItem->snapshotID());
     gpNotificationCenter->append(pNotification);
@@ -1657,4 +1702,7 @@
     AssertPtrReturn(pSnapshotItem, false);
 
+    /* Acquire machine: */
+    const CMachine comMachine = m_machines.value(pSnapshotItem->machineID());
+
     /* Get corresponding snapshot: */
     const CSnapshot comSnapshot = pSnapshotItem->snapshot();
@@ -1662,8 +1710,8 @@
 
     /* In manual mode we should check whether current state is changed: */
-    if (!fAutomatically && m_comMachine.GetCurrentStateModified())
+    if (!fAutomatically && comMachine.GetCurrentStateModified())
     {
         /* Ask if user really wants to restore the selected snapshot: */
-        int iResultCode = msgCenter().confirmSnapshotRestoring(comSnapshot.GetName(), m_comMachine.GetCurrentStateModified());
+        int iResultCode = msgCenter().confirmSnapshotRestoring(comSnapshot.GetName(), comMachine.GetCurrentStateModified());
         if (iResultCode & AlertButton_Cancel)
             return false;
@@ -1673,5 +1721,5 @@
         {
             /* Take snapshot of changed current state: */
-            m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
+            m_pSnapshotTree->setCurrentItem(m_currentStateItems.value(pSnapshotItem->machineID()));
             if (!takeSnapshot())
                 return false;
@@ -1680,5 +1728,5 @@
 
     /* Restore snapshot: */
-    UINotificationProgressSnapshotRestore *pNotification = new UINotificationProgressSnapshotRestore(m_comMachine, comSnapshot);
+    UINotificationProgressSnapshotRestore *pNotification = new UINotificationProgressSnapshotRestore(comMachine, comSnapshot);
     gpNotificationCenter->append(pNotification);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.h	(revision 96659)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/snapshots/UISnapshotPane.h	(revision 96660)
@@ -185,5 +185,5 @@
         void refreshAll();
         /** Populates snapshot items for corresponding @a comSnapshot using @a pItem as parent. */
-        void populateSnapshots(const CSnapshot &comSnapshot, QITreeWidgetItem *pItem);
+        void populateSnapshots(const QUuid &uMachineId, const CSnapshot &comSnapshot, QITreeWidgetItem *pItem);
 
         /** Cleanups all. */
@@ -224,16 +224,14 @@
       * @{ */
         /** Holds the action-pool reference. */
-        UIActionPool  *m_pActionPool;
+        UIActionPool *m_pActionPool;
         /** Holds whether we should show toolbar. */
-        bool           m_fShowToolbar;
-        /** Holds the COM machine object. */
-        CMachine       m_comMachine;
-        /** Holds the machine object ID. */
-        QUuid        m_uMachineId;
-        /** Holds the cached session state. */
-        KSessionState  m_enmSessionState;
-
-        /** Holds whether the snapshot operations are allowed. */
-        bool  m_fShapshotOperationsAllowed;
+        bool          m_fShowToolbar;
+
+        /** Holds the COM machine object list. */
+        QMap<QUuid, CMachine>       m_machines;
+        /** Holds the cached session state list. */
+        QMap<QUuid, KSessionState>  m_sessionStates;
+        /** Holds the list of operation allowance states. */
+        QMap<QUuid, bool>           m_operationAllowed;
 
         /** Holds the snapshot item editing protector. */
@@ -259,8 +257,9 @@
         /** Holds the snapshot tree instance. */
         UISnapshotTree *m_pSnapshotTree;
-        /** Holds the "current snapshot" item reference. */
-        UISnapshotItem *m_pCurrentSnapshotItem;
-        /** Holds the "current state" item reference. */
-        UISnapshotItem *m_pCurrentStateItem;
+
+        /** Holds the "current snapshot" item list. */
+        QMap<QUuid, UISnapshotItem*>  m_currentSnapshotItems;
+        /** Holds the "current state" item list. */
+        QMap<QUuid, UISnapshotItem*>  m_currentStateItems;
 
         /** Holds the details-widget instance. */
