- Timestamp:
- Sep 25, 2024 4:32:45 PM (7 months ago)
- svn:sync-xref-src-repo-rev:
- 164928
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r106061 r106149 40 40 #include "UISettingsDefs.h" 41 41 #include "UITranslator.h" 42 #include "UIVRDESettingsEditor.h" 42 43 #if defined(VBOX_WS_NIX) && !defined(VBOX_GUI_WITH_CUSTOMIZATIONS1) 43 44 # include "UIDesktopWidgetWatchdog.h" … … 2904 2905 return VMActivityOverviewColumn_Max; 2905 2906 } 2907 2908 /* QString <= UIVRDESecurityMethod: */ 2909 template<> SHARED_LIBRARY_STUFF QString UIConverter::toString(const UIVRDESecurityMethod &enmSecurityMethod) const 2910 { 2911 QString strResult; 2912 switch (enmSecurityMethod) 2913 { 2914 case UIVRDESecurityMethod_TLS: strResult = QApplication::translate("UICommon", "TLS"); break; 2915 case UIVRDESecurityMethod_RDP: strResult = QApplication::translate("UICommon", "RDP"); break; 2916 case UIVRDESecurityMethod_Negotiate: strResult = QApplication::translate("UICommon", "NEGOTIATE"); break; 2917 default: 2918 { 2919 AssertMsgFailed(("No text for security method=%d", enmSecurityMethod)); 2920 break; 2921 } 2922 } 2923 return strResult; 2924 } 2925 2926 /* QString <= UIVRDESecurityMethod: */ 2927 template<> SHARED_LIBRARY_STUFF QString UIConverter::toInternalString(const UIVRDESecurityMethod &enmSecurityMethod) const 2928 { 2929 QString strResult; 2930 switch (enmSecurityMethod) 2931 { 2932 case UIVRDESecurityMethod_TLS: strResult = QString(); break; 2933 case UIVRDESecurityMethod_RDP: strResult = QString("RDP"); break; 2934 case UIVRDESecurityMethod_Negotiate: strResult = QString("NEGOTIATE"); break; 2935 default: 2936 { 2937 AssertMsgFailed(("No text for security method=%d", enmSecurityMethod)); 2938 break; 2939 } 2940 } 2941 return strResult; 2942 } 2943 2944 /* UIVRDESecurityMethod <= QString: */ 2945 template<> SHARED_LIBRARY_STUFF UIVRDESecurityMethod UIConverter::fromInternalString<UIVRDESecurityMethod>(const QString &strSecurityMethod) const 2946 { 2947 if (strSecurityMethod.compare("RDP", Qt::CaseInsensitive) == 0) 2948 return UIVRDESecurityMethod_RDP; 2949 if (strSecurityMethod.compare("NEGOTIATE", Qt::CaseInsensitive) == 0) 2950 return UIVRDESecurityMethod_Negotiate; 2951 return UIVRDESecurityMethod_TLS; 2952 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.cpp
r106061 r106149 41 41 : UIEditor(pParent) 42 42 , m_fFeatureEnabled(false) 43 , m_enmSecurityMethod(UIVRDESecurityMethod_Max) 43 44 , m_enmAuthType(KAuthType_Max) 44 45 , m_fMultipleConnectionsAllowed(false) … … 47 48 , m_pLabelPort(0) 48 49 , m_pEditorPort(0) 50 , m_pLabelSecurityMethod(0) 51 , m_pComboSecurityMethod(0) 49 52 , m_pLabelAuthMethod(0) 50 53 , m_pComboAuthType(0) … … 102 105 } 103 106 107 void UIVRDESettingsEditor::setSecurityMethod(const UIVRDESecurityMethod &enmMethod) 108 { 109 /* Update cached value and 110 * combo if value has changed: */ 111 if (m_enmSecurityMethod != enmMethod) 112 { 113 m_enmSecurityMethod = enmMethod; 114 repopulateComboSecurityMethod(); 115 } 116 } 117 118 UIVRDESecurityMethod UIVRDESettingsEditor::securityMethod() const 119 { 120 return m_pComboSecurityMethod ? m_pComboSecurityMethod->currentData().value<UIVRDESecurityMethod>() : m_enmSecurityMethod; 121 } 122 104 123 void UIVRDESettingsEditor::setAuthType(const KAuthType &enmType) 105 124 { … … 167 186 m_pEditorPort->setToolTip(tr("Holds the VRDP Server port number. You may specify 0 (zero), to select port 3389, the " 168 187 "standard port for RDP.")); 188 189 if (m_pLabelSecurityMethod) 190 m_pLabelSecurityMethod->setText(tr("&Security Method:")); 191 if (m_pComboSecurityMethod) 192 { 193 for (int iIndex = 0; iIndex < m_pComboSecurityMethod->count(); ++iIndex) 194 { 195 const UIVRDESecurityMethod enmType = m_pComboSecurityMethod->itemData(iIndex).value<UIVRDESecurityMethod>(); 196 m_pComboSecurityMethod->setItemText(iIndex, gpConverter->toString(enmType)); 197 } 198 m_pComboSecurityMethod->setToolTip(tr("Selects the VRDP security method.")); 199 } 169 200 170 201 if (m_pLabelAuthMethod) … … 264 295 } 265 296 297 /* Prepare 'security method' label: */ 298 m_pLabelSecurityMethod = new QLabel(m_pWidgetSettings); 299 if (m_pLabelSecurityMethod) 300 { 301 m_pLabelSecurityMethod->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 302 pLayoutRemoteDisplaySettings->addWidget(m_pLabelSecurityMethod, 1, 0); 303 } 304 /* Prepare 'security method' combo: */ 305 m_pComboSecurityMethod = new QComboBox(m_pWidgetSettings); 306 if (m_pComboSecurityMethod) 307 { 308 if (m_pLabelSecurityMethod) 309 m_pLabelSecurityMethod->setBuddy(m_pComboSecurityMethod); 310 m_pComboSecurityMethod->setSizeAdjustPolicy(QComboBox::AdjustToContents); 311 312 pLayoutRemoteDisplaySettings->addWidget(m_pComboSecurityMethod, 1, 1, 1, 2); 313 } 314 266 315 /* Prepare 'auth type' label: */ 267 316 m_pLabelAuthMethod = new QLabel(m_pWidgetSettings); … … 269 318 { 270 319 m_pLabelAuthMethod->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 271 pLayoutRemoteDisplaySettings->addWidget(m_pLabelAuthMethod, 1, 0);320 pLayoutRemoteDisplaySettings->addWidget(m_pLabelAuthMethod, 2, 0); 272 321 } 273 322 /* Prepare 'auth type' combo: */ … … 279 328 m_pComboAuthType->setSizeAdjustPolicy(QComboBox::AdjustToContents); 280 329 281 pLayoutRemoteDisplaySettings->addWidget(m_pComboAuthType, 1, 1, 1, 2);330 pLayoutRemoteDisplaySettings->addWidget(m_pComboAuthType, 2, 1, 1, 2); 282 331 } 283 332 … … 287 336 { 288 337 m_pLabelTimeout->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 289 pLayoutRemoteDisplaySettings->addWidget(m_pLabelTimeout, 2, 0);338 pLayoutRemoteDisplaySettings->addWidget(m_pLabelTimeout, 3, 0); 290 339 } 291 340 /* Prepare 'timeout' editor: */ … … 297 346 m_pEditorTimeout->setValidator(new QIntValidator(this)); 298 347 299 pLayoutRemoteDisplaySettings->addWidget(m_pEditorTimeout, 2, 1, 1, 2);348 pLayoutRemoteDisplaySettings->addWidget(m_pEditorTimeout, 3, 1, 1, 2); 300 349 } 301 350 … … 305 354 { 306 355 m_pLabelOptions->setAlignment(Qt::AlignRight | Qt::AlignVCenter); 307 pLayoutRemoteDisplaySettings->addWidget(m_pLabelOptions, 3, 0);356 pLayoutRemoteDisplaySettings->addWidget(m_pLabelOptions, 4, 0); 308 357 } 309 358 /* Prepare 'multiple connections' check-box: */ 310 359 m_pCheckboxMultipleConnections = new QCheckBox(m_pWidgetSettings); 311 360 if (m_pCheckboxMultipleConnections) 312 pLayoutRemoteDisplaySettings->addWidget(m_pCheckboxMultipleConnections, 3, 1);361 pLayoutRemoteDisplaySettings->addWidget(m_pCheckboxMultipleConnections, 4, 1); 313 362 } 314 363 … … 332 381 } 333 382 383 void UIVRDESettingsEditor::repopulateComboSecurityMethod() 384 { 385 if (m_pComboSecurityMethod) 386 { 387 /* Clear combo first of all: */ 388 m_pComboSecurityMethod->clear(); 389 390 QVector<UIVRDESecurityMethod> securityMethods = QVector<UIVRDESecurityMethod>() << UIVRDESecurityMethod_TLS 391 << UIVRDESecurityMethod_RDP 392 << UIVRDESecurityMethod_Negotiate; 393 394 /* Take into account currently cached value: */ 395 if (!securityMethods.contains(m_enmSecurityMethod)) 396 securityMethods.prepend(m_enmSecurityMethod); 397 398 /* Populate combo finally: */ 399 foreach (const UIVRDESecurityMethod &enmType, securityMethods) 400 m_pComboSecurityMethod->addItem(gpConverter->toString(enmType), QVariant::fromValue(enmType)); 401 402 /* Look for proper index to choose: */ 403 const int iIndex = m_pComboSecurityMethod->findData(QVariant::fromValue(m_enmSecurityMethod)); 404 if (iIndex != -1) 405 m_pComboSecurityMethod->setCurrentIndex(iIndex); 406 } 407 } 408 334 409 void UIVRDESettingsEditor::repopulateComboAuthType() 335 410 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIVRDESettingsEditor.h
r106061 r106149 45 45 class QWidget; 46 46 47 /** VRDE Security Methods. */ 48 enum UIVRDESecurityMethod 49 { 50 UIVRDESecurityMethod_TLS, 51 UIVRDESecurityMethod_RDP, 52 UIVRDESecurityMethod_Negotiate, 53 UIVRDESecurityMethod_Max 54 }; 55 Q_DECLARE_METATYPE(UIVRDESecurityMethod); 56 47 57 /** UIEditor sub-class used as a VRDE settings editor. */ 48 58 class SHARED_LIBRARY_STUFF UIVRDESettingsEditor : public UIEditor … … 73 83 QString port() const; 74 84 85 /** Defines security @a enmMethod. */ 86 void setSecurityMethod(const UIVRDESecurityMethod &enmMethod); 87 /** Returns security method. */ 88 UIVRDESecurityMethod securityMethod() const; 89 75 90 /** Defines auth @a enmType. */ 76 91 void setAuthType(const KAuthType &enmType); … … 87 102 /** Returns whether multiple connections allowed. */ 88 103 bool isMultipleConnectionsAllowed() const; 89 90 104 91 105 private slots: … … 106 120 void prepareConnections(); 107 121 122 /** Repopulates security method combo-box. */ 123 void repopulateComboSecurityMethod(); 108 124 /** Repopulates auth type combo-box. */ 109 125 void repopulateComboAuthType(); … … 112 128 * @{ */ 113 129 /** Holds whether feature is enabled. */ 114 bool m_fFeatureEnabled;130 bool m_fFeatureEnabled; 115 131 /** Holds the port. */ 116 QString m_strPort; 132 QString m_strPort; 133 /** Holds the security method. */ 134 UIVRDESecurityMethod m_enmSecurityMethod; 117 135 /** Holds the auth type. */ 118 KAuthType m_enmAuthType;136 KAuthType m_enmAuthType; 119 137 /** Holds the timeout. */ 120 QString m_strTimeout;138 QString m_strTimeout; 121 139 /** Returns whether multiple connections allowed. */ 122 bool m_fMultipleConnectionsAllowed;140 bool m_fMultipleConnectionsAllowed; 123 141 /** @} */ 124 142 … … 133 151 /** Holds the port editor instance. */ 134 152 QLineEdit *m_pEditorPort; 135 /** Holds the port auth method label instance. */ 153 /** Holds the security method label instance. */ 154 QLabel *m_pLabelSecurityMethod; 155 /** Holds the security method combo instance. */ 156 QComboBox *m_pComboSecurityMethod; 157 /** Holds the auth method label instance. */ 136 158 QLabel *m_pLabelAuthMethod; 137 /** Holds the portauth method combo instance. */159 /** Holds the auth method combo instance. */ 138 160 QComboBox *m_pComboAuthType; 139 161 /** Holds the timeout label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp
r106074 r106149 74 74 , m_fRemoteDisplayServerEnabled(false) 75 75 , m_strRemoteDisplayPort(QString()) 76 , m_remoteDisplaySecurityMethod(UIVRDESecurityMethod_Max) 76 77 , m_remoteDisplayAuthType(KAuthType_Null) 77 78 , m_uRemoteDisplayTimeout(0) … … 101 102 && (m_fRemoteDisplayServerEnabled == other.m_fRemoteDisplayServerEnabled) 102 103 && (m_strRemoteDisplayPort == other.m_strRemoteDisplayPort) 104 && (m_remoteDisplaySecurityMethod == other.m_remoteDisplaySecurityMethod) 103 105 && (m_remoteDisplayAuthType == other.m_remoteDisplayAuthType) 104 106 && (m_uRemoteDisplayTimeout == other.m_uRemoteDisplayTimeout) … … 269 271 /** Holds the remote display server port. */ 270 272 QString m_strRemoteDisplayPort; 273 /** Holds the remote display server security method. */ 274 UIVRDESecurityMethod m_remoteDisplaySecurityMethod; 271 275 /** Holds the remote display server auth type. */ 272 276 KAuthType m_remoteDisplayAuthType; … … 412 416 oldDisplayData.m_fRemoteDisplayServerEnabled = comVrdeServer.GetEnabled(); 413 417 oldDisplayData.m_strRemoteDisplayPort = comVrdeServer.GetVRDEProperty("TCP/Ports"); 418 oldDisplayData.m_remoteDisplaySecurityMethod = 419 gpConverter->fromInternalString<UIVRDESecurityMethod>(comVrdeServer.GetVRDEProperty("Security/Method")); 414 420 oldDisplayData.m_remoteDisplayAuthType = comVrdeServer.GetAuthType(); 415 421 oldDisplayData.m_uRemoteDisplayTimeout = comVrdeServer.GetAuthTimeout(); … … 494 500 m_pEditorVRDESettings->setFeatureEnabled(oldDisplayData.m_fRemoteDisplayServerEnabled); 495 501 m_pEditorVRDESettings->setPort(oldDisplayData.m_strRemoteDisplayPort); 502 m_pEditorVRDESettings->setSecurityMethod(oldDisplayData.m_remoteDisplaySecurityMethod); 496 503 m_pEditorVRDESettings->setAuthType(oldDisplayData.m_remoteDisplayAuthType); 497 504 m_pEditorVRDESettings->setTimeout(QString::number(oldDisplayData.m_uRemoteDisplayTimeout)); … … 570 577 newDisplayData.m_fRemoteDisplayServerEnabled = m_pEditorVRDESettings->isFeatureEnabled(); 571 578 newDisplayData.m_strRemoteDisplayPort = m_pEditorVRDESettings->port(); 579 newDisplayData.m_remoteDisplaySecurityMethod = m_pEditorVRDESettings->securityMethod(); 572 580 newDisplayData.m_remoteDisplayAuthType = m_pEditorVRDESettings->authType(); 573 581 newDisplayData.m_uRemoteDisplayTimeout = m_pEditorVRDESettings->timeout().toULong(); … … 1197 1205 { 1198 1206 comServer.SetVRDEProperty("TCP/Ports", newDisplayData.m_strRemoteDisplayPort); 1207 fSuccess = comServer.isOk(); 1208 } 1209 /* Save remote display server security method: */ 1210 if (fSuccess && newDisplayData.m_remoteDisplaySecurityMethod != oldDisplayData.m_remoteDisplaySecurityMethod) 1211 { 1212 comServer.SetVRDEProperty("Security/Method", gpConverter->toInternalString(newDisplayData.m_remoteDisplaySecurityMethod)); 1199 1213 fSuccess = comServer.isOk(); 1200 1214 }
Note:
See TracChangeset
for help on using the changeset viewer.