Changeset 90365 in vbox
- Timestamp:
- Jul 28, 2021 11:18:52 AM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r90035 r90365 44 44 #include "UIMessageCenter.h" 45 45 #include "UIModalWindowManager.h" 46 #include "UINotificationCenter.h" 46 47 #include "UIVirtualBoxManagerWidget.h" 47 48 #include "UIVirtualMachineItemCloud.h" … … 1871 1872 { 1872 1873 /* Unregister machine first: */ 1873 CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);1874 CMediumVector media = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly); 1874 1875 if (!comMachine.isOk()) 1875 1876 { … … 1877 1878 continue; 1878 1879 } 1879 /* Prepare cleanup progress: */ 1880 CProgress comProgress = comMachine.DeleteConfig(comMedia); 1881 if (!comMachine.isOk()) 1882 { 1883 msgCenter().cannotRemoveMachine(comMachine); 1884 continue; 1885 } 1886 /* And show cleanup progress finally: */ 1887 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_90px.png"); 1888 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1889 { 1890 msgCenter().cannotRemoveMachine(comMachine, comProgress); 1891 continue; 1892 } 1880 /* Remove machine: */ 1881 UINotificationProgressMachineMediaRemove *pNotification = new UINotificationProgressMachineMediaRemove(comMachine, media); 1882 notificationCenter().append(pNotification); 1893 1883 } 1894 1884 else if (iResultCode == AlertButton_Choice2 || iResultCode == AlertButton_Ok) 1895 1885 { 1896 1886 /* Unregister machine first: */ 1897 CMediumVector comMedia = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly);1887 CMediumVector media = comMachine.Unregister(KCleanupMode_DetachAllReturnHardDisksOnly); 1898 1888 if (!comMachine.isOk()) 1899 1889 { … … 1902 1892 } 1903 1893 /* Finally close all media, deliberately ignoring errors: */ 1904 foreach (CMedium comMedium, comMedia)1894 foreach (CMedium comMedium, media) 1905 1895 { 1906 1896 if (!comMedium.isNull()) -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90352 r90365 186 186 187 187 /********************************************************************************************************************************* 188 * Class UINotificationProgressMachineMediaRemove implementation. * 189 *********************************************************************************************************************************/ 190 191 UINotificationProgressMachineMediaRemove::UINotificationProgressMachineMediaRemove(const CMachine &comMachine, 192 const CMediumVector &media) 193 : m_comMachine(comMachine) 194 , m_media(media) 195 { 196 } 197 198 QString UINotificationProgressMachineMediaRemove::name() const 199 { 200 return UINotificationProgress::tr("Removing machine media ..."); 201 } 202 203 QString UINotificationProgressMachineMediaRemove::details() const 204 { 205 return UINotificationProgress::tr("<b>Machine Name:</b> %1").arg(m_comMachine.GetName()); 206 } 207 208 CProgress UINotificationProgressMachineMediaRemove::createProgress(COMResult &comResult) 209 { 210 /* Initialize progress-wrapper: */ 211 CProgress comProgress = m_comMachine.DeleteConfig(m_media); 212 /* Store COM result: */ 213 comResult = m_comMachine; 214 /* Return progress-wrapper: */ 215 return comProgress; 216 } 217 218 219 /********************************************************************************************************************************* 188 220 * Class UINotificationProgressCloudMachineAdd implementation. * 189 221 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90352 r90365 204 204 /** Holds the target machine options. */ 205 205 QVector<KCloneOptions> m_options; 206 }; 207 208 /** UINotificationProgress extension for machine media remove functionality. */ 209 class SHARED_LIBRARY_STUFF UINotificationProgressMachineMediaRemove : public UINotificationProgress 210 { 211 Q_OBJECT; 212 213 public: 214 215 /** Constructs machine media remove notification-progress. 216 * @param comMachine Brings the machine being removed. 217 * @param media Brings the machine media being removed. */ 218 UINotificationProgressMachineMediaRemove(const CMachine &comMachine, 219 const CMediumVector &media); 220 221 protected: 222 223 /** Returns object name. */ 224 virtual QString name() const /* override final */; 225 /** Returns object details. */ 226 virtual QString details() const /* override final */; 227 /** Creates and returns started progress-wrapper. */ 228 virtual CProgress createProgress(COMResult &comResult) /* override final */; 229 230 private: 231 232 /** Holds the machine being removed. */ 233 CMachine m_comMachine; 234 /** Holds the machine media being removed. */ 235 CMediumVector m_media; 206 236 }; 207 237
Note:
See TracChangeset
for help on using the changeset viewer.