/*
    Copyright (c) 2008 Louai Al-Khanji

    This file is part of Safra.

    Safra 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.

    Safra 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 Safra; see the file COPYING. If not, see
    <http://www.gnu.org/licenses/>.
*/

#ifndef SAFRA_WEBVIEW_H
#define SAFRA_WEBVIEW_H

#include <QWebView>
#include <KUrl>

class WebView : public QWebView
{
    Q_OBJECT
    public:
        WebView(QWidget* parent = 0);

        void load(const QUrl& link);

    signals:
        void middleClicked(const QString& link);

    protected:
        void mousePressEvent(QMouseEvent* event);
        void paintEvent(QPaintEvent* event);

    private slots:
        void updateHoveredLink(const QString& link);

    private:
        static KUrl massageUrl(const QUrl& url);
        QString m_hoveredLink;
        QPixmap m_pixmap;
};

#endif // SAFRA_WEBVIEW_H
