Changeset 23755 in vbox
- Timestamp:
- Oct 14, 2009 11:48:01 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxMediaManagerDlg.cpp
r23703 r23755 1258 1258 case VBoxDefs::MediumType_HardDisk: 1259 1259 { 1260 CMediumAttachmentVector vec= machine.GetMediumAttachments();1261 for (int i = 0; i < vec.size(); ++ i)1260 CMediumAttachmentVector attachments = machine.GetMediumAttachments(); 1261 foreach (const CMediumAttachment &attachment, attachments) 1262 1262 { 1263 CMediumAttachment hda = vec [i]; 1264 if (hda.GetMedium().GetId() == aMedium.id()) 1263 if (attachment.GetType() != KDeviceType_HardDisk) continue; 1264 1265 if (attachment.GetMedium().GetId() == aMedium.id()) 1265 1266 { 1266 machine.DetachDevice(hda.GetController(), 1267 hda.GetPort(), 1268 hda.GetDevice()); 1267 machine.DetachDevice (attachment.GetController(), attachment.GetPort(), attachment.GetDevice()); 1269 1268 if (!machine.isOk()) 1270 1269 { 1271 CStorageController ctl = machine.GetStorageControllerByName(hda.GetController()); 1272 1273 vboxProblem().cannotDetachDevice (this, machine, 1274 VBoxDefs::MediumType_HardDisk, aMedium.location(), 1275 ctl.GetBus(), hda.GetPort(), hda.GetDevice()); 1270 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1271 vboxProblem().cannotDetachDevice (this, machine, VBoxDefs::MediumType_HardDisk, aMedium.location(), 1272 controller.GetBus(), attachment.GetPort(), attachment.GetDevice()); 1276 1273 success = false; 1277 1274 break; … … 1283 1280 case VBoxDefs::MediumType_DVD: 1284 1281 { 1285 machine.MountMedium ("IDE Controller", 1, 0, NULL); 1286 if (!machine.isOk()) 1282 Assert (0); 1283 CMediumAttachmentVector attachments = machine.GetMediumAttachments(); 1284 foreach (const CMediumAttachment &attachment, attachments) 1287 1285 { 1288 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1289 success = false; 1286 if (attachment.GetType() != KDeviceType_DVD) continue; 1287 1288 VBoxMedium medium = vboxGlobal().findMedium (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId()); 1289 if (medium.id() == aMedium.id()) 1290 { 1291 machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString()); 1292 if (!machine.isOk()) 1293 { 1294 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1295 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1296 success = false; 1297 break; 1298 } 1299 } 1290 1300 } 1291 1301 break; … … 1293 1303 case VBoxDefs::MediumType_Floppy: 1294 1304 { 1295 machine.MountMedium ("Floppy Controller", 0, 0, NULL); 1296 if (!machine.isOk()) 1305 Assert (0); 1306 CMediumAttachmentVector attachments = machine.GetMediumAttachments(); 1307 foreach (const CMediumAttachment &attachment, attachments) 1297 1308 { 1298 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1299 success = false; 1309 if (attachment.GetType() != KDeviceType_Floppy) continue; 1310 1311 VBoxMedium medium = vboxGlobal().findMedium (attachment.GetMedium().isNull() ? QString() : attachment.GetMedium().GetId()); 1312 if (medium.id() == aMedium.id()) 1313 { 1314 machine.MountMedium (attachment.GetController(), attachment.GetPort(), attachment.GetDevice(), QString()); 1315 if (!machine.isOk()) 1316 { 1317 CStorageController controller = machine.GetStorageControllerByName (attachment.GetController()); 1318 vboxProblem().cannotUnmountMedium (this, machine, aMedium); 1319 success = false; 1320 break; 1321 } 1322 } 1300 1323 } 1301 1324 break;
Note:
See TracChangeset
for help on using the changeset viewer.