VirtualBox

Changeset 78092 in vbox


Ignore:
Timestamp:
Apr 10, 2019 2:27:06 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Marking the session username and password fields when session creation fails.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDialogPanel.h

    r78001 r78092  
    6161
    6262    /** Handles the Qt show @a pEvent. */
    63     void showEvent(QShowEvent *pEvent);
     63    void showEvent(QShowEvent *pEvent) /* override */;
    6464    /** Handles the Qt hide @a pEvent. */
    65     void hideEvent(QHideEvent *pEvent);
     65    void hideEvent(QHideEvent *pEvent) /* override */;
    6666    void addVerticalSeparator();
    6767
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp

    r78010 r78092  
    413413        appendLog("Could not find Guest Additions", FileManagerLogType_Error);
    414414        postSessionClosed();
     415        if (m_pSessionPanel)
     416            m_pSessionPanel->markForError(true);
    415417        return;
    416418    }
     
    418420    {
    419421        appendLog("No user name is given", FileManagerLogType_Error);
    420         return;
    421     }
    422     createSession(strUserName, strPassword);
     422        if (m_pSessionPanel)
     423            m_pSessionPanel->markForError(true);
     424        return;
     425    }
     426    if (m_pSessionPanel)
     427        m_pSessionPanel->markForError(!createSession(strUserName, strPassword));
    423428}
    424429
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerOperationsPanel.cpp

    r77528 r78092  
    338338        return;
    339339
     340    QPalette mPalette = palette();
     341    mPalette.setColor(QPalette::Window, qApp->palette().color(QPalette::Light));
     342    setPalette(mPalette);
    340343
    341344    m_pScrollArea = new QScrollArea;
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerSessionPanel.cpp

    r77528 r78092  
    4646    /** Makes sure certain widgets are enabled so that a guest session can be created. */
    4747    void switchSessionCloseMode();
     48    void markForError(bool fMarkForError);
    4849
    4950protected:
     
    5758    void sltCreateButtonClick();
    5859    void sltShowHidePassword(bool flag);
     60    void sltHandleTextChanged(const QString &strText);
    5961
    6062private:
     
    6769    QHBoxLayout  *m_pMainLayout;
    6870    QCheckBox    *m_pShowPasswordCheckBox;
     71    QColor        m_defaultBaseColor;
     72    QColor        m_errorBaseColor;
     73    bool          m_fMarkedForError;
    6974};
    7075
     
    8287    , m_pMainLayout(0)
    8388    , m_pShowPasswordCheckBox(0)
     89    , m_fMarkedForError(0)
    8490{
    8591    prepareWidgets();
     
    97103        m_pMainLayout->addWidget(m_pUserNameEdit, 2);
    98104        m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIFileManager", "User Name"));
     105        m_defaultBaseColor = m_pUserNameEdit->palette().color(QPalette::Base);
     106        m_errorBaseColor = QColor(m_defaultBaseColor.red(),
     107                                  0.5 * m_defaultBaseColor.green(),
     108                                  0.5 * m_defaultBaseColor.blue());
     109        connect(m_pUserNameEdit, &QILineEdit::textChanged,
     110                this, &UIGuestSessionCreateWidget::sltHandleTextChanged);
    99111    }
    100112
     
    105117        m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIFileManager", "Password"));
    106118        m_pPasswordEdit->setEchoMode(QLineEdit::Password);
     119        connect(m_pPasswordEdit, &QILineEdit::textChanged,
     120                this, &UIGuestSessionCreateWidget::sltHandleTextChanged);
    107121    }
    108122
     
    148162    else
    149163        m_pPasswordEdit->setEchoMode(QLineEdit::Password);
     164}
     165
     166void UIGuestSessionCreateWidget::sltHandleTextChanged(const QString &strText)
     167{
     168    Q_UNUSED(strText);
     169    markForError(false);
    150170}
    151171
     
    213233}
    214234
     235void UIGuestSessionCreateWidget::markForError(bool fMarkForError)
     236{
     237    if (m_fMarkedForError == fMarkForError)
     238        return;
     239    m_fMarkedForError = fMarkForError;
     240
     241        if (m_pUserNameEdit)
     242        {
     243            QPalette mPalette = m_pUserNameEdit->palette();
     244            if (m_fMarkedForError)
     245                mPalette.setColor(QPalette::Base, m_errorBaseColor);
     246            else
     247                mPalette.setColor(QPalette::Base, m_defaultBaseColor);
     248            m_pUserNameEdit->setPalette(mPalette);
     249        }
     250        if (m_pPasswordEdit)
     251        {
     252            QPalette mPalette = m_pPasswordEdit->palette();
     253            if (m_fMarkedForError)
     254                mPalette.setColor(QPalette::Base, m_errorBaseColor);
     255            else
     256                mPalette.setColor(QPalette::Base, m_defaultBaseColor);
     257            m_pPasswordEdit->setPalette(mPalette);
     258        }
     259}
     260
    215261
    216262/*********************************************************************************************************************************
     
    240286{
    241287    return "SessionPanel";
     288}
     289
     290void UIFileManagerSessionPanel::markForError(bool fMarkForError)
     291{
     292    if (m_pSessionCreateWidget)
     293        m_pSessionCreateWidget->markForError(fMarkForError);
    242294}
    243295
     
    268320}
    269321
     322void UIFileManagerSessionPanel::showEvent(QShowEvent *pEvent)
     323{
     324    markForError(false);
     325    UIDialogPanel::showEvent(pEvent);
     326}
     327
    270328#include "UIFileManagerSessionPanel.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerSessionPanel.h

    r77528 r78092  
    4747    /** @} */
    4848    virtual QString panelName() const /* override */;
     49    void markForError(bool fMarkForError);
    4950
    5051protected:
     
    5354    virtual void prepareConnections() /* override */;
    5455    void retranslateUi();
     56    void showEvent(QShowEvent *pEvent) /* override */;
    5557
    5658private:
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