VirtualBox

Changeset 34822 in vbox


Ignore:
Timestamp:
Dec 8, 2010 9:19:56 AM (14 years ago)
Author:
vboxsync
Message:

FE/Qt: File-open window called from running VM device menu (cd/floppy) remembers last folder.

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

Legend:

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

    r34811 r34822  
    25632563/* Open some external medium using file open dialog
    25642564 * and temporary cache (enumerate) it in GUI inner mediums cache: */
    2565 QString VBoxGlobal::openMediumWithFileOpenDialog(VBoxDefs::MediumType mediumType, QWidget *pParent, const QString &strDefaultFolder) const
     2565QString VBoxGlobal::openMediumWithFileOpenDialog(VBoxDefs::MediumType mediumType, QWidget *pParent,
     2566                                                 const QString &strDefaultFolder /* = QString() */,
     2567                                                 bool fUseLastFolder /* = false */) const
    25662568{
    25672569    /* Initialize variables: */
    25682570    CVirtualBox vbox = vboxGlobal().virtualBox();
    2569     QString strHomeFolder = strDefaultFolder.isEmpty() ? vbox.GetHomeFolder() : strDefaultFolder;
     2571    QString strHomeFolder = fUseLastFolder && !m_strLastFolder.isEmpty() ? m_strLastFolder :
     2572                            strDefaultFolder.isEmpty() ? vbox.GetHomeFolder() : strDefaultFolder;
    25702573    QList < QPair <QString, QString> > filters;
    25712574    QStringList backends;
     
    26262629        /* Get location: */
    26272630        QString strLocation = files[0];
     2631
     2632        /* Remember absolute path: */
     2633        m_strLastFolder = QFileInfo(strLocation).absolutePath();
    26282634
    26292635        /* Open corresponding medium: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r34740 r34822  
    590590    }
    591591
    592     QString openMediumWithFileOpenDialog(VBoxDefs::MediumType mediumType, QWidget *pParent = 0, const QString &strDefaultFolder = QString()) const;
     592    QString openMediumWithFileOpenDialog(VBoxDefs::MediumType mediumType, QWidget *pParent = 0,
     593                                         const QString &strDefaultFolder = QString(), bool fUseLastFolder = false) const;
    593594
    594595    /* Returns the number of current running Fe/Qt4 main windows. */
     
    851852    QString mUserDefinedPortName;
    852853
     854    mutable QString m_strLastFolder;
     855
    853856    QPixmap mWarningIcon, mErrorIcon;
    854857
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r34728 r34822  
    12921292                usedImages << medium.GetId();
    12931293        }
    1294         /* Open VMM Dialog: */
    1295         QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(target.type, defaultMachineWindow()->machineWindow());
     1294        /* Call for file-open window: */
     1295        QString strMediumId = vboxGlobal().openMediumWithFileOpenDialog(target.type, defaultMachineWindow()->machineWindow(),
     1296                                                                        QString(), true);
    12961297        defaultMachineWindow()->machineView()->setFocus();
    12971298        if (!strMediumId.isNull())
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