diff options
Diffstat (limited to 'src/urlbar/urlbar.h')
-rw-r--r-- | src/urlbar/urlbar.h | 106 |
1 files changed, 68 insertions, 38 deletions
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index 8d267b2c..cda8a2e1 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,99 @@ #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 QTimer; + + +class IconButton : public QToolButton +{ + Q_OBJECT + +public: + IconButton(QWidget *parent = 0); + +signals: + void clicked(QPoint); + +protected: + void mouseReleaseEvent(QMouseEvent *event); + +}; -class UrlBar : public KHistoryComboBox +// Definitions +typedef QList<IconButton *> IconButtonPointerList; + + +// ------------------------------------------------------------------------------------ + + +class REKONQ_TESTS_EXPORT UrlBar : public KLineEdit { Q_OBJECT public: - UrlBar(QWidget *parent = 0); + + enum icon + { + KGet = 0x00000001, + RSS = 0x00000010, + SSL = 0x00000100, + }; + + explicit UrlBar(QWidget *parent = 0); ~UrlBar(); - void selectAll() const; - KUrl url() const; - QSize sizeHint() const; - void setBackgroundColor(QColor); - bool isLoading(); - - void setProgress(int progress); + void setPrivateMode(bool on); -signals: - void activated(const KUrl&); +private slots: + void activated(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab); + void setQUrl(const QUrl &url); -public slots: - void setUrl(const QUrl &url); - void updateProgress(int progress); - void updateUrl(); + void loadFinished(); + void loadTyped(const QString &); + + void clearRightIcons(); -private slots: - void activated(const QString& url); - void loadFinished(bool); - void cleared(); + void detectTypedString(const QString &); + void suggest(); protected: - virtual void paintEvent(QPaintEvent *event); - virtual void keyPressEvent(QKeyEvent *event); + void paintEvent(QPaintEvent *event); + void keyPressEvent(QKeyEvent *event); + void focusInEvent(QFocusEvent *event); + void dropEvent(QDropEvent *event); + void mouseDoubleClickEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); private: - void setupLineEdit(); + IconButton *addRightIcon(UrlBar::icon); + void activateSuggestions(bool); - KLineEdit *lineEdit() const; + QWeakPointer<CompletionWidget> _box; + WebTab *_tab; + bool _privateMode; - static QLinearGradient generateGradient(const QColor &color, int height); + IconButton *_icon; + IconButtonPointerList _rightIconsList; - static QColor s_defaultBaseColor; - - LineEdit *m_lineEdit; - - KUrl m_currentUrl; - int m_progress; + QTimer *_suggestionTimer; }; + #endif |