VirtualBox

Changeset 82336 in vbox


Ignore:
Timestamp:
Dec 3, 2019 8:34:46 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135160
Message:

FE/Qt: bugref:9611: UIMachineLogic: Get rid of hardcoded DnD mode list, instead acquire this list through CSystemProperties interface (s.a. r135116).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r82335 r82336  
    24012401{
    24022402    /* Assign new mode (without save): */
    2403     KDnDMode mode = pAction->data().value<KDnDMode>();
    2404     machine().SetDnDMode(mode);
     2403    KDnDMode enmMode = pAction->data().value<KDnDMode>();
     2404    machine().SetDnDMode(enmMode);
    24052405}
    24062406
     
    29502950void UIMachineLogic::updateMenuDevicesDragAndDrop(QMenu *pMenu)
    29512951{
     2952    /* Acquire current DnD mode: */
     2953    const KDnDMode enmCurrentMode = machine().GetDnDMode();
     2954
    29522955    /* First run: */
    29532956    if (!m_pDragAndDropActions)
    29542957    {
     2958        /* Prepare action-group: */
    29552959        m_pDragAndDropActions = new QActionGroup(this);
    2956         for (int i = KDnDMode_Disabled; i < KDnDMode_Max; ++i)
     2960        /* Load currently supported DnD modes: */
     2961        CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
     2962        QVector<KDnDMode> dndModes = comProperties.GetSupportedDnDModes();
     2963        /* Take current DnD mode into account: */
     2964        if (!dndModes.contains(enmCurrentMode))
     2965            dndModes.prepend(enmCurrentMode);
     2966        /* Create action for all clipboard modes: */
     2967        foreach (const KDnDMode &enmMode, dndModes)
    29572968        {
    2958             KDnDMode mode = (KDnDMode)i;
    2959             QAction *pAction = new QAction(gpConverter->toString(mode), m_pDragAndDropActions);
     2969            QAction *pAction = new QAction(gpConverter->toString(enmMode), m_pDragAndDropActions);
    29602970            pMenu->addAction(pAction);
    2961             pAction->setData(QVariant::fromValue(mode));
     2971            pAction->setData(QVariant::fromValue(enmMode));
    29622972            pAction->setCheckable(true);
    2963             pAction->setChecked(machine().GetDnDMode() == mode);
     2973            pAction->setChecked(enmMode == enmCurrentMode);
    29642974        }
     2975        /* Connect action-group trigger: */
    29652976        connect(m_pDragAndDropActions, &QActionGroup::triggered, this, &UIMachineLogic::sltChangeDragAndDropType);
    29662977    }
     
    29682979    else
    29692980        foreach (QAction *pAction, m_pDragAndDropActions->actions())
    2970             if (pAction->data().value<KDnDMode>() == machine().GetDnDMode())
     2981            if (pAction->data().value<KDnDMode>() == enmCurrentMode)
    29712982                pAction->setChecked(true);
    29722983}
Note: See TracChangeset for help on using the changeset viewer.

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