2655 |
2655 |
2656 @param url URL to get icon for (QUrl) |
2656 @param url URL to get icon for (QUrl) |
2657 @return icon for the URL (QIcon) |
2657 @return icon for the URL (QIcon) |
2658 """ |
2658 """ |
2659 icon = HelpWindow.__getWebIcon(url) |
2659 icon = HelpWindow.__getWebIcon(url) |
|
2660 if icon.isNull(): |
|
2661 hostUrl = QUrl() |
|
2662 hostUrl.setScheme(url.scheme()) |
|
2663 hostUrl.setHost(url.host()) |
|
2664 icon = HelpWindow.__getWebIcon(hostUrl) |
2660 |
2665 |
2661 if icon.isNull(): |
2666 if icon.isNull(): |
2662 pixmap = QWebSettings.webGraphic(QWebSettings.DefaultFrameIconGraphic) |
2667 pixmap = QWebSettings.webGraphic(QWebSettings.DefaultFrameIconGraphic) |
2663 if pixmap.isNull(): |
2668 if pixmap.isNull(): |
2664 pixmap = UI.PixmapCache.getPixmap("defaultIcon.png") |
2669 pixmap = UI.PixmapCache.getPixmap("defaultIcon.png") |
2673 Private static method to fetch the icon for a URL. |
2678 Private static method to fetch the icon for a URL. |
2674 |
2679 |
2675 @param url URL to get icon for (QUrl) |
2680 @param url URL to get icon for (QUrl) |
2676 @return icon for the URL (QIcon) |
2681 @return icon for the URL (QIcon) |
2677 """ |
2682 """ |
|
2683 scheme = url.scheme() |
|
2684 if scheme in ["eric", "about"]: |
|
2685 return UI.PixmapCache.getIcon("ericWeb.png") |
|
2686 elif scheme == "qthelp": |
|
2687 return UI.PixmapCache.getIcon("qthelp.png") |
|
2688 elif scheme == "file": |
|
2689 return UI.PixmapCache.getIcon("fileMisc.png") |
|
2690 elif scheme == "abp": |
|
2691 return UI.PixmapCache.getIcon("adBlockPlus.png") |
|
2692 |
2678 icon = QWebSettings.iconForUrl(url) |
2693 icon = QWebSettings.iconForUrl(url) |
2679 if icon.isNull(): |
2694 if icon.isNull(): |
2680 # try again |
2695 # try again |
2681 QThread.usleep(10) |
2696 QThread.usleep(10) |
2682 icon = QWebSettings.iconForUrl(url) |
2697 icon = QWebSettings.iconForUrl(url) |