VirtualBox

Changeset 29607 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 18, 2010 9:44:38 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: fix the error handling in the case all is gone wrong when adding a USB device

File:
1 edited

Legend:

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

    r29437 r29607  
    17711771{
    17721772    QString sDetails;
    1773     QString m = aDevice.GetManufacturer().trimmed();
    1774     QString p = aDevice.GetProduct().trimmed();
    1775     if (m.isEmpty() && p.isEmpty())
    1776     {
    1777         sDetails =
    1778             tr ("Unknown device %1:%2", "USB device details")
    1779             .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))
    1780             .arg (QString().sprintf ("%04hX", aDevice.GetProductId()));
    1781     }
     1773    if (aDevice.isNull())
     1774        sDetails = tr("Unknown device", "USB device details");
    17821775    else
    17831776    {
    1784         if (p.toUpper().startsWith (m.toUpper()))
    1785             sDetails = p;
     1777        QString m = aDevice.GetManufacturer().trimmed();
     1778        QString p = aDevice.GetProduct().trimmed();
     1779
     1780        if (m.isEmpty() && p.isEmpty())
     1781        {
     1782            sDetails =
     1783                tr ("Unknown device %1:%2", "USB device details")
     1784                .arg (QString().sprintf ("%04hX", aDevice.GetVendorId()))
     1785                .arg (QString().sprintf ("%04hX", aDevice.GetProductId()));
     1786        }
    17861787        else
    1787             sDetails = m + " " + p;
    1788     }
    1789     ushort r = aDevice.GetRevision();
    1790     if (r != 0)
    1791         sDetails += QString().sprintf (" [%04hX]", r);
     1788        {
     1789            if (p.toUpper().startsWith (m.toUpper()))
     1790                sDetails = p;
     1791            else
     1792                sDetails = m + " " + p;
     1793        }
     1794        ushort r = aDevice.GetRevision();
     1795        if (r != 0)
     1796            sDetails += QString().sprintf (" [%04hX]", r);
     1797    }
    17921798
    17931799    return sDetails.trimmed();
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