VirtualBox

Changeset 85454 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 24, 2020 10:50:38 AM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9722: VirtualBox Manager: Hot-load last used public key on subsequent try to create cloud console connection; Path to key being stored in extra-data.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp

    r85398 r85454  
    118118const char *UIExtraDataDefs::GUI_CloudConsoleManager_Restrictions = "GUI/CloudConsoleManager/Restrictions";
    119119const char *UIExtraDataDefs::GUI_CloudConsoleManager_Details_Expanded = "GUI/CloudConsoleManager/Details/Expanded";
     120
     121/* Cloud Console: */
     122const char *UIExtraDataDefs::GUI_CloudConsole_PublicKey_Path = "GUI/CloudConsole/PublicKey/Path";
    120123
    121124#ifdef VBOX_GUI_WITH_EXTRADATA_MANAGER_UI
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r85398 r85454  
    230230        /** Holds whether Cloud Console Manager details expanded. */
    231231        SHARED_LIBRARY_STUFF extern const char *GUI_CloudConsoleManager_Details_Expanded;
     232    /** @} */
     233
     234    /** @name Cloud Console
     235      * @{ */
     236        /** Holds Cloud Console public key path. */
     237        SHARED_LIBRARY_STUFF extern const char *GUI_CloudConsole_PublicKey_Path;
    232238    /** @} */
    233239
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r85389 r85454  
    19331933           << GUI_CloudConsoleManager_Restrictions
    19341934           << GUI_CloudConsoleManager_Details_Expanded
     1935           << GUI_CloudConsole_PublicKey_Path
    19351936           << GUI_HideDescriptionForWizards
    19361937           << GUI_HideFromManager << GUI_HideDetails
     
    30633064}
    30643065
     3066QString UIExtraDataManager::cloudConsolePublicKeyPath()
     3067{
     3068    return extraDataString(GUI_CloudConsole_PublicKey_Path);
     3069}
     3070
     3071void UIExtraDataManager::setCloudConsolePublicKeyPath(const QString &strPath)
     3072{
     3073    setExtraDataString(GUI_CloudConsole_PublicKey_Path, strPath);
     3074}
     3075
    30653076WizardMode UIExtraDataManager::modeForWizardType(WizardType type)
    30663077{
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r85389 r85454  
    450450        /** Defines whether Cloud Console Manager details @a fExpanded. */
    451451        void setCloudConsoleManagerDetailsExpanded(bool fExpanded);
     452    /** @} */
     453
     454    /** @name Cloud Console
     455      * @{ */
     456        /** Returns Cloud Console public key path. */
     457        QString cloudConsolePublicKeyPath();
     458        /** Defines Cloud Console public key @a strPath. */
     459        void setCloudConsolePublicKeyPath(const QString &strPath);
    452460    /** @} */
    453461
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r85446 r85454  
    131131    void prepare();
    132132
     133    /** Loads file contents. */
     134    void loadFileContents(const QString &strPath, bool fIgnoreErrors = false);
     135
    133136    /** Holds the text-editor instance. */
    134137    QTextEdit         *m_pTextEditor;
     
    175178    if (!strFileName.isEmpty())
    176179    {
    177         QFile file(strFileName);
    178         if (file.open(QIODevice::ReadOnly))
    179             m_pTextEditor->setPlainText(file.readAll());
    180         else
    181             msgCenter().cannotOpenPublicKeyFile(strFileName);
     180        gEDataManager->setCloudConsolePublicKeyPath(strFileName);
     181        loadFileContents(strFileName);
    182182    }
    183183}
     
    219219    /* Apply language settings: */
    220220    retranslateUi();
     221
     222    /* Load last remembered file contents: */
     223    loadFileContents(gEDataManager->cloudConsolePublicKeyPath(), true /* ignore errors */);
     224
     225    /* Resize to suitable size: */
     226    const int iMinimumHeightHint = minimumSizeHint().height();
     227    resize(iMinimumHeightHint * 2, iMinimumHeightHint);
     228}
     229
     230void UIAcquirePublicKeyDialog::loadFileContents(const QString &strPath, bool fIgnoreErrors /* = false */)
     231{
     232    if (strPath.isEmpty())
     233        return;
     234    QFile file(strPath);
     235    if (file.open(QIODevice::ReadOnly))
     236        m_pTextEditor->setPlainText(file.readAll());
     237    else if (!fIgnoreErrors)
     238        msgCenter().cannotOpenPublicKeyFile(strPath);
    221239}
    222240
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette