Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
Telepathy Text UI
Commits
b3235218
Commit
b3235218
authored
Sep 29, 2020
by
Nicolas Fella
Browse files
Port away from KSettings::PluginPage
It doesn't do much and it's the only user of this class.
parent
6f533004
Changes
2
Hide whitespace changes
Inline
Side-by-side
config/messages/messages-config.cpp
View file @
b3235218
...
...
@@ -30,9 +30,10 @@
K_PLUGIN_FACTORY
(
KTpMessagesConfigFactory
,
registerPlugin
<
MessagesConfig
>
();)
MessagesConfig
::
MessagesConfig
(
QWidget
*
parent
,
const
QVariantList
&
args
)
:
PluginPage
(
new
KAboutData
(
"ktp_chat_messages"
,
i18n
(
"Chat Messages"
),
"1.0"
),
parent
,
args
)
:
KCModule
(
parent
,
args
)
,
m_pluginSelector
(
new
KPluginSelector
(
this
))
{
pluginSelector
()
->
addPlugins
(
m_
pluginSelector
->
addPlugins
(
KTp
::
MessageFilterConfigManager
::
self
()
->
allPlugins
(),
KPluginSelector
::
ReadConfigFile
,
i18n
(
"Plugins"
),
...
...
@@ -40,17 +41,27 @@ MessagesConfig::MessagesConfig(QWidget* parent, const QVariantList& args)
KTp
::
MessageFilterConfigManager
::
self
()
->
sharedConfig
()
//why won't this take a KConfigGroup?
);
//Am surprised that PluginPage() doesn't do this for me
connect
(
m_pluginSelector
,
&
KPluginSelector
::
changed
,
this
,
&
MessagesConfig
::
markAsChanged
);
QLayout
*
layout
=
new
QVBoxLayout
();
layout
->
addWidget
(
pluginSelector
()
);
layout
->
addWidget
(
m_
pluginSelector
);
setLayout
(
layout
);
}
void
MessagesConfig
::
save
()
{
KSettings
::
PluginPage
::
save
();
m_pluginSelector
->
save
();
KTp
::
MessageFilterConfigManager
::
self
()
->
reloadConfig
();
}
void
MessagesConfig
::
defaults
()
{
m_pluginSelector
->
defaults
();
}
void
MessagesConfig
::
load
()
{
m_pluginSelector
->
load
();
}
#include "messages-config.moc"
config/messages/messages-config.h
View file @
b3235218
...
...
@@ -19,19 +19,22 @@
#ifndef KCM_MESSAGES_H
#define KCM_MESSAGES_H
#include <
ksettings/pluginpage.h
>
#include <
KCModule
>
class
MessagesConfig
:
public
KSettings
::
PluginPage
class
KPluginSelector
;
class
MessagesConfig
:
public
KCModule
{
Q_OBJECT
public:
explicit
MessagesConfig
(
QWidget
*
parent
=
0
,
const
QVariantList
&
args
=
QVariantList
());
explicit
MessagesConfig
(
QWidget
*
parent
=
nullptr
,
const
QVariantList
&
args
=
QVariantList
());
virtual
void
save
();
void
save
()
override
;
void
defaults
()
override
;
void
load
()
override
;
private:
class
Private
;
Private
*
d
;
KPluginSelector
*
m_pluginSelector
;
};
#endif // KCM_MESSAGES_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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