plasma-framework/plasma/containmentactionspluginsconfig.cpp

94 lines
2.8 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2009 Chani Armitage <chani@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "containmentactionspluginsconfig.h"
#include "private/containmentactionspluginsconfig_p.h"
#include <QHash>
#include <QEvent>
2012-09-26 14:46:47 +02:00
#include <QMouseEvent>
#include <QWheelEvent>
#include <QString>
#include <kdebug.h>
#include "containmentactions.h"
using namespace Plasma;
namespace Plasma
{
ContainmentActionsPluginsConfig::ContainmentActionsPluginsConfig()
: d(new ContainmentActionsPluginsConfigPrivate(this))
{
}
ContainmentActionsPluginsConfig::ContainmentActionsPluginsConfig(const ContainmentActionsPluginsConfig &other)
: d(new ContainmentActionsPluginsConfigPrivate(this))
{
d->plugins = other.d->plugins;
}
ContainmentActionsPluginsConfig& ContainmentActionsPluginsConfig::operator=(const ContainmentActionsPluginsConfig &other)
{
d->plugins = other.d->plugins;
return *this;
}
ContainmentActionsPluginsConfig::~ContainmentActionsPluginsConfig()
{
delete d;
}
void ContainmentActionsPluginsConfig::clear()
{
d->plugins.clear();
}
void ContainmentActionsPluginsConfig::remove(QEvent *trigger)
{
QString s = ContainmentActions::eventToString(trigger);
d->plugins.remove(s);
}
void ContainmentActionsPluginsConfig::addPlugin(QEvent *trigger, const QString &name)
{
QString s = ContainmentActions::eventToString(trigger);
d->plugins.insert(s, name);
}
void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::MouseButton button, const QString &name)
{
2012-09-26 14:46:47 +02:00
QMouseEvent event(QEvent::MouseButtonPress, QPoint(), button, button, modifiers);
QString s = ContainmentActions::eventToString(&event);
d->plugins.insert(s, name);
}
void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::Orientation wheelDirection, const QString &name)
{
2012-09-26 14:46:47 +02:00
//most of those parameters are just fillers
QWheelEvent event(QPoint(0,0), 0, Qt::NoButton, modifiers, wheelDirection);
QString s = ContainmentActions::eventToString(&event);
d->plugins.insert(s, name);
}
} // namespace Plasma