aboutsummaryrefslogtreecommitdiff
path: root/src/addressbar/urllineedit.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 14:05:10 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-04-17 14:05:10 +0200
commit359839213db33bdf95811adc883940eb50fb50e4 (patch)
treea0b849775afc28e1d4072ca9085645462d8e3c51 /src/addressbar/urllineedit.cpp
parentAdd loading progess bar to the address bar (diff)
downloadsmolbote-359839213db33bdf95811adc883940eb50fb50e4.tar.xz
Clean up UrlLineEdit
Diffstat (limited to 'src/addressbar/urllineedit.cpp')
-rw-r--r--src/addressbar/urllineedit.cpp59
1 files changed, 8 insertions, 51 deletions
diff --git a/src/addressbar/urllineedit.cpp b/src/addressbar/urllineedit.cpp
index 4e8d930..fa65e5b 100644
--- a/src/addressbar/urllineedit.cpp
+++ b/src/addressbar/urllineedit.cpp
@@ -7,7 +7,6 @@
*/
#include "urllineedit.h"
-#include "webengine/webview.h"
#include <QLabel>
#include <QMenu>
#include <QShortcut>
@@ -23,65 +22,23 @@ UrlLineEdit::UrlLineEdit(QWidget *parent)
m_listView->setVisible(false);
- m_pageMenuAction = addAction(style()->standardIcon(QStyle::SP_DriveNetIcon), QLineEdit::LeadingPosition);
- m_pageMenuAction->setShortcut(QKeySequence("F2"));
- m_pageMenuAction->setToolTip(tr("Page Actions (%1)").arg(m_pageMenuAction->shortcut().toString()));
- connect(m_pageMenuAction, &QAction::triggered, m_pageMenuAction, [&]() {
- if(m_pageMenuAction->menu()) {
- m_pageMenuAction->menu()->exec(this->mapToGlobal(QPoint(0, height())));
+ pageMenu_action = addAction(style()->standardIcon(QStyle::SP_DriveNetIcon), QLineEdit::LeadingPosition);
+ connect(pageMenu_action, &QAction::triggered, pageMenu_action, [&]() {
+ if(pageMenu_action->menu()) {
+ pageMenu_action->menu()->exec(this->mapToGlobal(QPoint(0, height())));
}
});
- m_toolsMenuAction = addAction(style()->standardIcon(QStyle::SP_FileIcon), QLineEdit::TrailingPosition);
- m_toolsMenuAction->setShortcut(QKeySequence("F10"));
- m_toolsMenuAction->setToolTip(tr("Tools (%1)").arg(m_toolsMenuAction->shortcut().toString()));
- connect(m_toolsMenuAction, &QAction::triggered, m_toolsMenuAction, [&]() {
- if(m_toolsMenuAction->menu()) {
- m_toolsMenuAction->menu()->exec(this->mapToGlobal(QPoint(width(), height())));
+ toolsMenu_action = addAction(style()->standardIcon(QStyle::SP_FileIcon), QLineEdit::TrailingPosition);
+ connect(toolsMenu_action, &QAction::triggered, toolsMenu_action, [&]() {
+ if(toolsMenu_action->menu()) {
+ toolsMenu_action->menu()->exec(this->mapToGlobal(QPoint(width(), height())));
}
});
QTextCharFormat hostnameFormat;
hostnameFormat.setFontWeight(QFont::Bold);
m_hostFormat.format = hostnameFormat;
-
- // connect signals
- connect(this, &QLineEdit::returnPressed, [this]() {
- if(this->text().startsWith('#')) {;
- m_view->search(this->text().mid(1));
- } else {
- if(m_view) {
- m_view->load(QUrl::fromUserInput(this->text()));
- } else {
- this->clear();
- }
- }
- this->clearFocus();
- });
-}
-
-UrlLineEdit::~UrlLineEdit()
-{
-}
-
-void UrlLineEdit::connectWebView(WebView *view)
-{
- disconnect(urlChangedConnection);
-
- if(view == nullptr) {
- clear();
- m_pageMenuAction->setMenu(nullptr);
- m_toolsMenuAction->setMenu(nullptr);
- return;
- }
-
- m_view = view;
-
- setUrl(view->url());
- m_pageMenuAction->setMenu(view->pageMenu());
- m_toolsMenuAction->setMenu(view->toolsMenu());
-
- urlChangedConnection = connect(view, &WebView::urlChanged, this, &UrlLineEdit::setUrl);
}
void UrlLineEdit::setUrl(const QUrl &url)