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
70fb3249
Commit
70fb3249
authored
Jun 12, 2021
by
Mark Nauwelaerts
Browse files
project: expose additional project information
parent
646193ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
addons/project/kateprojectpluginview.cpp
View file @
70fb3249
...
...
@@ -298,6 +298,11 @@ QPair<KateProjectView *, KateProjectInfoView *> KateProjectPluginView::viewForPr
m_projectsCombo
->
addItem
(
QIcon
::
fromTheme
(
QStringLiteral
(
"project-open"
)),
project
->
name
(),
project
->
fileName
());
m_projectsComboGit
->
addItem
(
QIcon
::
fromTheme
(
QStringLiteral
(
"project-open"
)),
project
->
name
(),
project
->
fileName
());
/*
* inform onward
*/
Q_EMIT
pluginProjectAdded
(
project
->
baseDir
(),
project
->
name
());
/**
* remember and return it
*/
...
...
@@ -387,6 +392,17 @@ QStringList KateProjectPluginView::allProjectsFiles() const
return
fileList
;
}
QMap
<
QString
,
QString
>
KateProjectPluginView
::
allProjects
()
const
{
QMap
<
QString
,
QString
>
projectMap
;
const
auto
projectList
=
m_plugin
->
projects
();
for
(
auto
project
:
projectList
)
{
projectMap
[
project
->
baseDir
()]
=
project
->
name
();
}
return
projectMap
;
}
void
KateProjectPluginView
::
slotViewChanged
()
{
/**
...
...
@@ -609,6 +625,9 @@ void KateProjectPluginView::slotProjectClose(KateProject *project)
m_projectsCombo
->
removeItem
(
index
);
m_projectsComboGit
->
removeItem
(
index
);
// inform onward
Q_EMIT
pluginProjectRemoved
(
project
->
baseDir
(),
project
->
name
());
}
QString
KateProjectPluginView
::
currentWord
()
const
...
...
addons/project/kateprojectpluginview.h
View file @
70fb3249
...
...
@@ -26,6 +26,9 @@ class KateProjectView;
class
KateProjectPlugin
;
class
KateProjectInfoView
;
typedef
QMap
<
QString
,
QString
>
QStringMap
;
Q_DECLARE_METATYPE
(
QStringMap
)
class
KateProjectPluginView
:
public
QObject
,
public
KXMLGUIClient
{
Q_OBJECT
...
...
@@ -38,6 +41,7 @@ class KateProjectPluginView : public QObject, public KXMLGUIClient
Q_PROPERTY
(
QString
allProjectsCommonBaseDir
READ
allProjectsCommonBaseDir
)
Q_PROPERTY
(
QStringList
allProjectsFiles
READ
allProjectsFiles
)
Q_PROPERTY
(
QStringMap
allProjects
READ
allProjects
)
public:
KateProjectPluginView
(
KateProjectPlugin
*
plugin
,
KTextEditor
::
MainWindow
*
mainWindow
);
...
...
@@ -84,6 +88,11 @@ public:
*/
QStringList
allProjectsFiles
()
const
;
/**
* @returns a map of all open projects which maps base directory to name
*/
QMap
<
QString
,
QString
>
allProjects
()
const
;
/**
* the main window we belong to
* @return our main window
...
...
@@ -199,6 +208,16 @@ private Q_SLOTS:
Q_SIGNALS:
/**
* Emitted if project is about to close.
*/
void
pluginProjectRemoved
(
QString
baseDir
,
QString
name
);
/**
* Emitted if project is added.
*/
void
pluginProjectAdded
(
QString
baseDir
,
QString
name
);
/**
* Emitted if project is about to close.
*/
...
...
Write
Preview
Markdown
is supported
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