Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Config::Config()

m_tocOpenAllEntries = settings.value( "browser/tocopenallentries", true ).toBool();
m_tabUseSingleClick = settings.value( "browser/tabusesingleclick", true ).toBool();
m_tabOpenInForeground = settings.value( "browser/tabopeninforeground", false ).toBool();

QDir dir;
dir.setPath (m_datapath);
Expand Down Expand Up @@ -124,6 +125,7 @@ void Config::save( )

settings.setValue( "browser/tocopenallentries", m_tocOpenAllEntries );
settings.setValue( "browser/tabusesingleclick", m_tabUseSingleClick );
settings.setValue( "browser/tabopeninforeground", m_tabOpenInForeground );
}

QString Config::getEbookSettingFile(const QString& ebookfile ) const
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class Config

bool m_tocOpenAllEntries;
bool m_tabUseSingleClick;
bool m_tabOpenInForeground;

bool m_advUseInternalEditor;
QString m_advExternalEditorPath;
Expand Down
3 changes: 3 additions & 0 deletions src/dialog_setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ DialogSetup::DialogSetup(QWidget* parent)
m_enableLocalStorage->setChecked( pConfig->browser.enableLocalStorage );
m_openAllTOCEntries->setChecked( pConfig->m_tocOpenAllEntries );
boxUseSingleClick->setChecked( pConfig->m_tabUseSingleClick );
boxTabOpenInForeground->setChecked( pConfig->m_tabOpenInForeground );

#if defined (USE_WEBENGINE)
m_enableOfflineStorage->setChecked( false );
Expand Down Expand Up @@ -164,6 +165,8 @@ void DialogSetup::accept()
Check_Need_Restart( m_enableLocalStorage, &pConfig->browser.enableLocalStorage, &need_restart );
Check_Need_Restart( boxUseSingleClick, &pConfig->m_tabUseSingleClick, &need_restart );

pConfig->m_tabOpenInForeground = boxTabOpenInForeground->isChecked();

Config::ToolbarMode newmode;

if ( rbToolbarSmall->isChecked() )
Expand Down
9 changes: 8 additions & 1 deletion src/dialog_setup.ui
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,14 @@
</property>
</widget>
</item>
</layout>
<item>
<widget class="QCheckBox" name="boxTabOpenInForeground">
<property name="text">
<string>Open tabs in foreground</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
Expand Down
12 changes: 1 addition & 11 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,12 +707,7 @@ QUrl MainWindow::getNewTabLink() const

void MainWindow::onOpenPageInNewTab( )
{
openPage( getNewTabLink(), OPF_NEW_TAB | OPF_CONTENT_TREE );
}

void MainWindow::onOpenPageInNewBackgroundTab( )
{
openPage( getNewTabLink(), OPF_NEW_TAB | OPF_BACKGROUND );
openPage( getNewTabLink(), OPF_NEW_TAB | (pConfig->m_tabOpenInForeground ? OPF_CONTENT_TREE : OPF_BACKGROUND) );
}

void MainWindow::browserChanged(ViewWindow* newbrowser )
Expand Down Expand Up @@ -1284,11 +1279,6 @@ void MainWindow::setupActions()
m_contextMenu->addAction ( i18n("&Open this link in a new tab"),
this,
SLOT( onOpenPageInNewTab() ),
QKeySequence( "Shift+Enter" ) );

m_contextMenu->addAction ( i18n("&Open this link in a new background tab"),
this,
SLOT( onOpenPageInNewBackgroundTab() ),
QKeySequence( "Ctrl+Enter" ) );
}

Expand Down
1 change: 0 additions & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindow
//! Update state of navigation actions.
void onHistoryChanged();
void onOpenPageInNewTab();
void onOpenPageInNewBackgroundTab();

// Actions
void actionOpenFile();
Expand Down
4 changes: 1 addition & 3 deletions src/qtwebengine/viewwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ QMenu* ViewWindow::getContextMenu( const QUrl& link, QWidget* parent )
{
m_contextMenuLink = createStandardContextMenu( parent );
m_contextMenuLink->addSeparator();
m_contextMenuLink->addAction( i18n("&Open this link in a new tab"), ::mainWindow, SLOT(onOpenPageInNewTab()), QKeySequence("Shift+Enter") );
m_contextMenuLink->addAction( i18n("&Open this link in a new background tab"), ::mainWindow, SLOT(onOpenPageInNewBackgroundTab()), QKeySequence("Ctrl+Enter") );
m_contextMenuLink->addAction( i18n("&Open this link in a new tab"), ::mainWindow, SLOT(onOpenPageInNewTab()), QKeySequence("Ctrl+Enter") );
}

setTabKeeper( link );
Expand Down Expand Up @@ -253,7 +252,6 @@ void ViewWindow::contextMenuEvent(QContextMenuEvent* e)
if ( !link.isEmpty() )
{
m->addAction( i18n("Open Link in a new tab\tShift+LMB"), ::mainWindow, SLOT( onOpenPageInNewTab() ) );
m->addAction( i18n("Open Link in a new background tab\tCtrl+LMB"), ::mainWindow, SLOT( onOpenPageInNewBackgroundTab() ) );
m->addSeparator();
setTabKeeper( link );
}
Expand Down
7 changes: 2 additions & 5 deletions src/qtwebkit/viewwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ QMenu* ViewWindow::getContextMenu( const QUrl& link, QWidget* parent )
m_contextMenuLink = createStandardContextMenu( parent );
m_contextMenuLink->addSeparator();

m_contextMenuLink->addAction( i18n("&Open this link in a new tab"), ::mainWindow, SLOT(onOpenPageInNewTab()), QKeySequence("Shift+Enter") );

m_contextMenuLink->addAction( i18n("&Open this link in a new background tab"), ::mainWindow, SLOT(onOpenPageInNewBackgroundTab()), QKeySequence("Ctrl+Enter") );
m_contextMenuLink->addAction( i18n("&Open this link in a new tab"), ::mainWindow, SLOT(onOpenPageInNewTab()), QKeySequence("Ctrl+Enter") );
}

setTabKeeper( link );
Expand Down Expand Up @@ -250,7 +248,7 @@ void ViewWindow::mouseReleaseEvent ( QMouseEvent* event )
if ( !link.isEmpty() )
{
setTabKeeper( link );
::mainWindow->onOpenPageInNewBackgroundTab();
::mainWindow->onOpenPageInNewTab();
return;
}
}
Expand All @@ -267,7 +265,6 @@ void ViewWindow::contextMenuEvent(QContextMenuEvent* e)
if ( !link.isEmpty() )
{
m->addAction( i18n("Open Link in a new tab\tShift+LMB"), ::mainWindow, SLOT( onOpenPageInNewTab() ) );
m->addAction( i18n("Open Link in a new background tab\tCtrl+LMB"), ::mainWindow, SLOT( onOpenPageInNewBackgroundTab() ) );
m->addSeparator();
setTabKeeper( link );
}
Expand Down