summaryrefslogtreecommitdiffstats
path: root/konqueror/keditbookmarks/updater.h
blob: 6f1afb5500a5a1e2f0164dcfa0f0b4ed57da37b3 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* This file is part of the KDE project
   Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License version 2 as published by the Free Software Foundation.

   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.  See the GNU
    General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef __updater_h
#define __updater_h

#include <kbookmark.h>
#include <konq_faviconmgr.h>

#include <tdeparts/part.h>
#include <tdeparts/browserinterface.h>

class FavIconWebGrabber : public QObject
{
    TQ_OBJECT
public:
    FavIconWebGrabber(KParts::ReadOnlyPart *part, const KURL &url);
    ~FavIconWebGrabber() {}

protected slots:
    void slotMimetype(TDEIO::Job *job, const TQString &_type);
    void slotFinished(TDEIO::Job *job);

private:
    KParts::ReadOnlyPart *m_part;
    KURL m_url;
};

class FavIconBrowserInterface;

class FavIconUpdater : public KonqFavIconMgr 
{
    TQ_OBJECT

public:
    FavIconUpdater(TQObject *parent, const char *name);
    ~FavIconUpdater();
    void downloadIcon(const KBookmark &bk);
    void downloadIconActual(const KBookmark &bk);

    virtual void notifyChange(bool isHost, TQString hostOrURL, 
                              TQString iconName);

protected slots:
    void setIconURL(const KURL &iconURL);
    void slotCompleted();
    void timerDone();
    

signals:
    void done(bool succeeded);

private:
    KParts::ReadOnlyPart *m_part;
    FavIconBrowserInterface *m_browserIface;
    FavIconWebGrabber *m_webGrabber;
    TQTimer *m_timer;
    KBookmark m_bk;
};

class FavIconBrowserInterface : public KParts::BrowserInterface
{
    TQ_OBJECT
public:
    FavIconBrowserInterface(FavIconUpdater *view, const char *name)
        : KParts::BrowserInterface(view, name), m_view(view) {
        ;
    }
private:
    FavIconUpdater *m_view;
};

#endif