Commit 87d5a0fd authored by Christoph Cullmann's avatar Christoph Cullmann

cleanup internal API

parent cea1d82d
......@@ -132,7 +132,7 @@ void KateApp::restoreKate()
sessionManager()->activateSession(lastSession, false, false);
// plugins
KatePluginManager::self()->loadConfig(sessionConfig);
KateApp::self()->pluginManager()->loadConfig(sessionConfig);
// restore the files we need
m_docManager->restoreDocumentList(sessionConfig);
......
......@@ -203,7 +203,7 @@ KateConfigDialog::KateConfigDialog(KateMainWindow *parent, KTextEditor::View *vi
item->setHeader(i18n("Plugin Manager"));
item->setIcon(QIcon::fromTheme(QStringLiteral("preferences-plugin")));
KatePluginList &pluginList(KatePluginManager::self()->pluginList());
KatePluginList &pluginList(KateApp::self()->pluginManager()->pluginList());
foreach(const KatePluginInfo & plugin, pluginList) {
if (plugin.load
&& qobject_cast<KTextEditor::ConfigPageInterface *>(plugin.plugin)) {
......
......@@ -20,8 +20,10 @@
#include "kateconfigplugindialogpage.h"
#include "kateapp.h"
#include "katepluginmanager.h"
#include "kateconfigdialog.h"
#include <KLocalizedString>
#include <QVBoxLayout>
......@@ -79,7 +81,7 @@ KateConfigPluginPage::KateConfigPluginPage(QWidget *parent, KateConfigDialog *di
listView->setHeaderLabels(headers);
listView->setWhatsThis(i18n("Here you can see all available Kate plugins. Those with a check mark are loaded, and will be loaded again the next time Kate is started."));
KatePluginList &pluginList(KatePluginManager::self()->pluginList());
KatePluginList &pluginList(KateApp::self()->pluginManager()->pluginList());
for (KatePluginList::iterator it = pluginList.begin(); it != pluginList.end(); ++it) {
if (it->alwaysLoad) {
continue;
......@@ -108,8 +110,8 @@ void KateConfigPluginPage::stateChange(KatePluginListItem *item, bool b)
void KateConfigPluginPage::loadPlugin(KatePluginListItem *item)
{
KatePluginManager::self()->loadPlugin(item->info());
KatePluginManager::self()->enablePluginGUI(item->info());
KateApp::self()->pluginManager()->loadPlugin(item->info());
KateApp::self()->pluginManager()->enablePluginGUI(item->info());
myDialog->addPluginPage(item->info()->plugin);
item->setCheckState(0, Qt::Checked);
......@@ -118,7 +120,7 @@ void KateConfigPluginPage::loadPlugin(KatePluginListItem *item)
void KateConfigPluginPage::unloadPlugin(KatePluginListItem *item)
{
myDialog->removePluginPage(item->info()->plugin);
KatePluginManager::self()->unloadPlugin(item->info());
KateApp::self()->pluginManager()->unloadPlugin(item->info());
item->setCheckState(0, Qt::Unchecked);
}
......
......@@ -180,7 +180,7 @@ KateMainWindow::KateMainWindow(KConfig *sconfig, const QString &sgroup)
KateApp::self()->addMainWindow(this);
// enable plugin guis
KatePluginManager::self()->enableAllPluginsGUI(this, sconfig);
KateApp::self()->pluginManager()->enableAllPluginsGUI(this, sconfig);
// caption update
for (uint i = 0; i < KateDocManager::self()->documents(); i++) {
......@@ -219,7 +219,7 @@ KateMainWindow::~KateMainWindow()
KateApp::self()->removeMainWindow(this);
// disable all plugin guis, delete all pluginViews
KatePluginManager::self()->disableAllPluginsGUI(this);
KateApp::self()->pluginManager()->disableAllPluginsGUI(this);
// delete the view manager, before KateMainWindow's wrapper is dead
delete m_viewManager;
......@@ -350,7 +350,7 @@ void KateMainWindow::setupActions()
QAction *settingsConfigure = KStandardAction::preferences(this, SLOT(slotConfigure()), actionCollection());
settingsConfigure->setWhatsThis(i18n("Configure various aspects of this application and the editing component."));
if (KatePluginManager::self()->pluginList().count() > 0) {
if (KateApp::self()->pluginManager()->pluginList().count() > 0) {
a = actionCollection()->addAction(QStringLiteral("help_plugins_contents"));
a->setText(i18n("&Plugins Handbook"));
connect(a, SIGNAL(triggered()), this, SLOT(pluginHelp()));
......@@ -910,7 +910,7 @@ void KateMainWindow::saveProperties(KConfigGroup &config)
// store all plugin view states
int id = KateApp::self()->mainWindowID(this);
foreach(const KatePluginInfo & item, KatePluginManager::self()->pluginList()) {
foreach(const KatePluginInfo & item, KateApp::self()->pluginManager()->pluginList()) {
if (item.plugin && pluginViews().contains(item.plugin)) {
if (auto interface = qobject_cast<KTextEditor::SessionConfigInterface *> (pluginViews().value(item.plugin))) {
KConfigGroup group(config.config(), QString::fromLatin1("Plugin:%1:MainWindow:%2").arg(item.saveName()).arg(id));
......@@ -931,7 +931,7 @@ void KateMainWindow::readProperties(const KConfigGroup &config)
startRestore(configBase, config.name());
// perhaps enable plugin guis
KatePluginManager::self()->enableAllPluginsGUI(this, configBase);
KateApp::self()->pluginManager()->enableAllPluginsGUI(this, configBase);
finishRestore();
......
......@@ -50,11 +50,6 @@ KatePluginManager::~KatePluginManager()
unloadAllPlugins();
}
KatePluginManager *KatePluginManager::self()
{
return KateApp::self()->pluginManager();
}
void KatePluginManager::setupPluginList()
{
KService::List traderList = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Plugin"));
......
......@@ -52,8 +52,6 @@ public:
KatePluginManager(QObject *parent);
~KatePluginManager();
static KatePluginManager *self();
void unloadAllPlugins();
void enableAllPluginsGUI(KateMainWindow *win, KConfigBase *config = 0);
......@@ -97,4 +95,3 @@ private:
};
#endif
......@@ -178,7 +178,7 @@ void KateSessionManager::loadSession(const KateSession::Ptr &session) const
// if we have no session config object, try to load the default
// (anonymous/unnamed sessions)
// load plugin config + plugins
KatePluginManager::self()->loadConfig(sc);
KateApp::self()->pluginManager()->loadConfig(sc);
if (loadDocs) {
KateApp::self()->documentManager()->restoreDocumentList(sc);
......@@ -299,7 +299,7 @@ bool KateSessionManager::renameSession(KateSession::Ptr session, const QString &
void KateSessionManager::saveSessionTo(KConfig *sc) const
{
// save plugin configs and which plugins to load
KatePluginManager::self()->writeConfig(sc);
KateApp::self()->pluginManager()->writeConfig(sc);
// save document configs + which documents to load
KateDocManager::self()->saveDocumentList(sc);
......
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