Changeset 642 for trunk/src/gui/itemviews/qfileiconprovider.cpp
- Timestamp:
- Mar 6, 2010, 12:32:46 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/itemviews/qfileiconprovider.cpp
r620 r642 99 99 #ifdef Q_WS_WIN 100 100 QIcon getWinIcon(const QFileInfo &fi) const; 101 #elif defined(Q_WS_PM) 102 QIcon getPmIcon(const QFileInfo &fi) const; 101 103 #elif defined(Q_WS_MAC) 102 104 QIcon getMacIcon(const QFileInfo &fi) const; … … 319 321 } 320 322 323 #elif defined(Q_WS_PM) 324 QIcon QFileIconProviderPrivate::getPmIcon(const QFileInfo &fileInfo) const 325 { 326 QIcon retIcon; 327 328 if (fileInfo.isRoot()) { 329 // Unfortunately, WinLoadFileIcon() returns a regular folder icon for 330 // paths like "C:\" (and nothing for "C:") instead of a drive icon. 331 // Getting the latter involves calling WPS object methods so we leave it 332 // out for now and let the stock Qt drive-specific icons be used instead. 333 return retIcon; 334 } 335 336 QByteArray path = QDir::toNativeSeparators( 337 QDir::cleanPath(fileInfo.absoluteFilePath())).toLocal8Bit(); 338 HPOINTER hicon = WinLoadFileIcon(path, FALSE); 339 if (hicon != NULLHANDLE) { 340 // we're requesting the system (shared) icon handle which should be 341 // always the same for the given file until the icon is changed, so use 342 // the bitmap handles as a key in the pixmap cache 343 QString key = QString(QLatin1String("qt_hicon_%1")).arg(hicon); 344 QString keyMini = key + QLatin1String("_m"); 345 QPixmap pixmap; 346 QPixmapCache::find(key, pixmap); 347 if (!pixmap.isNull()) { 348 retIcon.addPixmap(pixmap); 349 QPixmapCache::find(keyMini, pixmap); 350 if (!pixmap.isNull()) 351 retIcon.addPixmap(pixmap); 352 } else { 353 QPixmap mini; 354 retIcon = QPixmap::fromPmHPOINTER(hicon, &pixmap, &mini); 355 if (!retIcon.isNull()) { 356 // store pixmaps in the cache 357 Q_ASSERT(!pixmap.isNull() || !mini.isNull()); 358 if (!pixmap.isNull()) 359 QPixmapCache::insert(key, pixmap); 360 if (!mini.isNull()) 361 QPixmapCache::insert(keyMini, mini); 362 } 363 } 364 } 365 366 return retIcon; 367 } 368 321 369 #elif defined(Q_WS_MAC) 322 370 QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const … … 410 458 if (!icon.isNull()) 411 459 return icon; 460 #elif defined Q_WS_PM 461 if (QApplication::desktopSettingsAware()) { 462 QIcon icon= d->getPmIcon(info); 463 if (!icon.isNull()) 464 return icon; 465 } 412 466 #endif 413 467 if (info.isRoot())
Note:
See TracChangeset
for help on using the changeset viewer.