Changeset 90373 in vbox
- Timestamp:
- Jul 28, 2021 3:33:16 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145954
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r90365 r90373 1339 1339 { 1340 1340 root()->resetDragToken(); 1341 } 1342 1343 void UIChooserModel::sltHandleCloudMachineRemoved(const QString &strShortProviderName, 1344 const QString &strProfileName, 1345 const QString &strName) 1346 { 1347 Q_UNUSED(strName); 1348 1349 /* Update profile to make sure it has no stale instances: */ 1350 const UICloudEntityKey cloudEntityKeyForProfile = UICloudEntityKey(strShortProviderName, strProfileName); 1351 createReadCloudMachineListTask(cloudEntityKeyForProfile, false /* with refresh? */); 1341 1352 } 1342 1353 … … 1878 1889 continue; 1879 1890 } 1880 /* Remov emachine: */1891 /* Removing machine: */ 1881 1892 UINotificationProgressMachineMediaRemove *pNotification = new UINotificationProgressMachineMediaRemove(comMachine, media); 1882 1893 notificationCenter().append(pNotification); … … 1908 1919 machines << pMachineItem->cache()->toCloud()->machine(); 1909 1920 1910 /* Stop cloud update prematurely: */1921 /* Stop cloud profile update prematurely: */ 1911 1922 m_pTimerCloudProfileUpdate->stop(); 1912 1923 … … 1915 1926 if (iResultCode == AlertButton_Cancel) 1916 1927 { 1917 /* Resume cloud update if cancelled: */1928 /* Resume cloud profile update if cancelled: */ 1918 1929 m_pTimerCloudProfileUpdate->start(10000); 1919 1930 return; … … 1921 1932 1922 1933 /* For every selected machine-item: */ 1923 QSet<UICloudEntityKey> changedCloudEntityKeys;1924 1934 foreach (UIChooserItemMachine *pMachineItem, machineItems) 1925 1935 { … … 1928 1938 const QString strProfileName = pMachineItem->parentItem()->name(); 1929 1939 const QUuid uMachineId = pMachineItem->id(); 1930 const UICloudEntityKey cloudEntityKeyForProfile = UICloudEntityKey(strProviderShortName, strProfileName);1931 1940 const UICloudEntityKey cloudEntityKeyForMachine = UICloudEntityKey(strProviderShortName, strProfileName, uMachineId); 1932 1941 … … 1937 1946 /* Acquire cloud machine: */ 1938 1947 CCloudMachine comMachine = pMachineItem->cache()->toCloud()->machine(); 1939 CProgress comProgress; 1940 /* Prepare remove progress: */ 1941 if (iResultCode == AlertButton_Choice1) 1942 comProgress = comMachine.Remove(); 1943 /* Prepare unregister progress: */ 1944 else if (iResultCode == AlertButton_Choice2) 1945 comProgress = comMachine.Unregister(); 1946 if (!comMachine.isOk()) 1947 { 1948 msgCenter().cannotRemoveCloudMachine(comMachine); 1949 continue; 1950 } 1951 /* And show unregister progress finally: */ 1952 msgCenter().showModalProgressDialog(comProgress, comMachine.GetName(), ":/progress_delete_cloud_vm_90px.png", 0, 0); 1953 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 1954 { 1955 msgCenter().cannotRemoveCloudMachine(comMachine, comProgress); 1956 continue; 1957 } 1958 1959 /* Append cloud entity key for profile to update: */ 1960 if (!changedCloudEntityKeys.contains(cloudEntityKeyForProfile)) 1961 changedCloudEntityKeys.insert(cloudEntityKeyForProfile); 1962 } 1963 1964 /* Restart List Cloud Machines task for required profile keys: */ 1965 foreach (const UICloudEntityKey &guiCloudProfileKey, changedCloudEntityKeys) 1966 createReadCloudMachineListTask(guiCloudProfileKey, false /* with refresh? */); 1948 1949 /* Removing cloud machine: */ 1950 UINotificationProgressCloudMachineRemove *pNotification = 1951 new UINotificationProgressCloudMachineRemove(comMachine, 1952 iResultCode == AlertButton_Choice1, 1953 strProviderShortName, 1954 strProfileName); 1955 connect(pNotification, &UINotificationProgressCloudMachineRemove::sigCloudMachineRemoved, 1956 this, &UIChooserModel::sltHandleCloudMachineRemoved); 1957 notificationCenter().append(pNotification); 1958 } 1967 1959 } 1968 1960 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r88681 r90373 341 341 /** @name Cloud stuff. 342 342 * @{ */ 343 /** Handles cloud machine removal. 344 * @param strShortProviderName Brigns the provider short name. 345 * @param strProfileName Brings the profile name. 346 * @param strName Brings the machine name. */ 347 void sltHandleCloudMachineRemoved(const QString &strShortProviderName, 348 const QString &strProfileName, 349 const QString &strName); 350 343 351 /** Updates selected cloud profiles. */ 344 352 void sltUpdateSelectedCloudProfiles(); -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp
r90366 r90373 321 321 322 322 /********************************************************************************************************************************* 323 * Class UINotificationProgressCloudMachineCreate implementation. * 324 *********************************************************************************************************************************/ 325 326 UINotificationProgressCloudMachineRemove::UINotificationProgressCloudMachineRemove(const CCloudMachine &comMachine, 327 bool fFullRemoval, 328 const QString &strShortProviderName, 329 const QString &strProfileName) 330 : m_comMachine(comMachine) 331 , m_fFullRemoval(fFullRemoval) 332 , m_strShortProviderName(strShortProviderName) 333 , m_strProfileName(strProfileName) 334 { 335 /* Acquire cloud VM name: */ 336 m_strName = m_comMachine.GetName(); 337 338 /* Listen for last progress signal: */ 339 connect(this, &UINotificationProgress::sigProgressFinished, 340 this, &UINotificationProgressCloudMachineRemove::sltHandleProgressFinished); 341 } 342 343 QString UINotificationProgressCloudMachineRemove::name() const 344 { 345 return m_fFullRemoval 346 ? UINotificationProgress::tr("Deleting cloud VM files ...") 347 : UINotificationProgress::tr("Removing cloud VM ..."); 348 } 349 350 QString UINotificationProgressCloudMachineRemove::details() const 351 { 352 return UINotificationProgress::tr("<b>Name:</b> %1").arg(m_strName); 353 } 354 355 CProgress UINotificationProgressCloudMachineRemove::createProgress(COMResult &comResult) 356 { 357 /* Initialize progress-wrapper: */ 358 CProgress comProgress = m_fFullRemoval 359 ? m_comMachine.Remove() 360 : m_comMachine.Unregister(); 361 /* Store COM result: */ 362 comResult = m_comMachine; 363 /* Return progress-wrapper: */ 364 return comProgress; 365 } 366 367 void UINotificationProgressCloudMachineRemove::sltHandleProgressFinished() 368 { 369 if (error().isEmpty()) 370 emit sigCloudMachineRemoved(m_strShortProviderName, m_strProfileName, m_strName); 371 } 372 373 374 /********************************************************************************************************************************* 323 375 * Class UINotificationProgressApplianceExport implementation. * 324 376 *********************************************************************************************************************************/ -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h
r90365 r90373 350 350 }; 351 351 352 /** UINotificationProgress extension for cloud machine remove functionality. */ 353 class SHARED_LIBRARY_STUFF UINotificationProgressCloudMachineRemove : public UINotificationProgress 354 { 355 Q_OBJECT; 356 357 signals: 358 359 /** Notifies listeners about cloud machine was removed. 360 * @param strShortProviderName Brigns the short provider name. 361 * @param strProfileName Brings the profile name. 362 * @param strName Brings the machine name. */ 363 void sigCloudMachineRemoved(const QString &strShortProviderName, 364 const QString &strProfileName, 365 const QString &strName); 366 367 public: 368 369 /** Constructs cloud machine remove notification-progress. 370 * @param comMachine Brings the cloud machine being removed. 371 * @param fFullRemoval Brings whether cloud machine should be removed fully. */ 372 UINotificationProgressCloudMachineRemove(const CCloudMachine &comMachine, 373 bool fFullRemoval, 374 const QString &strShortProviderName, 375 const QString &strProfileName); 376 377 protected: 378 379 /** Returns object name. */ 380 virtual QString name() const /* override final */; 381 /** Returns object details. */ 382 virtual QString details() const /* override final */; 383 /** Creates and returns started progress-wrapper. */ 384 virtual CProgress createProgress(COMResult &comResult) /* override final */; 385 386 private slots: 387 388 /** Handles signal about progress being finished. */ 389 void sltHandleProgressFinished(); 390 391 private: 392 393 /** Holds the cloud machine being removed. */ 394 CCloudMachine m_comMachine; 395 /** Holds the name acquired from cloud machine. */ 396 QString m_strName; 397 /** Holds whether cloud machine should be removed fully. */ 398 bool m_fFullRemoval; 399 /** Holds the short provider name. */ 400 QString m_strShortProviderName; 401 /** Holds the profile name. */ 402 QString m_strProfileName; 403 }; 404 352 405 /** UINotificationProgress extension for export appliance functionality. */ 353 406 class SHARED_LIBRARY_STUFF UINotificationProgressApplianceExport : public UINotificationProgress
Note:
See TracChangeset
for help on using the changeset viewer.