|
|
@ -87,8 +87,7 @@ WBTabBar::WBTabBar(QWidget *parent) |
|
|
|
connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); |
|
|
|
connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); |
|
|
|
} |
|
|
|
} |
|
|
|
setTabsClosable(true); |
|
|
|
setTabsClosable(true); |
|
|
|
connect(this, SIGNAL(tabCloseRequested(int)), |
|
|
|
connect(this, SIGNAL(tabCloseRequested(int)), this, SIGNAL(closeTab(int))); |
|
|
|
this, SIGNAL(closeTab(int))); |
|
|
|
|
|
|
|
setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); |
|
|
|
setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); |
|
|
|
setMovable(true); |
|
|
|
setMovable(true); |
|
|
|
setDocumentMode(false); |
|
|
|
setDocumentMode(false); |
|
|
@ -116,26 +115,23 @@ void WBTabBar::contextMenuRequested(const QPoint &position) |
|
|
|
menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); |
|
|
|
menu.addAction(tr("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); |
|
|
|
int index = tabAt(position); |
|
|
|
int index = tabAt(position); |
|
|
|
if (-1 != index) { |
|
|
|
if (-1 != index) { |
|
|
|
QAction *action = menu.addAction(tr("Clone Tab"), |
|
|
|
QAction *action = menu.addAction(tr("Clone Tab"), this, SLOT(cloneTab())); |
|
|
|
this, SLOT(cloneTab())); |
|
|
|
|
|
|
|
action->setData(index); |
|
|
|
action->setData(index); |
|
|
|
|
|
|
|
|
|
|
|
menu.addSeparator(); |
|
|
|
menu.addSeparator(); |
|
|
|
|
|
|
|
|
|
|
|
action = menu.addAction(tr("&Close Tab"), |
|
|
|
action = menu.addAction(tr("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close); |
|
|
|
this, SLOT(closeTab()), QKeySequence::Close); |
|
|
|
|
|
|
|
action->setData(index); |
|
|
|
action->setData(index); |
|
|
|
|
|
|
|
|
|
|
|
action = menu.addAction(tr("Close &Other Tabs"), |
|
|
|
action = menu.addAction(tr("Close &Other Tabs"), this, SLOT(closeOtherTabs())); |
|
|
|
this, SLOT(closeOtherTabs())); |
|
|
|
|
|
|
|
action->setData(index); |
|
|
|
action->setData(index); |
|
|
|
|
|
|
|
|
|
|
|
menu.addSeparator(); |
|
|
|
menu.addSeparator(); |
|
|
|
|
|
|
|
|
|
|
|
action = menu.addAction(tr("Reload Tab"), |
|
|
|
action = menu.addAction(tr("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh); |
|
|
|
this, SLOT(reloadTab()), QKeySequence::Refresh); |
|
|
|
|
|
|
|
action->setData(index); |
|
|
|
action->setData(index); |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
menu.addSeparator(); |
|
|
|
menu.addSeparator(); |
|
|
|
} |
|
|
|
} |
|
|
|
menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs())); |
|
|
|
menu.addAction(tr("Reload All Tabs"), this, SIGNAL(reloadAllTabs())); |
|
|
@ -412,45 +408,30 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent) |
|
|
|
p.setColor(QPalette::Window, palette().color(QPalette::Base)); |
|
|
|
p.setColor(QPalette::Window, palette().color(QPalette::Base)); |
|
|
|
emptyWidget->setPalette(p); |
|
|
|
emptyWidget->setPalette(p); |
|
|
|
emptyWidget->setAutoFillBackground(true); |
|
|
|
emptyWidget->setAutoFillBackground(true); |
|
|
|
disconnect(this, SIGNAL(currentChanged(int)), |
|
|
|
disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); |
|
|
|
this, SLOT(currentChanged(int))); |
|
|
|
|
|
|
|
addTab(emptyWidget, tr("(Untitled)")); |
|
|
|
addTab(emptyWidget, tr("(Untitled)")); |
|
|
|
connect(this, SIGNAL(currentChanged(int)), |
|
|
|
connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); |
|
|
|
this, SLOT(currentChanged(int))); |
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// webview
|
|
|
|
// webview
|
|
|
|
WBWebView *webView = new WBWebView; |
|
|
|
WBWebView *webView = new WBWebView; |
|
|
|
urlLineEdit->setWebView(webView); |
|
|
|
urlLineEdit->setWebView(webView); |
|
|
|
connect(webView, SIGNAL(loadStarted()), |
|
|
|
connect(webView, SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted())); |
|
|
|
this, SLOT(webViewLoadStarted())); |
|
|
|
connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(webViewIconChanged())); |
|
|
|
connect(webView, SIGNAL(loadFinished(bool)), |
|
|
|
connect(webView, SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); |
|
|
|
this, SLOT(webViewIconChanged())); |
|
|
|
connect(webView, SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); |
|
|
|
connect(webView, SIGNAL(iconChanged()), |
|
|
|
connect(webView, SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); |
|
|
|
this, SLOT(webViewIconChanged())); |
|
|
|
connect(webView->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); |
|
|
|
connect(webView, SIGNAL(titleChanged(const QString &)), |
|
|
|
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), this, SIGNAL(geometryChangeRequested(const QRect &))); |
|
|
|
this, SLOT(webViewTitleChanged(const QString &))); |
|
|
|
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), this, SIGNAL(printRequested(QWebFrame *))); |
|
|
|
connect(webView, SIGNAL(urlChanged(const QUrl &)), |
|
|
|
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SIGNAL(menuBarVisibilityChangeRequested(bool))); |
|
|
|
this, SLOT(webViewUrlChanged(const QUrl &))); |
|
|
|
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SIGNAL(statusBarVisibilityChangeRequested(bool))); |
|
|
|
connect(webView->page(), SIGNAL(windowCloseRequested()), |
|
|
|
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SIGNAL(toolBarVisibilityChangeRequested(bool))); |
|
|
|
this, SLOT(windowCloseRequested())); |
|
|
|
|
|
|
|
connect(webView->page(), SIGNAL(geometryChangeRequested(const QRect &)), |
|
|
|
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)), UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool))); |
|
|
|
this, SIGNAL(geometryChangeRequested(const QRect &))); |
|
|
|
|
|
|
|
connect(webView->page(), SIGNAL(printRequested(QWebFrame *)), |
|
|
|
connect(webView, SIGNAL(embedCodeCaptured(const QString&)), UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&))); |
|
|
|
this, SIGNAL(printRequested(QWebFrame *))); |
|
|
|
|
|
|
|
connect(webView->page(), SIGNAL(menuBarVisibilityChangeRequested(bool)), |
|
|
|
|
|
|
|
this, SIGNAL(menuBarVisibilityChangeRequested(bool))); |
|
|
|
|
|
|
|
connect(webView->page(), SIGNAL(statusBarVisibilityChangeRequested(bool)), |
|
|
|
|
|
|
|
this, SIGNAL(statusBarVisibilityChangeRequested(bool))); |
|
|
|
|
|
|
|
connect(webView->page(), SIGNAL(toolBarVisibilityChangeRequested(bool)), |
|
|
|
|
|
|
|
this, SIGNAL(toolBarVisibilityChangeRequested(bool))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(webView, SIGNAL(pixmapCaptured(const QPixmap&, bool)), |
|
|
|
|
|
|
|
UBApplication::applicationController, SLOT(addCapturedPixmap(const QPixmap &, bool))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(webView, SIGNAL(embedCodeCaptured(const QString&)), |
|
|
|
|
|
|
|
UBApplication::applicationController, SLOT(addCapturedEmbedCode(const QString&))); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addTab(webView, tr("(Untitled)")); |
|
|
|
addTab(webView, tr("(Untitled)")); |
|
|
|
if (makeCurrent) |
|
|
|
if (makeCurrent) |
|
|
@ -465,7 +446,6 @@ WBWebView *WBTabWidget::newTab(bool makeCurrent) |
|
|
|
|
|
|
|
|
|
|
|
if (count() == 1) |
|
|
|
if (count() == 1) |
|
|
|
currentChanged(currentIndex()); |
|
|
|
currentChanged(currentIndex()); |
|
|
|
emit tabsChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return webView; |
|
|
|
return webView; |
|
|
|
} |
|
|
|
} |
|
|
@ -553,13 +533,13 @@ void WBTabWidget::closeTab(int index) |
|
|
|
removeTab(index); |
|
|
|
removeTab(index); |
|
|
|
webView->deleteLater(); |
|
|
|
webView->deleteLater(); |
|
|
|
|
|
|
|
|
|
|
|
emit tabsChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFocus && count() > 0) |
|
|
|
if (hasFocus && count() > 0) |
|
|
|
currentWebView()->setFocus(); |
|
|
|
currentWebView()->setFocus(); |
|
|
|
|
|
|
|
|
|
|
|
if (count() == 0) |
|
|
|
if (count() == 0){ |
|
|
|
emit lastTabClosed(); |
|
|
|
newTab(); |
|
|
|
|
|
|
|
emit currentChanged(0); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WBTabWidget::webViewLoadStarted() |
|
|
|
void WBTabWidget::webViewLoadStarted() |
|
|
@ -616,7 +596,6 @@ void WBTabWidget::webViewUrlChanged(const QUrl &url) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mTabBar->setTabData(index, url); |
|
|
|
mTabBar->setTabData(index, url); |
|
|
|
} |
|
|
|
} |
|
|
|
emit tabsChanged(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// web view does not reload sometime on OSX ... force it
|
|
|
|
// web view does not reload sometime on OSX ... force it
|
|
|
|
webView->show(); |
|
|
|
webView->show(); |
|
|
|