VirtualBox

Changeset 31563 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 11, 2010 12:14:50 PM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: 1900: Create GUI support for NAT forwarding: Added cancel handler for altered port-forwarding table.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp

    r31535 r31563  
    23542354}
    23552355
     2356bool VBoxProblemReporter::confirmCancelingPortForwardingDialog(QWidget *pParent) const
     2357{
     2358    return messageOkCancel(pParent, Question,
     2359        tr("<p>Canceling the port forwarding configuration process will cause "
     2360           "any unsaved changes to be lost. Do you really wish to do so?</p>"));
     2361}
     2362
    23562363void VBoxProblemReporter::showRuntimeError (const CConsole &aConsole, bool fatal,
    23572364                                            const QString &errorID,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r31535 r31563  
    370370
    371371    void warnAboutIncorrectPort(QWidget *pParent) const;
     372    bool confirmCancelingPortForwardingDialog(QWidget *pParent) const;
    372373
    373374    void showRuntimeError (const CConsole &console, bool fatal,
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsPortForwardingDlg.cpp

    r31548 r31563  
    414414                                                                 const UIPortForwardingDataList &rules)
    415415    : QIWithRetranslateUI<QIDialog>(pParent)
     416    , fIsTableDataChanged(false)
    416417    , m_pTableView(0)
    417418    , m_pToolBar(0)
     
    479480    /* Create model: */
    480481    m_pModel = new UIPortForwardingModel(this, rules);
     482    connect(m_pModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(sltTableDataChanged()));
     483    connect(m_pModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(sltTableDataChanged()));
     484    connect(m_pModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(sltTableDataChanged()));
    481485    m_pTableView->setModel(m_pModel);
    482486
     
    568572}
    569573
     574/* Table data change handler: */
     575void VBoxVMSettingsPortForwardingDlg::sltTableDataChanged()
     576{
     577    fIsTableDataChanged = true;
     578}
     579
    570580/* Table index-change handler: */
    571581void VBoxVMSettingsPortForwardingDlg::sltCurrentChanged()
     
    636646    /* Base class accept() slot: */
    637647    QIWithRetranslateUI<QIDialog>::accept();
     648}
     649
     650void VBoxVMSettingsPortForwardingDlg::reject()
     651{
     652    /* Check if table data was changed: */
     653    if (fIsTableDataChanged && !vboxProblem().confirmCancelingPortForwardingDialog(this))
     654        return;
     655    /* Base class reject() slot: */
     656    QIWithRetranslateUI<QIDialog>::reject();
    638657}
    639658
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/vm/VBoxVMSettingsPortForwardingDlg.h

    r31535 r31563  
    111111
    112112    /* Table slots: */
     113    void sltTableDataChanged();
    113114    void sltCurrentChanged();
    114115    void sltShowTableContexMenu(const QPoint &position);
     
    117118    /* Dialog slots: */
    118119    void accept();
     120    void reject();
    119121
    120122private:
     
    125127    /* Event filter: */
    126128    bool eventFilter(QObject *pObj, QEvent *pEvent);
     129
     130    /* Flags: */
     131    bool fIsTableDataChanged;
    127132
    128133    /* 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