Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
Dolphin
Commits
8402b989
Commit
8402b989
authored
Oct 02, 2022
by
Kai Uwe Broulik
🍇
Browse files
DolphinTabWidget: Allow specifying new tab position in openNewTab
parent
57f69445
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/dolphintabwidget.cpp
View file @
8402b989
...
...
@@ -157,7 +157,7 @@ void DolphinTabWidget::openNewActivatedTab(const QUrl& primaryUrl, const QUrl& s
}
}
void
DolphinTabWidget
::
openNewTab
(
const
QUrl
&
primaryUrl
,
const
QUrl
&
secondaryUrl
)
void
DolphinTabWidget
::
openNewTab
(
const
QUrl
&
primaryUrl
,
const
QUrl
&
secondaryUrl
,
DolphinTabWidget
::
NewTabPosition
position
)
{
QWidget
*
focusWidget
=
QApplication
::
focusWidget
();
...
...
@@ -173,8 +173,16 @@ void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryU
tabBar
()
->
setTabText
(
tabIndex
,
tabName
(
tabPage
));
});
if
(
position
==
NewTabPosition
::
FollowSetting
)
{
if
(
GeneralSettings
::
openNewTabAfterLastTab
())
{
position
=
NewTabPosition
::
AtEnd
;
}
else
{
position
=
NewTabPosition
::
AfterCurrent
;
}
}
int
newTabIndex
=
-
1
;
if
(
!
GeneralSettings
::
openNewTabAfterLastTab
())
{
if
(
position
==
NewTabPosition
::
AfterCurrent
||
(
position
==
NewTabPosition
::
FollowSetting
&&
!
GeneralSettings
::
openNewTabAfterLastTab
())
)
{
newTabIndex
=
currentIndex
()
+
1
;
}
...
...
src/dolphintabwidget.h
View file @
8402b989
...
...
@@ -28,6 +28,15 @@ public:
*/
explicit
DolphinTabWidget
(
DolphinNavigatorsWidgetAction
*
navigatorsWidget
,
QWidget
*
parent
);
/**
* Where a newly opened tab should be placed.
*/
enum
class
NewTabPosition
{
FollowSetting
,
///< Honor openNewTabAfterLastTab setting
AfterCurrent
,
///< After the current tab
AtEnd
,
///< At the end of the tab bar
};
/**
* @return Tab page at the current index (can be 0 if tabs count is smaller than 1)
*/
...
...
@@ -113,7 +122,7 @@ public Q_SLOTS:
* Opens a new tab in the background showing the URL \a primaryUrl and the
* optional URL \a secondaryUrl.
*/
void
openNewTab
(
const
QUrl
&
primaryUrl
,
const
QUrl
&
secondaryUrl
=
QUrl
());
void
openNewTab
(
const
QUrl
&
primaryUrl
,
const
QUrl
&
secondaryUrl
=
QUrl
()
,
NewTabPosition
position
=
NewTabPosition
::
FollowSetting
);
/**
* Opens each directory in \p dirs in a separate tab unless it is already open.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment