- Timestamp:
- Nov 15, 2010 3:26:55 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67756
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r33703 r34068 632 632 } 633 633 634 void VBoxProblemReporter::cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox) 635 { 636 message(pParent ? pParent : mainWindowShown(), 637 Error, 638 tr("Failed to open a virtual machine located in %1.") 639 .arg(strMachinePath), 640 formatErrorInfo(vbox)); 641 } 642 643 void VBoxProblemReporter::cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName) 644 { 645 message(pParent ? pParent : mainWindowShown(), 646 Error, 647 tr("Failed to add a virtual machine <b>%1</b> located in <i>%2</i> because its already present.") 648 .arg(strMachineName).arg(strMachinePath)); 649 } 650 634 651 void VBoxProblemReporter:: 635 652 cannotApplyMachineSettings (const CMachine &machine, const COMResult &res) … … 1077 1094 int VBoxProblemReporter::confirmMachineDeletion(const CMachine &machine) 1078 1095 { 1079 QString msg;1080 QString button;1081 QString name;1082 1083 1096 if (machine.GetAccessible()) 1084 1097 { 1085 1098 int cDisks = 0; 1086 const QVector<CMediumAttachment> &mediums = machine.GetMediumAttachments();1087 for (int i =0; i < mediums.size(); ++i)1099 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 1100 for (int i = 0; i < attachments.size(); ++i) 1088 1101 { 1089 const CMediumAttachment & m = mediums.at(i);1090 /* Check if the medium is a harddisk */1091 if ( m.GetType() == KDeviceType_HardDisk)1102 const CMediumAttachment &attachment = attachments.at(i); 1103 /* Check if the medium is a harddisk: */ 1104 if (attachment.GetType() == KDeviceType_HardDisk) 1092 1105 { 1093 /* Check if the disk isn't shared. If the disk is shared, it1094 * will be *never* deleted. */1095 QVector <QString> ids = m.GetMedium().GetMachineIds();1106 /* Check if the disk isn't shared. 1107 * If the disk is shared, it will be *never* deleted. */ 1108 QVector<QString> ids = attachment.GetMedium().GetMachineIds(); 1096 1109 if (ids.size() == 1) 1097 1110 ++cDisks; 1098 1111 } 1099 1112 } 1100 const QString strDeleteBtn = tr("Delete", "machine"); 1101 const QString strDeleteAllBtn = tr("Delete All", "machine"); 1102 const QString strKeepHarddisksBtn = tr("Keep Harddisks", "machine"); 1103 const QString strText = tr("<p>Are you sure you want to permanently delete the virtual " 1104 "machine <b>%1</b>?</p>" 1105 "<p>This operation <i>cannot</i> be undone.</p>") 1113 const QString strBase = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>" 1114 "<p>Would you like to remove it from your hard disk as well?</p>") 1106 1115 .arg(machine.GetName()); 1107 const QString strText1 = tr("<p>If you select <b>%1</b> both the machine itself and the " 1108 "virtual disks attached to it will be removed. If you wish " 1109 "to preserve the virtual disks for later use, select " 1110 "<b>%2</b>.</p>") 1111 .arg(strDeleteAllBtn) 1112 .arg(strKeepHarddisksBtn); 1113 if (cDisks == 0) 1114 return message(&vboxGlobal().selectorWnd(), Question, 1115 strText, 1116 0, /* aAutoConfirmId */ 1117 QIMessageBox::Yes, 1118 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 1119 0, 1120 strDeleteBtn); 1121 else if (cDisks == 1) 1122 return message(&vboxGlobal().selectorWnd(), Question, 1123 strText + strText1, 1124 0, /* aAutoConfirmId */ 1125 QIMessageBox::No, 1126 QIMessageBox::Yes, 1127 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 1128 strKeepHarddisksBtn, 1129 strDeleteAllBtn); 1130 else 1131 return message(&vboxGlobal().selectorWnd(), Question, 1132 strText + 1133 tr("<p>You have more than one virtual disk attached. Please make sure " 1134 "that you do not need any of them before continuing.</p>") + 1135 strText1, 1136 0, /* aAutoConfirmId */ 1137 QIMessageBox::No, 1138 QIMessageBox::Yes, 1139 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 1140 strKeepHarddisksBtn, 1141 strDeleteAllBtn); 1116 const QString strExtd = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>" 1117 "<p>Would you like to remove it from your hard disk as well? " 1118 "Doing this will also remove the files containing the machine's virtual hard disks.</p>") 1119 .arg(machine.GetName()); 1120 return message(&vboxGlobal().selectorWnd(), 1121 Question, 1122 cDisks == 0 ? strBase : strExtd, 1123 0, /* auto-confirm id */ 1124 QIMessageBox::Yes, 1125 QIMessageBox::No, 1126 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default); 1142 1127 } 1143 1128 else 1144 1129 { 1145 /* this should be in sync with UIVMListBoxItem::recache() */ 1146 QFileInfo fi (machine.GetSettingsFilePath()); 1147 name = fi.suffix().toLower() == "xml" ? 1148 fi.completeBaseName() : fi.fileName(); 1149 msg = tr ("<p>Are you sure you want to unregister the inaccessible " 1150 "virtual machine <b>%1</b>?</p>" 1151 "<p>You will not be able to register it again from " 1152 "GUI.</p>") 1153 .arg (name); 1154 button = tr ("Unregister", "machine"); 1155 } 1156 1157 return messageOkCancel (&vboxGlobal().selectorWnd(), Question, msg, 1158 0 /* aAutoConfirmId */, button); 1130 /* This should be in sync with UIVMListBoxItem::recache(): */ 1131 QFileInfo fi(machine.GetSettingsFilePath()); 1132 const QString strName = fi.suffix().toLower() == "xml" ? fi.completeBaseName() : fi.fileName(); 1133 const QString strBase = tr("You are about to remove the inaccessible virtual machine " 1134 "<b>%1</b> from the machine list. Do you wish to proceed?") 1135 .arg(strName); 1136 return message(&vboxGlobal().selectorWnd(), 1137 Question, 1138 strBase, 1139 0, /* auto-confirm id */ 1140 QIMessageBox::Ok, 1141 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default); 1142 } 1159 1143 } 1160 1144
Note:
See TracChangeset
for help on using the changeset viewer.