VirtualBox

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


Ignore:
Timestamp:
Jun 23, 2020 12:06:12 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9515. Adding necessary validity checks for user name/password fields.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.cpp

    r84915 r84917  
    6060{
    6161    m_pTextVisibilityButton = new QToolButton(this);
     62    m_pTextVisibilityButton->setFocusPolicy(Qt::ClickFocus);
    6263    m_pTextVisibilityButton->setAutoRaise(true);
    6364    m_pTextVisibilityButton->setCursor(Qt::ArrowCursor);
     
    127128}
    128129
     130bool UIUserNamePasswordEditor::isComplete()
     131{
     132    if (m_pUserNameLineEdit && m_pUserNameLineEdit->text().isEmpty())
     133    {
     134        // mark user name the line edit
     135        return false;
     136    }
     137    if (m_pPasswordLineEdit && m_pPasswordRepeatLineEdit)
     138    {
     139        if (m_pPasswordLineEdit->text() != m_pPasswordRepeatLineEdit->text())
     140        {
     141            // mark password line edits
     142            return false;
     143        }
     144        if (m_pPasswordLineEdit->text().isEmpty())
     145            return false;
     146    }
     147    return true;
     148}
     149
    129150void UIUserNamePasswordEditor::retranslateUi()
    130151{
     
    165186    pLabel->setBuddy(pLineEdit);
    166187    ++iRow;
     188    connect(pLineEdit, &T::textChanged, this, &UIUserNamePasswordEditor::sigSomeTextChanged);
    167189    return;
    168190}
     
    226248            m_pUserNamePasswordEditor = new UIUserNamePasswordEditor;
    227249            pMemoryLayout->addWidget(m_pUserNamePasswordEditor, 0, 0);
     250            connect(m_pUserNamePasswordEditor, &UIUserNamePasswordEditor::sigSomeTextChanged,
     251                    this, &UIWizardNewVMPageBasicInstallSetup::completeChanged);
    228252        }
    229253        if (m_pLabel)
     
    277301bool UIWizardNewVMPageBasicInstallSetup::isComplete() const
    278302{
    279     return UIWizardPage::isComplete();
    280 }
     303    if (m_pUserNamePasswordEditor)
     304        return m_pUserNamePasswordEditor->isComplete();
     305    return true;
     306}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicInstallSetup.h

    r84915 r84917  
    7070    Q_OBJECT;
    7171
     72signals:
     73
     74    /** this is emitted whenever the content of one of the line edits is changed. */
     75    void sigSomeTextChanged();
     76
    7277public:
    7378
     
    7984    QString password() const;
    8085    void setPassword(const QString &strPassword);
     86
     87    /** Returns false if username or password fields are empty, or password fields do not match. */
     88    bool isComplete();
    8189
    8290protected:
     
    115123protected:
    116124
    117 
    118 
    119125    /* Widgets: */
    120126    UIUserNamePasswordEditor *m_pUserNamePasswordEditor;
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicNameType.cpp

    r84915 r84917  
    347347int UIWizardNewVMPageBasicNameType::nextId() const
    348348{
    349     // UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
    350     // if (!pWizard || !pWizard->isUnattendedInstallEnabled())
    351     //     return UIWizardNewVM::PageHardware;
     349    UIWizardNewVM *pWizard = qobject_cast<UIWizardNewVM*>(wizard());
     350    if (!pWizard || !pWizard->isUnattendedInstallEnabled())
     351        return UIWizardNewVM::PageHardware;
    352352    return UIWizardNewVM::PageInstallSetup;
    353353}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicNameType.h

    r84890 r84917  
    117117
    118118    /* Validation stuff: */
    119     bool validatePage();
     119    virtual bool validatePage() /* override */;
    120120
    121121    /* Widgets: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicUnattended.cpp

    r84886 r84917  
    115115{
    116116    bool fISOFileOK = checkISOFile();
    117     //emit completeChanged();
    118117    return fISOFileOK;
    119118}
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasicUnattended.h

    r84886 r84917  
    9191
    9292    /* Validation stuff: */
    93     bool validatePage();
     93    virtual bool validatePage() /* override */;
    9494
    9595    /* Widgets: */
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