- Timestamp:
- Dec 3, 2019 8:24:12 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r81969 r82335 2367 2367 { 2368 2368 /* 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); 2371 2371 } 2372 2372 … … 2915 2915 void UIMachineLogic::updateMenuDevicesSharedClipboard(QMenu *pMenu) 2916 2916 { 2917 /* Acquire current clipboard mode: */ 2918 const KClipboardMode enmCurrentMode = machine().GetClipboardMode(); 2919 2917 2920 /* First run: */ 2918 2921 if (!m_pSharedClipboardActions) 2919 2922 { 2923 /* Prepare action-group: */ 2920 2924 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) 2922 2933 { 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); 2925 2935 pMenu->addAction(pAction); 2926 pAction->setData(QVariant::fromValue( mode));2936 pAction->setData(QVariant::fromValue(enmMode)); 2927 2937 pAction->setCheckable(true); 2928 pAction->setChecked( machine().GetClipboardMode() == mode);2938 pAction->setChecked(enmMode == enmCurrentMode); 2929 2939 } 2940 /* Connect action-group trigger: */ 2930 2941 connect(m_pSharedClipboardActions, &QActionGroup::triggered, this, &UIMachineLogic::sltChangeSharedClipboardType); 2931 2942 } … … 2933 2944 else 2934 2945 foreach (QAction *pAction, m_pSharedClipboardActions->actions()) 2935 if (pAction->data().value<KClipboardMode>() == machine().GetClipboardMode())2946 if (pAction->data().value<KClipboardMode>() == enmCurrentMode) 2936 2947 pAction->setChecked(true); 2937 2948 }
Note:
See TracChangeset
for help on using the changeset viewer.