Changeset 45281 in vbox
- Timestamp:
- Apr 2, 2013 11:08:27 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 84676
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45280 r45281 457 457 } 458 458 459 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine) 460 { 461 /* Preserve error-info: */ 462 COMResult res(machine); 463 /* Show the message: */ 464 message(mainWindowShown(), 465 MessageType_Error, 466 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 467 !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res)); 468 } 469 470 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine, const CProgress &progress) 471 { 472 message(mainWindowShown(), 473 MessageType_Error, 474 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 475 formatErrorInfo(progress.GetErrorInfo())); 476 } 477 478 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) 479 { 480 /* Preserve error-info: */ 481 COMResult res(console); 482 /* Show the message: */ 459 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) 460 { 483 461 message(mainWindowShown(), MessageType_Error, 484 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()), 485 formatErrorInfo(res)); 462 tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> " 463 "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>" 464 "<p>Please resolve this name-conflict and try again.</p>") 465 .arg(strName, strGroupName)); 466 } 467 468 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) 469 { 470 return messageOkCancel(mainWindowShown(), MessageType_Question, 471 tr("<p>You are trying to move group <nobr><b>%1</b></nobr> " 472 "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>" 473 "<p>Would you like to automatically rename it?</p>") 474 .arg(strName, strGroupName), 475 0, /* auto-confirm id */ 476 tr("Rename")); 486 477 } 487 478 … … 500 491 } 501 492 502 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) 503 { 504 message(mainWindowShown(), MessageType_Error, 505 tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> " 506 "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>" 507 "<p>Please resolve this name-conflict and try again.</p>") 508 .arg(strName, strGroupName)); 509 } 510 511 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) 493 bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) 512 494 { 513 495 return messageOkCancel(mainWindowShown(), MessageType_Question, 514 tr("<p>You are trying to move group <nobr><b>%1</b></nobr>"515 " to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"516 "<p> Would you like to automatically rename it?</p>")517 .arg(strName, strGroupName),496 tr("<p>You are about to remove following virtual " 497 "machine items from the machine list:</p>" 498 "<p><b>%1</b></p>" 499 "<p>Do you wish to proceed?</p>").arg(names.join(", ")), 518 500 0, /* auto-confirm id */ 519 tr("Rename")); 520 } 521 522 int UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) 523 { 524 return message(&vboxGlobal().selectorWnd(), 525 MessageType_Question, 526 tr("<p>You are about to remove following virtual " 527 "machine items from the machine list:</p>" 528 "<p><b>%1</b></p>" 529 "<p>Do you wish to proceed?</p>").arg(names.join(", ")), 530 0, /* auto-confirm id */ 531 QIMessageBox::Ok, 532 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 533 0, 534 tr("Remove")); 501 tr("Remove")); 535 502 } 536 503 … … 599 566 /* Prepare message itself: */ 600 567 return cInacessibleMachineCount == machines.size() ? 601 message(mainWindowShown(), 602 MessageType_Question, 603 strText, 604 0, /* auto-confirm id */ 605 QIMessageBox::Ok, 606 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 568 message(mainWindowShown(), MessageType_Question, 569 strText, 0, /* auto-confirm id */ 570 QIMessageBox::Ok | QIMessageBox::Default, 571 QIMessageBox::Cancel | QIMessageBox::Escape, 607 572 0, 608 573 tr("Remove")) : 609 message(mainWindowShown(), 610 MessageType_Question, 611 strText, 612 0, /* auto-confirm id */ 574 message(mainWindowShown(), MessageType_Question, 575 strText, 0, /* auto-confirm id */ 613 576 QIMessageBox::Yes, 614 QIMessageBox::No ,615 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,577 QIMessageBox::No | QIMessageBox::Default, 578 QIMessageBox::Cancel | QIMessageBox::Escape, 616 579 tr("Delete all files"), 617 580 tr("Remove only")); 618 581 } 619 582 583 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) 584 { 585 /* Preserve error-info: */ 586 COMResult res(machine); 587 /* Show the message: */ 588 message(mainWindowShown(), 589 MessageType_Error, 590 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 591 !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res)); 592 } 593 594 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) 595 { 596 message(mainWindowShown(), 597 MessageType_Error, 598 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 599 formatErrorInfo(progress.GetErrorInfo())); 600 } 601 620 602 bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) 621 603 { 622 return messageOkCancel(&vboxGlobal().selectorWnd(), MessageType_Question, 623 tr("<p>Are you sure you want to discard the saved state of " 624 "the following virtual machines?</p><p><b>%1</b></p>" 625 "<p>This operation is equivalent to resetting or powering off " 626 "the machine without doing a proper shutdown of the guest OS.</p>") 627 .arg(strNames), 628 0 /* pcszAutoConfirmId */, 629 tr("Discard", "saved state")); 604 return messageOkCancel(mainWindowShown(), MessageType_Question, 605 tr("<p>Are you sure you want to discard the saved state of " 606 "the following virtual machines?</p><p><b>%1</b></p>" 607 "<p>This operation is equivalent to resetting or powering off " 608 "the machine without doing a proper shutdown of the guest OS.</p>") 609 .arg(strNames), 610 0 /* pcszAutoConfirmId */, 611 tr("Discard", "saved state")); 612 } 613 614 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) 615 { 616 /* Preserve error-info: */ 617 COMResult res(console); 618 /* Show the message: */ 619 message(mainWindowShown(), MessageType_Error, 620 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()), 621 formatErrorInfo(res)); 630 622 } 631 623 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45280 r45281 212 212 void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath); 213 213 void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName); 214 void cannotDeleteMachine(const CMachine &machine);215 void cannotDeleteMachine(const CMachine &machine, const CProgress &progress);216 void cannotDiscardSavedState(const CConsole &console);217 void cannotSetGroups(const CMachine &machine);218 214 void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName); 219 215 bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName); 220 int confirmMachineItemRemoval(const QStringList &names); 216 void cannotSetGroups(const CMachine &machine); 217 bool confirmMachineItemRemoval(const QStringList &names); 221 218 int confirmMachineRemoval(const QList<CMachine> &machines); 219 void cannotRemoveMachine(const CMachine &machine); 220 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress); 222 221 bool confirmDiscardSavedState(const QString &strNames); 222 void cannotDiscardSavedState(const CConsole &console); 223 223 bool remindAboutInaccessibleMedia(); 224 224 bool confirmVMReset(const QString &strNames); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r45280 r45281 1422 1422 void UIGChooserModel::removeItems(const QList<UIGChooserItem*> &itemsToRemove) 1423 1423 { 1424 /* Show machine-items remove dialog: */1424 /* Confirm machine-items removal: */ 1425 1425 QStringList names; 1426 1426 foreach (UIGChooserItem *pItem, itemsToRemove) 1427 1427 names << pItem->name(); 1428 int rc = msgCenter().confirmMachineItemRemoval(names); 1429 if (rc == QIMessageBox::Cancel) 1428 if (!msgCenter().confirmMachineItemRemoval(names)) 1430 1429 return; 1431 1430 … … 1473 1472 if (!machine.isOk()) 1474 1473 { 1475 msgCenter().cannot DeleteMachine(machine);1474 msgCenter().cannotRemoveMachine(machine); 1476 1475 continue; 1477 1476 } … … 1480 1479 if (!machine.isOk()) 1481 1480 { 1482 msgCenter().cannot DeleteMachine(machine);1481 msgCenter().cannotRemoveMachine(machine); 1483 1482 continue; 1484 1483 } … … 1487 1486 if (progress.GetResultCode() != 0) 1488 1487 { 1489 msgCenter().cannot DeleteMachine(machine, progress);1488 msgCenter().cannotRemoveMachine(machine, progress); 1490 1489 continue; 1491 1490 } … … 1497 1496 if (!machine.isOk()) 1498 1497 { 1499 msgCenter().cannot DeleteMachine(machine);1498 msgCenter().cannotRemoveMachine(machine); 1500 1499 continue; 1501 1500 }
Note:
See TracChangeset
for help on using the changeset viewer.