plasma: call the base class init() method

Plasma::Applet::init() marks the applets as movable items for example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-19 02:03:14 +03:00
parent 6ff89abb0f
commit ebde34f06c
20 changed files with 39 additions and 5 deletions

View file

@ -406,6 +406,8 @@ BatteryMonitor::~BatteryMonitor()
void BatteryMonitor::init()
{
Plasma::PopupApplet::init();
configChanged();
QTimer::singleShot(500, m_batterywidget, SLOT(slotUpdateLayout()));
}

View file

@ -100,6 +100,8 @@ CalendarApplet::CalendarApplet(QObject *parent, const QVariantList &args)
void CalendarApplet::init()
{
Plasma::PopupApplet::init();
Plasma::ToolTipManager::self()->registerWidget(this);
slotTimeout();
m_timer->start();

View file

@ -356,6 +356,8 @@ DeviceNotifier::~DeviceNotifier()
void DeviceNotifier::init()
{
Plasma::PopupApplet::init();
KConfigGroup configgroup = config();
m_devicenotifierwidget->onlyremovable = configgroup.readEntry("showOnlyRemovable", true);
QTimer::singleShot(500, m_devicenotifierwidget, SLOT(slotUpdateLayout()));

View file

@ -93,6 +93,8 @@ DigitalClockApplet::DigitalClockApplet(QObject *parent, const QVariantList &args
void DigitalClockApplet::init()
{
Plasma::Applet::init();
m_timer->start();
Plasma::ToolTipManager::self()->registerWidget(this);
}

View file

@ -68,6 +68,8 @@ IconApplet::IconApplet(QObject *parent, const QVariantList &args)
void IconApplet::init()
{
Plasma::Applet::init();
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);

View file

@ -48,6 +48,8 @@ KeyboardApplet::KeyboardApplet(QObject *parent, const QVariantList &args)
void KeyboardApplet::init()
{
Plasma::Applet::init();
KConfigGroup configgroup = config();
m_showflag = configgroup.readEntry("showFlag", false);
m_showtext = configgroup.readEntry("showText", true);

View file

@ -1733,6 +1733,8 @@ LauncherApplet::LauncherApplet(QObject *parent, const QVariantList &args)
void LauncherApplet::init()
{
Plasma::PopupApplet::init();
setGlobalShortcut(KShortcut(Qt::ALT+Qt::Key_F2));
m_shareconfig = KSharedConfig::openConfig(globalConfig().config()->name());
m_configgroup = m_shareconfig->group("Plugins");

View file

@ -260,6 +260,8 @@ LockoutApplet::~LockoutApplet()
void LockoutApplet::init()
{
Plasma::Applet::init();
m_layout = new QGraphicsLinearLayout(Qt::Horizontal, this);
m_layout->setContentsMargins(0, 0, 0, 0);
m_layout->setSpacing(s_spacing);

View file

@ -122,6 +122,8 @@ LunaApplet::LunaApplet(QObject *parent, const QVariantList &args)
void LunaApplet::init()
{
Plasma::Applet::init();
Plasma::ToolTipManager::self()->registerWidget(this);
slotTimeout();
m_timer->start();

View file

@ -982,6 +982,8 @@ MixerApplet::~MixerApplet()
void MixerApplet::init()
{
Plasma::PopupApplet::init();
slotThemeChanged();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(slotThemeChanged()));
}

View file

@ -88,6 +88,8 @@ NotesApplet::NotesApplet(QObject *parent, const QVariantList &args)
void NotesApplet::init()
{
Plasma::PopupApplet::init();
configChanged();
}

View file

@ -328,6 +328,8 @@ PagerApplet::PagerApplet(QObject *parent, const QVariantList &args)
void PagerApplet::init()
{
Plasma::Applet::init();
KConfigGroup configgroup = config();
const PagerApplet::PagerMode oldpagermode = m_pagermode;
m_pagermode = static_cast<PagerApplet::PagerMode>(configgroup.readEntry("pagerMode", static_cast<int>(s_defaultpagermode)));

View file

@ -43,10 +43,6 @@ PanelSpacer::PanelSpacer(QObject *parent, const QVariantList &args)
setCacheMode(DeviceCoordinateCache);
}
PanelSpacer::~PanelSpacer()
{
}
QList<QAction *> PanelSpacer::contextualActions()
{
return m_actions;
@ -73,6 +69,8 @@ void PanelSpacer::toggleFixed(bool flexible)
void PanelSpacer::init()
{
Plasma::Applet::init();
if (containment()) {
connect(containment(), SIGNAL(toolBoxVisibilityChanged(bool)), this, SLOT(updateConfigurationMode(bool)));
}

View file

@ -28,7 +28,7 @@ class PanelSpacer : public Plasma::Applet
Q_OBJECT
public:
PanelSpacer(QObject *parent, const QVariantList &args);
~PanelSpacer();
void init();
void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
void constraintsEvent(Plasma::Constraints constraints);

View file

@ -108,6 +108,8 @@ Quicklaunch::~Quicklaunch()
void Quicklaunch::init()
{
Applet::init();
// Initialize outer layout
m_layout = new QGraphicsLinearLayout();
m_layout->setContentsMargins(2, 2, 2, 2);

View file

@ -823,6 +823,8 @@ SystemMonitor::~SystemMonitor()
void SystemMonitor::init()
{
Plasma::PopupApplet::init();
slotThemeChanged();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(slotThemeChanged()));
}

View file

@ -88,6 +88,8 @@ SystemTrayApplet::~SystemTrayApplet()
void SystemTrayApplet::init()
{
Plasma::Applet::init();
m_layout = new QGraphicsLinearLayout(Qt::Horizontal, this);
m_layout->setContentsMargins(s_margin, s_margin, s_margin, s_margin);
m_layout->setSpacing(s_spacing);

View file

@ -344,6 +344,8 @@ TasksApplet::TasksApplet(QObject *parent, const QVariantList &args)
void TasksApplet::init()
{
Plasma::Applet::init();
KConfigGroup configgroup = config();
m_tooltipmode = static_cast<TasksApplet::ToolTipMode>(configgroup.readEntry("tooltipMode", static_cast<int>(s_defaultooltipmode)));

View file

@ -88,6 +88,8 @@ Trash::~Trash()
void Trash::init()
{
Plasma::Applet::init();
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);

View file

@ -764,6 +764,8 @@ WeatherApplet::~WeatherApplet()
void WeatherApplet::init()
{
Plasma::PopupApplet::init();
KConfigGroup configgroup = config();
m_tempunit = static_cast<KTemperature::KTempUnit>(configgroup.readEntry("weatherTempUnit", static_cast<int>(s_defaulttempunit)));
m_location = configgroup.readEntry("weatherLocation", QString());