1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Pressing ESC in LocationBar now fill it with address from current tab

This commit is contained in:
nowrep 2011-07-21 17:16:53 +02:00
parent a8881c1d73
commit 23bebb3b9d
4 changed files with 24 additions and 4 deletions

View File

@ -215,10 +215,17 @@ void LocationBar::clearIcon()
void LocationBar::setPrivacy(bool state) void LocationBar::setPrivacy(bool state)
{ {
QString img;
if (state) if (state)
m_siteIcon->setStyleSheet("QToolButton{border-image: url(:/icons/locationbar/safeline.png); margin-left:2px;}"); img = "safeline.png";
else else
m_siteIcon->setStyleSheet("QToolButton{border-image: url(:/icons/locationbar/searchchoose.png); margin-left:2px;}"); img = "searchchoose.png";
#if QT_VERSION == 0x040800
m_siteIcon->setStyleSheet("QToolButton{border-image: url(:/icons/locationbar/"+img+"); margin-left:2px; padding-left: 4px; }");
#else
m_siteIcon->setStyleSheet("QToolButton{border-image: url(:/icons/locationbar/"+img+"); margin-left:2px;}");
#endif
} }
void LocationBar::focusOutEvent(QFocusEvent* e) void LocationBar::focusOutEvent(QFocusEvent* e)
@ -242,7 +249,7 @@ void LocationBar::dropEvent(QDropEvent* event)
} }
} }
else if (event->mimeData()->hasText()) { else if (event->mimeData()->hasText()) {
QUrl dropUrl = QUrl(event->mimeData()->text()); QUrl dropUrl = QUrl(event->mimeData()->text().trimmed());
if (WebView::isUrlValid(dropUrl)) { if (WebView::isUrlValid(dropUrl)) {
setText(dropUrl.toString()); setText(dropUrl.toString());
p_QupZilla->loadAddress(dropUrl); p_QupZilla->loadAddress(dropUrl);

View File

@ -34,6 +34,7 @@ WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar)
m_layout->setSpacing(0); m_layout->setSpacing(0);
m_view = new WebView(p_QupZilla, this); m_view = new WebView(p_QupZilla, this);
m_view->setLocationBar(locationBar);
m_layout->addWidget(m_view); m_layout->addWidget(m_view);
setLayout(m_layout); setLayout(m_layout);

View File

@ -569,6 +569,18 @@ void WebView::contextMenuEvent(QContextMenuEvent* event)
QWebView::contextMenuEvent(event); QWebView::contextMenuEvent(event);
} }
void WebView::stop()
{
if (page()) {
emit ipChanged(m_currentIp);
page()->triggerAction(QWebPage::Stop);
loadFinished(true);
if (m_locationBar->text().isEmpty())
m_locationBar->setText(url().toEncoded());
}
}
void WebView::addNotification(QWidget* notif) void WebView::addNotification(QWidget* notif)
{ {
emit showNotification(notif); emit showNotification(notif);

View File

@ -69,7 +69,7 @@ public:
int tabIndex() const; int tabIndex() const;
public slots: public slots:
void stop(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Stop); loadFinished(true);} } void stop();
void back(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Back);} } void back(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Back);} }
void forward(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Forward);} } void forward(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Forward);} }
void slotReload(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Reload);} } void slotReload(){ if (page()) {emit ipChanged(m_currentIp); page()->triggerAction(QWebPage::Reload);} }