Changeset View
Changeset View
Standalone View
Standalone View
kcms/runners/kcm.cpp
1 | /* This file is part of the KDE Project | 1 | /* This file is part of the KDE Project | ||
---|---|---|---|---|---|
2 | Copyright (c) 2014 Vishesh Handa <me@vhanda.in> | 2 | Copyright (c) 2014 Vishesh Handa <me@vhanda.in> | ||
3 | Copyright (c) 2020 Alexander Lohnau <alexander.lohnau@gmx.de> | ||||
3 | 4 | | |||
4 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or | ||
5 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public | ||
6 | License version 2 as published by the Free Software Foundation. | 7 | License version 2 as published by the Free Software Foundation. | ||
7 | 8 | | |||
8 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | Library General Public License for more details. | 12 | Library General Public License for more details. | ||
12 | 13 | | |||
13 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
14 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
17 | */ | 18 | */ | ||
18 | 19 | | |||
19 | #include "kcm.h" | 20 | #include "kcm.h" | ||
20 | 21 | | |||
21 | #include "kcmutils_version.h" | | |||
22 | | ||||
23 | #include <KPluginFactory> | 22 | #include <KPluginFactory> | ||
24 | #include <KPluginLoader> | | |||
25 | #include <KAboutData> | 23 | #include <KAboutData> | ||
26 | #include <KSharedConfig> | 24 | #include <KSharedConfig> | ||
27 | #include <QDebug> | 25 | #include <QDebug> | ||
28 | #include <QStandardPaths> | 26 | #include <QStandardPaths> | ||
29 | #include <KLocalizedString> | 27 | #include <KLocalizedString> | ||
30 | #include <KRunner/RunnerManager> | 28 | #include <KRunner/RunnerManager> | ||
31 | #include <KCModuleInfo> | 29 | #include <KCModuleInfo> | ||
32 | #include <KCModuleProxy> | 30 | #include <KCModuleProxy> | ||
33 | #include <KPluginSelector> | 31 | #include <KPluginSelector> | ||
34 | 32 | | |||
35 | #include <QApplication> | 33 | #include <QApplication> | ||
36 | #include <QVBoxLayout> | 34 | #include <QVBoxLayout> | ||
37 | #include <QLabel> | 35 | #include <QLabel> | ||
38 | #include <QDialog> | 36 | #include <QDialog> | ||
39 | #include <QDialogButtonBox> | | |||
40 | #include <QPainter> | 37 | #include <QPainter> | ||
41 | #include <QPushButton> | 38 | #include <QPushButton> | ||
42 | 39 | | |||
43 | K_PLUGIN_FACTORY(SearchConfigModuleFactory, registerPlugin<SearchConfigModule>();) | 40 | K_PLUGIN_FACTORY(SearchConfigModuleFactory, registerPlugin<SearchConfigModule>();) | ||
44 | 41 | | |||
45 | 42 | | |||
46 | SearchConfigModule::SearchConfigModule(QWidget* parent, const QVariantList& args) | 43 | SearchConfigModule::SearchConfigModule(QWidget* parent, const QVariantList& args) | ||
47 | : KCModule(parent, args) | 44 | : KCModule(parent, args) | ||
Show All 27 Lines | 46 | { | |||
75 | headerLayout->addWidget(label); | 72 | headerLayout->addWidget(label); | ||
76 | headerLayout->addStretch(); | 73 | headerLayout->addStretch(); | ||
77 | headerLayout->addWidget(clearHistoryButton); | 74 | headerLayout->addWidget(clearHistoryButton); | ||
78 | 75 | | |||
79 | m_pluginSelector = new KPluginSelector(this); | 76 | m_pluginSelector = new KPluginSelector(this); | ||
80 | 77 | | |||
81 | connect(m_pluginSelector, &KPluginSelector::changed, this, &SearchConfigModule::markAsChanged); | 78 | connect(m_pluginSelector, &KPluginSelector::changed, this, &SearchConfigModule::markAsChanged); | ||
82 | connect(m_pluginSelector, &KPluginSelector::configCommitted, this, &SearchConfigModule::markAsChanged); | 79 | connect(m_pluginSelector, &KPluginSelector::configCommitted, this, &SearchConfigModule::markAsChanged); | ||
83 | | ||||
84 | #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 67, 0) | | |||
85 | connect(m_pluginSelector, &KPluginSelector::defaulted, this, &KCModule::defaulted); | 80 | connect(m_pluginSelector, &KPluginSelector::defaulted, this, &KCModule::defaulted); | ||
86 | #endif | | |||
87 | 81 | | |||
88 | layout->addLayout(headerLayout); | 82 | layout->addLayout(headerLayout); | ||
89 | layout->addWidget(m_pluginSelector); | 83 | layout->addWidget(m_pluginSelector); | ||
90 | | ||||
91 | Plasma::RunnerManager *manager = new Plasma::RunnerManager(this); | | |||
92 | manager->reloadConfiguration(); | | |||
93 | } | 84 | } | ||
94 | 85 | | |||
95 | void SearchConfigModule::load() | 86 | void SearchConfigModule::load() | ||
96 | { | 87 | { | ||
97 | // Set focus on the pluginselector to pass focus to search bar. | 88 | // Set focus on the pluginselector to pass focus to search bar. | ||
98 | m_pluginSelector->setFocus(Qt::OtherFocusReason); | 89 | m_pluginSelector->setFocus(Qt::OtherFocusReason); | ||
99 | 90 | | |||
100 | m_pluginSelector->addPlugins(Plasma::RunnerManager::listRunnerInfo(), | 91 | m_pluginSelector->addPlugins(Plasma::RunnerManager::listRunnerInfo(), | ||
Show All 22 Lines |