diff options
Diffstat (limited to 'src/urlbar/urlbar.hpp')
-rw-r--r-- | src/urlbar/urlbar.hpp | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/src/urlbar/urlbar.hpp b/src/urlbar/urlbar.hpp new file mode 100644 index 00000000..da34151e --- /dev/null +++ b/src/urlbar/urlbar.hpp @@ -0,0 +1,120 @@ +/* ============================================================ + * The rekonq project + * ============================================================ + * SPDX-License-Identifier: GPL-2.0-or-later + * Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com> + * Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com> + * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> + * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua <aqua@iserlohn-fortress.net> + * ============================================================ + * Description: URL Bar + * ============================================================ */ + +#pragma once + +#include "../rekonq.hpp" +#include <QLineEdit> +#include <QToolButton> +#include <rview.hpp> + +class IconButton : public QToolButton { + Q_OBJECT + +public: + explicit IconButton(QWidget *parent = nullptr); + +signals: + void clicked(QPoint); + +protected: + void mouseReleaseEvent(QMouseEvent *event); +}; + +// Definitions +typedef QList<IconButton *> IconButtonPointerList; + +class UrlBar : public QLineEdit { + Q_OBJECT + +public: + enum Icon { KGet = 0x00000001, RSS = 0x00000010, BK = 0x00001000, SearchEngine = 0x00010000, AdBlock = 0x01000000 }; + + explicit UrlBar(QWidget *parent = nullptr); + ~UrlBar() override = default; + +public slots: + void setCurrentView(RekonqView *view) + { + m_currentView = view; + loadProgress(view->progress()); + setUrl(view->url()); + } + + void setUrl(const QUrl &url); + + /** + * Let us add bookmarks as the major browsers do + * + */ + // void manageBookmarks(); + + void clearUrlbar(); + + void loadRequestedUrl(const QUrl &url, rekonq::OpenType = rekonq::CurrentTab); + + void loadStarted(); + void loadProgress(int); + void loadFinished(); + + // void clearRightIcons(); + // void updateRightIcons(); + + // void detectTypedString(const QString &); + // void suggest(); + + // void manageStarred(QPoint); + // void manageAdBlock(QPoint); + + // void addToFavorites(); + // void removeFromFavorites(); + + // void refreshFavicon(); + + // void pasteAndGo(); + // void pasteAndSearch(); + // void delSlot(); + // bool isValidURL(QString url); + + // void showRSSInfo(QPoint); + // void showSSLInfo(QPoint); + +protected: + void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *); + /* + void keyReleaseEvent(QKeyEvent *event); + void dropEvent(QDropEvent *event); + void mouseDoubleClickEvent(QMouseEvent *); + void contextMenuEvent(QContextMenuEvent *event); + */ + +private: + /** + * Updates right icon position, given its number in the right icons list + * and considering rekonq window position/dimension + */ + // void updateRightIconPosition(IconButton *, int); + // IconButton *addRightIcon(UrlBar::icon); + + // QWeakPointer<CompletionWidget> _box; + RekonqView *m_currentView = nullptr; + int m_currentView_progress = 0; + + IconButton *_icon; + IconButtonPointerList _rightIconsList; + + const QColor backgroundColor; + const QColor highlightColor; +}; |