Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
fae6267e
Commit
fae6267e
authored
Mar 03, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Mar 04, 2021
Browse files
Move buttons toggling to KateViewManager
parent
b968f317
Changes
3
Hide whitespace changes
Inline
Side-by-side
kate/katemainwindow.cpp
View file @
fae6267e
...
...
@@ -689,24 +689,6 @@ void KateMainWindow::removeMenuBarActionFromContextMenu()
}
}
void
KateMainWindow
::
setForwardButtonEnabled
(
bool
val
)
{
if
(
auto
v
=
activeView
())
{
if
(
auto
kvs
=
qobject_cast
<
KateViewSpace
*>
(
v
->
parentWidget
()
->
parentWidget
()))
{
kvs
->
setForwardButtonEnabled
(
val
);
}
}
}
void
KateMainWindow
::
setBackButtonEnabled
(
bool
val
)
{
if
(
auto
v
=
activeView
())
{
if
(
auto
kvs
=
qobject_cast
<
KateViewSpace
*>
(
v
->
parentWidget
()
->
parentWidget
()))
{
kvs
->
setBackButtonEnabled
(
val
);
}
}
}
void
KateMainWindow
::
toggleShowStatusBar
()
{
Q_EMIT
statusBarToggled
();
...
...
@@ -1212,10 +1194,11 @@ void KateMainWindow::addJump(QUrl url, KTextEditor::Cursor c)
// set to last
currentLocation
=
m_locations
.
size
()
-
1
;
// disable forward button as we are at the end now
setForwardButtonEnabled
(
false
);
Q_EMIT
forwardButtonEnabled
(
false
);
// renable back
if
(
currentLocation
>
0
)
{
setB
ackButtonEnabled
(
true
);
Q_EMIT
b
ackButtonEnabled
(
true
);
}
}
...
...
@@ -1290,7 +1273,7 @@ void KateMainWindow::goBack()
currentLocation
--
;
if
(
currentLocation
<=
0
)
{
setB
ackButtonEnabled
(
false
);
Q_EMIT
b
ackButtonEnabled
(
false
);
}
if
(
!
location
.
url
.
isValid
()
||
!
location
.
cursor
.
isValid
())
{
...
...
@@ -1309,7 +1292,7 @@ void KateMainWindow::goBack()
const
QSignalBlocker
blocker
(
activeView
());
activeView
()
->
setCursorPosition
(
location
.
cursor
);
// enable forward
setF
orwardButtonEnabled
(
true
);
Q_EMIT
f
orwardButtonEnabled
(
true
);
return
;
}
...
...
@@ -1317,7 +1300,7 @@ void KateMainWindow::goBack()
const
QSignalBlocker
blocker
(
v
);
v
->
setCursorPosition
(
location
.
cursor
);
// enable forward
setF
orwardButtonEnabled
(
true
);
Q_EMIT
f
orwardButtonEnabled
(
true
);
}
void
KateMainWindow
::
goForward
()
...
...
@@ -1333,7 +1316,7 @@ void KateMainWindow::goForward()
currentLocation
++
;
if
(
currentLocation
+
1
>=
m_locations
.
size
())
{
setF
orwardButtonEnabled
(
false
);
Q_EMIT
f
orwardButtonEnabled
(
false
);
}
if
(
!
location
.
url
.
isValid
()
||
!
location
.
cursor
.
isValid
())
{
...
...
@@ -1354,7 +1337,7 @@ void KateMainWindow::goForward()
return
;
}
setB
ackButtonEnabled
(
true
);
Q_EMIT
b
ackButtonEnabled
(
true
);
auto
v
=
openUrl
(
location
.
url
);
const
QSignalBlocker
blocker
(
v
);
...
...
kate/katemainwindow.h
View file @
fae6267e
...
...
@@ -149,9 +149,6 @@ private:
void
addMenuBarActionToContextMenu
();
void
removeMenuBarActionFromContextMenu
();
void
setForwardButtonEnabled
(
bool
v
);
void
setBackButtonEnabled
(
bool
v
);
/**
* read some global options from katerc
*/
...
...
@@ -231,6 +228,8 @@ Q_SIGNALS:
void
statusBarToggled
();
void
tabBarToggled
();
void
unhandledShortcutOverride
(
QEvent
*
e
);
void
backButtonEnabled
(
bool
enabled
);
void
forwardButtonEnabled
(
bool
enabled
);
public:
void
openUrl
(
const
QString
&
name
=
QString
());
...
...
kate/kateviewmanager.cpp
View file @
fae6267e
...
...
@@ -87,6 +87,17 @@ KateViewManager::KateViewManager(QWidget *parentW, KateMainWindow *parent)
documentCreated
(
doc
);
}
connect
(
m_mainWindow
,
&
KateMainWindow
::
backButtonEnabled
,
this
,
[
this
](
bool
v
)
{
if
(
auto
avs
=
activeViewSpace
())
{
avs
->
setBackButtonEnabled
(
v
);
}
});
connect
(
m_mainWindow
,
&
KateMainWindow
::
forwardButtonEnabled
,
this
,
[
this
](
bool
v
)
{
if
(
auto
avs
=
activeViewSpace
())
{
avs
->
setForwardButtonEnabled
(
v
);
}
});
m_blockViewCreationAndActivation
=
false
;
// init done
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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