VirtualBox

Changeset 103610 in vbox


Ignore:
Timestamp:
Feb 29, 2024 9:35:50 AM (9 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10611: Global preferences / General page: Adding page validation; Make sure Default machine folder present if changed; Prevent Global Preferences from being accepted otherwise.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDefaultMachineFolderEditor.cpp

    r102036 r103610  
    107107                m_pLabel->setBuddy(m_pSelector);
    108108            m_pSelector->setInitialPath(uiCommon().homeFolder());
     109            connect(m_pSelector, &UIFilePathSelector::pathChanged,
     110                    this, &UIDefaultMachineFolderEditor::sigPathChanged);
    109111
    110112            m_pLayout->addWidget(m_pSelector, 0, 1);
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIDefaultMachineFolderEditor.h

    r101011 r103610  
    4545    Q_OBJECT;
    4646
     47signals:
     48
     49    /** Notify listeners about @a strPath changed. */
     50    void sigPathChanged(const QString &strPath);
     51
    4752public:
    4853
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r101717 r103610  
    2727
    2828/* Qt includes: */
     29#include <QDir>
    2930#include <QVBoxLayout>
    3031
     
    123124    if (m_pEditorVRDEAuthLibrary)
    124125        m_pEditorVRDEAuthLibrary->setValue(oldData.m_strVRDEAuthLibrary);
     126
     127    /* Revalidate: */
     128    revalidate();
    125129}
    126130
     
    154158}
    155159
     160bool UIGlobalSettingsGeneral::validate(QList<UIValidationMessage> &messages)
     161{
     162    /* Pass by default: */
     163    bool fPass = true;
     164
     165    /* Prepare message: */
     166    UIValidationMessage message;
     167
     168    /* Check for the folder presence: */
     169    if (   m_pEditorDefaultMachineFolder
     170        && !QDir(m_pEditorDefaultMachineFolder->value()).exists())
     171    {
     172        message.second << tr("Default machine folder is missing.");
     173        fPass = false;
     174    }
     175
     176    /* Serialize message: */
     177    if (!message.second.isEmpty())
     178        messages << message;
     179
     180    /* Return result: */
     181    return fPass;
     182}
     183
    156184void UIGlobalSettingsGeneral::retranslateUi()
    157185{
     
    189217            addEditor(m_pEditorDefaultMachineFolder);
    190218            pLayout->addWidget(m_pEditorDefaultMachineFolder);
     219            connect(m_pEditorDefaultMachineFolder, &UIDefaultMachineFolderEditor::sigPathChanged,
     220                    this, &UIGlobalSettingsGeneral::revalidate);
    191221        }
    192222
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h

    r101717 r103610  
    7272    virtual void saveFromCacheTo(QVariant &data) RT_OVERRIDE;
    7373
     74    /** Performs validation, updates @a messages list if something is wrong. */
     75    virtual bool validate(QList<UIValidationMessage> &messages) RT_OVERRIDE;
     76
    7477    /** Handles translation event. */
    7578    virtual void retranslateUi() RT_OVERRIDE;
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