From 35cdc4f30f167037ef25f8f0a2d134cff74a599a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 14 Oct 2012 21:52:46 +0200 Subject: clean up urlbar url loading. We really are lighter now :) --- src/webwindow/webwindow.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/webwindow/webwindow.cpp') diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index e76d1d5d..f7adb1b6 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -128,6 +128,8 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg) connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(webLoadFinished(bool))); connect(_tab->view(), SIGNAL(loadProgress(int)), this, SLOT(webLoadProgress(int))); + connect(_bar, SIGNAL(focusIn()), this, SLOT(urlbarFocused())); + // page signals connect(page(), SIGNAL(pageCreated(WebPage *)), this, SIGNAL(pageCreated(WebPage *))); @@ -187,10 +189,7 @@ void WebWindow::setupActions() m_loadStopReloadAction = new KAction(this); actionCollection()->addAction(QL1S("load_stop_reload") , m_loadStopReloadAction); m_loadStopReloadAction->setShortcutConfigurable(false); - - m_loadStopReloadAction->setIcon(KIcon("go-jump-locationbar")); - m_loadStopReloadAction->setToolTip(i18n("Go")); - m_loadStopReloadAction->setText(i18n("Go")); + urlbarFocused(); // new window action a = new KAction(KIcon("window-new"), i18n("&New Window"), this); @@ -362,15 +361,31 @@ void WebWindow::webLoadFinished(bool b) { emit loadFinished(b); - m_loadStopReloadAction->setIcon(KIcon("view-refresh")); - m_loadStopReloadAction->setToolTip(i18n("Reload the current page")); - m_loadStopReloadAction->setText(i18n("Reload")); - connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _tab->view(), SLOT(reload())); - + if (_bar->hasFocus()) + { + urlbarFocused(); + } + else + { + m_loadStopReloadAction->setIcon(KIcon("view-refresh")); + m_loadStopReloadAction->setToolTip(i18n("Reload the current page")); + m_loadStopReloadAction->setText(i18n("Reload")); + connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _tab->view(), SLOT(reload())); + } + updateHistoryActions(); } +void WebWindow::urlbarFocused() +{ + m_loadStopReloadAction->setIcon(KIcon("go-jump-locationbar")); + m_loadStopReloadAction->setToolTip(i18n("Go")); + m_loadStopReloadAction->setText(i18n("Go")); + connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _bar, SLOT(loadTypedUrl())); +} + + void WebWindow::aboutToShowBackMenu() { m_historyBackMenu->clear(); -- cgit v1.2.1