VirtualBox

Changeset 35587 in vbox


Ignore:
Timestamp:
Jan 17, 2011 2:21:04 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69482
Message:

FE/Qt: New VM Wizard: Warn the user if the machine folder can not be created due to lack of permissions.

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

Legend:

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

    r35274 r35587  
    19721972}
    19731973
     1974void VBoxProblemReporter::warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName)
     1975{
     1976    message(pParent ? pParent : mainWindowShown(), Critical,
     1977            tr("<p>Cannot create the machine folder:</p>"
     1978               "<p><b>%1</b></p>"
     1979               "<p>Please check you have the permissions required to do so.</p>").arg(strFolderName));
     1980}
     1981
    19741982/**
    19751983 *  @return @c true if the user has selected to continue without attaching a
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h

    r35273 r35587  
    323323    bool confirmVMReset (QWidget *aParent);
    324324
     325    void warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName);
    325326    bool confirmHardDisklessMachine (QWidget *aParent);
    326327
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r35234 r35587  
    266266{
    267267    /* Cleanup old folder if present: */
    268     cleanupMachineFolder();
     268    bool fMachineFolderDeleted = cleanupMachineFolder();
     269    if (!fMachineFolderDeleted)
     270    {
     271        vboxProblem().warnAboutCannotCreateMachineFolder(this, m_strMachineFolder);
     272        return false;
     273    }
     274
    269275    /* Get VBox: */
    270276    CVirtualBox vbox = vboxGlobal().virtualBox();
     
    276282    /* Get machine directory: */
    277283    QString strMachineFolder = fileInfo.absolutePath();
     284
    278285    /* Try to create this machine directory (and it's predecessors): */
    279286    bool fMachineFolderCreated = QDir().mkpath(strMachineFolder);
     287    if (!fMachineFolderCreated)
     288    {
     289        vboxProblem().warnAboutCannotCreateMachineFolder(this, strMachineFolder);
     290        return false;
     291    }
     292
    280293    /* Initialize machine dir value: */
    281     if (fMachineFolderCreated)
    282         m_strMachineFolder = strMachineFolder;
    283     /* Return creation result: */
    284     return fMachineFolderCreated;
     294    m_strMachineFolder = strMachineFolder;
     295    return true;
    285296}
    286297
     
    289300    /* Return if machine folder was NOT set: */
    290301    if (m_strMachineFolder.isEmpty())
    291         return false;
     302        return true;
    292303    /* Try to cleanup this machine directory (and it's predecessors): */
    293304    bool fMachineFolderRemoved = QDir().rmpath(m_strMachineFolder);
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette