File indexing completed on 2023-12-03 07:46:04
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2000 Carsten Pfeiffer <pfeiffer@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KURLPIXMAPPROVIDER_H 0009 #define KURLPIXMAPPROVIDER_H 0010 0011 #include "kiowidgets_export.h" 0012 #include <KPixmapProvider> 0013 0014 /** 0015 * @class KUrlPixmapProvider kurlpixmapprovider.h <KUrlPixmapProvider> 0016 * 0017 * Implementation of KPixmapProvider. 0018 * 0019 * Uses KMimeType::pixmapForURL() to resolve icons. 0020 * 0021 * Instantiate this class and supply it to the desired class, e.g. 0022 * \code 0023 * KHistoryComboBox *combo = new KHistoryComboBox(this); 0024 * combo->setPixmapProvider(new KUrlPixmapProvider); 0025 * [...] 0026 * \endcode 0027 * 0028 * @short Resolves pixmaps for URLs 0029 * @author Carsten Pfeiffer <pfeiffer@kde.org> 0030 * 0031 * @deprecated since 5.66, use KIO::iconNameForUrl to get the icon name and use QIcon::fromTheme 0032 */ 0033 #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 66) && KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 66) 0034 0035 class KIOWIDGETS_EXPORT KUrlPixmapProvider : public KPixmapProvider 0036 { 0037 public: 0038 /** 0039 * Creates a new url pixmap provider. 0040 */ 0041 KIOWIDGETS_DEPRECATED_VERSION(5, 66, "Use KIO::iconNameForUrl to get the icon name and use QIcon::fromTheme") 0042 KUrlPixmapProvider(); 0043 0044 /** 0045 * Destroys the url pixmap provider. 0046 */ 0047 KIOWIDGETS_DEPRECATED_VERSION(5, 66, "Use KIO::iconNameForUrl to get the icon name and use QIcon::fromTheme") 0048 ~KUrlPixmapProvider() override; 0049 0050 /** 0051 * Returns a pixmap for @p url with size @p size. 0052 * 0053 * Uses KMimeType::pixmapForURL(). 0054 * 0055 * @param url the URL to fetch a pixmap for 0056 * @param size the size of the pixmap in pixels, or 0 for default. 0057 * @return the resulting pixmap 0058 * @see KIconLoader::StdSizes 0059 */ 0060 KIOWIDGETS_DEPRECATED_VERSION(5, 66, "Use KIO::iconNameForUrl to get the icon name and use QIcon::fromTheme") 0061 QPixmap pixmapFor(const QString &url, int size = 0) override; 0062 0063 protected: 0064 void virtual_hook(int id, void *data) override; 0065 0066 private: 0067 class Private; 0068 Private *const d; 0069 }; 0070 0071 #endif 0072 0073 #endif // KURLPIXMAPPROVIDER_H