Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KRDC
Commits
5a615041
Commit
5a615041
authored
Dec 02, 2021
by
Nicolas Fella
Committed by
Albert Astals Cid
Dec 23, 2021
Browse files
Port away from deprecated plugin things
parent
2fcc61d5
Pipeline
#113681
passed with stage
in 55 seconds
Changes
5
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
5a615041
...
...
@@ -9,7 +9,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project
(
krdc VERSION
${
RELEASE_SERVICE_VERSION
}
)
set
(
QT_MIN_VERSION
"5.15.0"
)
set
(
KF5_MIN_VERSION
"5.8
5
.0"
)
set
(
KF5_MIN_VERSION
"5.8
9
.0"
)
find_package
(
ECM
${
KF5_MIN_VERSION
}
REQUIRED NO_MODULE
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/modules
${
ECM_MODULE_PATH
}
)
...
...
config/preferencesdialog.cpp
View file @
5a615041
...
...
@@ -11,9 +11,8 @@
#include
<KConfigSkeleton>
#include
<KLocalizedString>
#include
<KPlugin
Selector
>
#include
<KPlugin
Widget
>
#include
<KPluginMetaData>
#include
<KPluginInfo>
PreferencesDialog
::
PreferencesDialog
(
QWidget
*
parent
,
KConfigSkeleton
*
skeleton
)
:
KConfigDialog
(
parent
,
QStringLiteral
(
"preferences"
),
skeleton
)
...
...
@@ -29,11 +28,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton)
skeleton
->
config
()
->
group
(
"hostpreferences"
));
addPage
(
hostPreferencesList
,
i18n
(
"Hosts"
),
QStringLiteral
(
"computer"
),
i18n
(
"Host Configuration"
));
m_pluginSelector
=
new
KPluginSelector
();
const
QList
<
KPluginInfo
>
offers
=
KPluginInfo
::
fromMetaData
(
KPluginLoader
::
findPlugins
(
QStringLiteral
(
"krdc"
)));
m_pluginSelector
->
addPlugins
(
offers
,
KPluginSelector
::
ReadConfigFile
,
i18n
(
"Plugins"
),
QStringLiteral
(
"Service"
),
KSharedConfig
::
openConfig
());
m_pluginSelector
->
load
();
m_pluginSelector
=
new
KPluginWidget
();
const
QVector
<
KPluginMetaData
>
offers
=
KPluginMetaData
::
findPlugins
(
QStringLiteral
(
"krdc"
));
m_pluginSelector
->
setConfig
(
KSharedConfig
::
openConfig
()
->
group
(
QStringLiteral
(
"Plugins"
)));
m_pluginSelector
->
addPlugins
(
offers
,
i18n
(
"Plugins"
));
addPage
(
m_pluginSelector
,
i18n
(
"Plugins"
),
QStringLiteral
(
"preferences-plugin"
),
i18n
(
"Plugin Configuration"
));
connect
(
this
,
SIGNAL
(
accepted
()),
SLOT
(
saveState
()));
...
...
config/preferencesdialog.h
View file @
5a615041
...
...
@@ -12,7 +12,7 @@
#include
<QDialogButtonBox>
class
KConfigSkeleton
;
class
KPlugin
Selector
;
class
KPlugin
Widget
;
class
PreferencesDialog
:
public
KConfigDialog
{
...
...
@@ -30,7 +30,7 @@ private Q_SLOTS:
void
settingsChanged
();
private:
KPlugin
Selector
*
m_pluginSelector
;
KPlugin
Widget
*
m_pluginSelector
;
bool
m_settingsChanged
;
void
enableButton
(
QDialogButtonBox
::
StandardButton
standardButton
);
};
...
...
mainwindow.cpp
View file @
5a615041
...
...
@@ -193,26 +193,17 @@ void MainWindow::setupActions()
void
MainWindow
::
loadAllPlugins
()
{
const
QVector
<
KPluginMetaData
>
offers
=
KPlugin
Loader
::
findPlugins
(
QStringLiteral
(
"krdc"
));
const
QVector
<
KPluginMetaData
>
offers
=
KPlugin
MetaData
::
findPlugins
(
QStringLiteral
(
"krdc"
));
const
KConfigGroup
conf
=
KSharedConfig
::
openConfig
()
->
group
(
QStringLiteral
(
"Plugins"
));
for
(
const
KPluginMetaData
&
plugin
:
offers
)
{
KPluginInfo
pluginInfo
=
KPluginInfo
::
fromMetaData
(
plugin
);
pluginInfo
.
load
(
conf
);
const
bool
enabled
=
pluginInfo
.
isPluginEnabled
();
const
bool
enabled
=
plugin
.
isEnabled
(
conf
);
if
(
enabled
)
{
RemoteViewFactory
*
component
=
nullptr
;
KPluginLoader
loader
(
plugin
.
fileName
());
KPluginFactory
*
factory
=
loader
.
factory
();
if
(
factory
)
{
component
=
factory
->
create
<
RemoteViewFactory
>
();
}
const
auto
result
=
KPluginFactory
::
instantiatePlugin
<
RemoteViewFactory
>
(
plugin
);
if
(
component
)
{
if
(
result
)
{
RemoteViewFactory
*
component
=
result
.
plugin
;
const
int
sorting
=
plugin
.
value
(
QStringLiteral
(
"X-KDE-KRDC-Sorting"
)).
toInt
();
m_remoteViewFactories
.
insert
(
sorting
,
component
);
}
...
...
mainwindow.h
View file @
5a615041
...
...
@@ -13,7 +13,6 @@
#include
"remoteviewfactory.h"
#include
<KXmlGuiWindow>
#include
<KPluginInfo>
class
KComboBox
;
class
KLineEdit
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment