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
Utilities
Kate
Commits
59e0bc31
Commit
59e0bc31
authored
Aug 25, 2022
by
Waqar Ahmed
Browse files
Use KTextEditor::MainWindow to find toolviewmanager
parent
555496c5
Pipeline
#222531
passed with stage
in 9 minutes and 8 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
addons/project/kateprojectinfoviewterminal.cpp
View file @
59e0bc31
...
...
@@ -31,7 +31,7 @@ KateProjectInfoViewTerminal::KateProjectInfoViewTerminal(KateProjectPluginView *
m_layout
->
setSpacing
(
0
);
m_layout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_showProjectInfoViewAction
=
Utils
::
toolviewShowAction
(
pluginView
,
QStringLiteral
(
"kateprojectinfo"
));
m_showProjectInfoViewAction
=
Utils
::
toolviewShowAction
(
m_
pluginView
->
mainWindow
()
,
QStringLiteral
(
"kateprojectinfo"
));
}
KateProjectInfoViewTerminal
::~
KateProjectInfoViewTerminal
()
...
...
apps/lib/ktexteditor_utils.cpp
View file @
59e0bc31
...
...
@@ -33,37 +33,20 @@ QIcon iconForDocument(KTextEditor::Document *doc)
return
icon
;
}
QAction
*
toolviewShowAction
(
K
XMLGUIClient
*
client
,
const
QString
&
toolviewName
)
QAction
*
toolviewShowAction
(
K
TextEditor
::
MainWindow
*
mainWindow
,
const
QString
&
toolviewName
)
{
if
(
!
client
)
{
qWarning
()
<<
Q_FUNC_INFO
<<
"invalid null client, toolviewName: "
<<
toolviewName
;
Q_ASSERT
(
false
);
return
nullptr
;
}
Q_ASSERT
(
mainWindow
);
const
auto
clients
=
mainWindow
->
guiFactory
()
->
clients
();
static
const
QString
prefix
=
QStringLiteral
(
"kate_mdi_toolview_"
);
if
(
client
->
componentName
()
==
QStringLiteral
(
"toolviewmanager"
))
{
return
client
->
actionCollection
()
->
action
(
prefix
+
toolviewName
);
}
KXMLGUIClient
*
toolviewmanager
=
nullptr
;
if
(
!
client
->
factory
())
{
qWarning
()
<<
Q_FUNC_INFO
<<
"don't have a client factory, toolviewName: "
<<
toolviewName
;
return
nullptr
;
}
const
auto
clients
=
client
->
factory
()
->
clients
();
for
(
auto
client
:
clients
)
{
if
(
client
->
componentName
()
==
QStringLiteral
(
"toolviewmanager"
))
{
toolviewmanager
=
client
;
break
;
}
}
auto
it
=
std
::
find_if
(
clients
.
begin
(),
clients
.
end
(),
[](
const
KXMLGUIClient
*
c
)
{
return
c
->
componentName
()
==
QStringLiteral
(
"toolviewmanager"
);
});
if
(
!
toolviewmanager
)
{
if
(
it
==
clients
.
end
()
)
{
qWarning
()
<<
Q_FUNC_INFO
<<
"Unexpected unable to find toolviewmanager KXMLGUIClient, toolviewName: "
<<
toolviewName
;
return
nullptr
;
}
return
toolviewmanager
->
actionCollection
()
->
action
(
prefix
+
toolviewName
);
return
(
*
it
)
->
actionCollection
()
->
action
(
prefix
+
toolviewName
);
}
}
apps/lib/ktexteditor_utils.h
View file @
59e0bc31
...
...
@@ -90,5 +90,5 @@ inline QFont viewFont(KTextEditor::View *view)
*/
KATE_PRIVATE_EXPORT
QIcon
iconForDocument
(
KTextEditor
::
Document
*
doc
);
KATE_PRIVATE_EXPORT
QAction
*
toolviewShowAction
(
K
XMLGUIClient
*
client
,
const
QString
&
toolviewName
);
KATE_PRIVATE_EXPORT
QAction
*
toolviewShowAction
(
K
TextEditor
::
MainWindow
*
,
const
QString
&
toolviewName
);
}
Waqar Ahmed
@waqar
mentioned in merge request
!854 (merged)
·
Aug 25, 2022
mentioned in merge request
!854 (merged)
mentioned in merge request !854
Toggle commit list
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