VirtualBox

Ignore:
Timestamp:
Aug 17, 2015 12:24:04 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Port-forwarding dialog: Do not ask user for rejection twice.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsPortForwardingDlg.cpp

    r57366 r57384  
    2828# include "UIGlobalSettingsPortForwardingDlg.h"
    2929# include "UIIconPool.h"
     30# include "UIMessageCenter.h"
    3031# include "QIDialogButtonBox.h"
    3132
     
    9596void UIGlobalSettingsPortForwardingDlg::reject()
    9697{
    97     /* Discard table: */
    98     bool fPassed = m_pIPv4Table->discard() && m_pIPv6Table->discard();
    99     if (!fPassed)
     98    /* Ask user to discard table changes if necessary: */
     99    if (   (m_pIPv4Table->isChanged() || m_pIPv6Table->isChanged())
     100        && !msgCenter().confirmCancelingPortForwardingDialog(window()))
    100101        return;
    101102    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsPortForwardingDlg.cpp

    r57366 r57384  
    2727# include "UIMachineSettingsPortForwardingDlg.h"
    2828# include "UIIconPool.h"
     29# include "UIMessageCenter.h"
    2930# include "QIDialogButtonBox.h"
    3031
     
    7980void UIMachineSettingsPortForwardingDlg::reject()
    8081{
    81     /* Discard table: */
    82     bool fPassed = m_pTable->discard();
    83     if (!fPassed)
     82    /* Ask user to discard table changes if necessary: */
     83    if (   m_pTable->isChanged()
     84        && !msgCenter().confirmCancelingPortForwardingDialog(window()))
    8485        return;
    8586    /* Call to base-class: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp

    r57366 r57384  
    754754}
    755755
    756 bool UIPortForwardingTable::discard() const
    757 {
    758     /* Check if table data was changed and user do not want to loose it: */
    759     if (m_fIsTableDataChanged && !msgCenter().confirmCancelingPortForwardingDialog(window()))
    760         return false;
    761     /* True by default: */
    762     return true;
    763 }
    764 
    765756void UIPortForwardingTable::sltAddRule()
    766757{
     
    787778    sltCurrentChanged();
    788779    sltAdjustTable();
    789 }
    790 
    791 void UIPortForwardingTable::sltTableDataChanged()
    792 {
    793     m_fIsTableDataChanged = true;
    794780}
    795781
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.h

    r57366 r57384  
    135135    const UIPortForwardingDataList& rules() const;
    136136    bool validate() const;
    137     bool discard() const;
     137
     138    /** Returns whether the table data was changed. */
     139    bool isChanged() const { return m_fIsTableDataChanged; }
    138140
    139141private slots:
     
    144146    void sltDelRule();
    145147
     148    /** Marks table data as changed. */
     149    void sltTableDataChanged() { m_fIsTableDataChanged = true; }
     150
    146151    /* Handlers: Table stuff: */
    147     void sltTableDataChanged();
    148152    void sltCurrentChanged();
    149153    void sltShowTableContexMenu(const QPoint &position);
     
    160164    /* Flags: */
    161165    bool m_fAllowEmptyGuestIPs;
     166
     167    /** Holds whether the table data was changed. */
    162168    bool m_fIsTableDataChanged;
    163169
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