Changeset 74957 in vbox
- Timestamp:
- Oct 21, 2018 11:53:53 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.cpp
r74956 r74957 401 401 } 402 402 403 void UICloudProfileManagerWidget::sltImportCloudProfiles() 404 { 405 /* Get provider item: */ 406 UIItemCloudProvider *pProviderItem = static_cast<UIItemCloudProvider*>(m_pTreeWidget->currentItem()); 407 AssertMsgReturnVoid(pProviderItem, ("Current item must not be null!\n")); 408 409 /* Confirm cloud profile removal: */ 410 if (!msgCenter().confirmCloudProfilesImport(this)) 411 return; 412 413 /* Get VirtualBox for further activities: */ 414 const CVirtualBox comVBox = vboxGlobal().virtualBox(); 415 416 /* Get CloudProviderManager for further activities: */ 417 CCloudProviderManager comCloudProviderManager = comVBox.GetCloudProviderManager(); 418 /* Show error message if necessary: */ 419 if (!comVBox.isOk()) 420 msgCenter().cannotAcquireCloudProviderManager(comVBox, this); 421 else 422 { 423 /* Acquire provider ID: */ 424 const QUuid uId = pProviderItem->data(Column_Name, Data_ProviderID).toUuid(); 425 426 /* Look for corresponding provider: */ 427 CCloudProvider comCloudProvider = comCloudProviderManager.GetProviderById(uId); 428 /* Show error message if necessary: */ 429 if (!comCloudProviderManager.isOk()) 430 msgCenter().cannotFindCloudProvider(comCloudProviderManager, uId, this); 431 else 432 { 433 /* Import profiles: */ 434 comCloudProvider.ImportProfiles(); 435 436 /* Show error message if necessary: */ 437 if (!comCloudProvider.isOk()) 438 msgCenter().cannotImportCloudProfiles(comCloudProvider, this); 439 else 440 loadCloudStuff(); 441 } 442 } 443 } 444 403 445 void UICloudProfileManagerWidget::sltRemoveCloudProfile() 404 446 { … … 470 512 } 471 513 472 void UICloudProfileManagerWidget::sltImportCloudProfiles()473 {474 /* Get provider item: */475 UIItemCloudProvider *pProviderItem = static_cast<UIItemCloudProvider*>(m_pTreeWidget->currentItem());476 AssertMsgReturnVoid(pProviderItem, ("Current item must not be null!\n"));477 478 /* Confirm cloud profile removal: */479 if (!msgCenter().confirmCloudProfilesImport(this))480 return;481 482 /* Get VirtualBox for further activities: */483 const CVirtualBox comVBox = vboxGlobal().virtualBox();484 485 /* Get CloudProviderManager for further activities: */486 CCloudProviderManager comCloudProviderManager = comVBox.GetCloudProviderManager();487 /* Show error message if necessary: */488 if (!comVBox.isOk())489 msgCenter().cannotAcquireCloudProviderManager(comVBox, this);490 else491 {492 /* Acquire provider ID: */493 const QUuid uId = pProviderItem->data(Column_Name, Data_ProviderID).toUuid();494 495 /* Look for corresponding provider: */496 CCloudProvider comCloudProvider = comCloudProviderManager.GetProviderById(uId);497 /* Show error message if necessary: */498 if (!comCloudProviderManager.isOk())499 msgCenter().cannotFindCloudProvider(comCloudProviderManager, uId, this);500 else501 {502 /* Import profiles: */503 comCloudProvider.ImportProfiles();504 505 /* Show error message if necessary: */506 if (!comCloudProvider.isOk())507 msgCenter().cannotImportCloudProfiles(comCloudProvider, this);508 else509 loadCloudStuff();510 }511 }512 }513 514 514 void UICloudProfileManagerWidget::sltHandleCurrentItemChange() 515 515 { … … 525 525 /* Update actions availability: */ 526 526 m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add)->setEnabled(!pItem || pItemProvider); 527 m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)->setEnabled(!pItem || pItemProvider); 527 528 m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove)->setEnabled(pItemProfile); 528 529 m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details)->setEnabled(pItemProfile || pItemProvider); 529 m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)->setEnabled(!pItem || pItemProvider);530 530 531 531 /* If there is an item => update details data: */ … … 561 561 { 562 562 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add)); 563 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)); 563 564 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details)); 564 menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));565 565 } 566 566 … … 591 591 connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add), &QAction::triggered, 592 592 this, &UICloudProfileManagerWidget::sltAddCloudProfile); 593 connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import), &QAction::triggered, 594 this, &UICloudProfileManagerWidget::sltImportCloudProfiles); 593 595 connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove), &QAction::triggered, 594 596 this, &UICloudProfileManagerWidget::sltRemoveCloudProfile); 595 597 connect(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details), &QAction::toggled, 596 598 this, &UICloudProfileManagerWidget::sltToggleCloudProfileDetailsVisibility); 597 connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import), &QAction::triggered,598 this, &UICloudProfileManagerWidget::sltImportCloudProfiles);599 599 } 600 600 … … 636 636 /* Add toolbar actions: */ 637 637 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add)); 638 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)); 638 639 m_pToolBar->addSeparator(); 639 640 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove)); 640 641 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details)); 641 m_pToolBar->addSeparator();642 m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));643 642 644 643 #ifdef VBOX_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.h
r74923 r74957 91 91 /** Handles command to create cloud profile. */ 92 92 void sltAddCloudProfile(); 93 /** Handles command to import cloud profiles. */ 94 void sltImportCloudProfiles(); 93 95 /** Handles command to remove cloud profile. */ 94 96 void sltRemoveCloudProfile(); 95 97 /** Handles command to make cloud profile details @a fVisible. */ 96 98 void sltToggleCloudProfileDetailsVisibility(bool fVisible); 97 /** Handles command to import cloud profiles. */98 void sltImportCloudProfiles();99 99 /** @} */ 100 100 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp
r74951 r74957 2422 2422 }; 2423 2423 2424 /** Simple action extension, used as 'Perform Import' action class. */ 2425 class UIActionMenuSelectorCloudPerformImport : public UIActionSimple 2426 { 2427 Q_OBJECT; 2428 2429 public: 2430 2431 /** Constructs action passing @a pParent to the base-class. */ 2432 UIActionMenuSelectorCloudPerformImport(UIActionPool *pParent) 2433 : UIActionSimple(pParent, 2434 ":/cloud_profile_restore_32px.png", ":/cloud_profile_restore_16px.png", 2435 ":/cloud_profile_restore_disabled_32px.png", ":/cloud_profile_restore_disabled_16px.png") 2436 {} 2437 2438 protected: 2439 2440 /** Returns shortcut extra-data ID. */ 2441 virtual QString shortcutExtraDataID() const /* override */ 2442 { 2443 return QString("ImportCloudProfiles"); 2444 } 2445 2446 /** Returns default shortcut. */ 2447 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */ 2448 { 2449 return QKeySequence("Ctrl+Shift+I"); 2450 } 2451 2452 /** Handles translation event. */ 2453 virtual void retranslateUi() /* override */ 2454 { 2455 setIconText(QApplication::translate("UIActionPool", "Import")); 2456 setName(QApplication::translate("UIActionPool", "&Import Profiles...")); 2457 setShortcutScope(QApplication::translate("UIActionPool", "Cloud Profile Manager")); 2458 setStatusTip(QApplication::translate("UIActionPool", "Import the list of cloud profiles from external files")); 2459 setToolTip(tr("Import Cloud Profiles (%1)").arg(shortcut().toString())); 2460 } 2461 }; 2462 2424 2463 /** Simple action extension, used as 'Perform Remove' action class. */ 2425 2464 class UIActionMenuSelectorCloudPerformRemove : public UIActionSimple … … 2498 2537 setStatusTip(QApplication::translate("UIActionPool", "Open pane with selected cloud profile properties")); 2499 2538 setToolTip(tr("Open Cloud Profile Properties (%1)").arg(shortcut().toString())); 2500 }2501 };2502 2503 /** Simple action extension, used as 'Perform Refresh' action class. */2504 class UIActionMenuSelectorCloudPerformImport : public UIActionSimple2505 {2506 Q_OBJECT;2507 2508 public:2509 2510 /** Constructs action passing @a pParent to the base-class. */2511 UIActionMenuSelectorCloudPerformImport(UIActionPool *pParent)2512 : UIActionSimple(pParent,2513 ":/cloud_profile_restore_32px.png", ":/cloud_profile_restore_16px.png",2514 ":/cloud_profile_restore_disabled_32px.png", ":/cloud_profile_restore_disabled_16px.png")2515 {}2516 2517 protected:2518 2519 /** Returns shortcut extra-data ID. */2520 virtual QString shortcutExtraDataID() const /* override */2521 {2522 return QString("ImportCloudProfiles");2523 }2524 2525 /** Returns default shortcut. */2526 virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */2527 {2528 return QKeySequence("Ctrl+Shift+I");2529 }2530 2531 /** Handles translation event. */2532 virtual void retranslateUi() /* override */2533 {2534 setIconText(QApplication::translate("UIActionPool", "Import"));2535 setName(QApplication::translate("UIActionPool", "&Import Profiles..."));2536 setShortcutScope(QApplication::translate("UIActionPool", "Cloud Profile Manager"));2537 setStatusTip(QApplication::translate("UIActionPool", "Import the list of cloud profiles from external files"));2538 setToolTip(tr("Import Cloud Profiles (%1)").arg(shortcut().toString()));2539 2539 } 2540 2540 }; … … 2665 2665 m_pool[UIActionIndexST_M_Cloud] = new UIActionMenuSelectorCloud(this); 2666 2666 m_pool[UIActionIndexST_M_Cloud_S_Add] = new UIActionMenuSelectorCloudPerformAdd(this); 2667 m_pool[UIActionIndexST_M_Cloud_S_Import] = new UIActionMenuSelectorCloudPerformImport(this); 2667 2668 m_pool[UIActionIndexST_M_Cloud_S_Remove] = new UIActionMenuSelectorCloudPerformRemove(this); 2668 2669 m_pool[UIActionIndexST_M_Cloud_T_Details] = new UIActionMenuSelectorCloudToggleProperties(this); 2669 m_pool[UIActionIndexST_M_Cloud_S_Import] = new UIActionMenuSelectorCloudPerformImport(this);2670 2670 2671 2671 /* Prepare update-handlers for known menus: */ … … 2846 2846 /* 'Add' action: */ 2847 2847 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_S_Add)) || fSeparator; 2848 /* 'Import' action: */ 2849 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_S_Import)) || fSeparator; 2848 2850 2849 2851 /* Separator? */ … … 2858 2860 /* 'Properties' action: */ 2859 2861 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_T_Details)) || fSeparator; 2860 2861 /* Separator? */2862 if (fSeparator)2863 {2864 pMenu->addSeparator();2865 fSeparator = false;2866 }2867 2868 /* 'Import' action: */2869 fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_S_Import)) || fSeparator;2870 2862 } 2871 2863 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.h
r74950 r74957 146 146 UIActionIndexST_M_Cloud, 147 147 UIActionIndexST_M_Cloud_S_Add, 148 UIActionIndexST_M_Cloud_S_Import, 148 149 UIActionIndexST_M_Cloud_S_Remove, 149 150 UIActionIndexST_M_Cloud_T_Details, 150 UIActionIndexST_M_Cloud_S_Import,151 151 152 152 /* Maximum index: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r74950 r74957 1794 1794 /* Remember action list: */ 1795 1795 m_cloudProfileManagerActions << actionPool()->action(UIActionIndexST_M_Cloud_S_Add) 1796 << actionPool()->action(UIActionIndexST_M_Cloud_S_Import) 1796 1797 << actionPool()->action(UIActionIndexST_M_Cloud_S_Remove) 1797 << actionPool()->action(UIActionIndexST_M_Cloud_T_Details) 1798 << actionPool()->action(UIActionIndexST_M_Cloud_S_Import); 1798 << actionPool()->action(UIActionIndexST_M_Cloud_T_Details); 1799 1799 } 1800 1800 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74950 r74957 644 644 { 645 645 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Add)); 646 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Import)); 646 647 m_pToolBar->addSeparator(); 647 648 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Remove)); 648 649 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_T_Details)); 649 m_pToolBar->addSeparator();650 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Import));651 650 break; 652 651 }
Note:
See TracChangeset
for help on using the changeset viewer.