- Timestamp:
- Apr 2, 2013 10:48:56 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45278 r45280 478 478 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) 479 479 { 480 /* preserve the current error info before calling the object again*/480 /* Preserve error-info: */ 481 481 COMResult res(console); 482 482 /* Show the message: */ 483 483 message(mainWindowShown(), MessageType_Error, 484 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.") 485 .arg(console.GetMachine().GetName()), 486 formatErrorInfo(res)); 487 } 488 489 void UIMessageCenter::notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName) 490 { 491 message(&vboxGlobal().selectorWnd(), 492 MessageType_Error, 484 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.").arg(console.GetMachine().GetName()), 485 formatErrorInfo(res)); 486 } 487 488 void UIMessageCenter::cannotSetGroups(const CMachine &machine) 489 { 490 /* Preserve error-info: */ 491 COMResult res(machine); 492 /* Compose machine name: */ 493 QString strName = machine.GetName(); 494 if (strName.isEmpty()) 495 strName = QFileInfo(machine.GetSettingsFilePath()).baseName(); 496 /* Show the message: */ 497 message(mainWindowShown(), MessageType_Error, 498 tr("Failed to set groups of the virtual machine <b>%1</b>.").arg(strName), 499 formatErrorInfo(res)); 500 } 501 502 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) 503 { 504 message(mainWindowShown(), MessageType_Error, 493 505 tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> " 494 506 "to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>" 495 507 "<p>Please resolve this name-conflict and try again.</p>") 496 .arg(strName, strGroupName), 497 0, /* auto-confirm id */ 498 QIMessageBox::Ok | QIMessageBox::Default); 499 } 500 501 int UIMessageCenter::askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName) 502 { 503 return message(&vboxGlobal().selectorWnd(), 504 MessageType_Question, 505 tr("<p>You are trying to move group <nobr><b>%1</b></nobr> " 506 "to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>" 507 "<p>Would you like to automatically rename it?</p>") 508 .arg(strName, strGroupName), 509 0, /* auto-confirm id */ 510 QIMessageBox::Ok, 511 QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default, 512 0, 513 tr("Rename")); 508 .arg(strName, strGroupName)); 509 } 510 511 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) 512 { 513 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), 518 0, /* auto-confirm id */ 519 tr("Rename")); 514 520 } 515 521 … … 622 628 0 /* pcszAutoConfirmId */, 623 629 tr("Discard", "saved state")); 624 }625 626 void UIMessageCenter::cannotSetGroups(const CMachine &machine)627 {628 /* Preserve error-info: */629 COMResult res(machine);630 /* Compose machine name: */631 QString strName = machine.GetName();632 if (strName.isEmpty())633 strName = QFileInfo(machine.GetSettingsFilePath()).baseName();634 /* Show the message: */635 message(mainWindowShown(), MessageType_Error,636 tr("Failed to set groups of the virtual machine <b>%1</b>.").arg(strName),637 formatErrorInfo(res));638 630 } 639 631 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45278 r45280 215 215 void cannotDeleteMachine(const CMachine &machine, const CProgress &progress); 216 216 void cannotDiscardSavedState(const CConsole &console); 217 void notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName); 218 int askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName); 217 void cannotSetGroups(const CMachine &machine); 218 void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName); 219 bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName); 219 220 int confirmMachineItemRemoval(const QStringList &names); 220 221 int confirmMachineRemoval(const QList<CMachine> &machines); 221 222 bool confirmDiscardSavedState(const QString &strNames); 222 void cannotSetGroups(const CMachine &machine);223 223 bool remindAboutInaccessibleMedia(); 224 224 bool confirmVMReset(const QString &strNames); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r45278 r45280 353 353 /* Make sure this machine can be opened: */ 354 354 CMachine newMachine = vbox.OpenMachine(strTmpFile); 355 if (!vbox.isOk() || newMachine.isNull())355 if (!vbox.isOk()) 356 356 { 357 357 msgCenter().cannotOpenMachine(vbox, strTmpFile); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r45279 r45280 759 759 else if (pCollisionSibling->type() == UIGChooserItemType_Group) 760 760 { 761 msgCenter(). notifyAboutCollisionOnGroupRemovingCantBeResolved(strItemName, pParentItem->name());761 msgCenter().cannotResolveCollisionAutomatically(strItemName, pParentItem->name()); 762 762 return; 763 763 } … … 765 765 else if (pItem->type() == UIGChooserItemType_Group) 766 766 { 767 if (msgCenter(). askAboutCollisionOnGroupRemoving(strItemName, pParentItem->name()) == QIMessageBox::Ok)767 if (msgCenter().confirmAutomaticCollisionResolve(strItemName, pParentItem->name())) 768 768 toBeRenamed << pItem; 769 769 else … … 1999 1999 const QStringList &oldGroupList = m_oldLists.value(strId); 2000 2000 const UIStringSet &oldGroupSet = UIStringSet::fromList(oldGroupList); 2001 /* Make sure group set waschanged: */2001 /* Make sure group set changed: */ 2002 2002 if (newGroupSet == oldGroupSet) 2003 2003 continue;
Note:
See TracChangeset
for help on using the changeset viewer.