summaryrefslogtreecommitdiff
path: root/src/mainview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r--src/mainview.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 1c36adcf..0bc6fbde 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -512,6 +512,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 +594,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 +606,7 @@ void MainView::webViewTitleChanged(const QString &title)
}
if (currentIndex() == index)
{
- emit currentTitle(tabTitle);
+ emit currentTitle(viewTitle);
}
Application::historyManager()->updateHistoryEntry(view->url(), tabTitle);
}
@@ -657,6 +658,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)