From 36212edeed4ff4815f7f779bfb1d90f0d07c95a5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 31 Jan 2012 10:53:38 +0100 Subject: Update signals/slot between detached tab and its new mainview Again, sorry for the long waiting... Courtesy patch by vasthusya@gmail.com BUG:273556 REVIEWED-BY: adjam --- src/mainview.cpp | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainview.cpp b/src/mainview.cpp index 711ee15e..2e187809 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -755,8 +755,38 @@ void MainView::detachTab(int index, MainWindow *toWindow) w = rApp->newMainWindow(false); else w = toWindow; - w->mainView()->addTab(tab, rApp->iconManager()->iconForUrl(u), label); + + w->mainView()->addTab(tab, label); w->mainView()->widgetBar()->insertWidget(0, bar); w->mainView()->updateTabBar(); + + // reconnect signals to the new mainview + // Code copied from newWebTab(), any new changes there should be applied here + + // disconnecting webview with old mainview + disconnect(tab->view(), SIGNAL(loadStarted())); + disconnect(tab->view(), SIGNAL(loadFinished(bool))); + disconnect(tab, SIGNAL(titleChanged(const QString &))); + disconnect(tab->view(), SIGNAL(urlChanged(const QUrl &))); + disconnect(tab->view(), SIGNAL(iconChanged())); + disconnect(tab->view(), SIGNAL(openPreviousInHistory())); + disconnect(tab->view(), SIGNAL(openNextInHistory())); + + // disconnecting webPage signals with old mainview + disconnect(tab->page(), SIGNAL(windowCloseRequested())); + disconnect(tab->page(), SIGNAL(printRequested(QWebFrame *))); + + // connecting webview with new mainview + connect(tab->view(), SIGNAL(loadStarted()), w->mainView(), SLOT(webViewLoadStarted())); + connect(tab->view(), SIGNAL(loadFinished(bool)), w->mainView(), SLOT(webViewLoadFinished(bool))); + connect(tab, SIGNAL(titleChanged(const QString &)), w->mainView(), SLOT(webViewTitleChanged(const QString &))); + connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), w->mainView(), SLOT(webViewUrlChanged(const QUrl &))); + connect(tab->view(), SIGNAL(iconChanged()), w->mainView(), SLOT(webViewIconChanged())); + connect(tab->view(), SIGNAL(openPreviousInHistory()), w->mainView(), SIGNAL(openPreviousInHistory())); + connect(tab->view(), SIGNAL(openNextInHistory()), w->mainView(), SIGNAL(openNextInHistory())); + + // connecting webPage signals with new mainview + connect(tab->page(), SIGNAL(windowCloseRequested()), w->mainView(), SLOT(windowCloseRequested())); + connect(tab->page(), SIGNAL(printRequested(QWebFrame *)), w->mainView(), SIGNAL(printRequested(QWebFrame *))); } } -- cgit v1.2.1