diff options
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 1c36adcf..0b17ef2a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -329,6 +329,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent) connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(tab->view(), SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); + connect(tab->view(), SIGNAL(zoomChanged(qreal)), m_parentWindow, SLOT(setZoomSliderFactor(qreal))); // connecting webPage signals with mainview connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); @@ -512,6 +513,8 @@ void MainView::closeTab(int index, bool del) UrlBar *urlbar = _widgetBar->urlBar(index); _widgetBar->removeWidget(urlbar); + _widgetBar->setCurrentIndex(m_currentTabIndex); + if (del) { tab->deleteLater(); // tab is scheduled for deletion. @@ -592,11 +595,10 @@ void MainView::webViewIconChanged() void MainView::webViewTitleChanged(const QString &title) { - QString tabTitle = title; - if (title.isEmpty()) - { - tabTitle = i18n("(Untitled)"); - } + QString viewTitle = title.isEmpty()? i18n("(Untitled)") : title; + QString tabTitle = viewTitle; + tabTitle.replace('&', "&&"); + WebView *view = qobject_cast<WebView *>(sender()); int index = indexOf(view->parentWidget()); if (-1 != index) @@ -605,7 +607,7 @@ void MainView::webViewTitleChanged(const QString &title) } if (currentIndex() == index) { - emit currentTitle(tabTitle); + emit currentTitle(viewTitle); } Application::historyManager()->updateHistoryEntry(view->url(), tabTitle); } @@ -657,6 +659,17 @@ void MainView::openClosedTab() } } +void MainView::switchToTab() +{ + // uses the sender to determine the tab index + QAction *sender = static_cast<QAction*>(QObject::sender()); + int index = sender->data().toInt(); + index -= 1; // to compensate for off by 1 presented to the user + if( index < 0 || index >= count() ) + return; + setCurrentIndex( index ); +} + QLabel *MainView::animatedLoading(int index, bool addMovie) { if (index == -1) |