diff options
Diffstat (limited to 'src/urlbar/urlbar.h')
-rw-r--r-- | src/urlbar/urlbar.h | 104 |
1 files changed, 64 insertions, 40 deletions
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index 8d267b2c..b644f84f 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -13,9 +13,9 @@ * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy +* by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. -* +* * 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 @@ -30,69 +30,93 @@ #ifndef URLBAR_H #define URLBAR_H - -// Local Includes -#include "lineedit.h" +// Rekonq Includes +#include "rekonq_defines.h" // KDE Includes #include <KUrl> -#include <KHistoryComboBox> +#include <KLineEdit> // Qt Includes -#include <QUrl> +#include <QWeakPointer> +#include <QToolButton> // Forward Declarations class QLinearGradient; class QWidget; -class KCompletion; +class CompletionWidget; +class WebTab; -class UrlBar : public KHistoryComboBox +class IconButton : public QToolButton { Q_OBJECT public: - UrlBar(QWidget *parent = 0); - ~UrlBar(); - - void selectAll() const; - KUrl url() const; - QSize sizeHint() const; - void setBackgroundColor(QColor); - bool isLoading(); + IconButton(QWidget *parent = 0); - void setProgress(int progress); - signals: - void activated(const KUrl&); - -public slots: - void setUrl(const QUrl &url); - void updateProgress(int progress); - void updateUrl(); - -private slots: - void activated(const QString& url); - void loadFinished(bool); - void cleared(); + void clicked(QPoint); protected: - virtual void paintEvent(QPaintEvent *event); - virtual void keyPressEvent(QKeyEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + +}; + + +// Definitions +typedef QList<IconButton *> IconButtonPointerList; + + +// ------------------------------------------------------------------------------------ -private: - void setupLineEdit(); - KLineEdit *lineEdit() const; +class REKONQ_TESTS_EXPORT UrlBar : public KLineEdit +{ + Q_OBJECT + +public: - static QLinearGradient generateGradient(const QColor &color, int height); + enum icon + { + KGet = 0x00000001, + RSS = 0x00000010, + SSL = 0x00000100, + }; - static QColor s_defaultBaseColor; + explicit UrlBar(QWidget *parent = 0); + ~UrlBar(); + + void setPrivateMode(bool on); + +private slots: + void activated(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab); + void setQUrl(const QUrl &url); - LineEdit *m_lineEdit; + void loadFinished(); + void loadTyped(const QString &); - KUrl m_currentUrl; - int m_progress; + void clearRightIcons(); + +protected: + void paintEvent(QPaintEvent *event); + void keyPressEvent(QKeyEvent *event); + void focusInEvent(QFocusEvent *event); + void dropEvent(QDropEvent *event); + void mouseDoubleClickEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); + +private: + IconButton *addRightIcon(UrlBar::icon); + void activateSuggestions(bool); + + QWeakPointer<CompletionWidget> _box; + WebTab *_tab; + bool _privateMode; + + IconButton *_icon; + IconButtonPointerList _rightIconsList; }; + #endif |