1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Little changes in "open new tab after active" + in ctrl+click on links

- when opening clean new tab, it will be opened at the end of tabbar
  regardless of user settings
- fixing issue when ctrl+left clicking on dial in speed dial opening
  page in new tab and also started to drag dial
This commit is contained in:
nowrep 2012-01-26 20:19:56 +01:00
parent 0cf13286d2
commit d78df618b0
9 changed files with 37 additions and 48 deletions

Binary file not shown.

View File

@ -255,7 +255,7 @@ void MainApplication::postLaunch()
}
if (m_postLaunchActions.contains(OpenNewTab)) {
getWindow()->tabWidget()->addView();
getWindow()->tabWidget()->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd);
}
}
@ -479,7 +479,7 @@ void MainApplication::addNewTab(const QUrl &url)
if (!getWindow()) {
return;
}
getWindow()->tabWidget()->addView(url);
getWindow()->tabWidget()->addView(url, Qz::NT_SelectedTabAtTheEnd);
}
QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl)

View File

@ -127,7 +127,7 @@ void QupZilla::postLaunch()
for (int i = 0; i < qApp->arguments().count(); i++) {
QString arg = arguments.at(i);
if (arg.startsWith("-url=")) {
m_tabWidget->addView(QUrl(arg.replace("-url=", "")));
m_tabWidget->addView(QUrl(arg.replace("-url=", "")), Qz::NT_SelectedTabAtTheEnd);
addTab = false;
}
}
@ -181,8 +181,7 @@ void QupZilla::postLaunch()
}
if (addTab) {
int index = m_tabWidget->addView(startUrl, Qz::NT_CleanSelectedTab);
m_tabWidget->setCurrentIndex(index);
m_tabWidget->addView(startUrl, Qz::NT_SelectedTabAtTheEnd);
if (startUrl.isEmpty() || startUrl.toString() == "qupzilla:speeddial") {
locationBar()->setFocus();
@ -191,7 +190,7 @@ void QupZilla::postLaunch()
if (m_tabWidget->getTabBar()->normalTabsCount() <= 0 && m_startBehaviour != Qz::BW_OtherRestoredWindow) {
//Something went really wrong .. add one tab
m_tabWidget->addView(m_homepage);
m_tabWidget->addView(m_homepage, Qz::NT_SelectedTabAtTheEnd);
}
aboutToShowBookmarksMenu();
@ -1351,7 +1350,7 @@ void QupZilla::aboutQupZilla()
void QupZilla::addTab()
{
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true);
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true);
}
void QupZilla::webSearch()

View File

@ -37,7 +37,10 @@ enum NewTabPositionFlag {
NT_SelectedTab = 1,
NT_NotSelectedTab = 2,
NT_CleanTab = 4,
NT_TabAtTheEnd = 8,
NT_SelectedTabAtTheEnd = NT_SelectedTab | NT_TabAtTheEnd,
NT_NotSelectedTabAtTheEnd = NT_NotSelectedTab | NT_TabAtTheEnd,
NT_CleanSelectedTab = NT_CleanTab | NT_SelectedTab,
NT_CleanNotSelectedTab = NT_CleanTab | NT_NotSelectedTab
};

View File

@ -341,7 +341,7 @@ void TabBar::mouseMoveEvent(QMouseEvent* event)
void TabBar::mouseDoubleClickEvent(QMouseEvent* event)
{
if (event->button() == Qt::LeftButton && tabAt(event->pos()) == -1) {
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true);
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true);
return;
}
@ -365,7 +365,7 @@ void TabBar::mouseReleaseEvent(QMouseEvent* event)
return;
}
if (id == -1 && event->button() == Qt::MiddleButton) {
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTab, true);
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true);
return;
}

View File

@ -278,7 +278,7 @@ int TabWidget::addView(QUrl url, const QString &title, const Qz::NewTabPositionF
url = m_urlOnNewTab;
}
if (m_newTabAfterActive) {
if (m_newTabAfterActive && !(openFlags & Qz::NT_TabAtTheEnd)) {
// If we are opening newBgTab from pinned tab, make sure it won't be
// opened between other pinned tabs
position = qMax(currentIndex() + 1, m_tabBar->pinnedTabsCount());

View File

@ -265,12 +265,6 @@ void WebPage::populateNetworkRequest(QNetworkRequest &request)
QWebPage* WebPage::createWindow(QWebPage::WebWindowType type)
{
#if 0
Q_UNUSED(type);
int index = p_QupZilla->tabWidget()->addView(QUrl(), TabWidget::CleanSelectedPage);
return p_QupZilla->weView(index)->page();
#endif
return new PopupWebPage(type, p_QupZilla);
}

View File

@ -553,14 +553,14 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
}
#if (QTWEBKIT_VERSION >= QTWEBKIT_VERSION_CHECK(2, 2, 0))
// still bugged? in 4.8 RC (it shows selection of webkit's internal source, not html from page)
// it may or may not be bug, but this implementation is useless for us
//
// if (!selectedHtml().isEmpty())
// menu->addAction(tr("Show source of selection"), this, SLOT(showSourceOfSelection()));
// still bugged? in 4.8 RC (it shows selection of webkit's internal source, not html from page)
// it may or may not be bug, but this implementation is useless for us
//
// if (!selectedHtml().isEmpty())
// menu->addAction(tr("Show source of selection"), this, SLOT(showSourceOfSelection()));
#endif
// mApp->plugins()->populateWebViewMenu(m_menu, this, hitTest);
// mApp->plugins()->populateWebViewMenu(m_menu, this, hitTest);
}
void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
@ -608,8 +608,8 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos)
menu->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &all"), this, SLOT(selectAll()));
menu->addSeparator();
if (url().scheme() == "http" || url().scheme() == "https") {
// bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?"));
// if (result)
// bool result = validateConfirm(tr("Do you want to upload this page to an online source code validator?"));
// if (result)
menu->addAction(tr("Validate page"), this, SLOT(openUrlInSelectedTab()))->setData("http://validator.w3.org/check?uri=" + url().toString());
}
@ -783,12 +783,21 @@ void WebView::mousePressEvent(QMouseEvent* event)
return;
}
#endif
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl();
}
}
case Qt::LeftButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
m_clickedUrl = frame->hitTestContent(event->pos()).linkUrl();
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (event->modifiers() == Qt::ControlModifier && isUrlValid(link)) {
openUrlInNewTab(link, Qz::NT_NotSelectedTab);
event->accept();
return;
}
}
}
@ -816,22 +825,6 @@ void WebView::mouseReleaseEvent(QMouseEvent* event)
break;
}
case Qt::LeftButton: {
QWebFrame* frame = page()->frameAt(event->pos());
if (frame) {
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
if (m_clickedUrl == link && event->modifiers() == Qt::ControlModifier) {
if (isUrlValid(link)) {
openUrlInNewTab(link, Qz::NT_NotSelectedTab);
event->accept();
return;
}
}
}
break;
}
default:
break;
}
@ -905,7 +898,7 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
QTouchEvent::TouchPoint touchPoint;
touchPoint.setState(Qt::TouchPointMoved);
if ((ev->type() == QEvent::MouseButtonPress
|| ev->type() == QEvent::MouseButtonDblClick)) {
|| ev->type() == QEvent::MouseButtonDblClick)) {
touchPoint.setState(Qt::TouchPointPressed);
}
else if (ev->type() == QEvent::MouseButtonRelease) {

View File

@ -2475,12 +2475,12 @@ não foi encontrado!</translation>
<message>
<location filename="../src/preferences/preferences.ui" line="1116"/>
<source>Allow HTML5 local storage</source>
<translation type="unfinished"></translation>
<translation>Permitir armazenamento local HTML5</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="1123"/>
<source>Delete local storage on close</source>
<translation type="unfinished"></translation>
<translation>Eliminar armazenamento local ao fechar</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="1159"/>
@ -2565,12 +2565,12 @@ não foi encontrado!</translation>
<message>
<location filename="../src/preferences/preferences.ui" line="1687"/>
<source>Filter tracking cookies</source>
<translation type="unfinished"></translation>
<translation>Filtrar cookies de rastreio</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="1731"/>
<source>&lt;b&gt;Warning:&lt;/b&gt; Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first!</source>
<translation type="unfinished"></translation>
<translation>&lt;b&gt;Aviso:&lt;/b&gt; as opções Coincidente com domínio e Filtrar cookies de rastreio podem recusar alguns cookies das páginas visitados. Se ocorrem problemas, tente desativar estas opções!</translation>
</message>
<message>
<source>Default Font</source>
@ -2694,7 +2694,7 @@ não foi encontrado!</translation>
<message>
<location filename="../src/preferences/preferences.ui" line="1770"/>
<source>&lt;b&gt;SSL Certificates&lt;/b&gt;</source>
<translation type="unfinished"></translation>
<translation>&lt;b&gt;Certificados SSL&lt;/b&gt;</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="1783"/>
@ -2704,7 +2704,7 @@ não foi encontrado!</translation>
<message>
<location filename="../src/preferences/preferences.ui" line="1790"/>
<source>Edit CA certificates in SSL Manager</source>
<translation type="unfinished"></translation>
<translation>Editar certificados no gestor SSL</translation>
</message>
<message>
<location filename="../src/preferences/preferences.ui" line="1835"/>