- Timestamp:
- May 3, 2022 6:21:34 PM (2 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
-
globals/UIMessageCenter.cpp (modified) (1 diff)
-
globals/UIMessageCenter.h (modified) (1 diff)
-
medium/UIMediumItem.cpp (modified) (6 diffs)
-
medium/UIMediumItem.h (modified) (4 diffs)
-
medium/UIMediumManager.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r94757 r94797 1314 1314 } 1315 1315 1316 bool UIMessageCenter::confirmDVDListClear(const QStringList &DVDPathList, QWidget *pParent /* = 0 */) 1317 { 1318 if (DVDPathList.isEmpty()) 1319 return false; 1320 1321 QString strDetails("<!--EOM-->"); 1322 QString strDetailMessage(tr("The list of inaccessible DVDs is as follows:")); 1323 1324 if (!strDetailMessage.isEmpty()) 1325 strDetails.prepend(QString("<p>%1.</p>").arg(UITranslator::emphasize(strDetailMessage))); 1326 1327 strDetails += QString("<table bgcolor=%1 border=0 cellspacing=5 cellpadding=0 width=100%>") 1328 .arg(QApplication::palette().color(QPalette::Active, QPalette::Window).name(QColor::HexRgb)); 1329 foreach (const QString &strDVD, DVDPathList) 1330 strDetails += QString("<tr><td>%1</td></tr>").arg(strDVD); 1331 strDetails += QString("</table>"); 1332 1333 if (!strDetails.isEmpty()) 1334 strDetails = "<qt>" + strDetails + "</qt>"; 1335 1336 return message(pParent, 1337 MessageType_Question, 1338 tr("<p>This will clear the optical disk list by releasing inaccessible DVDs" 1339 " from the virtual machines they are attached to" 1340 " and remove them from the list of registered media.<p>" 1341 "Are you sure?"), 1342 strDetails, 1343 0 /* auto-confirm id */, 1344 AlertButton_Ok, 1345 AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape, 1346 0 /* third button */, 1347 tr("Clear") /* ok button text */, 1348 QString() /* cancel button text */, 1349 QString() /* 3rd button text */, 1350 QString() /* help keyword */); 1351 } 1352 1316 1353 bool UIMessageCenter::confirmCloudNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const 1317 1354 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r94757 r94797 353 353 bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0) const; 354 354 int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0) const; 355 bool confirmDVDListClear(const QStringList &DVDPathList, QWidget *pParent = 0); 355 356 /** @} */ 356 357 -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.cpp
r93115 r94797 91 91 } 92 92 93 bool UIMediumItem::release(bool f Induced /* = false */)93 bool UIMediumItem::release(bool fShowMessageBox, bool fInduced) 94 94 { 95 95 /* Refresh medium and item: */ … … 102 102 103 103 /* Confirm release: */ 104 if (!msgCenter().confirmMediumRelease(medium(), fInduced, treeWidget())) 105 return false; 104 if (fShowMessageBox) 105 if (!msgCenter().confirmMediumRelease(medium(), fInduced, treeWidget())) 106 return false; 106 107 107 108 /* Release: */ … … 193 194 194 195 /* Detach the medium from all the VMs it's attached to: */ 195 if (!release(true ))196 if (!release(true, true)) 196 197 return false; 197 198 … … 402 403 } 403 404 404 bool UIMediumItemHD::remove( )405 bool UIMediumItemHD::remove(bool fShowMessageBox) 405 406 { 406 407 /* Confirm medium removal: */ 407 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 408 return false; 408 if (fShowMessageBox) 409 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 410 return false; 409 411 410 412 /* Propose to remove medium storage: */ … … 507 509 } 508 510 509 bool UIMediumItemCD::remove( )511 bool UIMediumItemCD::remove(bool fShowMessageBox) 510 512 { 511 513 /* Confirm medium removal: */ 512 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 513 return false; 514 if (fShowMessageBox) 515 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 516 return false; 514 517 515 518 /* Close optical-disk: */ … … 568 571 } 569 572 570 bool UIMediumItemFD::remove( )573 bool UIMediumItemFD::remove(bool fShowMessageBox) 571 574 { 572 575 /* Confirm medium removal: */ 573 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 574 return false; 576 if (fShowMessageBox) 577 if (!msgCenter().confirmMediumRemoval(medium(), treeWidget())) 578 return false; 575 579 576 580 /* Close floppy-disk: */ -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumItem.h
r93990 r94797 50 50 virtual bool move(); 51 51 /** Removes UIMedium wrapped by <i>this</i> item. */ 52 virtual bool remove( ) = 0;52 virtual bool remove(bool fShowMessageBox) = 0; 53 53 /** Releases UIMedium wrapped by <i>this</i> item. 54 54 * @param fInduced Brings whether this action is caused by other user's action, 55 55 * not a direct order to release particularly selected medium. */ 56 virtual bool release(bool f Induced = false);56 virtual bool release(bool fShowMessageBox, bool fInduced); 57 57 58 58 /** Refreshes item fully. */ … … 181 181 182 182 /** Removes UIMedium wrapped by <i>this</i> item. */ 183 virtual bool remove( ) RT_OVERRIDE;183 virtual bool remove(bool fShowMessageBox) RT_OVERRIDE; 184 184 /** Releases UIMedium wrapped by <i>this</i> item from virtual @a comMachine. */ 185 185 virtual bool releaseFrom(CMachine comMachine) RT_OVERRIDE; … … 208 208 209 209 /** Removes UIMedium wrapped by <i>this</i> item. */ 210 virtual bool remove( ) RT_OVERRIDE;210 virtual bool remove(bool fShowMessageBox) RT_OVERRIDE; 211 211 /** Releases UIMedium wrapped by <i>this</i> item from virtual @a comMachine. */ 212 212 virtual bool releaseFrom(CMachine comMachine) RT_OVERRIDE; … … 230 230 231 231 /** Removes UIMedium wrapped by <i>this</i> item. */ 232 virtual bool remove( ) RT_OVERRIDE;232 virtual bool remove(bool fShowMessageBox) RT_OVERRIDE; 233 233 /** Releases UIMedium wrapped by <i>this</i> item from virtual @a comMachine. */ 234 234 virtual bool releaseFrom(CMachine comMachine) RT_OVERRIDE; -
trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp
r94294 r94797 507 507 508 508 /* Remove current medium-item: */ 509 pMediumItem->remove( );509 pMediumItem->remove(true /* show message box */); 510 510 } 511 511 … … 518 518 519 519 /* Remove current medium-item: */ 520 bool fResult = pMediumItem->release( );520 bool fResult = pMediumItem->release(true /* show message box */, false /* induced */); 521 521 522 522 /* Refetch currently chosen medium-item: */ … … 527 527 void UIMediumManagerWidget::sltClear() 528 528 { 529 /* Currently we clear only DVD medium type items: */ 530 if (currentMediumType() != UIMediumDeviceType_DVD) 531 return; 532 QITreeWidget* pTreeWidget = currentTreeWidget(); 533 AssertReturnVoid(pTreeWidget); 534 /* Iterate over the tree items assuming medium items are immediate children of the root and they dont have children 535 * themselves which currently holds for DVD medium type: */ 536 QList<UIMediumItem*> mediumsToRemove; 537 QStringList nameList; 538 for (int i = 0; i < pTreeWidget->childCount(); ++i) 539 { 540 UIMediumItem *pMediumItem = qobject_cast<UIMediumItem*>(pTreeWidget->childItem(i)); 541 if (!pMediumItem) 542 continue; 543 if (pMediumItem->state() == KMediumState_Inaccessible) 544 { 545 mediumsToRemove << pMediumItem; 546 nameList << pMediumItem->name(); 547 } 548 } 549 if (!msgCenter().confirmDVDListClear(nameList, this)) 550 return; 551 552 foreach (UIMediumItem *pMediumItem, mediumsToRemove) 553 { 554 pMediumItem->release(false /* no messag box */, false /* induced */); 555 pMediumItem->remove(false /* show no message box */); 556 } 529 557 } 530 558 … … 601 629 if (m_pDetailsWidget) 602 630 m_pDetailsWidget->setCurrentType(currentMediumType()); 631 632 /* Clear action is enabled only for DVD medium type: */ 633 if (m_pActionPool && m_pActionPool->action(UIActionIndexMN_M_Medium_S_Clear)) 634 m_pActionPool->action(UIActionIndexMN_M_Medium_S_Clear)->setEnabled(currentMediumType() == UIMediumDeviceType_DVD); 635 603 636 /* Re-fetch currently chosen medium-item: */ 604 637 refetchCurrentChosenMediumItem();
Note:
See TracChangeset
for help on using the changeset viewer.

