VirtualBox

Changeset 23142 in vbox


Ignore:
Timestamp:
Sep 18, 2009 3:39:59 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: context menu when right clicking on the network icon in the status bar.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h

    r23054 r23142  
    222222    void prepareFloppyMenu();
    223223    void prepareDVDMenu();
     224    void prepareNetworkMenu();
     225    void prepareSFMenu();
    224226
    225227    void captureFloppy (QAction *aAction);
     
    322324    QMenu *mDevicesMountFloppyMenu;
    323325    QMenu *mDevicesMountDVDMenu;
    324     /* see showIndicatorContextMenu for a description of mDevicesSFMenu */
    325     /* QMenu *mDevicesSFMenu; */
     326    QMenu *mDevicesSFMenu;
     327    QMenu *mDevicesNetworkMenu;
    326328    VBoxUSBMenu *mDevicesUSBMenu;
    327329    /* VBoxSwitchMenu *mDevicesVRDPMenu; */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r23054 r23142  
    416416
    417417    mMainMenu = new QIMenu (this);
     418    mDevicesNetworkMenu = new QMenu(this);
     419    mDevicesSFMenu = new QMenu(this);
    418420
    419421    /* Machine submenu */
     
    474476    mDevicesUSBMenuSeparator = mDevicesMenu->addSeparator();
    475477
    476     /* see showIndicatorContextMenu for a description of mDevicesSFMenu */
    477     /* mDevicesSFMenu = mDevicesMenu->addMenu (QString::null); */
    478478    mDevicesMenu->addAction (mDevicesSFDialogAction);
    479479    mDevicesSFMenuSeparator = mDevicesMenu->addSeparator();
     
    664664    connect (mDevicesMountFloppyMenu, SIGNAL(aboutToShow()), this, SLOT(prepareFloppyMenu()));
    665665    connect (mDevicesMountDVDMenu, SIGNAL(aboutToShow()), this, SLOT(prepareDVDMenu()));
     666    connect (mDevicesNetworkMenu, SIGNAL(aboutToShow()), this, SLOT(prepareNetworkMenu()));
     667    connect (mDevicesSFMenu, SIGNAL(aboutToShow()), this, SLOT(prepareSFMenu()));
    666668
    667669    connect (statusBar(), SIGNAL(messageChanged (const QString &)), this, SLOT(statusTipChanged (const QString &)));
     
    19831985
    19841986        mDevicesNetworkDialogAction->setEnabled (isRunningOrPaused && count > 0);
     1987        mDevicesNetworkMenu->setEnabled (isRunningOrPaused && count > 0);
    19851988
    19861989        /* update tooltip */
     
    20792082        QString data;
    20802083        QMap <QString, QString> sfs;
     2084
     2085        mDevicesSFMenu->setEnabled (true);
    20812086
    20822087        /// @todo later: add global folders
     
    32443249}
    32453250
     3251void VBoxConsoleWnd::prepareNetworkMenu()
     3252{
     3253    mDevicesNetworkMenu->clear();
     3254    mDevicesNetworkMenu->addAction (mDevicesNetworkDialogAction);
     3255}
     3256
     3257void VBoxConsoleWnd::prepareSFMenu()
     3258{
     3259    mDevicesSFMenu->clear();
     3260    mDevicesSFMenu->addAction (mDevicesSFDialogAction);
     3261}
     3262
    32463263void VBoxConsoleWnd::statusTipChanged (const QString & /*aMes*/)
    32473264{
     
    33953412    if (ind == sf_light)
    33963413    {
    3397         /* Showing the context menu that always contains a single item is a
    3398          * bit stupid; let's better execute this item's action directly. The
    3399          * menu itself is kept just in case if we need more than one item in
    3400          * the future. */
    3401         /* mDevicesSFMenu->exec (e->globalPos()); */
    3402         if (mDevicesSFDialogAction->isEnabled())
    3403             mDevicesSFDialogAction->trigger();
     3414        if (mDevicesSFMenu->isEnabled())
     3415        {
     3416            mDevicesSFMenu->menuAction()->setData (true);
     3417            mDevicesSFMenu->exec (e->globalPos());
     3418            mDevicesSFMenu->menuAction()->setData (false);
     3419        }
    34043420    }
    34053421    else
    34063422    if (ind == net_light)
    34073423    {
    3408         if (mDevicesNetworkDialogAction->isEnabled())
    3409             mDevicesNetworkDialogAction->trigger();
     3424        if (mDevicesNetworkMenu->isEnabled())
     3425        {
     3426            mDevicesNetworkMenu->menuAction()->setData (true);
     3427            mDevicesNetworkMenu->exec (e->globalPos());
     3428            mDevicesNetworkMenu->menuAction()->setData (false);
     3429        }
    34103430    }
    34113431}
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