blob: eca0c1f5af1828b3a1ab88930e5346f4c9da4c9e (
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
90
91
92
93
 | /* ============================================================
 *
 * This file is a part of the reKonq project
 *
 * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
 * Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>
 *
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option) any later version.
 *
 * 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.
 *
 * ============================================================ */
#ifndef URLLINEEDIT_H
#define URLLINEEDIT_H
// Qt Includes
#include <QUrl>
#include <QWidget>
#include <QStyleOptionFrame>
QT_BEGIN_NAMESPACE
class QLineEdit;
QT_END_NAMESPACE
class ClearButton;
class ExLineEdit : public QWidget
{
    Q_OBJECT
public:
    ExLineEdit(QWidget *parent = 0);
    inline QLineEdit *lineEdit() const { return m_lineEdit; }
    void setLeftWidget(QWidget *widget);
    QWidget *leftWidget() const;
    QSize sizeHint() const;
protected:
    void focusInEvent(QFocusEvent *event);
    void focusOutEvent(QFocusEvent *event);
    void keyPressEvent(QKeyEvent *event);
    void paintEvent(QPaintEvent *event);
    void resizeEvent(QResizeEvent *event);
    bool event(QEvent *event);
protected:
    void updateGeometries();
    void initStyleOption(QStyleOptionFrameV2 *option) const;
    QWidget *m_leftWidget;
    QLineEdit *m_lineEdit;
    ClearButton *m_clearButton;
};
class UrlIconLabel;
class WebView;
class UrlLineEdit : public ExLineEdit
{
    Q_OBJECT
public:
    UrlLineEdit(QWidget *parent = 0);
    void setWebView(WebView *webView);
protected:
    void paintEvent(QPaintEvent *event);
    void focusOutEvent(QFocusEvent *event);
private slots:
    void webViewUrlChanged(const QUrl &url);
    void webViewIconChanged();
private:
    QLinearGradient generateGradient(const QColor &color) const;
    WebView *m_webView;
    UrlIconLabel *m_iconLabel;
    QColor m_defaultBaseColor;
};
#endif // URLLINEEDIT_H
 |