Commit b508fe5e authored by Christoph Cullmann's avatar Christoph Cullmann

start to let project plugin talk to build plugin, too ;)

parent 5e9d2897
......@@ -187,6 +187,17 @@ KateBuildView::KateBuildView(Kate::MainWindow *mw)
m_toolView->installEventFilter(this);
mainWindow()->guiFactory()->addClient(this);
// watch for project plugin view creation/deletion
connect(mainWindow(), SIGNAL(pluginViewCreated (const QString &, Kate::PluginView *))
, this, SLOT(slotPluginViewCreated (const QString &, Kate::PluginView *)));
connect(mainWindow(), SIGNAL(pluginViewDeleted (const QString &, Kate::PluginView *))
, this, SLOT(slotPluginViewDeleted (const QString &, Kate::PluginView *)));
// update once project plugin state manually
m_projectPluginView = mainWindow()->pluginView ("kateprojectplugin");
slotProjectMapChanged ();
}
......@@ -922,3 +933,32 @@ void KateBuildView::slotShowOthers(bool showItems) {
}
}
void KateBuildView::slotPluginViewCreated (const QString &name, Kate::PluginView *pluginView)
{
// add view
if (name == "kateprojectplugin") {
m_projectPluginView = pluginView;
slotProjectMapChanged ();
connect (pluginView, SIGNAL(projectMapChanged()), this, SLOT(slotProjectMapChanged()));
}
}
void KateBuildView::slotPluginViewDeleted (const QString &name, Kate::PluginView *)
{
// remove view
if (name == "kateprojectplugin") {
m_projectPluginView = 0;
slotProjectMapChanged ();
}
}
void KateBuildView::slotProjectMapChanged ()
{
// query new project map
QVariantMap projectMap;
if (m_projectPluginView)
projectMap = m_projectPluginView->property("projectMap").toMap();
printf ("got build %s\n", qPrintable(projectMap.value("build").toMap().value("build").toString()));
}
......@@ -99,6 +99,13 @@ class KateBuildView : public Kate::PluginView, public Kate::XMLGUIClient
void handleEsc(QEvent *e);
/**
* keep track if the project plugin is alive and if the project map did change
*/
void slotPluginViewCreated (const QString &name, Kate::PluginView *pluginView);
void slotPluginViewDeleted (const QString &name, Kate::PluginView *pluginView);
void slotProjectMapChanged ();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
......@@ -125,6 +132,11 @@ class KateBuildView : public Kate::PluginView, public Kate::XMLGUIClient
QList<Target> m_targetList;
int m_targetIndex;
KSelectAction* m_targetSelectAction;
/**
* current project plugin view, if any
*/
Kate::PluginView *m_projectPluginView;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment