Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 67423)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 67424)
@@ -99,5 +99,5 @@
     bool isCurrentStateItem() const { return m_fCurrentStateItem; }
 
-    /** Returns whether this is the current snapshot item. */
+    /** Returns whether this is the "current snapshot" item. */
     bool isCurrentSnapshotItem() const { return m_fCurrentSnapshotItem; }
     /** Defines whether this is the @a fCurrent snapshot item. */
@@ -138,7 +138,7 @@
     CMachine   m_comMachine;
 
-    /** Holds the current snapshot ID. */
+    /** Holds the "current snapshot" ID. */
     QString  m_strSnapshotID;
-    /** Holds whether the current snapshot is online one. */
+    /** Holds whether the "current snapshot" is online one. */
     bool     m_fOnline;
 
@@ -219,5 +219,5 @@
 {
     /* Set the bold font state
-     * for current state item: */
+     * for "current state" item: */
     QFont myFont = font(Column_Name);
     myFont.setBold(true);
@@ -236,5 +236,5 @@
 {
     /* Set the bold font state
-     * for current state item: */
+     * for "current state" item: */
     QFont myFont = font(Column_Name);
     myFont.setBold(true);
@@ -263,5 +263,5 @@
 
     /* Set/clear the bold font state
-     * for current snapshot item: */
+     * for "current snapshot" item: */
     QFont myFont = font(Column_Name);
     myFont.setBold(fCurrent);
@@ -471,4 +471,5 @@
     , m_pSnapshotTree(0)
     , m_pCurrentSnapshotItem(0)
+    , m_pCurrentStateItem(0)
     , m_pDetailsWidget(0)
 {
@@ -491,5 +492,5 @@
     if (m_comMachine.isNull())
     {
-        m_strMachineID = QString();
+        m_strMachineId = QString();
         m_enmSessionState = KSessionState_Null;
         m_fShapshotOperationsAllowed = false;
@@ -497,7 +498,7 @@
     else
     {
-        m_strMachineID = comMachine.GetId();
+        m_strMachineId = comMachine.GetId();
         m_enmSessionState = comMachine.GetSessionState();
-        m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(m_strMachineID);
+        m_fShapshotOperationsAllowed = gEDataManager->machineSnapshotOperationsEnabled(m_strMachineId);
     }
 
@@ -580,8 +581,8 @@
 }
 
-void UISnapshotPane::sltHandleMachineDataChange(QString strMachineID)
+void UISnapshotPane::sltHandleMachineDataChange(QString strMachineId)
 {
     /* Make sure it's our VM: */
-    if (strMachineID != m_strMachineID)
+    if (strMachineId != m_strMachineId)
         return;
 
@@ -589,12 +590,12 @@
     QWriteLocker locker(m_pLockReadWrite);
 
-    /* Recache current item data: */
-    currentStateItem()->recache();
-}
-
-void UISnapshotPane::sltHandleMachineStateChange(QString strMachineID, KMachineState enmState)
+    /* Recache "current state" item data: */
+    m_pCurrentStateItem->recache();
+}
+
+void UISnapshotPane::sltHandleMachineStateChange(QString strMachineId, KMachineState enmState)
 {
     /* Make sure it's our VM: */
-    if (strMachineID != m_strMachineID)
+    if (strMachineId != m_strMachineId)
         return;
 
@@ -602,13 +603,13 @@
     QWriteLocker locker(m_pLockReadWrite);
 
-    /* Recache current item data and machine-state: */
-    currentStateItem()->recache();
-    currentStateItem()->setMachineState(enmState);
-}
-
-void UISnapshotPane::sltHandleSessionStateChange(QString strMachineID, KSessionState enmState)
+    /* Recache "current state" item data and machine-state: */
+    m_pCurrentStateItem->recache();
+    m_pCurrentStateItem->setMachineState(enmState);
+}
+
+void UISnapshotPane::sltHandleSessionStateChange(QString strMachineId, KSessionState enmState)
 {
     /* Make sure it's our VM: */
-    if (strMachineID != m_strMachineID)
+    if (strMachineId != m_strMachineId)
         return;
 
@@ -623,8 +624,8 @@
 }
 
-void UISnapshotPane::sltHandleSnapshotChange(QString strMachineID)
+void UISnapshotPane::sltHandleSnapshotChange(QString strMachineId)
 {
     /* Make sure it's our VM: */
-    if (strMachineID != m_strMachineID)
+    if (strMachineId != m_strMachineId)
         return;
 
@@ -664,5 +665,5 @@
     if (m_pDetailsWidget->isVisible())
     {
-        /* Acquire current snapshot item: */
+        /* Acquire "current snapshot" item: */
         const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
         /* Update details-widget: */
@@ -680,5 +681,5 @@
     m_pActionCommitSnapshotDetails->setEnabled(false);
 
-    /* Acquire current snapshot item: */
+    /* Acquire "current snapshot" item: */
     const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
     AssertPtr(pSnapshotItem);
@@ -725,5 +726,5 @@
 void UISnapshotPane::sltHandleCurrentItemChange()
 {
-    /* Acquire current snapshot item: */
+    /* Acquire "current snapshot" item: */
     const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
 
@@ -1066,10 +1067,10 @@
         /* Populate snapshot tree: */
         populateSnapshots(comSnapshot, 0);
-        /* And make sure it has current snapshot item: */
+        /* And make sure it has "current snapshot" item: */
         Assert(m_pCurrentSnapshotItem);
 
-        /* Add the "current state" item as a child to current snapshot item: */
-        UISnapshotItem *pCsi = new UISnapshotItem(this, m_pCurrentSnapshotItem, m_comMachine);
-        pCsi->recache();
+        /* 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: */
@@ -1078,5 +1079,5 @@
             pCurrentItem = findItem(strFirstChildOfSelectedItem);
         if (pCurrentItem == 0)
-            pCurrentItem = currentStateItem();
+            pCurrentItem = m_pCurrentStateItem;
 
         /* Choose current item: */
@@ -1088,13 +1089,13 @@
     else
     {
-        /* There is no current snapshot item: */
+        /* There is no "current snapshot" item: */
         m_pCurrentSnapshotItem = 0;
 
         /* Add the "current state" item as a child of snapshot tree: */
-        UISnapshotItem *pCsi = new UISnapshotItem(this, m_pSnapshotTree, m_comMachine);
-        pCsi->recache();
+        m_pCurrentStateItem = new UISnapshotItem(this, m_pSnapshotTree, m_comMachine);
+        m_pCurrentStateItem->recache();
 
         /* Choose current item: */
-        m_pSnapshotTree->setCurrentItem(pCsi);
+        m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
         sltHandleCurrentItemChange();
     }
@@ -1155,5 +1156,5 @@
 void UISnapshotPane::updateActionStates()
 {
-    /* Acquire current snapshot item: */
+    /* Acquire "current snapshot" item: */
     const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
 
@@ -1163,6 +1164,6 @@
     /* Acquire machine-state of the "current state" item: */
     KMachineState enmState = KMachineState_Null;
-    if (currentStateItem())
-        enmState = currentStateItem()->machineState();
+    if (m_pCurrentStateItem)
+        enmState = m_pCurrentStateItem->machineState();
 
     /* Determine whether taking or deleting snapshots is possible: */
@@ -1229,7 +1230,7 @@
         CSession comSession;
         if (m_enmSessionState != KSessionState_Unlocked)
-            comSession = vboxGlobal().openExistingSession(m_strMachineID);
+            comSession = vboxGlobal().openExistingSession(m_strMachineId);
         else
-            comSession = vboxGlobal().openSession(m_strMachineID);
+            comSession = vboxGlobal().openSession(m_strMachineId);
         if (comSession.isNull())
             break;
@@ -1324,5 +1325,5 @@
     do
     {
-        /* Acquire current snapshot item: */
+        /* Acquire "current snapshot" item: */
         const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
         AssertPtr(pSnapshotItem);
@@ -1352,7 +1353,7 @@
         CSession comSession;
         if (m_enmSessionState != KSessionState_Unlocked)
-            comSession = vboxGlobal().openExistingSession(m_strMachineID);
+            comSession = vboxGlobal().openExistingSession(m_strMachineId);
         else
-            comSession = vboxGlobal().openSession(m_strMachineID);
+            comSession = vboxGlobal().openSession(m_strMachineId);
         if (comSession.isNull())
             break;
@@ -1401,5 +1402,5 @@
     do
     {
-        /* Acquire current snapshot item: */
+        /* Acquire "current snapshot" item: */
         const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
         AssertPtr(pSnapshotItem);
@@ -1425,5 +1426,5 @@
             {
                 /* Take snapshot of changed current state: */
-                m_pSnapshotTree->setCurrentItem(currentStateItem());
+                m_pSnapshotTree->setCurrentItem(m_pCurrentStateItem);
                 if (!takeSnapshot())
                     break;
@@ -1432,5 +1433,5 @@
 
         /* Open a direct session (this call will handle all errors): */
-        CSession comSession = vboxGlobal().openSession(m_strMachineID);
+        CSession comSession = vboxGlobal().openSession(m_strMachineId);
         if (comSession.isNull())
             break;
@@ -1475,5 +1476,5 @@
 void UISnapshotPane::cloneSnapshot()
 {
-    /* Acquire current snapshot item: */
+    /* Acquire "current snapshot" item: */
     const UISnapshotItem *pSnapshotItem = UISnapshotItem::toSnapshotItem(m_pSnapshotTree->currentItem());
     AssertReturnVoid(pSnapshotItem);
@@ -1534,13 +1535,4 @@
 }
 
-UISnapshotItem *UISnapshotPane::currentStateItem() const
-{
-    /* Last child of the current snapshot item if any or first child of invisible root item otherwise: */
-    QTreeWidgetItem *pCsi = m_pCurrentSnapshotItem ?
-                            m_pCurrentSnapshotItem->child(m_pCurrentSnapshotItem->childCount() - 1) :
-                            m_pSnapshotTree->invisibleRootItem()->child(0);
-    return static_cast<UISnapshotItem*>(pCsi);
-}
-
 SnapshotAgeFormat UISnapshotPane::traverseSnapshotAge(QTreeWidgetItem *pItem) const
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h	(revision 67423)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.h	(revision 67424)
@@ -69,5 +69,5 @@
 protected:
 
-    /** @name Event-handling stuff.
+    /** @name Qt event handlers.
       * @{ */
         /** Handles translation event. */
@@ -85,14 +85,14 @@
     /** @name Main event handlers.
       * @{ */
-        /** Handles machine data change for machine with @a strMachineID. */
-        void sltHandleMachineDataChange(QString strMachineID);
-        /** Handles machine @a enmState change for machine with @a strMachineID. */
-        void sltHandleMachineStateChange(QString strMachineID, KMachineState enmState);
-
-        /** Handles session @a enmState change for machine with @a strMachineID. */
-        void sltHandleSessionStateChange(QString strMachineID, KSessionState enmState);
-
-        /** Handles any snapshot change for machine with @a strMachineID. */
-        void sltHandleSnapshotChange(QString strMachineID);
+        /** Handles machine data change for machine with @a strMachineId. */
+        void sltHandleMachineDataChange(QString strMachineId);
+        /** Handles machine @a enmState change for machine with @a strMachineId. */
+        void sltHandleMachineStateChange(QString strMachineId, KMachineState enmState);
+
+        /** Handles session @a enmState change for machine with @a strMachineId. */
+        void sltHandleSessionStateChange(QString strMachineId, KSessionState enmState);
+
+        /** Handles any snapshot change for machine with @a strMachineId. */
+        void sltHandleSnapshotChange(QString strMachineId);
     /** @} */
 
@@ -177,6 +177,4 @@
         /** Searches for an item with corresponding @a strSnapshotID. */
         UISnapshotItem *findItem(const QString &strSnapshotID) const;
-        /** Returns the "current state" item. */
-        UISnapshotItem *currentStateItem() const;
 
         /** Searches for smallest snapshot age starting with @a pItem as parent. */
@@ -189,5 +187,5 @@
         CMachine       m_comMachine;
         /** Holds the machine object ID. */
-        QString        m_strMachineID;
+        QString        m_strMachineId;
         /** Holds the cached session state. */
         KSessionState  m_enmSessionState;
@@ -227,6 +225,8 @@
         /** Holds the snapshot tree instance. */
         UISnapshotTree *m_pSnapshotTree;
-        /** Holds the current snapshot item reference. */
+        /** Holds the "current snapshot" item reference. */
         UISnapshotItem *m_pCurrentSnapshotItem;
+        /** Holds the "current state" item reference. */
+        UISnapshotItem *m_pCurrentStateItem;
 
         /** Holds the details-widget instance. */
