From aa34e511fceac0451de3d03319d9caa320c2ccb6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 10 Aug 2009 15:14:50 +0200 Subject: Fixing bug 203156, about stop/reload switch on tab switching. Anyway, the fix seems quite "hackish" to me. Perhaps someone else will think something better.. BUG: 203156 --- src/mainview.cpp | 10 ++++++++-- src/mainview.h | 2 +- src/mainwindow.cpp | 2 +- src/urlbar.cpp | 15 +++++++++++---- src/urlbar.h | 3 ++- 5 files changed, 23 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mainview.cpp b/src/mainview.cpp index 5b08e17a..b8d063b8 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -327,6 +327,12 @@ void MainView::slotCurrentChanged(int index) currentUrlBar()->setUrl(webView->url()); emit showStatusBarMessage(webView->lastStatusBarText()); + // notify UI to eventually switch stop/reload button + if(currentUrlBar()->isLoading()) + emit browserTabLoading(true); + else + emit browserTabLoading(false); + // set focus to the current webview webView->setFocus(); } @@ -541,7 +547,7 @@ void MainView::webViewLoadStarted() } } - emit browserLoading(true); + emit browserTabLoading(true); if (index != currentIndex()) return; @@ -564,7 +570,7 @@ void MainView::webViewLoadFinished(bool ok) } webViewIconChanged(); - emit browserLoading(false); + emit browserTabLoading(false); // don't display messages for background tabs if (index != currentIndex()) diff --git a/src/mainview.h b/src/mainview.h index 982fd9eb..3e6b9efb 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -96,7 +96,7 @@ signals: void setCurrentTitle(const QString &url); void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info); void linkHovered(const QString &link); - void browserLoading(bool); + void browserTabLoading(bool); void printRequested(QWebFrame *frame); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8a527df2..5399a488 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -252,7 +252,7 @@ void MainWindow::setupActions() m_stopReloadAction = new KAction(this); actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); - connect(m_view, SIGNAL(browserLoading(bool)), this, SLOT(slotBrowserLoading(bool))); + connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(slotBrowserLoading(bool))); slotBrowserLoading(false); //first init for blank start page // ============== Custom Actions diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 1b1fbc54..94f248e3 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -244,10 +244,7 @@ void UrlBar::focusOutEvent(QFocusEvent *event) QSize UrlBar::sizeHint() const { - QSize size(lineEdit()->sizeHint()); - // make it (more or less) the same height with search bar (at least on oxygen) -// size.setHeight(size.height() + 2); - return size; + return lineEdit()->sizeHint(); } @@ -266,9 +263,19 @@ QLinearGradient UrlBar::generateGradient(const QColor &color, int height) return gradient; } + void UrlBar::setBackgroundColor(QColor c) { s_defaultBaseColor=c; repaint(); } + +bool UrlBar::isLoading() +{ + if(m_progress == 0) + { + return false; + } + return true; +} diff --git a/src/urlbar.h b/src/urlbar.h index 42ac9af7..50ba40f7 100644 --- a/src/urlbar.h +++ b/src/urlbar.h @@ -58,7 +58,8 @@ public: KUrl url() const; QSize sizeHint() const; void setBackgroundColor(QColor); - + bool isLoading(); + signals: void activated(const KUrl&); -- cgit v1.2.1