Tomas Jelinek has uploaded a new change for review.

Change subject: userportal,webadmin: bring back change CD menu to SPICE console
......................................................................

userportal,webadmin: bring back change CD menu to SPICE console

This has been lost while moving from 3.0 to 3.1.

This patch contains:
- setting the correct menu to the ActiveX plugin (XPI
plugin does not have this functionality)
- listening to the onmenuitemselected event and firing the correct
event in response
- fix the menu item creation - new StringBuilder(int) just creates the
empty string (int param means the capacity, not the actual content)
- fix the format of the menu
- removed items which are not handled by us anymore, but handled
by the spice client itself

Change-Id: Ifdfa982da00ae333271f60795b0c17fe602e14ef
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=957611
Signed-off-by: Tomas Jelinek <tjeli...@redhat.com>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/SpicePluginImpl.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceMenu.java
3 files changed, 11 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/07/14407/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/SpicePluginImpl.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/SpicePluginImpl.java
index 5c3e365..6bb4c11 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/SpicePluginImpl.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/uicommon/SpicePluginImpl.java
@@ -271,6 +271,7 @@
                                                    var usbAutoShare = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::getUsbAutoShare()();
                                                    var usbFilter = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::getUsbFilter()();
                                                    var disconnectedEvent = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::getDisconnectedEvent()();
+                                                   var menuItemSelectedEvent = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::getMenuItemSelectedEvent()();
                                                    var connectedEvent = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::getConnectedEvent()();
                                                    var wanOptionsEnabled = 
th...@org.ovirt.engine.ui.common.uicommon.SpicePluginImpl::isWanOptionsEnabled()();
                                                    // the !! is there to 
convert the value to boolean because it is returned as int
@@ -288,6 +289,8 @@
 
                                                    var client = 
$wnd.document.getElementById(id);
                                                    
client.attachEvent('onreadystatechange', onReadyStateChange);
+                                                   
client.attachEvent('onmenuitemselected', onMenuItemSelected);
+
                                                    tryToConnect();
 
                                                    function tryToConnect() {
@@ -298,7 +301,7 @@
                                                    client.hostIP = hostIp;
                                                    client.port = port;
                                                    client.Title = title;
-                                                   client.dynamicMenu = "";
+                                                   client.dynamicMenu = menu;
                                                    client.fullScreen = 
fullScreen;
                                                    client.Password = password;
                                                    client.NumberOfMonitors = 
numberOfMonitors;
@@ -358,6 +361,11 @@
                                                    // var gridRefreshManager = 
@org.ovirt.engine.ui.userportal.client.components.GridRefreshManager::getInstance()();
                                                    // 
gridrefreshmanag...@org.ovirt.engine.ui.userportal.client.components.GridRefreshManager::refreshGrids()();
                                                    }
+
+                                                   function 
onMenuItemSelected(itemId) {
+                                                   var spiceMenuItemEventArgs 
= 
@org.ovirt.engine.ui.uicommonweb.models.vms.SpiceMenuItemEventArgs::new(I)(itemId);
+                                                   
menuitemselectedeve...@org.ovirt.engine.ui.uicompat.Event::raise(Ljava/lang/Object;Lorg/ovirt/engine/ui/uicompat/EventArgs;)(model,
 spiceMenuItemEventArgs);
+                                                   }
                                                    }-*/;
 
     @Override
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 189d3df..1ac43a3 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
@@ -439,30 +439,6 @@
         int id = 1;
         menu = new SpiceMenu();
 
-        menu.getItems().add(new 
SpiceMenuCommandItem(ID_SYS_MENU_SEND_CTRL_ALT_DEL, 
ConstantsManager.getInstance()
-                .getConstants()
-                .send()
-                + " " + ctrlAltDelTranslated //$NON-NLS-1$
-                + "\t" + ctrlAltEndTranslated, "")); //$NON-NLS-1$ 
//$NON-NLS-2$
-        menu.getItems().add(new 
SpiceMenuCommandItem(ID_SYS_MENU_TOGGLE_FULL_SCREEN, 
ConstantsManager.getInstance()
-                .getConstants()
-                .toggleFullScreen()
-                + "\t" //$NON-NLS-1$
-                + toggleFullScreenKeysTranslated, "")); //$NON-NLS-1$
-
-        SpiceMenuContainerItem specialKes =
-                new SpiceMenuContainerItem(id, 
ConstantsManager.getInstance().getConstants().specialKeys());
-        menu.getItems().add(specialKes);
-
-        specialKes.getItems().add(new 
SpiceMenuCommandItem(ID_SYS_MENU_SEND_SHIFT_F11,
-                toggleFullScreenKeysTranslated, "")); //$NON-NLS-1$
-        specialKes.getItems()
-                .add(new SpiceMenuCommandItem(ID_SYS_MENU_SEND_SHIFT_F12, 
releaseCursorKeysTranslated, "")); //$NON-NLS-1$
-        specialKes.getItems().add(new 
SpiceMenuCommandItem(ID_SYS_MENU_SEND_CTRL_ALT_END,
-                ctrlAltEndTranslated, "")); //$NON-NLS-1$
-        menu.getItems().add(new SpiceMenuSeparatorItem(id));
-        id++;
-
         SpiceMenuContainerItem changeCDItem =
                 new SpiceMenuContainerItem(id, 
ConstantsManager.getInstance().getConstants().changeCd());
         id++;
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceMenu.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceMenu.java
index cfb1345..6ffc455 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceMenu.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceMenu.java
@@ -98,11 +98,11 @@
     }
 
     private String formatSpiceMenuItem(int parentId, int itemId, String 
itemText, int itemCode) {
-        return new StringBuilder(parentId)
+        return new StringBuilder(Integer.toString(parentId))
             .append("\r").append(itemId) //$NON-NLS-1$
             .append("\r").append(itemText) //$NON-NLS-1$
             .append("\r").append(itemCode) //$NON-NLS-1$
-            .append("\n").toString(); //$NON-NLS-1$
+            .append("\r\n").toString(); //$NON-NLS-1$
     }
 
 }


--
To view, visit http://gerrit.ovirt.org/14407
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdfa982da00ae333271f60795b0c17fe602e14ef
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjeli...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to