summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2014-01-25 01:07:16 (GMT)
committerChristoph Cullmann <cullmann@kde.org>2014-01-25 01:07:16 (GMT)
commite573c502f4297ffce0f71f7d17fa41517e3f4d22 (patch)
treee5cf4398d3a8b9fe65675db3eae17014a6aff330
parent654a1fa3e1c8089bbd9acd01eaf608c37dfc800c (diff)
honor the 'load me per default if my app name is mentioned in the list' X-KTextEditor-Load-Default attribute
-rw-r--r--kate/src/kateconfigplugindialogpage.cpp5
-rw-r--r--kate/src/katepluginmanager.cpp28
-rw-r--r--kate/src/katepluginmanager.h2
3 files changed, 9 insertions, 26 deletions
diff --git a/kate/src/kateconfigplugindialogpage.cpp b/kate/src/kateconfigplugindialogpage.cpp
index 984d37f..53d6bf6 100644
--- a/kate/src/kateconfigplugindialogpage.cpp
+++ b/kate/src/kateconfigplugindialogpage.cpp
@@ -49,8 +49,6 @@ KatePluginListItem::KatePluginListItem(bool checked, KatePluginInfo *info)
, mInfo(info)
{
setCheckState(0, checked ? Qt::Checked : Qt::Unchecked);
- // skip plugins that will be loaded always!
- setDisabled(info->alwaysLoad);
}
KatePluginListView::KatePluginListView(QWidget *parent)
@@ -83,9 +81,6 @@ KateConfigPluginPage::KateConfigPluginPage(QWidget *parent, KateConfigDialog *di
KatePluginList &pluginList(KateApp::self()->pluginManager()->pluginList());
for (KatePluginList::iterator it = pluginList.begin(); it != pluginList.end(); ++it) {
- if (it->alwaysLoad) {
- continue;
- }
QTreeWidgetItem *item = new KatePluginListItem(it->load, &(*it));
item->setText(0, it->service->name());
item->setText(1, it->service->comment());
diff --git a/kate/src/katepluginmanager.cpp b/kate/src/katepluginmanager.cpp
index 77629ce..d78958c 100644
--- a/kate/src/katepluginmanager.cpp
+++ b/kate/src/katepluginmanager.cpp
@@ -54,29 +54,17 @@ void KatePluginManager::setupPluginList()
{
KService::List traderList = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Plugin"));
- KatePluginList alwaysLoad;
- KatePluginList others;
+ m_pluginList.clear ();
foreach(const KService::Ptr & ptr, traderList) {
KatePluginInfo info;
info.service = ptr;
- info.alwaysLoad = false;
+ info.defaultLoad = info.service->property(QStringLiteral("X-KTextEditor-Load-Default")).toStringList().contains(QStringLiteral("kate"));
info.load = false;
- info.plugin = 0L;
-
- if (info.alwaysLoad) {
- alwaysLoad.push_back(info);
- } else {
- others.push_back(info);
- }
+ info.plugin = nullptr;
+ m_pluginList.push_back(info);
}
/**
- * prefer always load plugins in handling
- */
- m_pluginList = alwaysLoad;
- m_pluginList << others;
-
- /**
* construct fast lookup map
*/
m_name2Plugin.clear();
@@ -96,17 +84,17 @@ void KatePluginManager::loadConfig(KConfig *config)
if (config) {
KConfigGroup cg = KConfigGroup(config, QStringLiteral("Kate Plugins"));
- // disable all plugin if no config...
+ // disable all plugin if no config, beside the ones marked as default load
for (int i = 0; i < m_pluginList.size(); ++i) {
- m_pluginList[i].load = cg.readEntry(m_pluginList[i].service->library(), false);
+ m_pluginList[i].load = cg.readEntry(m_pluginList[i].service->library(), m_pluginList[i].defaultLoad);
}
}
/**
- * load plugins, some are always enforced to load!
+ * load plugins
*/
for (KatePluginList::iterator it = m_pluginList.begin(); it != m_pluginList.end(); ++it) {
- if (it->load || it->alwaysLoad) {
+ if (it->load) {
loadPlugin(&(*it));
// restore config
diff --git a/kate/src/katepluginmanager.h b/kate/src/katepluginmanager.h
index df15854..1e7f356 100644
--- a/kate/src/katepluginmanager.h
+++ b/kate/src/katepluginmanager.h
@@ -36,7 +36,7 @@ class KatePluginInfo
{
public:
bool load;
- bool alwaysLoad;
+ bool defaultLoad;
KService::Ptr service;
KTextEditor::Plugin *plugin;
QString saveName() const;