2009-08-18 01:40:25 +02:00
|
|
|
/*
|
2020-08-13 21:08:54 +02:00
|
|
|
SPDX-FileCopyrightText: 2009 Chani Armitage <chani@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
*/
|
2009-08-18 01:40:25 +02:00
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
|
2014-04-25 13:21:09 +02:00
|
|
|
#include <KActionCollection>
|
2021-03-05 19:15:32 +01:00
|
|
|
#include <QDebug>
|
2009-08-18 01:40:25 +02:00
|
|
|
|
|
|
|
#include <Plasma/Containment>
|
|
|
|
|
|
|
|
ContextTest::ContextTest(QObject *parent, const QVariantList &args)
|
|
|
|
: Plasma::ContainmentActions(parent, args)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-04-26 01:45:47 +02:00
|
|
|
QList<QAction *> ContextTest::contextualActions()
|
2009-08-18 01:40:25 +02:00
|
|
|
{
|
2014-04-25 13:21:09 +02:00
|
|
|
Plasma::Containment *c = containment();
|
|
|
|
Q_ASSERT(c);
|
2014-04-26 01:45:47 +02:00
|
|
|
QList<QAction *> actions;
|
2018-01-26 15:48:27 +01:00
|
|
|
actions << c->actions()->action(QStringLiteral("configure"));
|
2014-04-25 13:21:09 +02:00
|
|
|
|
|
|
|
return actions;
|
2009-08-18 01:40:25 +02:00
|
|
|
}
|
|
|
|
|
2014-04-25 13:21:09 +02:00
|
|
|
void ContextTest::performNextAction()
|
2009-08-18 01:40:25 +02:00
|
|
|
{
|
2014-04-25 13:21:09 +02:00
|
|
|
qWarning() << "Next action requested";
|
2009-08-18 01:40:25 +02:00
|
|
|
}
|
|
|
|
|
2014-04-25 13:21:09 +02:00
|
|
|
void ContextTest::performPreviousAction()
|
2009-08-18 01:40:25 +02:00
|
|
|
{
|
2014-04-25 13:21:09 +02:00
|
|
|
qWarning() << "Previous action requested";
|
2009-08-18 01:40:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ContextTest::init(const KConfigGroup &config)
|
|
|
|
{
|
|
|
|
m_text = config.readEntry("test-text", QString());
|
|
|
|
}
|
|
|
|
|
2014-04-26 01:45:47 +02:00
|
|
|
QWidget *ContextTest::createConfigurationInterface(QWidget *parent)
|
2009-08-18 01:40:25 +02:00
|
|
|
{
|
2021-03-05 19:15:32 +01:00
|
|
|
// m_currentText = m_text;
|
2009-08-18 01:40:25 +02:00
|
|
|
QWidget *widget = new QWidget(parent);
|
|
|
|
m_ui.setupUi(widget);
|
|
|
|
|
|
|
|
m_ui.text->setText(m_text);
|
2021-03-05 19:15:32 +01:00
|
|
|
// FIXME this way or just get it on close?
|
|
|
|
// connect(m_ui.text, SIGNAL(changed(QColor)), this, SLOT(setColor(QColor)));
|
|
|
|
// connect(this, SIGNAL(settingsChanged(bool)), parent, SLOT(settingsChanged(bool)));
|
2009-08-18 01:40:25 +02:00
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContextTest::configurationAccepted()
|
|
|
|
{
|
|
|
|
m_text = m_ui.text->text();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContextTest::save(KConfigGroup &config)
|
|
|
|
{
|
|
|
|
config.writeEntry("test-text", m_text);
|
|
|
|
}
|
|
|
|
|
2021-06-18 22:16:05 +02:00
|
|
|
K_PLUGIN_CLASS_WITH_JSON(ContextTest, "plasma-containmentactions-test.desktop")
|
2009-08-18 01:40:25 +02:00
|
|
|
|
2014-04-25 13:21:09 +02:00
|
|
|
#include "test.moc"
|