Port KWin effects away from KAction and KShortcut to Qt5/KF5 classes.

REVIEW: 111898
icc-effect-5.14.5
Reza Shah 2013-08-15 04:13:12 +09:00
parent bef5b71898
commit 61f452723e
34 changed files with 358 additions and 358 deletions

View File

@ -23,8 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "cube_inside.h"
#include <kaction.h>
#include <QAction>
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kwinconfig.h>
#include <kdebug.h>
@ -200,24 +201,23 @@ void CubeEffect::reconfigure(ReconfigureFlags)
// do not connect the shortcut if we use cylinder or sphere
if (!shortcutsRegistered) {
KActionCollection* actionCollection = new KActionCollection(this);
KAction* cubeAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Cube")));
QAction* cubeAction = actionCollection->addAction(QStringLiteral("Cube"));
cubeAction->setText(i18n("Desktop Cube"));
cubeAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F11));
cubeShortcut = cubeAction->globalShortcut();
KAction* cylinderAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Cylinder")));
KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction);
QAction* cylinderAction = actionCollection->addAction(QStringLiteral("Cylinder"));
cylinderAction->setText(i18n("Desktop Cylinder"));
cylinderAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
cylinderShortcut = cylinderAction->globalShortcut();
KAction* sphereAction = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("Sphere")));
KGlobalAccel::self()->setShortcut(cylinderAction, QList<QKeySequence>());
cylinderShortcut = KGlobalAccel::self()->shortcut(cylinderAction);
QAction* sphereAction = actionCollection->addAction(QStringLiteral("Sphere"));
sphereAction->setText(i18n("Desktop Sphere"));
sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
sphereShortcut = sphereAction->globalShortcut();
KGlobalAccel::self()->setShortcut(sphereAction, QList<QKeySequence>());
sphereShortcut = KGlobalAccel::self()->shortcut(sphereAction);
connect(cubeAction, SIGNAL(triggered(bool)), this, SLOT(toggleCube()));
connect(cylinderAction, SIGNAL(triggered(bool)), this, SLOT(toggleCylinder()));
connect(sphereAction, SIGNAL(triggered(bool)), this, SLOT(toggleSphere()));
connect(cubeAction, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(cubeShortcutChanged(QKeySequence)));
connect(cylinderAction, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(cylinderShortcutChanged(QKeySequence)));
connect(sphereAction, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(sphereShortcutChanged(QKeySequence)));
connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &CubeEffect::globalShortcutChanged);
shortcutsRegistered = true;
}
@ -2078,19 +2078,18 @@ void CubeEffect::slotTabBoxClosed()
}
}
void CubeEffect::cubeShortcutChanged(const QKeySequence& seq)
void CubeEffect::globalShortcutChanged(QAction *action, const QKeySequence &seq)
{
cubeShortcut = KShortcut(seq);
}
void CubeEffect::cylinderShortcutChanged(const QKeySequence& seq)
{
cylinderShortcut = KShortcut(seq);
}
void CubeEffect::sphereShortcutChanged(const QKeySequence& seq)
{
sphereShortcut = KShortcut(seq);
if (action->objectName() == QStringLiteral("Cube")) {
cubeShortcut.clear();
cubeShortcut.append(seq);
} else if (action->objectName() == QStringLiteral("Cylinder")) {
cylinderShortcut.clear();
cylinderShortcut.append(seq);
} else if (action->objectName() == QStringLiteral("Sphere")) {
sphereShortcut.clear();
sphereShortcut.append(seq);
}
}
void* CubeEffect::proxy()

View File

@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwineffects.h>
#include <kwinglutils.h>
#include <kshortcut.h>
#include <QObject>
#include <QQueue>
#include <QMatrix4x4>
@ -131,9 +130,7 @@ private Q_SLOTS:
void toggleSphere();
// slots for global shortcut changed
// needed to toggle the effect
void cubeShortcutChanged(const QKeySequence& seq);
void cylinderShortcutChanged(const QKeySequence& seq);
void sphereShortcutChanged(const QKeySequence& seq);
void globalShortcutChanged(QAction *action, const QKeySequence &seq);
void slotTabBoxAdded(int mode);
void slotTabBoxUpdated();
void slotTabBoxClosed();
@ -238,9 +235,9 @@ private:
GLVertexBuffer *m_cubeCapBuffer;
// Shortcuts - needed to toggle the effect
KShortcut cubeShortcut;
KShortcut cylinderShortcut;
KShortcut sphereShortcut;
QList<QKeySequence> cubeShortcut;
QList<QKeySequence> cylinderShortcut;
QList<QKeySequence> sphereShortcut;
// proxy
CubeEffectProxy m_proxy;

View File

@ -21,13 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "cubeconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <kcolorscheme.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KAboutData>
#include <KDE/KGlobalAccel>
#include <QVBoxLayout>
#include <QColor>
@ -54,29 +55,28 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
m_ui->tabWidget->setTabText(0, i18nc("@title:tab Basic Settings", "Basic"));
m_ui->tabWidget->setTabText(1, i18nc("@title:tab Advanced Settings", "Advanced"));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("Cube"));
m_actionCollection->setConfigGlobal(true);
KAction* cubeAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Cube"));
QAction* cubeAction = m_actionCollection->addAction(QStringLiteral("Cube"));
cubeAction->setText(i18n("Desktop Cube"));
cubeAction->setProperty("isConfigurationAction", true);
cubeAction->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F11));
KAction* cylinderAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Cylinder"));
KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
QAction* cylinderAction = m_actionCollection->addAction(QStringLiteral("Cylinder"));
cylinderAction->setText(i18n("Desktop Cylinder"));
cylinderAction->setProperty("isConfigurationAction", true);
cylinderAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KAction* sphereAction = (KAction*) m_actionCollection->addAction(QStringLiteral("Sphere"));
KGlobalAccel::self()->setShortcut(cylinderAction, QList<QKeySequence>());
QAction* sphereAction = m_actionCollection->addAction(QStringLiteral("Sphere"));
sphereAction->setText(i18n("Desktop Sphere"));
sphereAction->setProperty("isConfigurationAction", true);
sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KGlobalAccel::self()->setShortcut(sphereAction, QList<QKeySequence>());
m_ui->editor->addCollection(m_actionCollection);
#endif
connect(m_ui->kcfg_Caps, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
m_ui->kcfg_Wallpaper->setFilter(QStringLiteral("*.png *.jpeg *.jpg "));
addConfig(CubeConfig::self(), m_ui);

View File

@ -28,9 +28,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <kaction.h>
#include <QAction>
#include <kactioncollection.h>
#include <kdebug.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <netwm_def.h>
#include <QEvent>
@ -68,12 +69,13 @@ DesktopGridEffect::DesktopGridEffect()
{
// Load shortcuts
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*) actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
QAction* a = actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
a->setText(i18n("Show Desktop Grid"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F8));
shortcut = a->globalShortcut();
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8);
shortcut = KGlobalAccel::self()->shortcut(a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence)));
connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &DesktopGridEffect::globalShortcutChanged);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
@ -1207,9 +1209,10 @@ void DesktopGridEffect::finish()
}
}
void DesktopGridEffect::globalShortcutChanged(const QKeySequence& seq)
void DesktopGridEffect::globalShortcutChanged(QAction *action, const QKeySequence& seq)
{
shortcut = KShortcut(seq);
shortcut.clear();
shortcut.append(seq);
}
bool DesktopGridEffect::isMotionManagerMovingWindows() const

View File

@ -23,7 +23,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_DESKTOPGRID_H
#include <kwineffects.h>
#include <kshortcut.h>
#include <QObject>
#include <QTimeLine>
#include <QQuickView>
@ -96,7 +95,7 @@ private Q_SLOTS:
void toggle();
// slots for global shortcut changed
// needed to toggle the effect
void globalShortcutChanged(const QKeySequence& seq);
void globalShortcutChanged(QAction *action, const QKeySequence& seq);
void slotAddDesktop();
void slotRemoveDesktop();
void slotWindowAdded(KWin::EffectWindow* w);
@ -160,7 +159,7 @@ private:
QList<QPointF> scaledOffset;
// Shortcut - needed to toggle the effect
KShortcut shortcut;
QList<QKeySequence> shortcut;
PresentWindowsEffectProxy* m_proxy;
QList<WindowMotionManager> m_managers;

View File

@ -23,12 +23,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "desktopgridconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KAboutData>
#include <KDE/KGlobalAccel>
#include <QVBoxLayout>
@ -51,21 +52,20 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant
layout->addWidget(m_ui);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("DesktopGrid"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
QAction* a = m_actionCollection->addAction(QStringLiteral("ShowDesktopGrid"));
a->setText(i18n("Show Desktop Grid"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F8));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8);
m_ui->shortcutEditor->addCollection(m_actionCollection);
#endif
m_ui->desktopNameAlignmentCombo->addItem(i18nc("Desktop name alignment:", "Disabled"), QVariant(Qt::Alignment(0)));
m_ui->desktopNameAlignmentCombo->addItem(i18n("Top"), QVariant(Qt::AlignHCenter | Qt::AlignTop));

View File

@ -27,8 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
#include <QWidget>

View File

@ -21,14 +21,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "flipswitchconfig.h"
#include <QAction>
#include <kwinconfig.h>
#include <QFont>
#include <QKeyEvent>
#include <QMatrix4x4>
#include <kdebug.h>
#include <KAction>
#include <QAction>
#include <KActionCollection>
#include <KDE/KGlobalAccel>
#include <KDE/KIcon>
#include <KDE/KLocalizedString>
@ -58,18 +60,17 @@ FlipSwitchEffect::FlipSwitchEffect()
m_captionFont.setPointSize(m_captionFont.pointSize() * 2);
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
a->setText(i18n("Toggle Flip Switch (Current desktop)"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_shortcutCurrent = a->globalShortcut();
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActiveCurrent()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedCurrent(QKeySequence)));
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
b->setText(i18n("Toggle Flip Switch (All desktops)"));
b->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_shortcutAll = b->globalShortcut();
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence)));
QAction* flipSwitchCurrentAction = actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
flipSwitchCurrentAction->setText(i18n("Toggle Flip Switch (Current desktop)"));
KGlobalAccel::self()->setShortcut(flipSwitchCurrentAction, QList<QKeySequence>());
m_shortcutCurrent = KGlobalAccel::self()->shortcut(flipSwitchCurrentAction);
connect(flipSwitchCurrentAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveCurrent()));
QAction* flipSwitchAllAction = actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
flipSwitchAllAction->setText(i18n("Toggle Flip Switch (All desktops)"));
KGlobalAccel::self()->setShortcut(flipSwitchAllAction, QList<QKeySequence>());
m_shortcutAll = KGlobalAccel::self()->shortcut(flipSwitchAllAction);
connect(flipSwitchAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &FlipSwitchEffect::globalShortcutChanged);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(tabBoxAdded(int)), this, SLOT(slotTabBoxAdded(int)));
@ -822,14 +823,15 @@ void FlipSwitchEffect::selectNextOrPreviousWindow(bool forward)
//*************************************************************
// Keyboard handling
//*************************************************************
void FlipSwitchEffect::globalShortcutChangedAll(QKeySequence shortcut)
void FlipSwitchEffect::globalShortcutChanged(QAction *action, QKeySequence shortcut)
{
m_shortcutAll = KShortcut(shortcut);
}
void FlipSwitchEffect::globalShortcutChangedCurrent(QKeySequence shortcut)
{
m_shortcutCurrent = KShortcut(shortcut);
if (action->objectName() == QStringLiteral("FlipSwitchAll")) {
m_shortcutAll.clear();
m_shortcutAll.append(shortcut);
} else if (action->objectName() == QStringLiteral("FlipSwitchCurrent")) {
m_shortcutCurrent.clear();
m_shortcutCurrent.append(shortcut);
}
}
void FlipSwitchEffect::grabbedKeyboardEvent(QKeyEvent* e)

View File

@ -22,12 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KWIN_FLIPSWITCH_H
#include <kwineffects.h>
#include <KShortcut>
#include <QQueue>
#include <QTimeLine>
class KShortcut;
namespace KWin
{
@ -83,8 +80,7 @@ public:
private Q_SLOTS:
void toggleActiveCurrent();
void toggleActiveAllDesktops();
void globalShortcutChangedCurrent(QKeySequence shortcut);
void globalShortcutChangedAll(QKeySequence shortcut);
void globalShortcutChanged(QAction *action, QKeySequence shortcut);
void slotWindowAdded(KWin::EffectWindow* w);
void slotWindowClosed(KWin::EffectWindow *w);
void slotTabBoxAdded(int mode);
@ -141,8 +137,8 @@ private:
float m_yPosition;
bool m_windowTitle;
// Shortcuts
KShortcut m_shortcutCurrent;
KShortcut m_shortcutAll;
QList<QKeySequence> m_shortcutCurrent;
QList<QKeySequence> m_shortcutAll;
};
class FlipSwitchEffect::ItemInfo

View File

@ -21,12 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "flipswitchconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <KAction>
#include <KActionCollection>
#include <KDE/KAboutData>
#include <KDE/KGlobalAccel>
#include <QVBoxLayout>
@ -49,22 +50,19 @@ FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantLi
layout->addWidget(m_ui);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = (KAction*)m_actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
QAction* a = m_actionCollection->addAction(QStringLiteral("FlipSwitchCurrent"));
a->setText(i18n("Toggle Flip Switch (Current desktop)"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KAction* b = (KAction*)m_actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>());
QAction* b = m_actionCollection->addAction(QStringLiteral("FlipSwitchAll"));
b->setText(i18n("Toggle Flip Switch (All desktops)"));
b->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
KGlobalAccel::self()->setShortcut(b, QList<QKeySequence>());
m_actionCollection->setConfigGroup(QStringLiteral("FlipSwitch"));
m_actionCollection->setConfigGlobal(true);
m_ui->shortcutEditor->addCollection(m_actionCollection);
#endif
addConfig(FlipSwitchConfig::self(), m_ui);

View File

@ -21,11 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "invert.h"
#include <QAction>
#include <kwinglutils.h>
#include <kwinglplatform.h>
#include <kactioncollection.h>
#include <kaction.h>
#include <KDE/KGlobal>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <QStandardPaths>
@ -44,20 +45,20 @@ InvertEffect::InvertEffect()
m_shader(NULL),
m_allWindows(false)
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("Invert"));
QAction* a = actionCollection->addAction(QStringLiteral("Invert"));
a->setText(i18n("Toggle Invert Effect"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_I);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_I);
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleScreenInversion()));
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("InvertWindow"));
QAction* b = actionCollection->addAction(QStringLiteral("InvertWindow"));
b->setText(i18n("Toggle Invert Effect on Window"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
KGlobalAccel::self()->setDefaultShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_U);
KGlobalAccel::self()->setShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_U);
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleWindow()));
#endif
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
}

View File

@ -20,12 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "invert_config.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
@ -41,37 +42,33 @@ InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args
{
QVBoxLayout* layout = new QVBoxLayout(this);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
KActionCollection *actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
KAction* a = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("Invert")));
QAction* a = actionCollection->addAction(QStringLiteral("Invert"));
a->setText(i18n("Toggle Invert Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_I);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_I);
KAction* b = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("InvertWindow")));
QAction* b = actionCollection->addAction(QStringLiteral("InvertWindow"));
b->setText(i18n("Toggle Invert Effect on Window"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_U));
KGlobalAccel::self()->setDefaultShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_U);
KGlobalAccel::self()->setShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::META + Qt::Key_U);
mShortcutEditor = new KShortcutsEditor(actionCollection, this,
KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed);
connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
layout->addWidget(mShortcutEditor);
#endif
load();
}
InvertEffectConfig::~InvertEffectConfig()
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Undo (only) unsaved changes to global key shortcuts
mShortcutEditor->undoChanges();
#endif
}
void InvertEffectConfig::load()
@ -85,10 +82,7 @@ void InvertEffectConfig::save()
{
KCModule::save();
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
mShortcutEditor->save(); // undo() will restore to this state from now on
#endif
emit changed(false);
EffectsHandler::sendReloadMessage(QStringLiteral("invert"));
@ -96,10 +90,8 @@ void InvertEffectConfig::save()
void InvertEffectConfig::defaults()
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
mShortcutEditor->allDefault();
#endif
emit changed(true);
}

View File

@ -24,11 +24,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "lookingglassconfig.h"
#include <QAction>
#include <kwinglutils.h>
#include <kwinglplatform.h>
#include <kactioncollection.h>
#include <kaction.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <KDE/KGlobal>
@ -58,16 +59,19 @@ LookingGlassEffect::LookingGlassEffect()
actionCollection->setConfigGlobal(true);
actionCollection->setConfigGroup(QStringLiteral("LookingGlass"));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
#endif
QAction* a;
a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);

View File

@ -23,14 +23,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "lookingglassconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
#include <QWidget>
@ -58,29 +58,29 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria
addConfig(LookingGlassConfig::self(), m_ui);
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("LookingGlass"));
m_actionCollection->setConfigGlobal(true);
KAction* a;
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
QAction* a;
a = m_actionCollection->addAction(KStandardAction::ZoomIn);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
a = m_actionCollection->addAction(KStandardAction::ZoomOut);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
a = m_actionCollection->addAction(KStandardAction::ActualSize);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
m_ui->editor->addCollection(m_actionCollection);
#endif
}
LookingGlassEffectConfig::~LookingGlassEffectConfig()

View File

@ -24,9 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "magnifierconfig.h"
#include <QAction>
#include <kwinconfig.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kstandardaction.h>
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinxrenderutils.h>
#include <xcb/render.h>
#endif
#include <KDE/KGlobalAccel>
namespace KWin
{
@ -54,17 +55,20 @@ MagnifierEffect::MagnifierEffect()
, m_pixmap(XCB_PIXMAP_NONE)
#endif
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
#endif
QAction* a;
a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);

View File

@ -22,14 +22,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "magnifierconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
#include <QWidget>
@ -58,29 +58,30 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("Magnifier"));
m_actionCollection->setConfigGlobal(true);
KAction* a;
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
QAction* a;
a = m_actionCollection->addAction(KStandardAction::ZoomIn);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut));
a = m_actionCollection->addAction(KStandardAction::ZoomOut);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize));
a = m_actionCollection->addAction(KStandardAction::ActualSize);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View File

@ -22,6 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "mouseclickconfig.h"
#include <QAction>
#include <kwinglutils.h>
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
@ -30,9 +31,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <xcb/render.h>
#endif
#include <KDE/KAction>
#include <KDE/KActionCollection>
#include <KDE/KConfigGroup>
#include <KDE/KGlobalAccel>
#include <math.h>
@ -44,14 +45,14 @@ KWIN_EFFECT(mouseclick, MouseClickEffect)
MouseClickEffect::MouseClickEffect()
{
m_enabled = false;
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast<KAction*>(actionCollection->addAction(QStringLiteral("ToggleMouseClick")));
QAction* a = actionCollection->addAction(QStringLiteral("ToggleMouseClick"));
a->setText(i18n("Toggle Effect"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk);
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleEnabled()));
#endif
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);

View File

@ -22,12 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "mouseclickconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KActionCollection>
#include <KDE/KAction>
#include <KDE/KAboutData>
#include <KDE/KShortcutsEditor>
#include <KDE/KGlobalAccel>
#include <QWidget>
@ -51,18 +51,16 @@ MouseClickEffectConfig::MouseClickEffectConfig(QWidget* parent, const QVariantLi
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
KAction* a = static_cast<KAction*>(m_actionCollection->addAction(QStringLiteral("ToggleMouseClick")));
QAction* a = m_actionCollection->addAction(QStringLiteral("ToggleMouseClick"));
a->setText(i18n("Toggle Effect"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Asterisk);
m_ui->editor->addCollection(m_actionCollection);
#endif
addConfig(MouseClickConfig::self(), m_ui);
load();

View File

@ -24,11 +24,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "mousemarkconfig.h"
#include <QAction>
#include <kwinconfig.h>
#include <kwinglutils.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <math.h>
@ -48,18 +48,18 @@ KWIN_EFFECT(mousemark, MouseMarkEffect)
MouseMarkEffect::MouseMarkEffect()
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("ClearMouseMarks")));
QAction* a = actionCollection->addAction(QStringLiteral("ClearMouseMarks"));
a->setText(i18n("Clear All Mouse Marks"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
connect(a, SIGNAL(triggered(bool)), this, SLOT(clear()));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("ClearLastMouseMark")));
a = actionCollection->addAction(QStringLiteral("ClearLastMouseMark"));
a->setText(i18n("Clear Last Mouse Mark"));
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast()));
#endif
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
connect(effects, SIGNAL(screenLockingChanged(bool)), SLOT(screenLockingChanged(bool)));

View File

@ -23,14 +23,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "mousemarkconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KAboutData>
#include <KShortcutsEditor>
#include <KDE/KGlobalAccel>
#include <QWidget>
@ -57,23 +57,22 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
addConfig(MouseMarkConfig::self(), m_ui);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
KAction* a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("ClearMouseMarks")));
QAction* a = m_actionCollection->addAction(QStringLiteral("ClearMouseMarks"));
a->setText(i18n("Clear Mouse Marks"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F11);
a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("ClearLastMouseMark")));
a = m_actionCollection->addAction(QStringLiteral("ClearLastMouseMark"));
a->setText(i18n("Clear Last Mouse Mark"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::SHIFT + Qt::META + Qt::Key_F12);
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View File

@ -22,8 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "presentwindows.h"
//KConfigSkeleton
#include "presentwindowsconfig.h"
#include <QAction>
#include <kactioncollection.h>
#include <kaction.h>
#include <KDE/KGlobalAccel>
#include <KDE/KIcon>
#include <KDE/KLocalizedString>
#include <KDE/KStandardDirs>
@ -76,24 +77,25 @@ PresentWindowsEffect::PresentWindowsEffect()
m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this);
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("Expose"));
a->setText(i18n("Toggle Present Windows (Current desktop)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9));
shortcut = a->globalShortcut();
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence)));
KAction* b = (KAction*)actionCollection->addAction(QStringLiteral("ExposeAll"));
b->setText(i18n("Toggle Present Windows (All desktops)"));
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
shortcutAll = b->globalShortcut();
connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence)));
KAction* c = (KAction*)actionCollection->addAction(QStringLiteral("ExposeClass"));
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
connect(c, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass()));
connect(c, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedClass(QKeySequence)));
shortcutClass = c->globalShortcut();
QAction* exposeAction = actionCollection->addAction(QStringLiteral("Expose"));
exposeAction->setText(i18n("Toggle Present Windows (Current desktop)"));
KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9);
KGlobalAccel::self()->setShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9);
shortcut = KGlobalAccel::self()->shortcut(exposeAction);
connect(exposeAction, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
QAction* exposeAllAction = actionCollection->addAction(QStringLiteral("ExposeAll"));
exposeAllAction->setText(i18n("Toggle Present Windows (All desktops)"));
KGlobalAccel::self()->setDefaultShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10);
KGlobalAccel::self()->setShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10);
shortcutAll = KGlobalAccel::self()->shortcut(exposeAllAction);
connect(exposeAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
QAction* exposeClassAction = actionCollection->addAction(QStringLiteral("ExposeClass"));
exposeClassAction->setText(i18n("Toggle Present Windows (Window class)"));
KGlobalAccel::self()->setDefaultShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7);
KGlobalAccel::self()->setShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7);
connect(exposeClassAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass()));
shortcutClass = KGlobalAccel::self()->shortcut(exposeClassAction);
connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, &PresentWindowsEffect::globalShortcutChanged);
reconfigure(ReconfigureAll);
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
@ -1905,19 +1907,18 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const
return topLeft;
}
void PresentWindowsEffect::globalShortcutChanged(const QKeySequence& seq)
void PresentWindowsEffect::globalShortcutChanged(QAction *action, const QKeySequence& seq)
{
shortcut = KShortcut(seq);
}
void PresentWindowsEffect::globalShortcutChangedAll(const QKeySequence& seq)
{
shortcutAll = KShortcut(seq);
}
void PresentWindowsEffect::globalShortcutChangedClass(const QKeySequence& seq)
{
shortcutClass = KShortcut(seq);
if (action->objectName() == QStringLiteral("Expose")) {
shortcut.clear();
shortcut.append(seq);
} else if (action->objectName() == QStringLiteral("ExposeAll")) {
shortcutAll.clear();
shortcutAll.append(seq);
} else if (action->objectName() == QStringLiteral("ExposeClass")) {
shortcutClass.clear();
shortcutClass.append(seq);
}
}
bool PresentWindowsEffect::isActive() const

View File

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "presentwindows_proxy.h"
#include <kwineffects.h>
#include <kshortcut.h>
#include <QQuickView>
class QTimer;
@ -200,9 +199,7 @@ public Q_SLOTS:
// slots for global shortcut changed
// needed to toggle the effect
void globalShortcutChanged(const QKeySequence& seq);
void globalShortcutChangedAll(const QKeySequence& seq);
void globalShortcutChangedClass(const QKeySequence& seq);
void globalShortcutChanged(QAction *action, const QKeySequence &seq);
// EffectsHandler
void slotWindowAdded(KWin::EffectWindow *w);
void slotWindowClosed(KWin::EffectWindow *w);
@ -297,9 +294,9 @@ private:
QString m_windowFilter;
// Shortcut - needed to toggle the effect
KShortcut shortcut;
KShortcut shortcutAll;
KShortcut shortcutClass;
QList<QKeySequence> shortcut;
QList<QKeySequence> shortcutAll;
QList<QKeySequence> shortcutClass;
// Atoms
// Present windows for all windows of given desktop

View File

@ -22,12 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "presentwindows_config.h"
// KConfigSkeleton
#include "presentwindowsconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KAboutData>
#include <KDE/KGlobalAccel>
#include <QVBoxLayout>
@ -50,31 +51,31 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
layout->addWidget(m_ui);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("PresentWindows"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*) m_actionCollection->addAction(QStringLiteral("ExposeAll"));
QAction* a = m_actionCollection->addAction(QStringLiteral("ExposeAll"));
a->setText(i18n("Toggle Present Windows (All desktops)"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10);
KAction* b = (KAction*) m_actionCollection->addAction(QStringLiteral("Expose"));
QAction* b = m_actionCollection->addAction(QStringLiteral("Expose"));
b->setText(i18n("Toggle Present Windows (Current desktop)"));
b->setProperty("isConfigurationAction", true);
b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9));
KGlobalAccel::self()->setDefaultShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9);
KGlobalAccel::self()->setShortcut(b, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9);
KAction* c = (KAction*)m_actionCollection->addAction(QStringLiteral("ExposeClass"));
QAction* c = m_actionCollection->addAction(QStringLiteral("ExposeClass"));
c->setText(i18n("Toggle Present Windows (Window class)"));
c->setProperty("isConfigurationAction", true);
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
KGlobalAccel::self()->setDefaultShortcut(c, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7);
KGlobalAccel::self()->setShortcut(c, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7);
m_ui->shortcutEditor->addCollection(m_actionCollection);
#endif
connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));

View File

@ -23,8 +23,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "thumbnailasideconfig.h"
#include <QAction>
#include <kactioncollection.h>
#include <kaction.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
namespace KWin
@ -34,14 +35,13 @@ KWIN_EFFECT(thumbnailaside, ThumbnailAsideEffect)
ThumbnailAsideEffect::ThumbnailAsideEffect()
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = (KAction*)actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
QAction* a = actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::CTRL + Qt::Key_T);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::CTRL + Qt::Key_T);
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail()));
#endif
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect)));
connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowDamaged(KWin::EffectWindow*,QRect)));

View File

@ -22,15 +22,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "thumbnailasideconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kconfiggroup.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
#include <KDE/KGlobalAccel>
#include <QWidget>
#include <QVBoxLayout>
@ -58,21 +58,19 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
addConfig(ThumbnailAsideConfig::self(), this);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("ThumbnailAside"));
m_actionCollection->setConfigGlobal(true);
KAction* a = (KAction*)m_actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
QAction* a = m_actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail"));
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::CTRL + Qt::Key_T);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::CTRL + Qt::Key_T);
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View File

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "trackmouseconfig.h"
#include <QAction>
#include <QTime>
#include <QMatrix4x4>
@ -33,8 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kglobal.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <math.h>
@ -59,15 +60,15 @@ TrackMouseEffect::TrackMouseEffect()
if ( effects->isOpenGLCompositing())
m_angleBase = 90.0;
m_mousePolling = false;
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection *actionCollection = new KActionCollection(this);
m_action = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("TrackMouse")));
m_action = actionCollection->addAction(QStringLiteral("TrackMouse"));
m_action->setText(i18n("Track mouse"));
m_action->setGlobalShortcut(KShortcut());
KGlobalAccel::self()->setDefaultShortcut(m_action, QList<QKeySequence>());
KGlobalAccel::self()->setShortcut(m_action, QList<QKeySequence>());
connect(m_action, SIGNAL(triggered(bool)), this, SLOT(toggle()));
#endif
connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
reconfigure(ReconfigureAll);

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwineffects.h>
class KAction;
class QAction;
namespace KWin
{
@ -69,7 +69,7 @@ private:
QSize m_size[2];
XRenderPicture *m_picture[2];
#endif
KAction* m_action;
QAction* m_action;
Qt::KeyboardModifiers m_modifiers;
};

View File

@ -19,14 +19,14 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include <QAction>
#include <kwineffects.h>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kaction.h>
#include <KActionCollection>
#include <KDE/KAboutData>
#include <KShortcutsEditor>
#include <KDE/KGlobalAccel>
#include <QVBoxLayout>
#include <QLabel>
@ -56,17 +56,17 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
addConfig(TrackMouseConfig::self(), m_ui);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
m_actionCollection->setConfigGroup(QStringLiteral("TrackMouse"));
m_actionCollection->setConfigGlobal(true);
KAction *a = static_cast< KAction* >(m_actionCollection->addAction(QStringLiteral("TrackMouse")));
QAction *a = m_actionCollection->addAction(QStringLiteral("TrackMouse"));
a->setText(i18n("Track mouse"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut());
#endif
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>());
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>());
connect(m_ui->shortcut, SIGNAL(keySequenceChanged(QKeySequence)),
SLOT(shortcutChanged(QKeySequence)));
@ -88,11 +88,6 @@ void TrackMouseEffectConfig::checkModifiers()
void TrackMouseEffectConfig::load()
{
KCModule::load();
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action(QStringLiteral("TrackMouse"))))
m_ui->shortcut->setKeySequence(a->globalShortcut().primary());
#endif
checkModifiers();
emit changed(false);
@ -114,11 +109,9 @@ void TrackMouseEffectConfig::defaults()
void TrackMouseEffectConfig::shortcutChanged(const QKeySequence &seq)
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action(QStringLiteral("TrackMouse"))))
a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut, KAction::NoAutoloading);
#endif
if (QAction *a = m_actionCollection->action(QStringLiteral("TrackMouse"))) {
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << seq, KGlobalAccel::NoAutoloading);
}
// m_actionCollection->writeSettings();
emit changed(true);
}

View File

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "ui_trackmouse_config.h"
class KActionCollection;
class KAction;
namespace KWin
{

View File

@ -22,12 +22,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "windowgeometryconfig.h"
#include <QAction>
#include <QStringBuilder>
#include <kwinconfig.h>
#include <kconfiggroup.h>
#include <kwindowsystem.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocale>
#include <KDE/KLocalizedString>
#include <KDE/KGlobal>
@ -60,14 +61,15 @@ WindowGeometry::WindowGeometry()
myMeasure[1]->setAlignment(Qt::AlignCenter);
myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom);
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("WindowGeometry")));
QAction* a = actionCollection->addAction(QStringLiteral("WindowGeometry"));
a->setText(i18n("Toggle window geometry display (effect only)"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11);
connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle()));
#endif
connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*)));
connect(effects, SIGNAL(windowStepUserMovedResized(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowStepUserMovedResized(KWin::EffectWindow*,QRect)));

View File

@ -22,9 +22,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "windowgeometryconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KActionCollection>
#include <kaction.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kconfiggroup.h>
#include <KDE/KAboutData>
@ -44,17 +45,16 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList&
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(myUi = new WindowGeometryConfigForm(this));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
myActionCollection = new KActionCollection(this, KComponentData("kwin"));
KAction* a = (KAction*)myActionCollection->addAction(QStringLiteral("WindowGeometry"));
myActionCollection = new KActionCollection(this, QStringLiteral("kwin"));
QAction* a = myActionCollection->addAction(QStringLiteral("WindowGeometry"));
a->setText(i18n("Toggle KWin composited geometry display"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11);
myUi->shortcuts->addCollection(myActionCollection);
#endif
connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed()));
addConfig(WindowGeometryConfiguration::self(), myUi);

View File

@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <kaction.h>
#include <KDE/KAboutData>
#include <kconfiggroup.h>

View File

@ -23,14 +23,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "zoomconfig.h"
#include <QAction>
#include <QApplication>
#include <QStyle>
#include <QtGui/QVector2D>
#include <QtDBus/QDBusConnection>
#include <kaction.h>
#include <kactioncollection.h>
#include <kstandardaction.h>
#include <KDE/KConfigGroup>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <KDE/KDebug>
@ -66,48 +67,56 @@ ZoomEffect::ZoomEffect()
, yMove(0)
, moveFactor(20.0)
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
KActionCollection* actionCollection = new KActionCollection(this);
KAction* a = 0;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize())));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
QAction* a = 0;
a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomLeft")));
a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize()));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
a = actionCollection->addAction(QStringLiteral("MoveZoomLeft"));
a->setText(i18n("Move Zoomed Area to Left"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft()));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomRight")));
a = actionCollection->addAction(QStringLiteral("MoveZoomRight"));
a->setText(i18n("Move Zoomed Area to Right"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight()));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomUp")));
a = actionCollection->addAction(QStringLiteral("MoveZoomUp"));
a->setText(i18n("Move Zoomed Area Upwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp()));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomDown")));
a = actionCollection->addAction(QStringLiteral("MoveZoomDown"));
a->setText(i18n("Move Zoomed Area Downwards"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown()));
// TODO: these two actions don't belong into the effect. They need to be moved into KWin core
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToFocus")));
a = actionCollection->addAction(QStringLiteral("MoveMouseToFocus"));
a->setText(i18n("Move Mouse to Focus"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToFocus()));
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToCenter")));
a = actionCollection->addAction(QStringLiteral("MoveMouseToCenter"));
a->setText(i18n("Move Mouse to Center"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F6);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F6);
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToCenter()));
#endif
timeline.setDuration(350);
timeline.setFrameRange(0, 100);

View File

@ -23,14 +23,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// KConfigSkeleton
#include "zoomconfig.h"
#include <QAction>
#include <kwineffects.h>
#include <KDE/KGlobalAccel>
#include <KDE/KLocalizedString>
#include <kdebug.h>
#include <KActionCollection>
#include <kaction.h>
#include <KShortcutsEditor>
#include <KDE/KAboutData>
#include <KDE/KIcon>
#include <QVBoxLayout>
@ -56,64 +57,71 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
// Shortcut config. The shortcut belongs to the component "kwin"!
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
KActionCollection *actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
actionCollection->setConfigGroup(QStringLiteral("Zoom"));
actionCollection->setConfigGlobal(true);
KAction* a;
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn));
QAction* a;
a = actionCollection->addAction(KStandardAction::ZoomIn);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut));
a = actionCollection->addAction(KStandardAction::ZoomOut);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize));
a = actionCollection->addAction(KStandardAction::ActualSize);
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomLeft")));
a = actionCollection->addAction(QStringLiteral("MoveZoomLeft"));
a->setIcon(KIcon(QStringLiteral("go-previous")));
a->setText(i18n("Move Left"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomRight")));
a = actionCollection->addAction(QStringLiteral("MoveZoomRight"));
a->setIcon(KIcon(QStringLiteral("go-next")));
a->setText(i18n("Move Right"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomUp")));
a->setIcon(KIcon("go-up"));
a = actionCollection->addAction(QStringLiteral("MoveZoomUp"));
a->setIcon(KIcon(QStringLiteral("go-up")));
a->setText(i18n("Move Up"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveZoomDown")));
a = actionCollection->addAction(QStringLiteral("MoveZoomDown"));
a->setIcon(KIcon(QStringLiteral("go-down")));
a->setText(i18n("Move Down"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToFocus")));
a = actionCollection->addAction(QStringLiteral("MoveMouseToFocus"));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Focus"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F5));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
a = static_cast< KAction* >(actionCollection->addAction(QStringLiteral("MoveMouseToCenter")));
a = actionCollection->addAction(QStringLiteral("MoveMouseToCenter"));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Center"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F6);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F6);
m_ui->editor->addCollection(actionCollection);
#endif
load();
}