Index: trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp	(revision 35977)
+++ trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.cpp	(revision 35979)
@@ -130,4 +130,5 @@
   , mExtraConfigValue (aExtraConfigValue)
   , mCheckState (Qt::Checked)
+  , m_fModified(false)
 {}
 
@@ -159,4 +160,12 @@
                 break;
             }
+        case Qt::EditRole:
+            {
+                if (aColumn == OriginalValueSection)
+                    mOrigValue = aValue.toString();
+                else if (aColumn == ConfigValueSection)
+                    mConfigValue = aValue.toString();
+                break;
+            }
         default: break;
     }
@@ -169,4 +178,12 @@
     switch (aRole)
     {
+        case Qt::EditRole:
+            {
+                if (aColumn == OriginalValueSection)
+                    v = mOrigValue;
+                else if (aColumn == ConfigValueSection)
+                    v = mConfigValue;
+                break;
+            }
         case Qt::DisplayRole:
             {
@@ -303,4 +320,15 @@
                      mType == KVirtualSystemDescriptionType_NetworkAdapter))
                     v = mCheckState;
+                break;
+            }
+        case HardwareItem::TypeRole:
+            {
+                v = mType;
+                break;
+            }
+        case HardwareItem::ModifiedRole:
+            {
+                if (aColumn == ConfigValueSection)
+                    v = m_fModified;
                 break;
             }
@@ -543,5 +571,5 @@
 }
 
-bool HardwareItem::setModelData (QWidget *aEditor, QAbstractItemModel * /* aModel */, const QModelIndex & /* aIndex */)
+bool HardwareItem::setModelData (QWidget *aEditor, QAbstractItemModel *aModel, const QModelIndex & aIndex)
 {
     bool fDone = false;
@@ -577,4 +605,32 @@
             }
         case KVirtualSystemDescriptionType_Name:
+            {
+                if (QLineEdit *e = qobject_cast<QLineEdit*> (aEditor))
+                {
+                    /* When the VM name is changed the path of the disk images
+                     * should be also changed. So first of all find all disk
+                     * images corresponding to this appliance. Next check if
+                     * they are modified by the user already. If not change the
+                     * path to the new path. */
+                    /* Create an index of this position, but in column 0. */
+                    QModelIndex c0Index = aModel->index(aIndex.row(), 0, aIndex.parent());
+                    /* Query all items with the type HardDiskImage and which
+                     * are child's of this item. */
+                    QModelIndexList list = aModel->match(c0Index, HardwareItem::TypeRole, KVirtualSystemDescriptionType_HardDiskImage, -1, Qt::MatchExactly | Qt::MatchWrap | Qt::MatchRecursive);
+                    for (int i = 0; i < list.count(); ++i)
+                    {
+                        /* Get the index for the config value column. */
+                        QModelIndex hdIndex = aModel->index(list.at(i).row(), ConfigValueSection, list.at(i).parent());
+                        /* Ignore it if was already modified by the user. */
+                        if (!hdIndex.data(ModifiedRole).toBool())
+                            /* Replace any occurrence of the old VM name with
+                             * the new VM name. */
+                            aModel->setData(hdIndex, hdIndex.data(Qt::EditRole).toString().replace(mConfigValue, e->text()), Qt::EditRole);
+                    }
+                    mConfigValue = e->text();
+                    fDone = true;
+                }
+                break;
+            }
         case KVirtualSystemDescriptionType_Product:
         case KVirtualSystemDescriptionType_ProductUrl:
@@ -627,4 +683,7 @@
         default: break;
     }
+    if (fDone)
+        m_fModified = true;
+
     return fDone;
 }
@@ -889,5 +948,5 @@
 
     ModelItem *item = static_cast<ModelItem*> (index.internalPointer());
-    if (!item->setModelData (aEditor, aModel, index))
+    if (!item->setModelData (aEditor, aModel, aIndex))
         QItemDelegate::setModelData (aEditor, aModel, aIndex);
 }
Index: trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.h
===================================================================
--- trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.h	(revision 35977)
+++ trunk/src/VBox/Frontends/VirtualBox/src/widgets/VBoxApplianceEditorWgt.h	(revision 35979)
@@ -111,4 +111,10 @@
 public:
 
+    enum
+    {
+        TypeRole = Qt::UserRole,
+        ModifiedRole
+    };
+
     HardwareItem (int aNumber,
                   KVirtualSystemDescriptionType aType,
@@ -147,4 +153,5 @@
     QString mExtraConfigValue;
     Qt::CheckState mCheckState;
+    bool m_fModified;
 };
 
