Changeset 829
- Timestamp:
- Nov 19, 2010, 1:29:47 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/itemviews/qfileiconprovider.cpp
r769 r829 340 340 QDir::cleanPath(fileInfo.absoluteFilePath())).toLocal8Bit(); 341 341 HPOINTER hicon = WinLoadFileIcon(path, FALSE); 342 if (hicon == NULLHANDLE) { 343 // WinLoadFileIcon() fails on non-existing paths but we still want a 344 // system icon for it to be "in tune" with other icons. One known case 345 // is a directory on an NDFS SMB multi-resource share that links to a 346 // remote CD-ROM drive with no disk in it. This actually represents a 347 // more common problem when an icon for a non-existent path is 348 // requested. We will solve it by providing an icon of a known-to-exist 349 // path element instead. In order to differentiate between a 350 // non-existent folder and file we use a return code from 351 // DosQueryPathInfo() which appears to be ERROR_PATH_NOT_FOUND for the 352 // SMB multi-resource case and ERROR_FILE_NOT_FOUND otherwise. Note that 353 // a calling app may actually already know if it's a file or a directory 354 // from the listing of a parent directory (or we could do such a listing 355 // here) but it looks like too much hassle to use this approach here. 356 FILESTATUS3 info; 357 APIRET arc = DosQueryPathInfo(path, FIL_STANDARD, &info, sizeof(info)); 358 if (arc == ERROR_PATH_NOT_FOUND) { 359 // a known-to-exist directory 360 hicon = WinLoadFileIcon("\\", FALSE); 361 } else { 362 // a known-to-exist file 363 static char kernelFilePath[] = "?:\\OS2KRNL"; 364 if (kernelFilePath[0] == '?') { 365 ULONG bootDrive = 0; 366 DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, 367 (PVOID)&bootDrive, sizeof(bootDrive)); 368 kernelFilePath[0] = bootDrive + 'A' - 1; 369 } 370 hicon = WinLoadFileIcon(kernelFilePath, FALSE); 371 } 372 } 342 373 if (hicon != NULLHANDLE) { 343 374 // we're requesting the system (shared) icon handle which should be
Note:
See TracChangeset
for help on using the changeset viewer.