Ticket #191: qfileiconprovider.diff

File qfileiconprovider.diff, 1.1 KB (added by rudi, 13 years ago)

Fix for the above problem

  • qfileiconprovider.cpp

     
    339339    QByteArray path = QDir::toNativeSeparators(
    340340        QDir::cleanPath(fileInfo.absoluteFilePath())).toLocal8Bit();
    341341    HPOINTER hicon = WinLoadFileIcon(path, FALSE);
     342
     343    if (hicon == NULLHANDLE) {
     344        // QPixmap::fromPmHPOINTER fails on "SysPointers"
     345        // for now we load the icon of the root directory
     346#if     0
     347        if (fileInfo.isDir())
     348            hicon = WinQuerySysPointer(HWND_DESKTOP, SPTR_FOLDER, FALSE);
     349        else if (fileInfo.isExecutable())
     350            hicon = WinQuerySysPointer(HWND_DESKTOP, SPTR_PROGRAM, FALSE);
     351        else
     352            hicon = WinQuerySysPointer(HWND_DESKTOP, SPTR_FILE, FALSE);
     353#else
     354        hicon = WinLoadFileIcon("\\", FALSE);
     355#endif
     356    }
     357
     358
    342359    if (hicon != NULLHANDLE) {
    343360        // we're requesting the system (shared) icon handle which should be
    344361        // always the same for the given file until the icon is changed, so use