mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Option to open new tabs after active tab (enabled by default)
This commit is contained in:
parent
361cc6a184
commit
beca87fe19
@ -160,7 +160,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
ui->startProfile->addItem(actProfileName);
|
ui->startProfile->addItem(actProfileName);
|
||||||
QDir profilesDir(mApp->PROFILEDIR + "profiles/");
|
QDir profilesDir(mApp->PROFILEDIR + "profiles/");
|
||||||
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
QStringList list_ = profilesDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
foreach(const QString &name, list_) {
|
foreach(const QString & name, list_) {
|
||||||
if (actProfileName == name) {
|
if (actProfileName == name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -192,6 +192,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
ui->makeMovable->setChecked(settings.value("makeTabsMovable", true).toBool());
|
ui->makeMovable->setChecked(settings.value("makeTabsMovable", true).toBool());
|
||||||
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
|
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
|
||||||
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
||||||
|
ui->openNewTabAfterActive->setChecked(settings.value("newTabAfterActive", true).toBool());
|
||||||
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
||||||
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
||||||
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
|
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
|
||||||
@ -345,7 +346,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
|||||||
|
|
||||||
QDir lanDir(mApp->TRANSLATIONSDIR);
|
QDir lanDir(mApp->TRANSLATIONSDIR);
|
||||||
QStringList list = lanDir.entryList(QStringList("*.qm"));
|
QStringList list = lanDir.entryList(QStringList("*.qm"));
|
||||||
foreach(const QString &name, list) {
|
foreach(const QString & name, list) {
|
||||||
if (name.startsWith("qt_") || name == activeLanguage) {
|
if (name.startsWith("qt_") || name == activeLanguage) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -685,6 +686,7 @@ void Preferences::saveSettings()
|
|||||||
settings.setValue("makeTabsMovable", ui->makeMovable->isChecked());
|
settings.setValue("makeTabsMovable", ui->makeMovable->isChecked());
|
||||||
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
|
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
|
||||||
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
||||||
|
settings.setValue("newTabAfterActive", ui->openNewTabAfterActive->isChecked());
|
||||||
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
||||||
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
||||||
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
|
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
|
||||||
|
@ -642,14 +642,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" colspan="4">
|
<item row="10" column="0" colspan="4">
|
||||||
<widget class="QLabel" name="label_25">
|
<widget class="QLabel" name="label_25">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Address Bar behaviour</b></string>
|
<string><b>Address Bar behaviour</b></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="14" column="1">
|
||||||
<spacer name="verticalSpacer_8">
|
<spacer name="verticalSpacer_8">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -662,21 +662,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1" colspan="3">
|
<item row="9" column="1">
|
||||||
<widget class="QCheckBox" name="selectAllOnFocus">
|
|
||||||
<property name="text">
|
|
||||||
<string>Select all text by double clicking in address bar</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="12" column="1" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="addCountryWithAlt">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add .co.uk domain by pressing ALT key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<spacer name="verticalSpacer_7">
|
<spacer name="verticalSpacer_7">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -689,14 +675,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="11" column="1" colspan="3">
|
||||||
|
<widget class="QCheckBox" name="selectAllOnFocus">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select all text by double clicking in address bar</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="1" colspan="3">
|
||||||
|
<widget class="QCheckBox" name="addCountryWithAlt">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add .co.uk domain by pressing ALT key</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
<widget class="QCheckBox" name="askWhenClosingMultipleTabs">
|
<widget class="QCheckBox" name="askWhenClosingMultipleTabs">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ask when closing multiple tabs</string>
|
<string>Ask when closing multiple tabs</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="1" colspan="3">
|
<item row="12" column="1" colspan="3">
|
||||||
<widget class="QCheckBox" name="selectAllOnClick">
|
<widget class="QCheckBox" name="selectAllOnClick">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Select all text by clicking in address bar</string>
|
<string>Select all text by clicking in address bar</string>
|
||||||
@ -723,20 +723,27 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QCheckBox" name="dontQuitOnTab">
|
<widget class="QCheckBox" name="dontQuitOnTab">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Don't quit upon closing last tab</string>
|
<string>Don't quit upon closing last tab</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="8" column="1">
|
||||||
<widget class="QCheckBox" name="closedInsteadOpened">
|
<widget class="QCheckBox" name="closedInsteadOpened">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Closed tabs list instead of opened in tab bar</string>
|
<string>Closed tabs list instead of opened in tab bar</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QCheckBox" name="openNewTabAfterActive">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open new tabs after active tab</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="stackedWidgetPage4">
|
<widget class="QWidget" name="stackedWidgetPage4">
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "searchenginesmanager.h"
|
#include "searchenginesmanager.h"
|
||||||
#include "browsinglibrary.h"
|
#include "browsinglibrary.h"
|
||||||
#include "bookmarksmanager.h"
|
#include "bookmarksmanager.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
WebView::WebView(QWidget* parent)
|
WebView::WebView(QWidget* parent)
|
||||||
: QWebView(parent)
|
: QWebView(parent)
|
||||||
@ -38,6 +39,8 @@ WebView::WebView(QWidget* parent)
|
|||||||
, m_clickedFrame(0)
|
, m_clickedFrame(0)
|
||||||
, m_actionsHaveImages(false)
|
, m_actionsHaveImages(false)
|
||||||
{
|
{
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
|
connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
|
||||||
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
|
connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
|
||||||
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
|
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
|
||||||
@ -50,6 +53,14 @@ WebView::WebView(QWidget* parent)
|
|||||||
qApp->installEventFilter(this);
|
qApp->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebView::loadSettings()
|
||||||
|
{
|
||||||
|
Settings settings;
|
||||||
|
settings.beginGroup("Browser-Tabs-Settings");
|
||||||
|
m_newTabAfterActive = settings.value("newTabAfterActive", true).toBool();
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
QIcon WebView::icon() const
|
QIcon WebView::icon() const
|
||||||
{
|
{
|
||||||
if (url().scheme() == "qupzilla") {
|
if (url().scheme() == "qupzilla") {
|
||||||
@ -378,9 +389,9 @@ void WebView::openUrlInSelectedTab()
|
|||||||
void WebView::openUrlInBackgroundTab()
|
void WebView::openUrlInBackgroundTab()
|
||||||
{
|
{
|
||||||
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
if (QAction* action = qobject_cast<QAction*>(sender())) {
|
||||||
openUrlInNewTab(action->data().toUrl(), Qz::NT_NotSelectedTab);
|
openUrlInNewTab(action->data().toUrl(), m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
|
||||||
}
|
}
|
||||||
}\
|
}
|
||||||
|
|
||||||
void WebView::loadClickedFrame()
|
void WebView::loadClickedFrame()
|
||||||
{
|
{
|
||||||
@ -509,7 +520,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
|
|||||||
QMenu* pageMenu = page()->createStandardContextMenu();
|
QMenu* pageMenu = page()->createStandardContextMenu();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach(QAction* act, pageMenu->actions()) {
|
foreach(QAction * act, pageMenu->actions()) {
|
||||||
if (act->isSeparator()) {
|
if (act->isSeparator()) {
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
continue;
|
continue;
|
||||||
@ -765,7 +776,7 @@ void WebView::mousePressEvent(QMouseEvent* event)
|
|||||||
if (frame) {
|
if (frame) {
|
||||||
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
|
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
|
||||||
if (isUrlValid(link)) {
|
if (isUrlValid(link)) {
|
||||||
openUrlInNewTab(link, Qz::NT_NotSelectedTab);
|
openUrlInNewTab(link, m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -786,7 +797,7 @@ void WebView::mousePressEvent(QMouseEvent* event)
|
|||||||
if (frame && event->modifiers() == Qt::ControlModifier) {
|
if (frame && event->modifiers() == Qt::ControlModifier) {
|
||||||
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
|
QUrl link = frame->hitTestContent(event->pos()).linkUrl();
|
||||||
if (isUrlValid(link)) {
|
if (isUrlValid(link)) {
|
||||||
openUrlInNewTab(link, Qz::NT_NotSelectedTab);
|
openUrlInNewTab(link, m_newTabAfterActive ? Qz::NT_NotSelectedTab : Qz::NT_CleanTab);
|
||||||
event->accept();
|
event->accept();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
QString title() const;
|
QString title() const;
|
||||||
QUrl url() const;
|
QUrl url() const;
|
||||||
|
|
||||||
|
void loadSettings();
|
||||||
bool isLoading() const;
|
bool isLoading() const;
|
||||||
int loadProgress() const;
|
int loadProgress() const;
|
||||||
|
|
||||||
@ -143,6 +144,7 @@ private:
|
|||||||
QWebElement m_mediaElement;
|
QWebElement m_mediaElement;
|
||||||
QWebFrame* m_clickedFrame;
|
QWebFrame* m_clickedFrame;
|
||||||
bool m_actionsHaveImages;
|
bool m_actionsHaveImages;
|
||||||
|
bool m_newTabAfterActive;
|
||||||
|
|
||||||
QList<QTouchEvent::TouchPoint> m_touchPoints;
|
QList<QTouchEvent::TouchPoint> m_touchPoints;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user