Changeset 607


Ignore:
Timestamp:
Feb 26, 2010, 2:25:56 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Select the correct icon for the drive letter in standard file dialogs depending on the drive type (floppy, hard disk etc) [patch by rudi].

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/global/qt_os2.h

    r564 r607  
    4545#define QT_OS2_H
    4646
    47 #define OS2EMX_PLAIN_CHAR
     47#if defined(__EMX__)
     48# define OS2EMX_PLAIN_CHAR
     49#endif
    4850#define INCL_BASE
     51#define INCL_DOSDEVIOCTL
    4952#define INCL_PM
    5053#include <os2.h>
  • trunk/src/gui/itemviews/qfileiconprovider.cpp

    r561 r607  
    5252#  include <commctrl.h>
    5353#  include <objbase.h>
     54#elif defined(Q_WS_PM)
     55#  include <qt_os2.h>
    5456#elif defined(Q_WS_MAC)
    5557#  include <private/qt_cocoa_helpers_mac_p.h>
     
    429431        }
    430432    }
     433#elif defined(Q_WS_PM)
     434    {
     435        UCHAR ioc_parm[2];
     436        BIOSPARAMETERBLOCK bpb;
     437        ioc_parm[0] = 0;
     438        ioc_parm[1] = info.absoluteFilePath().at(0).cell() - 'A';
     439        APIRET arc = DosDevIOCtl((HFILE) - 1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
     440                                 ioc_parm, sizeof(ioc_parm), NULL,
     441                                 &bpb, sizeof(bpb), NULL);
     442
     443        if (arc == ERROR_NOT_SUPPORTED)
     444            return d->getIcon(QStyle::SP_DriveNetIcon);
     445
     446        if (arc == NO_ERROR && bpb.bDeviceType != DEVTYPE_FIXED) {
     447            if (bpb.fsDeviceAttr & 0x10)    // floppy format
     448                return d->getIcon(QStyle::SP_DriveFDIcon);
     449            if (!(bpb.fsDeviceAttr & 0x08))     // partitionable removable
     450                return d->getIcon(QStyle::SP_DriveCDIcon);
     451        }
     452
     453        return d->getIcon(QStyle::SP_DriveHDIcon);
     454    }
    431455#else
    432456    return d->getIcon(QStyle::SP_DriveHDIcon);
Note: See TracChangeset for help on using the changeset viewer.