Plasma
containmentactionspluginsconfig.cpp
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 2009 Chani Armitage <chani@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "containmentactionspluginsconfig.h" 00021 #include "private/containmentactionspluginsconfig_p.h" 00022 00023 #include <QHash> 00024 #include <QEvent> 00025 #include <QGraphicsSceneMouseEvent> 00026 #include <QGraphicsSceneWheelEvent> 00027 #include <QString> 00028 00029 #include <kdebug.h> 00030 00031 #include "containmentactions.h" 00032 00033 using namespace Plasma; 00034 00035 namespace Plasma 00036 { 00037 00038 ContainmentActionsPluginsConfig::ContainmentActionsPluginsConfig() 00039 : d(new ContainmentActionsPluginsConfigPrivate(this)) 00040 { 00041 } 00042 00043 ContainmentActionsPluginsConfig::ContainmentActionsPluginsConfig(const ContainmentActionsPluginsConfig &other) 00044 : d(new ContainmentActionsPluginsConfigPrivate(this)) 00045 { 00046 d->plugins = other.d->plugins; 00047 } 00048 00049 ContainmentActionsPluginsConfig& ContainmentActionsPluginsConfig::operator=(const ContainmentActionsPluginsConfig &other) 00050 { 00051 d->plugins = other.d->plugins; 00052 return *this; 00053 } 00054 00055 ContainmentActionsPluginsConfig::~ContainmentActionsPluginsConfig() 00056 { 00057 delete d; 00058 } 00059 00060 void ContainmentActionsPluginsConfig::clear() 00061 { 00062 d->plugins.clear(); 00063 } 00064 00065 void ContainmentActionsPluginsConfig::remove(QEvent *trigger) 00066 { 00067 QString s = ContainmentActions::eventToString(trigger); 00068 d->plugins.remove(s); 00069 } 00070 00071 void ContainmentActionsPluginsConfig::addPlugin(QEvent *trigger, const QString &name) 00072 { 00073 QString s = ContainmentActions::eventToString(trigger); 00074 d->plugins.insert(s, name); 00075 } 00076 00077 void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::MouseButton button, const QString &name) 00078 { 00079 QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); 00080 event.setButton(button); 00081 event.setModifiers(modifiers); 00082 QString s = ContainmentActions::eventToString(&event); 00083 d->plugins.insert(s, name); 00084 } 00085 00086 void ContainmentActionsPluginsConfig::addPlugin(Qt::KeyboardModifiers modifiers, Qt::Orientation wheelDirection, const QString &name) 00087 { 00088 QGraphicsSceneWheelEvent event(QEvent::GraphicsSceneWheel); 00089 event.setOrientation(wheelDirection); 00090 event.setModifiers(modifiers); 00091 QString s = ContainmentActions::eventToString(&event); 00092 d->plugins.insert(s, name); 00093 } 00094 00095 } // namespace Plasma 00096
KDE 4.6 API Reference