Commit 77f95ff5 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

internal mode, Kate or KWrite

disable all plugins for KWrite mode
avoids any plugin loading overhead, too, we don't even search
parent 73dce066
......@@ -50,8 +50,9 @@ static KateApp *appSelf = Q_NULLPTR;
Q_LOGGING_CATEGORY(LOG_KATE, "kate", QtWarningMsg)
KateApp::KateApp(const QCommandLineParser &args)
KateApp::KateApp(const QCommandLineParser &args, const ApplicationMode mode)
: m_args(args)
, m_mode(mode)
, m_wrapper(appSelf = this)
, m_docManager(this)
, m_adaptor(this)
......
......@@ -46,10 +46,39 @@ class KATE_TESTS_EXPORT KateApp : public QObject
* constructors & accessor to app object + plugin interface for it
*/
public:
/**
* Are we full featured Kate or the simplified KWrite?
*/
enum ApplicationMode { ApplicationKate, ApplicationKWrite };
/**
* application constructor
*/
KateApp(const QCommandLineParser &args);
KateApp(const QCommandLineParser &arg, const ApplicationMode mode = ApplicationKate);
/**
* return current application mode
*/
static ApplicationMode mode()
{
return KateApp::self()->m_mode;
}
/**
* return current application mode
*/
static bool isKate()
{
return mode() == KateApp::ApplicationKate;
}
/**
* return current application mode
*/
static bool isKWrite()
{
return mode() == KateApp::ApplicationKWrite;
}
/**
* get kate inited
......@@ -388,6 +417,11 @@ private:
*/
const QCommandLineParser &m_args;
/**
* application mode, kate or kwrite
*/
const ApplicationMode m_mode;
/**
* known main windows
*/
......
......@@ -51,6 +51,12 @@ KatePluginManager::~KatePluginManager()
void KatePluginManager::setupPluginList()
{
// no plugins for KWrite mode
if (KateApp::isKWrite()) {
Q_ASSERT(m_pluginList.isEmpty());
return;
}
// activate a hand-picked list of plugins per default, give them a hand-picked sort order for loading
const QMap<QString, int> defaultPlugins{
{QStringLiteral("katefiletreeplugin"), -1000},
......
......@@ -338,7 +338,7 @@ extern "C" Q_DECL_EXPORT int main(int argc, char **argv)
* behaves like a singleton, one unique instance
* we are passing our local command line parser to it
*/
KateApp kateApp(parser);
KateApp kateApp(parser, KateApp::ApplicationKWrite);
/**
* init kate
......
Supports Markdown
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