Tomas Jelinek has uploaded a new change for review. Change subject: userportal: don't pass ctrl+alt+delete for win>7 ......................................................................
userportal: don't pass ctrl+alt+delete for win>7 Don't pass the ctrl+alt+del for win 7 or newer client. This has already been implemented, but on the level of ConsolePopupPresenterWidget which is not enogh - it was executed only after opening the consonle popup. But if the user pressed the connect button, without opening the the console popup, the ctrl+alt+delete was passed to the guest. This patch moves this logic to SpiceConsoleModel. Change-Id: I09c45cb30577e84830b6e82d79d2bb7ef7455b1b Bug-Url: https://bugzilla.redhat.com/918650 Signed-off-by: Tomas Jelinek <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java M frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/popup/console/ConsolePopupPresenterWidget.java 3 files changed, 49 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/20/13020/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java index 8b09d9f..894cf1f 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Configurator.java @@ -18,6 +18,8 @@ import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; import com.google.gwt.i18n.client.LocaleInfo; +import com.google.gwt.regexp.shared.MatchResult; +import com.google.gwt.regexp.shared.RegExp; /** * Provides configuration values for client side. @@ -378,6 +380,45 @@ return new Version(versionStr.replace(',', '.').replace("\n", "")); //$NON-NLS-1$ //$NON-NLS-2$ } + // This code is copy-pasted from ConsoleUtils. The ConsoleUtils with lots of other + // console related logic is being extracted to common code. As soon as this + // effort will be finished, this code will have to be deleted and the corresponding + // logic will have to be called. + // TODO tjelinek: as soon as the console extraction will be done, get rid of this code + public boolean isCtrlAltDeleteEnabed() { + if (!clientOsType().equalsIgnoreCase("Windows")) { //$NON-NLS-1$ + return true; + } + + float ntVersion = extractNtVersion(getUserAgentString()); + + // For Windows 7 and Windows Server 2008 R2 it is NT 6.1 + // For Windows 8 and Windows Server 2012 it is NT 6.2 + // The passing of ctrl+alt+del is enabled only on windows older + // than Windows 7, so NT less than 6.1 + if (ntVersion >= 6.1f) { + return false; + } + + return true; + } + + private float extractNtVersion(String userAgentType) { + RegExp pattern = RegExp.compile(".*windows nt (\\d+\\.\\d+).*"); //$NON-NLS-1$ + MatchResult matcher = pattern.exec(userAgentType.toLowerCase()); + boolean matchFound = (matcher != null); + if (matchFound) { + return Float.parseFloat(matcher.getGroup(1)); + } + + return -1; + } + + public native String getUserAgentString() /*-{ + var userAgent = navigator.userAgent; + return userAgent; + }-*/; + protected abstract Event getSpiceVersionFileFetchedEvent(); protected abstract String clientOsType(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java index 0c3b07f..4de3165 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java @@ -5,6 +5,7 @@ import java.util.Collections; import java.util.List; +import org.ovirt.engine.ui.uicommonweb.Configurator; import org.ovirt.engine.core.common.action.ChangeDiskCommandParameters; import org.ovirt.engine.core.common.action.HibernateVmParameters; import org.ovirt.engine.core.common.action.RunVmParams; @@ -145,6 +146,13 @@ getspice().setWanOptionsEnabled(false); } + // make sure to not send the ctrl+alt+delete and TaskMgrExecution if not supported + Configurator configurator = (Configurator) TypeResolver.getInstance().Resolve(Configurator.class); + if (!configurator.isCtrlAltDeleteEnabed()) { + getspice().setSendCtrlAltDelete(false); + getspice().setNoTaskMgrExecution(false); + } + UICommand setVmTicketCommand = new UICommand("setVmCommand", new BaseCommandTarget() { //$NON-NLS-1$ @Override public void ExecuteCommand(UICommand uiCommand) { diff --git a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/popup/console/ConsolePopupPresenterWidget.java b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/popup/console/ConsolePopupPresenterWidget.java index 1c8fb81..15910dd 100644 --- a/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/popup/console/ConsolePopupPresenterWidget.java +++ b/frontend/webadmin/modules/userportal-gwtp/src/main/java/org/ovirt/engine/ui/userportal/section/main/presenter/popup/console/ConsolePopupPresenterWidget.java @@ -188,9 +188,6 @@ boolean ctrlAltDelEnabled = consoleUtils.isCtrlAltDelEnabled(); getView().setCtrlAltDelEnabled(ctrlAltDelEnabled, constants.ctrlAltDeletIsNotSupportedOnWindows()); - if (!ctrlAltDelEnabled && spice != null) { - spice.setSendCtrlAltDelete(false); - } } @Override -- To view, visit http://gerrit.ovirt.org/13020 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I09c45cb30577e84830b6e82d79d2bb7ef7455b1b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Tomas Jelinek <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
