add more spacing
[personal-kdebase.git] / apps / konqueror / src / konqpixmapprovider.h
blob48313ebe16a27edbe134c528f8d2b7db18591fe1
1 /* This file is part of the KDE project
2 Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #ifndef KONQ_PIXMAPPROVIDER_H
21 #define KONQ_PIXMAPPROVIDER_H
23 #include "konqprivate_export.h"
25 #include <kurl.h>
26 #include <kpixmapprovider.h>
27 #include "favicon_interface.h"
29 #include <QtCore/QMap>
30 #include <QtGui/QPixmap>
32 class KConfigGroup;
33 class KConfig;
35 // Ideally OrgKdeFavIconInterface should be exported with KONQUERORPRIVATE_EXPORT, but the cmake macro
36 // doesn't allow that. Doesn't seem to be a problem though, at least on linux, since the methods are all inline.
38 class KONQUERORPRIVATE_EXPORT KonqPixmapProvider : public org::kde::FavIcon, virtual public KPixmapProvider
40 Q_OBJECT
41 public:
42 static KonqPixmapProvider * self();
44 virtual ~KonqPixmapProvider();
46 /**
47 * Looks up a pixmap for @p url. Uses a cache for the iconname of url.
49 virtual QPixmap pixmapFor( const QString& url, int size = 0 );
51 /**
52 * Loads the cache to @p kc from key @p key.
54 void load( KConfigGroup& kc, const QString& key );
55 /**
56 * Saves the cache to @p kc as key @p key.
57 * Only those @p items are saved, otherwise the cache would grow forever.
59 void save( KConfigGroup& kc, const QString& key, const QStringList& items );
61 /**
62 * Clears the pixmap cache
64 void clear();
66 /**
67 * Looks up an iconname for @p url. Uses a cache for the iconname of url.
69 QString iconNameFor( const KUrl& url );
71 Q_SIGNALS:
72 void changed();
74 private Q_SLOTS:
75 /**
76 * Connected to the iconChanged signal emitted by the kded module
78 void notifyChange( bool isHost, const QString& hostOrURL, const QString& iconName );
80 private:
81 QPixmap loadIcon( const QString& icon, int size );
83 KonqPixmapProvider();
84 friend class KonqPixmapProviderSingleton;
86 QMap<KUrl,QString> iconMap;
90 #endif // KONQ_PIXMAPPROVIDER_H