summaryrefslogtreecommitdiffstats
path: root/knewsticker/common/newsiconmgr.h
blob: 300711555ce46efe264f51bbe91d8defd3df9efd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * newsiconmgr.h
 *
 * Copyright (c) 2001 Frerich Raabe <raabe@kde.org>
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
 * accompanying file 'COPYING'.
 */
#ifndef NEWSICONMGR_H
#define NEWSICONMGR_H

#include <tqobject.h>
#include <tqpixmap.h>

#include <dcopobject.h>
#include <kio/job.h>
#include <kurl.h>

class DCOPClient;

struct KIODownload;
typedef TQMap<KIO::Job *, KIODownload> KIODownloadMap;

class NewsIconMgr : public TQObject, public DCOPObject
{
	Q_OBJECT
	K_DCOP

	public:
		static NewsIconMgr *self();
	
		void getIcon(const KURL &);
		bool isStdIcon(const TQPixmap &) const;
	
	k_dcop:
		void slotGotIcon(bool, TQString, TQString);
	
	signals:
		void gotIcon(const KURL &, const TQPixmap &);
	
	protected:
		NewsIconMgr(TQObject * = 0L, const char * = 0L);
		~NewsIconMgr();
		
	private slots:
		void slotData(KIO::Job *, const TQByteArray &);
		void slotResult(KIO::Job *);

	private:
		TQString favicon(const KURL &) const;

		TQPixmap        m_stdIcon;
		KIODownloadMap m_kioDownload;

		static NewsIconMgr *m_instance;
};

#endif // NEWSICONMGR_H