Pimcommon

configurepluginswidget.cpp
1/*
2 SPDX-FileCopyrightText: 2016-2025 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "configurepluginswidget.h"
8using namespace Qt::Literals::StringLiterals;
9
10#include "configurepluginslistwidget.h"
11
12#include <KConfigGroup>
13#include <KLocalizedString>
14#include <KMessageWidget>
15#include <KSharedConfig>
16
17#include <QVBoxLayout>
18
19using namespace PimCommon;
20
21ConfigurePluginsWidget::ConfigurePluginsWidget(QWidget *parent)
22 : QWidget(parent)
23{
24 initLayout();
25}
26
27ConfigurePluginsWidget::ConfigurePluginsWidget(ConfigurePluginsListWidget *configurePluginListWidget, QWidget *parent)
28 : QWidget(parent)
29{
30 initLayout(configurePluginListWidget);
31}
32
33ConfigurePluginsWidget::~ConfigurePluginsWidget() = default;
34
35void ConfigurePluginsWidget::initLayout(ConfigurePluginsListWidget *configurePluginListWidget)
36{
37 auto layout = new QVBoxLayout(this);
39
40 mMessageWidget = new KMessageWidget(i18n("Restart is necessary for applying the changes."), this);
41 mMessageWidget->setObjectName("mMessageWidget"_L1);
42 mMessageWidget->setCloseButtonVisible(false);
43 mMessageWidget->setVisible(false);
44 mMessageWidget->setPosition(KMessageWidget::Header);
45 layout->addWidget(mMessageWidget);
46
47 if (!configurePluginListWidget) {
48 mConfigureListWidget = new ConfigurePluginsListWidget(this);
49 } else {
50 mConfigureListWidget = configurePluginListWidget;
51 }
52 mConfigureListWidget->setObjectName("configureListWidget"_L1);
53 layout->addWidget(mConfigureListWidget);
54
55 connect(mConfigureListWidget, &ConfigurePluginsListWidget::changed, this, &ConfigurePluginsWidget::slotConfigChanged);
56
57 initialize();
58}
59
60void ConfigurePluginsWidget::slotConfigChanged()
61{
62 mMessageWidget->animatedShow();
63 Q_EMIT wasChanged(true);
64}
65
66void ConfigurePluginsWidget::save()
67{
68 mConfigureListWidget->save();
69 Q_EMIT wasChanged(false);
70}
71
72void ConfigurePluginsWidget::defaults()
73{
74 mConfigureListWidget->defaults();
75}
76
77void ConfigurePluginsWidget::doLoadFromGlobalSettings()
78{
79 mConfigureListWidget->doLoadFromGlobalSettings();
80 mMessageWidget->animatedHide();
81 Q_EMIT wasChanged(false);
82}
83
84void ConfigurePluginsWidget::doResetToDefaultsOther()
85{
86 mConfigureListWidget->doResetToDefaultsOther();
87}
88
89void ConfigurePluginsWidget::initialize()
90{
91 mConfigureListWidget->initialize();
92}
93
94#include "moc_configurepluginswidget.cpp"
void setCloseButtonVisible(bool visible)
void animatedHide()
void animatedShow()
void setPosition(Position position)
The ConfigurePluginsListWidget class.
QString i18n(const char *text, const TYPE &arg...)
folderdialogacltab.h
void addWidget(QWidget *w)
void setContentsMargins(const QMargins &margins)
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void setObjectName(QAnyStringView name)
QLayout * layout() const const
virtual void setVisible(bool visible)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 3 2025 11:57:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.