mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
LocationBar: Show search icon as site icon when completion popup is open
This commit is contained in:
parent
4ad5900604
commit
948e623f9e
|
@ -61,6 +61,11 @@ void LocationCompleter::setLocationBar(LocationBar* locationBar)
|
||||||
m_locationBar = locationBar;
|
m_locationBar = locationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LocationCompleter::isVisible() const
|
||||||
|
{
|
||||||
|
return s_view->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
void LocationCompleter::closePopup()
|
void LocationCompleter::closePopup()
|
||||||
{
|
{
|
||||||
m_popupClosed = true;
|
m_popupClosed = true;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
void setMainWindow(BrowserWindow* window);
|
void setMainWindow(BrowserWindow* window);
|
||||||
void setLocationBar(LocationBar* locationBar);
|
void setLocationBar(LocationBar* locationBar);
|
||||||
|
|
||||||
|
bool isVisible() const;
|
||||||
void closePopup();
|
void closePopup();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
|
@ -77,6 +77,7 @@ LocationBar::LocationBar(BrowserWindow* window)
|
||||||
connect(m_completer, SIGNAL(showDomainCompletion(QString)), this, SLOT(showDomainCompletion(QString)));
|
connect(m_completer, SIGNAL(showDomainCompletion(QString)), this, SLOT(showDomainCompletion(QString)));
|
||||||
connect(m_completer, SIGNAL(clearCompletion()), this, SLOT(clearCompletion()));
|
connect(m_completer, SIGNAL(clearCompletion()), this, SLOT(clearCompletion()));
|
||||||
connect(m_completer, &LocationCompleter::loadRequested, this, &LocationBar::loadRequest);
|
connect(m_completer, &LocationCompleter::loadRequested, this, &LocationBar::loadRequest);
|
||||||
|
connect(m_completer, &LocationCompleter::popupClosed, this, &LocationBar::updateSiteIcon);
|
||||||
|
|
||||||
m_domainCompleterModel = new QStringListModel(this);
|
m_domainCompleterModel = new QStringListModel(this);
|
||||||
QCompleter* domainCompleter = new QCompleter(this);
|
QCompleter* domainCompleter = new QCompleter(this);
|
||||||
|
@ -160,6 +161,8 @@ void LocationBar::showCompletion(const QString &completion, bool completeDomain)
|
||||||
if (completeDomain) {
|
if (completeDomain) {
|
||||||
completer()->complete();
|
completer()->complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSiteIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationBar::clearCompletion()
|
void LocationBar::clearCompletion()
|
||||||
|
@ -311,6 +314,7 @@ void LocationBar::textEdited(const QString &text)
|
||||||
|
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
m_completer->complete(text);
|
m_completer->complete(text);
|
||||||
|
m_siteIcon->setIcon(QIcon::fromTheme(QSL("edit-find"), QIcon(QSL(":icons/menu/search-icon.svg"))));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_completer->closePopup();
|
m_completer->closePopup();
|
||||||
|
@ -375,10 +379,14 @@ void LocationBar::loadRequest(const LoadRequest &request)
|
||||||
|
|
||||||
void LocationBar::updateSiteIcon()
|
void LocationBar::updateSiteIcon()
|
||||||
{
|
{
|
||||||
|
if (m_completer->isVisible()) {
|
||||||
|
m_siteIcon->setIcon(QIcon::fromTheme(QSL("edit-find"), QIcon(QSL(":icons/menu/search-icon.svg"))));
|
||||||
|
} else {
|
||||||
QIcon icon = m_webView ? m_webView->icon() : IconProvider::emptyWebIcon();
|
QIcon icon = m_webView ? m_webView->icon() : IconProvider::emptyWebIcon();
|
||||||
if (m_webView && m_webView->url().scheme() == QL1S("https"))
|
if (m_webView && m_webView->url().scheme() == QL1S("https"))
|
||||||
icon = QIcon::fromTheme(QSL("document-encrypted"), icon);
|
icon = QIcon::fromTheme(QSL("document-encrypted"), icon);
|
||||||
m_siteIcon->setIcon(QIcon(icon.pixmap(16)));
|
m_siteIcon->setIcon(QIcon(icon.pixmap(16)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationBar::setPrivacyState(bool state)
|
void LocationBar::setPrivacyState(bool state)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user