Subject: 'Session preferences' window 'Session' tab content is too tall for small displays

From: René Genz <[email-masked]>
Date: Thu, 27 Aug 2015 00:34:54 +0200

Package: x2goclient
Version: 4.0.5.0

This issue can be observed on GNU/Linux, Mac OS X, and Windows version of x2goclient.
I was using:
- Mac OS X 10.10
- Fedora 22
- Windows 7

Steps to reproduce:
0. start X2Go client on a computer with a small display size (1280x800 px)
1. create a new X2Go session profile
2. set: Session tab -- '[x] use Proxy server for SSH connection'
3. buttons not displayed: [OK] [Cancel] [Defaults]

On Mac OS X and Windows the 'Session preferences' window does not use the minimal size possible.
On GNU/Linux the 'Session preferences' window uses the minimal size possible.

However, for all three operating systems the 'Session preferences' window does not resize automatically to the minimum size possible.

My Mac OS X notebook has a 13" display with a resolution of 1280x800 px.
Screen width is no issue. Screen height is the issue with x2goclient.
On Mac OS X the 'Session preferences - ...' window height is 900 px by default.
So the buttons '[OK] [Cancel] [Apply]' at the bottom of the x2goclient window are not displayed by default.

On Mac OS X:
- after moving the 'Session preferences' window a little bit it resizes, so buttons are displayed.
- resizing the window does resize it automatically, you have to move the window.
- if you set '[x] use Proxy server for SSH connection' in the Session tab and maximize the window with the green green [+] button (hold down alt key) in the upper left corner of the window the content of the "Proxy server" section is garbled
On Windows and GNU/Linux the 'Session preferences' window is not resized after moving.

By hiding the 'Session' tab and recompiling I verified the culprit:
Session tab -- '[x] use Proxy server for SSH connection'
This expands a big menu.

I thought of the following solutions:
- define minimum/maximum size of the 'Session preferences' window in height; on Mac OS X the windows minimum height is as small as 693 px
-> if
Session tab -- '[x] use Proxy server for SSH connection'
is set, the minimum height will get much larger; doh!

- add automatic resizing after 'Use Proxy server' check box is toggled with:
http://stackoverflow.com/questions/13942616/qt-resize-window-after-widget-remove/30472749#30472749
-> if the menu is extended, the required size to display all is still too small; doh!

- introduce scroll bars; so the buttons at the button of the 'Session preferences' window are displayed and you can scroll the content, if necessary
-> I could not get this to work; after several days I concluded my knowledge is insufficient for this task

- in the 'Session preferences' window in the 'Session' tab move the sections 'Server' and 'Session type' to an additional tab, dubbed 'Authentication'
-> I hacked the source and it worked out. :)
The files I created/edited have been attached as an archive.

I commented the lines in 'editconnectiondialog.*' in order to make sure to not forget any line.
Maybe some 'include headers' are not required anymore and can be removed.

Note, in the file:
x2goclient/src/sessionwidget.cpp
I replaced:
     lKey=new QLabel ( tr ( "Use RSA/DSA key for ssh connection:" ),sgb );
with:
     lKey=new QLabel ( tr ( "Use RSA/DSA key for SSH connection:" ),sgb );
because in other lines it is written SSH as well, for example:
     cbAutoLogin=new QCheckBox(tr("Try auto login (via SSH Agent or default SSH key)"),sgb);
OR
     cbProxy=new QCheckBox(tr("Use Proxy server for SSH connection"),sgb);

In the file:
x2goclient/src/sessionwidget.cpp
the section:
--8<--
#ifndef Q_WS_HILDON
     openKey=new QPushButton (
         QIcon ( mainWindow->iconsPath (
                     "/32x32/file-open.png" ) ),
         QString::null,sgb );
     QVBoxLayout *sgbLay = new QVBoxLayout ( sgb );
#else
     QPushButton* openKey=new QPushButton (
         QIcon ( mainWindow->iconsPath ( "/16x16/file-open.png" ) ),
         QString::null,sgb );
     QVBoxLayout *sgbLay = new QVBoxLayout ();
#endif
--8<--
urges me to ask: why 32x32 in one branch and 16x16 in the other?

With the changes in place I compiled the source on Mac OS X.
Everything seems to work just fine.
However, when opening the 'Session preferences' window of new or existing session you can see messages in terminal:
---8<---
$ ./macbuild.sh && client_build/x2goclient.app/Contents/MacOS/x2goclient
... snipping compilation output...
~/x2go/x2goclient
x2go-INFO-1> "Starting X2Go Client..."
x2go-WARNING-1> "English language requested, not loading translator."
x2go-WARNING-1> "English language requested, not loading translator."
x2go-INFO-3> "Started X2Go Client."

Object::connect: No such slot AuthenticationWidget::slot_emitSettings()
Object::connect: No such slot AuthenticationWidget::slot_emitSettings()
Object::connect: No such signal SessionWidget::directRDP(bool)
Object::connect: No such signal SessionWidget::settingsChanged(QString,QString,QString)

2015-08-26 00:47:08.242 x2goclient[6378:72130] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
x2go-INFO-6> "Closing X2Go Client ..."
x2go-INFO-7> "Finished X2Go Client closing hooks."
---8<---

With vanilla sources the output is like:
---8<---
$ ./macbuild.sh && client_build/x2goclient.app/Contents/MacOS/x2goclient
... snipping compilation output...
~/x2go/x2goclient
x2go-INFO-1> "Starting X2Go Client..."
x2go-WARNING-1> "English language requested, not loading translator."
x2go-WARNING-1> "English language requested, not loading translator."
x2go-INFO-3> "Started X2Go Client."

Object::connect: No such slot SessionWidget::slot_emitSettings()
Object::connect: No such slot SessionWidget::slot_emitSettings()
Object::connect: No such signal SessionWidget::directRDP(bool)
Object::connect: No such signal SessionWidget::settingsChanged(QString,QString,QString)
2015-08-26 00:43:16.741 x2goclient[6023:70742] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
x2go-INFO-6> "Closing X2Go Client ..."
x2go-INFO-7> "Finished X2Go Client closing hooks."
---8<---

On GNU/Linux the vanilla X2Go client does not print anything in terminal. Hence I did not try with my changes.

-- 
Kind regards,
René