plasma: proxy the desktop KCM in pager applet again

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-27 17:55:58 +03:00
parent 2f9c3988db
commit 22b76d52a6
3 changed files with 14 additions and 1 deletions

View file

@ -7,6 +7,7 @@ set(pager_SRCS
kde4_add_plugin(plasma_applet_pager ${pager_SRCS})
target_link_libraries(plasma_applet_pager
KDE4::plasma
KDE4::kcmutils
)
install(

View file

@ -26,6 +26,7 @@
#include <Plasma/SvgWidget>
#include <Plasma/Theme>
#include <Plasma/ToolTipManager>
#include <KCModuleInfo>
#include <KWindowSystem>
#include <KIcon>
#include <KIconLoader>
@ -247,7 +248,8 @@ PagerApplet::PagerApplet(QObject *parent, const QVariantList &args)
m_hidesingle(s_defaulthidesingle),
m_pagermodebox(nullptr),
m_hidesinglebox(nullptr),
m_spacer(nullptr)
m_spacer(nullptr),
m_kcmdesktopproxy(nullptr)
{
KGlobal::locale()->insertCatalog("plasma_applet_pager");
setAspectRatioMode(Plasma::AspectRatioMode::IgnoreAspectRatio);
@ -301,10 +303,17 @@ void PagerApplet::createConfigurationInterface(KConfigDialog *parent)
// doesn't look like media visualization but ok.. (that's what the clock applet uses)
parent->addPage(widget, i18n("Appearance"), "view-media-visualization");
m_kcmdesktopproxy = new KCModuleProxy("desktop");
parent->addPage(
m_kcmdesktopproxy, m_kcmdesktopproxy->moduleInfo().moduleName(),
m_kcmdesktopproxy->moduleInfo().icon()
);
connect(parent, SIGNAL(applyClicked()), this, SLOT(slotConfigAccepted()));
connect(parent, SIGNAL(okClicked()), this, SLOT(slotConfigAccepted()));
connect(m_pagermodebox, SIGNAL(currentIndexChanged(int)), parent, SLOT(settingsModified()));
connect(m_hidesinglebox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified()));
connect(m_kcmdesktopproxy, SIGNAL(changed(bool)), parent, SLOT(settingsModified()));
}
QList<QAction*> PagerApplet::contextualActions()
@ -459,6 +468,7 @@ void PagerApplet::slotConfigAccepted()
configgroup.writeEntry("pagerMode", pagermodeindex);
configgroup.writeEntry("pagerHideSingle", m_hidesingle);
slotUpdateLayout();
m_kcmdesktopproxy->save();
emit configNeedsSaving();
}

View file

@ -27,6 +27,7 @@
#include <QGraphicsLinearLayout>
#include <QGraphicsSceneWheelEvent>
#include <KConfigDialog>
#include <KCModuleProxy>
#include <Plasma/Applet>
class PagerSvg;
@ -75,6 +76,7 @@ private:
QComboBox* m_pagermodebox;
QCheckBox* m_hidesinglebox;
QSpacerItem* m_spacer;
KCModuleProxy* m_kcmdesktopproxy;
};
K_EXPORT_PLASMA_APPLET(pager, PagerApplet)