Index: /trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp	(revision 86895)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp	(revision 86896)
@@ -25,4 +25,5 @@
 #include <QStandardPaths>
 #include <QStatusBar>
+#include <QStyle>
 #include <QTextEdit>
 #ifndef VBOX_WS_WIN
@@ -34,4 +35,5 @@
 #include "QIDialogButtonBox.h"
 #include "QIFileDialog.h"
+#include "QIRichTextLabel.h"
 #include "UIActionPoolManager.h"
 #include "UICloudConsoleManager.h"
@@ -40,4 +42,5 @@
 #include "UICloudProfileManager.h"
 #include "UIDesktopServices.h"
+#include "UIDesktopWidgetWatchdog.h"
 #include "UIErrorString.h"
 #include "UIExtraDataManager.h"
@@ -118,4 +121,7 @@
 private slots:
 
+    /** Handles help-viewer @a link click. */
+    void sltHandleHelpViewerLinkClick(const QUrl &link);
+
     /** Handles abstract @a pButton click. */
     void sltHandleButtonClicked(QAbstractButton *pButton);
@@ -142,4 +148,6 @@
     /** Returns a list of default key folders. */
     QStringList defaultKeyFolders() const;
+    /** Returns a list of key generation tools. */
+    QStringList keyGenerationTools() const;
 
     /** Loads file contents.
@@ -147,4 +155,6 @@
     bool loadFileContents(const QString &strPath, bool fIgnoreErrors = false);
 
+    /** Holds the help-viewer instance. */
+    QIRichTextLabel   *m_pHelpViewer;
     /** Holds the text-editor instance. */
     QTextEdit         *m_pTextEditor;
@@ -160,4 +170,5 @@
 UIAcquirePublicKeyDialog::UIAcquirePublicKeyDialog(QWidget *pParent /* = 0 */)
     : QIWithRetranslateUI<QDialog>(pParent)
+    , m_pHelpViewer(0)
     , m_pTextEditor(0)
     , m_pButtonBox(0)
@@ -170,4 +181,13 @@
 {
     return m_pTextEditor->toPlainText();
+}
+
+void UIAcquirePublicKeyDialog::sltHandleHelpViewerLinkClick(const QUrl &link)
+{
+    /* Parse the link meta and use it to get tool path to copy to clipboard: */
+    bool fOk = false;
+    const uint uToolNumber = link.toString().section('#', 1, 1).toUInt(&fOk);
+    if (fOk)
+        QApplication::clipboard()->setText(keyGenerationTools().value(uToolNumber), QClipboard::Clipboard);
 }
 
@@ -204,4 +224,37 @@
 {
     setWindowTitle(tr("Public key"));
+
+    /* Generating help-viewer text: */
+    QStringList folders;
+    foreach (const QString &strFolder, defaultKeyFolders())
+        folders << QString("&nbsp;%1").arg(strFolder);
+    const QStringList initialTools = keyGenerationTools();
+    QStringList tools;
+    foreach (const QString &strTool, initialTools)
+        tools << QString("&nbsp;<a href=#%1><img src='manager://copy'/></a>&nbsp;&nbsp;%2")
+                         .arg(initialTools.indexOf(strTool))
+                         .arg(strTool);
+#ifdef VBOX_WS_WIN
+    m_pHelpViewer->setText(tr("We haven't found public key id_rsa[.pub] in suitable locations. "
+                              "If you have one, please put it under one of those folders OR copy "
+                              "content to the edit box below:<br><br>"
+                              "%1<br><br>"
+                              "If you don't have one, please consider using one of the following "
+                              "tools to generate it:<br><br>"
+                              "%2")
+                           .arg(folders.join("<br>"))
+                           .arg(tools.join("<br>")));
+#else
+    m_pHelpViewer->setText(tr("We haven't found public key id_rsa[.pub] in suitable location. "
+                              "If you have one, please put it under specified folder OR copy "
+                              "content to the edit box below:<br><br>"
+                              "%1<br><br>"
+                              "If you don't have one, please consider using the following "
+                              "tool to generate it:<br><br>"
+                              "%2")
+                           .arg(folders.join("<br>"))
+                           .arg(tools.join("<br>")));
+#endif
+
     m_pTextEditor->setPlaceholderText(tr("Paste public key"));
     m_pButtonBox->button(QDialogButtonBox::Open)->setText(tr("Browse"));
@@ -219,5 +272,5 @@
     /* Resize to suitable size: */
     const int iMinimumHeightHint = minimumSizeHint().height();
-    resize(iMinimumHeightHint * 2, iMinimumHeightHint);
+    resize(iMinimumHeightHint * 1.618, iMinimumHeightHint);
 }
 
@@ -228,4 +281,20 @@
     if (pLayout)
     {
+        /* Create help-viewer: */
+        m_pHelpViewer = new QIRichTextLabel(this);
+        if (m_pHelpViewer)
+        {
+            /* Prepare icon and size as well: */
+            const QIcon icon = UIIconPool::iconSet(":/file_manager_copy_16px.png");
+            const int iMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) * 2 / 3;
+
+            /* Configure help-viewer: */
+            m_pHelpViewer->setHidden(true);
+            m_pHelpViewer->setMinimumTextWidth(gpDesktop->screenGeometry(window()).width() / 5);
+            m_pHelpViewer->registerPixmap(icon.pixmap(window()->windowHandle(), QSize(iMetric, iMetric)), "manager://copy");
+            connect(m_pHelpViewer, &QIRichTextLabel::sigLinkClicked, this, &UIAcquirePublicKeyDialog::sltHandleHelpViewerLinkClick);
+            pLayout->addWidget(m_pHelpViewer, 2);
+        }
+
         /* Prepare text-editor: */
         m_pTextEditor = new QTextEdit(this);
@@ -233,5 +302,5 @@
         {
             connect(m_pTextEditor, &QTextEdit::textChanged, this, &UIAcquirePublicKeyDialog::sltRevalidate);
-            pLayout->addWidget(m_pTextEditor);
+            pLayout->addWidget(m_pTextEditor, 1);
         }
 
@@ -284,4 +353,8 @@
             fFileLoaded = loadFileContents(strAbsoluteFilePathWeNeed, true /* ignore errors */);
     }
+
+    /* Show/hide help-viewer depending on
+     * whether we were able to load the file: */
+    m_pHelpViewer->setHidden(fFileLoaded);
 }
 
@@ -296,4 +369,18 @@
     folders << QDir::toNativeSeparators(QDir(QDir::homePath()).absoluteFilePath(".ssh"));
     return folders;
+}
+
+QStringList UIAcquirePublicKeyDialog::keyGenerationTools() const
+{
+    QStringList tools;
+#ifdef VBOX_WS_WIN
+    // WORKAROUND:
+    // There is additional key generation tool on Windows:
+    tools << "puttygen.exe";
+    tools << "ssh-keygen.exe -m PEM -t rsa -b 4096";
+#else
+    tools << "ssh-keygen -m PEM -t rsa -b 4096";
+#endif
+    return tools;
 }
 
