1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

New option "Open new empty tabs after active tab".

Closes #544
This commit is contained in:
nowrep 2013-01-25 23:49:46 +01:00
parent 3cdb4c26df
commit c1c1b4130e
8 changed files with 31 additions and 11 deletions

View File

@ -290,7 +290,7 @@ void MainApplication::postLaunch()
}
if (m_postLaunchActions.contains(OpenNewTab)) {
getWindow()->tabWidget()->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd);
getWindow()->tabWidget()->addView(QUrl(), Qz::NT_SelectedNewEmptyTab);
}
AutoSaver* saver = new AutoSaver();
@ -550,7 +550,8 @@ void MainApplication::addNewTab(const QUrl &url)
if (!getWindow()) {
return;
}
getWindow()->tabWidget()->addView(url, Qz::NT_SelectedTabAtTheEnd);
getWindow()->tabWidget()->addView(url, url.isEmpty() ? Qz::NT_SelectedNewEmptyTab : Qz::NT_SelectedTabAtTheEnd);
}
QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &startUrl)

View File

@ -1477,7 +1477,7 @@ void QupZilla::aboutQupZilla()
void QupZilla::addTab()
{
m_tabWidget->addView(QUrl(), Qz::NT_SelectedTabAtTheEnd, true);
m_tabWidget->addView(QUrl(), Qz::NT_SelectedNewEmptyTab, true);
}
void QupZilla::webSearch()

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -75,7 +75,9 @@ enum NewTabPositionFlag {
NT_NotSelectedTab = 2,
NT_CleanTab = 4,
NT_TabAtTheEnd = 8,
NT_NewEmptyTab = 16,
NT_SelectedNewEmptyTab = NT_SelectedTab | NT_TabAtTheEnd | NT_NewEmptyTab,
NT_SelectedTabAtTheEnd = NT_SelectedTab | NT_TabAtTheEnd,
NT_NotSelectedTabAtTheEnd = NT_NotSelectedTab | NT_TabAtTheEnd,
NT_CleanSelectedTabAtTheEnd = NT_SelectedTab | NT_TabAtTheEnd | NT_CleanTab,

View File

@ -202,6 +202,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
ui->openNewEmptyTabAfterActive->setChecked(settings.value("newEmptyTabAfterActive", false).toBool());
ui->switchToNewTabs->setChecked(settings.value("OpenNewTabsSelected", false).toBool());
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
@ -824,6 +825,7 @@ void Preferences::saveSettings()
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked());
settings.setValue("newEmptyTabAfterActive", ui->openNewEmptyTabAfterActive->isChecked());
settings.setValue("OpenNewTabsSelected", ui->switchToNewTabs->isChecked());
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());

View File

@ -727,6 +727,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="openNewEmptyTabAfterActive">
<property name="text">
<string>Open new empty tabs after active tab</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="switchToNewTabs">
<property name="text">

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -64,7 +64,7 @@ void AddTabButton::mouseReleaseEvent(QMouseEvent* event)
QUrl guessedUrl = WebView::guessUrlFromString(selectionClipboard);
if (!guessedUrl.isEmpty()) {
m_tabWidget->addView(guessedUrl, Qz::NT_SelectedTabAtTheEnd);
m_tabWidget->addView(guessedUrl, Qz::NT_SelectedNewEmptyTab);
}
}
@ -93,7 +93,7 @@ void AddTabButton::dropEvent(QDropEvent* event)
}
foreach(const QUrl & url, mime->urls()) {
m_tabWidget->addView(url, Qz::NT_SelectedTabAtTheEnd);
m_tabWidget->addView(url, Qz::NT_SelectedNewEmptyTab);
}
}
@ -151,6 +151,7 @@ void TabWidget::loadSettings()
m_dontQuitWithOneTab = settings.value("dontQuitWithOneTab", false).toBool();
m_closedInsteadOpened = settings.value("closedInsteadOpenedTabs", false).toBool();
m_newTabAfterActive = settings.value("newTabAfterActive", true).toBool();
m_newEmptyTabAfterActive = settings.value("newEmptyTabAfterActive", false).toBool();
settings.endGroup();
settings.beginGroup("Web-URL-Settings");
@ -288,7 +289,13 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
url = m_urlOnNewTab;
}
if (position == -1 && m_newTabAfterActive && !(openFlags & Qz::NT_TabAtTheEnd)) {
bool openAfterActive = m_newTabAfterActive && !(openFlags & Qz::NT_TabAtTheEnd);
if (openFlags == Qz::NT_SelectedNewEmptyTab && m_newEmptyTabAfterActive) {
openAfterActive = true;
}
if (openAfterActive && position == -1) {
// If we are opening newBgTab from pinned tab, make sure it won't be
// opened between other pinned tabs
if (openFlags & Qz::NT_NotSelectedTab && m_lastBackgroundTabIndex != -1) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -140,6 +140,7 @@ private:
bool m_dontQuitWithOneTab;
bool m_closedInsteadOpened;
bool m_newTabAfterActive;
bool m_newEmptyTabAfterActive;
QUrl m_urlOnNewTab;
QupZilla* p_QupZilla;

View File

@ -1,6 +1,6 @@
/* ============================================================
* Mouse Gestures plugin for QupZilla
* Copyright (C) 2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -135,7 +135,7 @@ void MouseGestures::downGestured()
return;
}
m_view.data()->openUrlInNewTab(QUrl(), Qz::NT_SelectedTabAtTheEnd);
m_view.data()->openUrlInNewTab(QUrl(), Qz::NT_SelectedNewEmptyTab);
}
void MouseGestures::leftGestured()