diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 6 | ||||
-rw-r--r-- | src/mainview.h | 9 | ||||
-rw-r--r-- | src/mainwindow.cpp | 63 | ||||
-rw-r--r-- | src/mainwindow.h | 6 | ||||
-rw-r--r-- | src/rekonqui.rc | 5 | ||||
-rw-r--r-- | src/urlbar/urlbar.cpp | 18 | ||||
-rw-r--r-- | src/urlbar/urlbar.h | 7 | ||||
-rw-r--r-- | src/webpage.cpp | 4 | ||||
-rw-r--r-- | src/webtab.cpp | 7 | ||||
-rw-r--r-- | src/webtab.h | 3 |
10 files changed, 89 insertions, 39 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 17cdd884..d008b277 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -264,7 +264,7 @@ void MainView::currentChanged(int index) emit showStatusBarMessage(QString()); // notify UI to eventually switch stop/reload button - emit browserTabLoading(tab->isPageLoading()); + emit currentTabStateChanged(); // set focus to the current webview if (tab->url().scheme() == QL1S("about")) @@ -518,7 +518,7 @@ void MainView::webViewLoadStarted() if (index != currentIndex()) return; - emit browserTabLoading(true); + emit currentTabStateChanged(); emit showStatusBarMessage(i18n("Loading..."), Rekonq::Info); if (view == currentWebTab()->view() && view->url().scheme() != QL1S("about")) @@ -544,7 +544,7 @@ void MainView::webViewLoadFinished(bool ok) } webViewIconChanged(); - emit browserTabLoading(false); + emit currentTabStateChanged(); // don't display messages for background tabs if (index != currentIndex()) diff --git a/src/mainview.h b/src/mainview.h index 28185e48..f2ed7cba 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -113,13 +113,20 @@ Q_SIGNALS: void currentTitle(const QString &url); void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info); void linkHovered(const QString &link); - void browserTabLoading(bool); void openPreviousInHistory(); void openNextInHistory(); void closeWindow(); void printRequested(QWebFrame *frame); + /** + * Current tab state changed: + * 1. tab is loading + * 2. tab finished loading + * 3. tab urlbar got focus + */ + void currentTabStateChanged(); + public Q_SLOTS: /** * Core browser slot. This create a new tab with a WebView inside diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index feeb0383..f2ee25be 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -111,6 +111,7 @@ MainWindow::MainWindow() , m_bookmarksPanel(0) , m_webInspectorPanel(0) , m_analyzerPanel(0) + , m_loadStopReloadAction(0) , m_historyBackMenu(0) , m_historyForwardMenu(0) , m_bookmarksBar(0) @@ -196,8 +197,9 @@ MainWindow::MainWindow() connect(m_view, SIGNAL(openPreviousInHistory()), this, SLOT(openPrevious())); connect(m_view, SIGNAL(openNextInHistory()), this, SLOT(openNext())); - // update toolbar actions signals - connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateActions())); + // update actions + connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateHistoryActions())); + connect(m_view, SIGNAL(currentTabStateChanged()), this, SLOT(updateTabActions())); // Change window icon according to tab icon connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(changeWindowIcon(int))); @@ -362,12 +364,12 @@ void MainWindow::setupActions() actionCollection()->addAction(QL1S("stop"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(webStop())); - // stop reload Action - m_stopReloadAction = new KAction(this); - actionCollection()->addAction(QL1S("stop_reload") , m_stopReloadAction); - m_stopReloadAction->setShortcutConfigurable(false); - connect(m_view, SIGNAL(browserTabLoading(bool)), this, SLOT(browserLoading(bool))); + // load stop reload Action + m_loadStopReloadAction = new KAction(this); + actionCollection()->addAction(QL1S("load_stop_reload") , m_loadStopReloadAction); + m_loadStopReloadAction->setShortcutConfigurable(false); + // Open location action a = new KAction(i18n("Open Location"), this); KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L); openLocationShortcut.setAlternate(Qt::Key_F6); @@ -741,7 +743,7 @@ void MainWindow::preferences() } -void MainWindow::updateActions() +void MainWindow::updateHistoryActions() { bool rekonqPage = currentTab()->page()->isOnRekonqPage(); @@ -1040,7 +1042,7 @@ void MainWindow::viewPageSource() srcTab->setPart(pa, tmpUrl); srcTab->urlBar()->setQUrl(url.pathOrUrl()); m_view->setTabText(m_view->currentIndex(), i18n("Source of: ") + url.prettyUrl()); - updateActions(); + updateHistoryActions(); } else KRun::runUrl(tmpUrl, QL1S("text/plain"), this, false); @@ -1063,29 +1065,42 @@ WebTab *MainWindow::currentTab() const } -void MainWindow::browserLoading(bool v) +void MainWindow::updateTabActions() { + m_loadStopReloadAction->disconnect(); + + if (m_view->currentUrlBar()->hasFocus()) + { + m_loadStopReloadAction->disconnect(); + + m_loadStopReloadAction->setIcon(KIcon("go-jump-locationbar")); + m_loadStopReloadAction->setToolTip(i18n("Load typed url")); + m_loadStopReloadAction->setText(i18n("Load")); + + connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), m_view->currentUrlBar(), SLOT(loadDigitedUrl())); + return; + } + QAction *stop = actionCollection()->action(QL1S("stop")); QAction *reload = actionCollection()->action(QL1S("view_redisplay")); - if (v) + + if (currentTab()->isPageLoading()) { - disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); - m_stopReloadAction->setIcon(KIcon("process-stop")); - m_stopReloadAction->setToolTip(i18n("Stop loading the current page")); - m_stopReloadAction->setText(i18n("Stop")); - connect(m_stopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); + m_loadStopReloadAction->setIcon(KIcon("process-stop")); + m_loadStopReloadAction->setToolTip(i18n("Stop loading the current page")); + m_loadStopReloadAction->setText(i18n("Stop")); + connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); stop->setEnabled(true); } else { - disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); - m_stopReloadAction->setIcon(KIcon("view-refresh")); - m_stopReloadAction->setToolTip(i18n("Reload the current page")); - m_stopReloadAction->setText(i18n("Reload")); - connect(m_stopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); + 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)), reload, SIGNAL(triggered(bool))); stop->setEnabled(false); - updateActions(); + updateHistoryActions(); } } @@ -1119,7 +1134,7 @@ void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifie history->goToItem(*item); } - updateActions(); + updateHistoryActions(); } @@ -1152,7 +1167,7 @@ void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k history->goToItem(*item); } - updateActions(); + updateHistoryActions(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index abdf903a..0b1380da 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -104,7 +104,8 @@ public Q_SLOTS: void printRequested(QWebFrame *frame = 0); - void updateActions(); + void updateHistoryActions(); + void updateTabActions(); virtual void configureToolbars(); @@ -146,7 +147,6 @@ protected: void finalizeGUI(KXMLGUIClient *client); private Q_SLOTS: - void browserLoading(bool); void updateWindowTitle(const QString &title = QString()); // history related @@ -201,7 +201,7 @@ private: WebInspectorPanel *m_webInspectorPanel; NetworkAnalyzerPanel *m_analyzerPanel; - KAction *m_stopReloadAction; + KAction *m_loadStopReloadAction; KMenu *m_historyBackMenu; KMenu *m_historyForwardMenu; diff --git a/src/rekonqui.rc b/src/rekonqui.rc index 7aeeb566..1c6f26a5 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -1,6 +1,6 @@ <?xml version="1.0"?> <!DOCTYPE gui SYSTEM "kpartgui.dtd"> -<gui name="rekonq" version="60"> +<gui name="rekonq" version="61"> <!--- =========== Rekonq Menu ============= --> <Menu name="rekonqMenu" noMerge="1"> @@ -142,9 +142,8 @@ <text>Main Toolbar</text> <Action name="go_back" /> <Action name="go_forward" /> - <Separator /> - <Action name="stop_reload" /> <Action name="url_bar" /> + <Action name="load_stop_reload" /> <Action name="rekonq_tools" /> </ToolBar> diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp index 83684922..f8fb7d0c 100644 --- a/src/urlbar/urlbar.cpp +++ b/src/urlbar/urlbar.cpp @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com> * Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com> * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> @@ -177,6 +177,21 @@ void UrlBar::loadRequestedUrl(const KUrl& url, Rekonq::OpenType type) } +void UrlBar::loadDigitedUrl() +{ + UrlResolver res(text()); + UrlSearchList list = res.orderedSearchItems(); + if (list.isEmpty()) + { + loadRequestedUrl(KUrl(text())); + } + else + { + loadRequestedUrl(list.first().url); + } +} + + void UrlBar::paintEvent(QPaintEvent *event) { KColorScheme colorScheme(palette().currentColorGroup()); @@ -304,6 +319,7 @@ void UrlBar::keyPressEvent(QKeyEvent *event) void UrlBar::focusInEvent(QFocusEvent *event) { activateSuggestions(true); + rApp->mainWindow()->updateTabActions(); KLineEdit::focusInEvent(event); } diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index 2d158ff3..fb7bcb2b 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -2,7 +2,7 @@ * * This file is a part of the rekonq project * -* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com> * Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com> * Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com> * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr> @@ -119,6 +119,11 @@ private Q_SLOTS: void delSlot(); bool isValidURL(QString url); + /** + * Load digited url + */ + void loadDigitedUrl(); + protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent *event); diff --git a/src/webpage.cpp b/src/webpage.cpp index 9dee0967..43d81053 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -365,7 +365,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) UrlBar *bar = tab->urlBar(); bar->setQUrl(replyUrl); - rApp->mainWindow()->updateActions(); + rApp->mainWindow()->updateHistoryActions(); } else { @@ -484,7 +484,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply) UrlBar *bar = tab->urlBar(); bar->setQUrl(_loadingUrl); - rApp->mainWindow()->updateActions(); + rApp->mainWindow()->updateHistoryActions(); } } break; diff --git a/src/webtab.cpp b/src/webtab.cpp index 9516f83c..27b0fe8a 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -86,6 +86,7 @@ WebTab::WebTab(QWidget *parent) } connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int))); + connect(m_webView, SIGNAL(loadStarted()), this, SLOT(resetProgress())); connect(m_webView, SIGNAL(titleChanged(const QString &)), this, SIGNAL(titleChanged(const QString &))); // Session Manager @@ -120,6 +121,12 @@ void WebTab::updateProgress(int p) } +void WebTab::resetProgress() +{ + m_progress = 1; +} + + bool WebTab::isPageLoading() { return m_progress != 0 && m_progress != 100; diff --git a/src/webtab.h b/src/webtab.h index c3d3099b..0ba17d9e 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -97,7 +97,8 @@ public: private Q_SLOTS: void updateProgress(int progress); - + void resetProgress(); + void createWalletBar(const QString &, const QUrl &); void showRSSInfo(const QPoint &pos); void showSearchEngine(const QPoint &pos); |