plasma-framework/examples/testcontainmentactionsplugin/test.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.6 KiB
C++
Raw Normal View History

/*
SPDX-FileCopyrightText: 2009 Chani Armitage <chani@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "test.h"
2014-04-25 13:21:09 +02:00
#include <KActionCollection>
#include <QDebug>
#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()
{
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;
actions << c->actions()->action(QStringLiteral("configure"));
2014-04-25 13:21:09 +02:00
return actions;
}
2014-04-25 13:21:09 +02:00
void ContextTest::performNextAction()
{
2014-04-25 13:21:09 +02:00
qWarning() << "Next action requested";
}
2014-04-25 13:21:09 +02:00
void ContextTest::performPreviousAction()
{
2014-04-25 13:21:09 +02:00
qWarning() << "Previous action requested";
}
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)
{
// m_currentText = m_text;
QWidget *widget = new QWidget(parent);
m_ui.setupUi(widget);
m_ui.text->setText(m_text);
// 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)));
return widget;
}
void ContextTest::configurationAccepted()
{
m_text = m_ui.text->text();
}
void ContextTest::save(KConfigGroup &config)
{
config.writeEntry("test-text", m_text);
}
2014-04-25 13:21:09 +02:00
K_EXPORT_PLASMA_CONTAINMENTACTIONS_WITH_JSON(containmentactions_test, ContextTest, "plasma-containmentactions-test.desktop")
2014-04-25 13:21:09 +02:00
#include "test.moc"