VirtualBox

Changeset 85452 in vbox


Ignore:
Timestamp:
Jul 24, 2020 9:12:40 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
139498
Message:

FE/Qt: bugref:9663. Handling the virtual harddisk type change correctly in file path selector of the expert mode new disk wizard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r82968 r85452  
    4444#include "CSystemProperties.h"
    4545
     46/* Other VBox includes: */
     47#include <iprt/path.h>
    4648
    4749UIWizardNewVDPageExpert::UIWizardNewVDPageExpert(const QString &strDefaultName, const QString &strDefaultPath, qulonglong uDefaultSize)
     
    211213    {
    212214        QFileInfo fileInfo(m_pLocationEditor->text());
    213         if (fileInfo.completeSuffix() != m_strDefaultExtension)
    214         {
    215             QString strNewFilePath = QString("%1/%2.%3").arg(fileInfo.absoluteDir().absolutePath()).arg(fileInfo.fileName()).arg(m_strDefaultExtension);
     215        QString strSuffix = fileInfo.suffix();
     216        if (strSuffix != m_strDefaultExtension)
     217        {
     218            /* QFileInfo::baseName() removes completeSuffix() from the fileName(), which is everthing coming after the 'first'
     219               dot. I want to allow disk names with dots in it. So I remove the string from fileName()
     220               that comes after the 'last' dot: */
     221            QByteArray strFileName = fileInfo.fileName().toUtf8();
     222            RTPathStripSuffix(strFileName.data());
     223            QString strNewFilePath = QString("%1/%2.%3")
     224                .arg(fileInfo.absoluteDir().absolutePath())
     225                .arg(QString(strFileName))
     226                .arg(m_strDefaultExtension);
    216227            m_pLocationEditor->setText(strNewFilePath);
    217228        }
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