VirtualBox

Changeset 74957 in vbox


Ignore:
Timestamp:
Oct 21, 2018 11:53:53 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9230: Cloud Profile Manager: Actions reordering.

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  
    401401}
    402402
     403void 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
    403445void UICloudProfileManagerWidget::sltRemoveCloudProfile()
    404446{
     
    470512}
    471513
    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     else
    491     {
    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         else
    501         {
    502             /* Import profiles: */
    503             comCloudProvider.ImportProfiles();
    504 
    505             /* Show error message if necessary: */
    506             if (!comCloudProvider.isOk())
    507                 msgCenter().cannotImportCloudProfiles(comCloudProvider, this);
    508             else
    509                 loadCloudStuff();
    510         }
    511     }
    512 }
    513 
    514514void UICloudProfileManagerWidget::sltHandleCurrentItemChange()
    515515{
     
    525525    /* Update actions availability: */
    526526    m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add)->setEnabled(!pItem || pItemProvider);
     527    m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)->setEnabled(!pItem || pItemProvider);
    527528    m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove)->setEnabled(pItemProfile);
    528529    m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details)->setEnabled(pItemProfile || pItemProvider);
    529     m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import)->setEnabled(!pItem || pItemProvider);
    530530
    531531    /* If there is an item => update details data: */
     
    561561    {
    562562        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add));
     563        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));
    563564        menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details));
    564         menu.addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));
    565565    }
    566566
     
    591591    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add), &QAction::triggered,
    592592            this, &UICloudProfileManagerWidget::sltAddCloudProfile);
     593    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import), &QAction::triggered,
     594            this, &UICloudProfileManagerWidget::sltImportCloudProfiles);
    593595    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove), &QAction::triggered,
    594596            this, &UICloudProfileManagerWidget::sltRemoveCloudProfile);
    595597    connect(m_pActionPool->action(UIActionIndexST_M_Cloud_T_Details), &QAction::toggled,
    596598            this, &UICloudProfileManagerWidget::sltToggleCloudProfileDetailsVisibility);
    597     connect(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import), &QAction::triggered,
    598             this, &UICloudProfileManagerWidget::sltImportCloudProfiles);
    599599}
    600600
     
    636636        /* Add toolbar actions: */
    637637        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Add));
     638        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Import));
    638639        m_pToolBar->addSeparator();
    639640        m_pToolBar->addAction(m_pActionPool->action(UIActionIndexST_M_Cloud_S_Remove));
    640641        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));
    643642
    644643#ifdef VBOX_WS_MAC
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.h

    r74923 r74957  
    9191        /** Handles command to create cloud profile. */
    9292        void sltAddCloudProfile();
     93        /** Handles command to import cloud profiles. */
     94        void sltImportCloudProfiles();
    9395        /** Handles command to remove cloud profile. */
    9496        void sltRemoveCloudProfile();
    9597        /** Handles command to make cloud profile details @a fVisible. */
    9698        void sltToggleCloudProfileDetailsVisibility(bool fVisible);
    97         /** Handles command to import cloud profiles. */
    98         void sltImportCloudProfiles();
    9999    /** @} */
    100100
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.cpp

    r74951 r74957  
    24222422};
    24232423
     2424/** Simple action extension, used as 'Perform Import' action class. */
     2425class UIActionMenuSelectorCloudPerformImport : public UIActionSimple
     2426{
     2427    Q_OBJECT;
     2428
     2429public:
     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
     2438protected:
     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
    24242463/** Simple action extension, used as 'Perform Remove' action class. */
    24252464class UIActionMenuSelectorCloudPerformRemove : public UIActionSimple
     
    24982537        setStatusTip(QApplication::translate("UIActionPool", "Open pane with selected cloud profile properties"));
    24992538        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 UIActionSimple
    2505 {
    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()));
    25392539    }
    25402540};
     
    26652665    m_pool[UIActionIndexST_M_Cloud] = new UIActionMenuSelectorCloud(this);
    26662666    m_pool[UIActionIndexST_M_Cloud_S_Add] = new UIActionMenuSelectorCloudPerformAdd(this);
     2667    m_pool[UIActionIndexST_M_Cloud_S_Import] = new UIActionMenuSelectorCloudPerformImport(this);
    26672668    m_pool[UIActionIndexST_M_Cloud_S_Remove] = new UIActionMenuSelectorCloudPerformRemove(this);
    26682669    m_pool[UIActionIndexST_M_Cloud_T_Details] = new UIActionMenuSelectorCloudToggleProperties(this);
    2669     m_pool[UIActionIndexST_M_Cloud_S_Import] = new UIActionMenuSelectorCloudPerformImport(this);
    26702670
    26712671    /* Prepare update-handlers for known menus: */
     
    28462846    /* 'Add' action: */
    28472847    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_S_Add)) || fSeparator;
     2848    /* 'Import' action: */
     2849    fSeparator = addAction(pMenu, action(UIActionIndexST_M_Cloud_S_Import)) || fSeparator;
    28482850
    28492851    /* Separator? */
     
    28582860    /* 'Properties' action: */
    28592861    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;
    28702862}
    28712863
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolSelector.h

    r74950 r74957  
    146146    UIActionIndexST_M_Cloud,
    147147    UIActionIndexST_M_Cloud_S_Add,
     148    UIActionIndexST_M_Cloud_S_Import,
    148149    UIActionIndexST_M_Cloud_S_Remove,
    149150    UIActionIndexST_M_Cloud_T_Details,
    150     UIActionIndexST_M_Cloud_S_Import,
    151151
    152152    /* Maximum index: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r74950 r74957  
    17941794    /* Remember action list: */
    17951795    m_cloudProfileManagerActions << actionPool()->action(UIActionIndexST_M_Cloud_S_Add)
     1796                                 << actionPool()->action(UIActionIndexST_M_Cloud_S_Import)
    17961797                                 << 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);
    17991799}
    18001800
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp

    r74950 r74957  
    644644                {
    645645                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Add));
     646                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Import));
    646647                    m_pToolBar->addSeparator();
    647648                    m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Remove));
    648649                    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));
    651650                    break;
    652651                }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette