Falkon Develop
Cross-platform Qt-based web browser
locationbar.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#include "locationbar.h"
19#include "browserwindow.h"
20#include "tabbedwebview.h"
21#include "mainapplication.h"
22#include "webpage.h"
23#include "tabwidget.h"
24#include "bookmarksicon.h"
25#include "bookmarks.h"
26#include "bookmarkitem.h"
27#include "bookmarkstoolbar.h"
28#include "siteicon.h"
29#include "goicon.h"
30#include "downicon.h"
31#include "qztools.h"
32#include "iconprovider.h"
33#include "qzsettings.h"
34#include "colors.h"
35#include "autofillicon.h"
37#include "zoomlabel.h"
38
39#include <QTimer>
40#include <QMimeData>
41#include <QCompleter>
42#include <QStringListModel>
43#include <QContextMenuEvent>
44#include <QStyleOptionFrame>
45
47 : LineEdit(parent)
48 , m_window(nullptr)
49 , m_webView(nullptr)
50 , m_holdingAlt(false)
51 , m_oldTextLength(0)
52 , m_currentTextLength(0)
53 , m_loadProgress(0)
54 , m_progressVisible(false)
55{
56 setObjectName("locationbar");
57 setDragEnabled(true);
58
59 // Disable KDE QLineEdit transitions, it breaks with setText() && home()
60 setProperty("_kde_no_animations", QVariant(true));
61
62 m_bookmarkIcon = new BookmarksIcon(this);
63 m_goIcon = new GoIcon(this);
64 m_siteIcon = new SiteIcon(this);
65 m_autofillIcon = new AutoFillIcon(this);
66 auto* down = new DownIcon(this);
67 m_zoomlabel = new ZoomLabel(this);
68
69 addWidget(m_siteIcon, LineEdit::LeftSide);
70 addWidget(m_zoomlabel, LineEdit::RightSide);
71 addWidget(m_autofillIcon, LineEdit::RightSide);
72 addWidget(m_bookmarkIcon, LineEdit::RightSide);
75
76 m_completer = new LocationCompleter(this);
77 m_completer->setLocationBar(this);
78 connect(m_completer, &LocationCompleter::showCompletion, this, &LocationBar::showCompletion);
79 connect(m_completer, &LocationCompleter::showDomainCompletion, this, &LocationBar::showDomainCompletion);
80 connect(m_completer, &LocationCompleter::clearCompletion, this, &LocationBar::clearCompletion);
82 connect(m_completer, &LocationCompleter::popupClosed, this, &LocationBar::updateSiteIcon);
83
84 m_domainCompleterModel = new QStringListModel(this);
85 auto* domainCompleter = new QCompleter(this);
86 domainCompleter->setCompletionMode(QCompleter::InlineCompletion);
87 domainCompleter->setModel(m_domainCompleterModel);
88 setCompleter(domainCompleter);
89
90 m_progressTimer = new QTimer(this);
91 m_progressTimer->setInterval(700);
92 m_progressTimer->setSingleShot(true);
93 connect(m_progressTimer, &QTimer::timeout, this, &LocationBar::hideProgress);
94
95 editAction(PasteAndGo)->setText(tr("Paste And &Go"));
96 editAction(PasteAndGo)->setIcon(QIcon::fromTheme(QSL("edit-paste")));
97 connect(editAction(PasteAndGo), &QAction::triggered, this, &LocationBar::pasteAndGo);
98
99 connect(this, SIGNAL(textEdited(QString)), this, SLOT(textEdited(QString)));
100 connect(m_goIcon, &ClickableLabel::clicked, this, &LocationBar::requestLoadUrl);
101 connect(down, &ClickableLabel::clicked, m_completer, &LocationCompleter::showMostVisited);
102 connect(mApp->searchEnginesManager(), &SearchEnginesManager::activeEngineChanged, this, &LocationBar::updatePlaceHolderText);
103 connect(mApp->searchEnginesManager(), &SearchEnginesManager::defaultEngineChanged, this, &LocationBar::updatePlaceHolderText);
104 connect(mApp, &MainApplication::settingsReloaded, this, &LocationBar::loadSettings);
105
106 loadSettings();
107
108 updateSiteIcon();
109
110 // Hide icons by default
111 m_goIcon->setVisible(qzSettings->alwaysShowGoIcon);
112 m_autofillIcon->hide();
113
114 QTimer::singleShot(0, this, &LocationBar::updatePlaceHolderText);
115}
116
118{
119 return m_window;
120}
121
123{
124 m_window = window;
125 m_completer->setMainWindow(m_window);
126 m_siteIcon->setBrowserWindow(m_window);
127}
128
130{
131 return m_webView;
132}
133
135{
136 m_webView = view;
137
138 m_bookmarkIcon->setWebView(m_webView);
139 m_siteIcon->setWebView(m_webView);
140 m_zoomlabel->setWebView(m_webView);
141 m_autofillIcon->setWebView(m_webView);
142
143 connect(m_webView, &QWebEngineView::loadStarted, this, &LocationBar::loadStarted);
144 connect(m_webView, &QWebEngineView::loadProgress, this, &LocationBar::loadProgress);
145 connect(m_webView, &QWebEngineView::loadFinished, this, &LocationBar::loadFinished);
146 connect(m_webView, &QWebEngineView::urlChanged, this, &LocationBar::showUrl);
147 connect(m_webView, &WebView::privacyChanged, this, &LocationBar::setPrivacyState);
148}
149
150void LocationBar::setText(const QString &text)
151{
152 m_oldTextLength = text.length();
153 m_currentTextLength = m_oldTextLength;
154
155 LineEdit::setText(text);
156
157 refreshTextFormat();
158}
159
160void LocationBar::updatePlaceHolderText()
161{
162 if (qzSettings->searchFromAddressBar) {
163 setPlaceholderText(tr("Enter address or search with %1").arg(searchEngine().name));
164 } else
165 setPlaceholderText(tr("Enter address"));
166}
167
168void LocationBar::showCompletion(const QString &completion, bool completeDomain)
169{
170 LineEdit::setText(completion);
171
172 // Move cursor to the end
173 end(false);
174
175 if (completeDomain) {
176 completer()->complete();
177 }
178
179 updateSiteIcon();
180}
181
182void LocationBar::clearCompletion()
183{
184 m_webView->setFocus();
185 showUrl(m_webView->url());
186}
187
188void LocationBar::showDomainCompletion(const QString &completion)
189{
190 m_domainCompleterModel->setStringList(QStringList() << completion);
191
192 // We need to manually force the completion because model is updated asynchronously
193 // But only force completion when the user actually added new text
194 if (!completion.isEmpty() && m_oldTextLength < m_currentTextLength)
195 completer()->complete();
196}
197
198QString LocationBar::convertUrlToText(const QUrl &url)
199{
200 // It was most probably entered by user, so don't urlencode it
201 // Also don't urlencode JavaScript code
202 if (url.scheme().isEmpty() || url.scheme() == QL1S("javascript")) {
203 return QUrl::fromPercentEncoding(url.toEncoded());
204 }
205
206 QString stringUrl = QzTools::urlEncodeQueryString(url);
207
208 if (stringUrl == QL1S("falkon:speeddial") || stringUrl == QL1S("about:blank")) {
209 stringUrl.clear();
210 }
211
212 return stringUrl;
213}
214
216{
217 if (!qzSettings->searchFromAddressBar) {
218 return {};
219 } else if (qzSettings->searchWithDefaultEngine) {
220 return mApp->searchEnginesManager()->defaultEngine();
221 } else {
222 return mApp->searchEnginesManager()->activeEngine();
223 }
224}
225
227{
228 LoadAction action;
229
230 const QString &t = text.trimmed();
231
232 if (t.isEmpty()) {
233 return action;
234 }
235
236 // Check for Search Engine shortcut
237 const int firstSpacePos = t.indexOf(QLatin1Char(' '));
238 if (qzSettings->searchFromAddressBar && firstSpacePos != -1) {
239 const QString shortcut = t.left(firstSpacePos);
240 const QString searchedString = t.mid(firstSpacePos).trimmed();
241
242 SearchEngine en = mApp->searchEnginesManager()->engineForShortcut(shortcut);
243 if (en.isValid()) {
244 action.type = LoadAction::Search;
245 action.searchEngine = en;
246 action.loadRequest = mApp->searchEnginesManager()->searchResult(en, searchedString);
247 return action;
248 }
249 }
250
251 // Check for Bookmark keyword
252 const QList<BookmarkItem*> items = mApp->bookmarks()->searchKeyword(t);
253 if (!items.isEmpty()) {
254 BookmarkItem* item = items.at(0);
255 action.type = LoadAction::Bookmark;
256 action.bookmark = item;
257 action.loadRequest.setUrl(item->url());
258 return action;
259 }
260
261 if (!qzSettings->searchFromAddressBar) {
262 const QUrl &guessedUrl = QUrl::fromUserInput(t);
263 if (guessedUrl.isValid()) {
264 action.type = LoadAction::Url;
265 action.loadRequest = guessedUrl;
266 }
267 return action;
268 }
269
270 // Check for one word search
271 if (t != QL1S("localhost")
273 && !t.contains(QL1C('.'))
274 && !t.contains(QL1C(':'))
275 && !t.contains(QL1C('/'))
276 ) {
277 action.type = LoadAction::Search;
278 action.searchEngine = searchEngine();
279 action.loadRequest = mApp->searchEnginesManager()->searchResult(searchEngine(), t);
280 return action;
281 }
282
283 // Otherwise load as url
284 const QUrl guessedUrl = QUrl::fromUserInput(t);
285 if (guessedUrl.isValid()) {
286 // Always allow javascript: to be loaded
287 const bool forceLoad = guessedUrl.scheme() == QL1S("javascript");
288 // Only allow spaces in query
289 if (forceLoad || !QzTools::containsSpace(t) || !QzTools::containsSpace(guessedUrl.toString(QUrl::RemoveQuery))) {
290 // Only allow supported schemes
291 if (forceLoad || WebPage::supportedSchemes().contains(guessedUrl.scheme())) {
292 action.type = LoadAction::Url;
293 action.loadRequest = guessedUrl;
294 return action;
295 }
296 }
297 }
298
299 // Search when creating url failed
300 action.type = LoadAction::Search;
301 action.searchEngine = searchEngine();
302 action.loadRequest = mApp->searchEnginesManager()->searchResult(searchEngine(), t);
303 return action;
304}
305
306void LocationBar::refreshTextFormat()
307{
308 if (!m_webView) {
309 return;
310 }
311
312 TextFormat textFormat;
313 const QString hostName = m_webView->url().isEmpty() ? QUrl(text()).host() : m_webView->url().host();
314
315 if (!hostName.isEmpty()) {
316 const int hostPos = text().indexOf(hostName);
317
318 if (hostPos > 0) {
319 QTextCharFormat format;
320 format.setForeground(Colors::mid(palette().color(QPalette::Base), palette().color(QPalette::Text), 1, 1));
321
322 QTextLayout::FormatRange schemePart;
323 schemePart.start = 0;
324 schemePart.length = hostPos;
325 schemePart.format = format;
326
327 QTextLayout::FormatRange hostPart;
328 hostPart.start = hostPos;
329 hostPart.length = hostName.size();
330
331 QTextLayout::FormatRange remainingPart;
332 remainingPart.start = hostPos + hostName.size();
333 remainingPart.length = text().size() - remainingPart.start;
334 remainingPart.format = format;
335
336 textFormat.append(schemePart);
337 textFormat.append(hostPart);
338 textFormat.append(remainingPart);
339 }
340 }
341
342 setTextFormat(textFormat);
343}
344
345void LocationBar::requestLoadUrl()
346{
348 updateSiteIcon();
349}
350
351void LocationBar::textEdited(const QString &text)
352{
353 m_oldTextLength = m_currentTextLength;
354 m_currentTextLength = text.length();
355
356 if (!text.isEmpty()) {
357 m_completer->complete(text);
358 m_siteIcon->setIcon(QIcon::fromTheme(QSL("edit-find"), QIcon(QSL(":icons/menu/search-icon.svg"))));
359 }
360 else {
361 m_completer->closePopup();
362 }
363
364 setGoIconVisible(true);
365}
366
367void LocationBar::setGoIconVisible(bool state)
368{
369 if (state) {
370 m_bookmarkIcon->hide();
371 m_zoomlabel->hide();
372 m_goIcon->show();
373 }
374 else {
375 m_bookmarkIcon->show();
376 m_zoomlabel->requestShow();
377
378 if (!qzSettings->alwaysShowGoIcon) {
379 m_goIcon->hide();
380 }
381 }
382
384}
385
386void LocationBar::showUrl(const QUrl &url)
387{
388 if (hasFocus() || url.isEmpty()) {
389 return;
390 }
391
392 const QString stringUrl = convertUrlToText(url);
393
394 if (text() == stringUrl) {
395 home(false);
396 refreshTextFormat();
397 return;
398 }
399
400 // Set converted url as text
401 setText(stringUrl);
402
403 // Move cursor to the start
404 home(false);
405
406 m_bookmarkIcon->checkBookmark(url);
407}
408
410{
411 if (!m_webView->webTab()->isRestored()) {
412 return;
413 }
414
415 const QString urlString = convertUrlToText(request.url());
416
417 m_completer->closePopup();
418 m_webView->setFocus();
419
420 if (urlString != text()) {
421 setText(urlString);
422 }
423
424 m_webView->userLoadAction(request);
425}
426
427void LocationBar::updateSiteIcon()
428{
429 if (m_completer->isVisible()) {
430 m_siteIcon->setIcon(QIcon::fromTheme(QSL("edit-find"), QIcon(QSL(":icons/menu/search-icon.svg"))));
431 } else {
432 QIcon icon = IconProvider::emptyWebIcon();
433 if (property("secured").toBool()) {
434 icon = QIcon::fromTheme(QSL("document-encrypted"), icon);
435 }
436 m_siteIcon->setIcon(QIcon(icon.pixmap(16)));
437 }
438}
439
440void LocationBar::setPrivacyState(bool state)
441{
442 m_siteIcon->setProperty("secured", QVariant(state));
443 m_siteIcon->style()->unpolish(m_siteIcon);
444 m_siteIcon->style()->polish(m_siteIcon);
445
446 setProperty("secured", QVariant(state));
447 style()->unpolish(this);
448 style()->polish(this);
449
450 updateSiteIcon();
451}
452
453void LocationBar::pasteAndGo()
454{
455 clear();
456 paste();
457 requestLoadUrl();
458}
459
460void LocationBar::contextMenuEvent(QContextMenuEvent* event)
461{
462 QMenu* menu = createContextMenu();
463 menu->setAttribute(Qt::WA_DeleteOnClose);
464
465 // Prevent choosing first option with double rightclick
466 QPoint pos = event->globalPos();
467 pos.setY(pos.y() + 1);
468 menu->popup(pos);
469}
470
471void LocationBar::showEvent(QShowEvent* event)
472{
473 LineEdit::showEvent(event);
474
475 refreshTextFormat();
476}
477
478void LocationBar::focusInEvent(QFocusEvent* event)
479{
480 if (m_webView) {
481 const QString stringUrl = convertUrlToText(m_webView->url());
482
483 // Text has been edited, let's show go button
484 if (stringUrl != text()) {
485 setGoIconVisible(true);
486 }
487 }
488
491
492 if (m_window && Settings().value(QSL("Browser-View-Settings/instantBookmarksToolbar")).toBool()) {
493 m_window->bookmarksToolbar()->show();
494 }
495}
496
497void LocationBar::focusOutEvent(QFocusEvent* event)
498{
499 // Context menu or completer popup were opened
500 // Let's block focusOutEvent to trick QLineEdit and paint cursor properly
501 if (event->reason() == Qt::PopupFocusReason) {
502 return;
503 }
504
505 LineEdit::focusOutEvent(event);
506
507 setGoIconVisible(false);
508
509 if (text().trimmed().isEmpty()) {
510 clear();
511 }
512
513 refreshTextFormat();
514
515 if (m_window && Settings().value(QSL("Browser-View-Settings/instantBookmarksToolbar")).toBool()) {
516 m_window->bookmarksToolbar()->hide();
517 }
518}
519
520void LocationBar::dropEvent(QDropEvent* event)
521{
522 if (event->mimeData()->hasUrls()) {
523 const QUrl dropUrl = event->mimeData()->urls().at(0);
524 if (WebView::isUrlValid(dropUrl)) {
525 setText(dropUrl.toString());
526 loadRequest(dropUrl);
527
528 QFocusEvent event(QFocusEvent::FocusOut);
529 LineEdit::focusOutEvent(&event);
530 return;
531 }
532 }
533 else if (event->mimeData()->hasText()) {
534 const QString dropText = event->mimeData()->text().trimmed();
535 const QUrl dropUrl = QUrl(dropText);
536 if (WebView::isUrlValid(dropUrl)) {
537 setText(dropUrl.toString());
538 loadRequest(dropUrl);
539
540 QFocusEvent event(QFocusEvent::FocusOut);
541 LineEdit::focusOutEvent(&event);
542 return;
543 } else {
544 setText(dropText);
545 setFocus();
546 return;
547 }
548 }
549
550 LineEdit::dropEvent(event);
551}
552
553void LocationBar::keyPressEvent(QKeyEvent* event)
554{
555 switch (event->key()) {
556 case Qt::Key_V:
557 if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) {
558 pasteAndGo();
559 event->accept();
560 return;
561 }
562 break;
563
564 case Qt::Key_Down:
565 m_completer->complete(text());
566 break;
567
568 case Qt::Key_Left:
569 m_completer->closePopup();
570 break;
571
572 case Qt::Key_Escape:
573 m_webView->setFocus();
574 showUrl(m_webView->url());
575 event->accept();
576 break;
577
578 case Qt::Key_Alt:
579 m_holdingAlt = true;
580 break;
581
582 case Qt::Key_Return:
583 case Qt::Key_Enter:
584 switch (event->modifiers()) {
585 case Qt::ControlModifier:
586 if (!text().endsWith(QL1S(".com")))
587 setText(text().append(QL1S(".com")));
588 requestLoadUrl();
589 m_holdingAlt = false;
590 break;
591
592 case Qt::AltModifier:
593 m_completer->closePopup();
594 if (m_window) {
595 m_window->tabWidget()->addView(loadAction(text()).loadRequest);
596 }
597 m_holdingAlt = false;
598 break;
599
600 default:
601 requestLoadUrl();
602 m_holdingAlt = false;
603 }
604
605 break;
606
607 case Qt::Key_0:
608 case Qt::Key_1:
609 case Qt::Key_2:
610 case Qt::Key_3:
611 case Qt::Key_4:
612 case Qt::Key_5:
613 case Qt::Key_6:
614 case Qt::Key_7:
615 case Qt::Key_8:
616 case Qt::Key_9:
617 if (event->modifiers() & Qt::AltModifier || event->modifiers() & Qt::ControlModifier) {
618 event->ignore();
619 m_holdingAlt = false;
620 return;
621 }
622 break;
623
624 default:
625 m_holdingAlt = false;
626 }
627
628 LineEdit::keyPressEvent(event);
629}
630
631void LocationBar::loadStarted()
632{
633 m_progressVisible = true;
634 m_progressTimer->stop();
635 m_autofillIcon->hide();
636}
637
638void LocationBar::loadProgress(int progress)
639{
640 if (qzSettings->showLoadingProgress) {
641 m_loadProgress = progress;
642 update();
643 }
644}
645
646void LocationBar::loadFinished()
647{
648 if (qzSettings->showLoadingProgress) {
649 m_progressTimer->start();
650 }
651
652 auto* page = qobject_cast<WebPage*>(m_webView->page());
653
654 if (page && !page->autoFillUsernames().isEmpty()) {
655 m_autofillIcon->setUsernames(page->autoFillUsernames());
656 m_autofillIcon->show();
657 }
658}
659
660void LocationBar::loadSettings()
661{
662 Settings settings;
663 settings.beginGroup(QSL("AddressBar"));
664 m_progressStyle = static_cast<ProgressStyle>(settings.value(QSL("ProgressStyle"), 0).toInt());
665 bool customColor = settings.value(QSL("UseCustomProgressColor"), false).toBool();
666 m_progressColor = customColor ? settings.value(QSL("CustomProgressColor"), palette().color(QPalette::Highlight)).value<QColor>() : QColor();
667 settings.endGroup();
668}
669
670void LocationBar::hideProgress()
671{
672 if (qzSettings->showLoadingProgress) {
673 m_progressVisible = false;
674 update();
675 }
676}
677
678void LocationBar::paintEvent(QPaintEvent* event)
679{
680 LineEdit::paintEvent(event);
681
682 // Show loading progress
683 if (qzSettings->showLoadingProgress && m_progressVisible) {
684 QStyleOptionFrame option;
685 initStyleOption(&option);
686
687 QMargins margins = textMargins();
688
689 QRect contentsRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
690 contentsRect.adjust(
691 margins.left(), margins.top(), -margins.right(), -margins.bottom()
692 );
693
694 QColor bg = m_progressColor;
695 if (!bg.isValid() || bg.alpha() == 0) {
696 bg = Colors::mid(palette().color(QPalette::Base), palette().color(QPalette::Text), m_progressStyle > 0 ? 4 : 8, 1);
697 }
698
699 QPainter p(this);
700 p.setBrush(QBrush(bg));
701
702 // We are painting over text, make sure the text stays visible
703 p.setOpacity(0.5);
704
705 QPen outlinePen(bg.darker(110), 0.8);
706 p.setPen(outlinePen);
707
708 switch (m_progressStyle) {
709 case ProgressFilled: {
710 QRect bar = contentsRect.adjusted(0, 1, 0, -1);
711 bar.setWidth(bar.width() * m_loadProgress / 100);
712 const int roundness = bar.height() / 4.0;
713 p.drawRoundedRect(bar, roundness, roundness);
714 break;
715 }
716 case ProgressBottom: {
717 outlinePen.setWidthF(0.3);
718 outlinePen.setColor(outlinePen.color().darker(130));
719 p.setPen(outlinePen);
720 QRect bar(contentsRect.x(), contentsRect.bottom() - 3,
721 contentsRect.width() * m_loadProgress / 100.0, 3);
722 p.drawRoundedRect(bar, 1, 1);
723 break;
724 }
725 case ProgressTop: {
726 outlinePen.setWidthF(0.3);
727 outlinePen.setColor(outlinePen.color().darker(130));
728 p.setPen(outlinePen);
729 QRect bar(contentsRect.x(), contentsRect.top() + 1, contentsRect.width() * m_loadProgress / 100.0, 3);
730 p.drawRoundedRect(bar, 1, 1);
731 break;
732 }
733 default:
734 break;
735 }
736 }
737}
void setWebView(WebView *view)
void setUsernames(const QStringList &usernames)
QUrl url() const
void checkBookmark(const QUrl &url, bool forceCheck=false)
void setWebView(WebView *view)
TabWidget * tabWidget() const
BookmarksToolbar * bookmarksToolbar() const
void clicked(QPoint)
Definition: goicon.h:25
static QIcon emptyWebIcon()
QAction * editAction(EditAction action) const
Definition: lineedit.cpp:343
void addWidget(QWidget *widget, WidgetPosition position)
Definition: lineedit.cpp:259
void setTextFormat(const TextFormat &format)
Definition: lineedit.cpp:301
@ LeftSide
Definition: lineedit.h:79
@ RightSide
Definition: lineedit.h:80
QMenu * createContextMenu()
Definition: lineedit.cpp:191
void updateTextMargins()
Definition: lineedit.cpp:348
void focusInEvent(QFocusEvent *event) override
Definition: lineedit.cpp:362
bool event(QEvent *event) override
Definition: lineedit.cpp:170
@ PasteAndGo
Definition: lineedit.h:89
void clearTextFormat()
Definition: lineedit.cpp:317
QList< QTextLayout::FormatRange > TextFormat
Definition: lineedit.h:76
QUrl url() const
Definition: loadrequest.cpp:44
void setUrl(const QUrl &url)
Definition: loadrequest.cpp:49
void setBrowserWindow(BrowserWindow *window)
void loadRequest(const LoadRequest &request)
void setWebView(TabbedWebView *view)
static SearchEngine searchEngine()
static QString convertUrlToText(const QUrl &url)
BrowserWindow * browserWindow() const
LocationBar(QWidget *parent=nullptr)
Definition: locationbar.cpp:46
void setText(const QString &text)
TabbedWebView * webView() const
static LoadAction loadAction(const QString &text)
void showUrl(const QUrl &url)
void setLocationBar(LocationBar *locationBar)
void setMainWindow(BrowserWindow *window)
void showCompletion(const QString &completion, bool completeDomain)
void loadRequested(const LoadRequest &request)
void complete(const QString &string)
void showDomainCompletion(const QString &completion)
void settingsReloaded()
static bool containsSpace(const QString &str)
Definition: qztools.cpp:614
static QString urlEncodeQueryString(const QUrl &url)
Definition: qztools.cpp:220
void beginGroup(const QString &prefix)
Definition: settings.cpp:79
void endGroup()
Definition: settings.cpp:84
QVariant value(const QString &key, const QVariant &defaultValue=QVariant())
Definition: settings.cpp:74
void setIcon(const QIcon &icon)
Definition: siteicon.cpp:59
void setBrowserWindow(BrowserWindow *window)
Definition: siteicon.cpp:49
void setWebView(WebView *view)
Definition: siteicon.cpp:54
int addView(const LoadRequest &req, const Qz::NewTabPositionFlags &openFlags, bool selectLine=false, bool pinned=false)
Definition: tabwidget.cpp:314
void userLoadAction(const LoadRequest &req)
WebTab * webTab() const
static QStringList supportedSchemes()
Definition: webpage.cpp:231
bool isRestored() const
Definition: webtab.cpp:548
static bool isUrlValid(const QUrl &url)
Definition: webview.cpp:257
WebPage * page() const
Definition: webview.cpp:132
void privacyChanged(bool)
void setWebView(WebView *view)
Definition: zoomlabel.cpp:45
void requestShow()
Definition: zoomlabel.cpp:53
#define mApp
QColor mid(const QColor &oc1, const QColor &c2, int w1=1, int w2=1)
Definition: colors.cpp:210
int value(const QColor &c)
Definition: colors.cpp:238
const QColor & bg(const QPalette &pal, const QWidget *w)
Definition: colors.cpp:29
t
Definition: i18n.py:27
State state
#define QL1S(x)
Definition: qzcommon.h:44
#define QL1C(x)
Definition: qzcommon.h:48
#define QSL(x)
Definition: qzcommon.h:40
#define qzSettings
Definition: qzsettings.h:69
BookmarkItem * bookmark
Definition: locationbar.h:55
SearchEngine searchEngine
Definition: locationbar.h:54
LoadRequest loadRequest
Definition: locationbar.h:56