VirtualBox

Changeset 82335 in vbox for trunk/src


Ignore:
Timestamp:
Dec 3, 2019 8:24:12 AM (5 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

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

    r81969 r82335  
    23672367{
    23682368    /* Assign new mode (without save): */
    2369     KClipboardMode mode = pAction->data().value<KClipboardMode>();
    2370     machine().SetClipboardMode(mode);
     2369    KClipboardMode enmMode = pAction->data().value<KClipboardMode>();
     2370    machine().SetClipboardMode(enmMode);
    23712371}
    23722372
     
    29152915void UIMachineLogic::updateMenuDevicesSharedClipboard(QMenu *pMenu)
    29162916{
     2917    /* Acquire current clipboard mode: */
     2918    const KClipboardMode enmCurrentMode = machine().GetClipboardMode();
     2919
    29172920    /* First run: */
    29182921    if (!m_pSharedClipboardActions)
    29192922    {
     2923        /* Prepare action-group: */
    29202924        m_pSharedClipboardActions = new QActionGroup(this);
    2921         for (int i = KClipboardMode_Disabled; i < KClipboardMode_Max; ++i)
     2925        /* Load currently supported Clipboard modes: */
     2926        CSystemProperties comProperties = uiCommon().virtualBox().GetSystemProperties();
     2927        QVector<KClipboardMode> clipboardModes = comProperties.GetSupportedClipboardModes();
     2928        /* Take current clipboard mode into account: */
     2929        if (!clipboardModes.contains(enmCurrentMode))
     2930            clipboardModes.prepend(enmCurrentMode);
     2931        /* Create action for all clipboard modes: */
     2932        foreach (const KClipboardMode &enmMode, clipboardModes)
    29222933        {
    2923             KClipboardMode mode = (KClipboardMode)i;
    2924             QAction *pAction = new QAction(gpConverter->toString(mode), m_pSharedClipboardActions);
     2934            QAction *pAction = new QAction(gpConverter->toString(enmMode), m_pSharedClipboardActions);
    29252935            pMenu->addAction(pAction);
    2926             pAction->setData(QVariant::fromValue(mode));
     2936            pAction->setData(QVariant::fromValue(enmMode));
    29272937            pAction->setCheckable(true);
    2928             pAction->setChecked(machine().GetClipboardMode() == mode);
     2938            pAction->setChecked(enmMode == enmCurrentMode);
    29292939        }
     2940        /* Connect action-group trigger: */
    29302941        connect(m_pSharedClipboardActions, &QActionGroup::triggered, this, &UIMachineLogic::sltChangeSharedClipboardType);
    29312942    }
     
    29332944    else
    29342945        foreach (QAction *pAction, m_pSharedClipboardActions->actions())
    2935             if (pAction->data().value<KClipboardMode>() == machine().GetClipboardMode())
     2946            if (pAction->data().value<KClipboardMode>() == enmCurrentMode)
    29362947                pAction->setChecked(true);
    29372948}
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