diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 2ca0f6c294..53da98f0c2 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -11,7 +11,6 @@ set(kwin_effect_KDE_LIBS KF5::Plasma # screenedge effect KF5::KIconThemes KF5::KService - KF5::XmlGui ) set(kwin_effect_QT_LIBS diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp index a8ff239cc8..8b010701a4 100644 --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include "cube_inside.h" #include -#include #include #include #include @@ -200,17 +199,19 @@ void CubeEffect::reconfigure(ReconfigureFlags) // do not connect the shortcut if we use cylinder or sphere if (!shortcutsRegistered) { - KActionCollection* actionCollection = new KActionCollection(this); - QAction* cubeAction = actionCollection->addAction(QStringLiteral("Cube")); + QAction* cubeAction = new QAction(this); + cubeAction->setObjectName(QStringLiteral("Cube")); cubeAction->setText(i18n("Desktop Cube")); KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction); - QAction* cylinderAction = actionCollection->addAction(QStringLiteral("Cylinder")); + QAction* cylinderAction = new QAction(this); + cylinderAction->setObjectName(QStringLiteral("Cylinder")); cylinderAction->setText(i18n("Desktop Cylinder")); KGlobalAccel::self()->setShortcut(cylinderAction, QList()); cylinderShortcut = KGlobalAccel::self()->shortcut(cylinderAction); - QAction* sphereAction = actionCollection->addAction(QStringLiteral("Sphere")); + QAction* sphereAction = new QAction(this); + sphereAction->setObjectName(QStringLiteral("Sphere")); sphereAction->setText(i18n("Desktop Sphere")); KGlobalAccel::self()->setShortcut(sphereAction, QList()); sphereShortcut = KGlobalAccel::self()->shortcut(sphereAction); diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 5d54496eb2..6455c3866b 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -30,7 +30,6 @@ along with this program. If not, see . #include #include -#include #include #include #include @@ -67,8 +66,8 @@ DesktopGridEffect::DesktopGridEffect() , m_proxy(0) { // Load shortcuts - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a = actionCollection->addAction(QStringLiteral("ShowDesktopGrid")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("ShowDesktopGrid")); a->setText(i18n("Show Desktop Grid")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::CTRL + Qt::Key_F8); KGlobalAccel::self()->setShortcut(a, QList() << Qt::CTRL + Qt::Key_F8); diff --git a/effects/flipswitch/flipswitch.cpp b/effects/flipswitch/flipswitch.cpp index 337e6e0fd9..008fd55599 100644 --- a/effects/flipswitch/flipswitch.cpp +++ b/effects/flipswitch/flipswitch.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include #include -#include #include #include @@ -57,13 +56,14 @@ FlipSwitchEffect::FlipSwitchEffect() m_captionFont.setBold(true); m_captionFont.setPointSize(m_captionFont.pointSize() * 2); - KActionCollection* actionCollection = new KActionCollection(this); - QAction* flipSwitchCurrentAction = actionCollection->addAction(QStringLiteral("FlipSwitchCurrent")); + QAction* flipSwitchCurrentAction = new QAction(this); + flipSwitchCurrentAction->setObjectName(QStringLiteral("FlipSwitchCurrent")); flipSwitchCurrentAction->setText(i18n("Toggle Flip Switch (Current desktop)")); KGlobalAccel::self()->setShortcut(flipSwitchCurrentAction, QList()); m_shortcutCurrent = KGlobalAccel::self()->shortcut(flipSwitchCurrentAction); connect(flipSwitchCurrentAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveCurrent())); - QAction* flipSwitchAllAction = actionCollection->addAction(QStringLiteral("FlipSwitchAll")); + QAction* flipSwitchAllAction = new QAction(this); + flipSwitchAllAction->setObjectName(QStringLiteral("FlipSwitchAll")); flipSwitchAllAction->setText(i18n("Toggle Flip Switch (All desktops)")); KGlobalAccel::self()->setShortcut(flipSwitchAllAction, QList()); m_shortcutAll = KGlobalAccel::self()->shortcut(flipSwitchAllAction); diff --git a/effects/invert/invert.cpp b/effects/invert/invert.cpp index 85b918c54f..03ce15d8af 100644 --- a/effects/invert/invert.cpp +++ b/effects/invert/invert.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -43,15 +42,15 @@ InvertEffect::InvertEffect() m_shader(NULL), m_allWindows(false) { - KActionCollection* actionCollection = new KActionCollection(this); - - QAction* a = actionCollection->addAction(QStringLiteral("Invert")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("Invert")); a->setText(i18n("Toggle Invert Effect")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::CTRL + Qt::META + Qt::Key_I); KGlobalAccel::self()->setShortcut(a, QList() << Qt::CTRL + Qt::META + Qt::Key_I); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleScreenInversion())); - QAction* b = actionCollection->addAction(QStringLiteral("InvertWindow")); + QAction* b = new QAction(this); + b->setObjectName(QStringLiteral("InvertWindow")); b->setText(i18n("Toggle Invert Effect on Window")); KGlobalAccel::self()->setDefaultShortcut(b, QList() << Qt::CTRL + Qt::META + Qt::Key_U); KGlobalAccel::self()->setShortcut(b, QList() << Qt::CTRL + Qt::META + Qt::Key_U); diff --git a/effects/lookingglass/lookingglass.cpp b/effects/lookingglass/lookingglass.cpp index 28a578d848..31edd1dbf0 100644 --- a/effects/lookingglass/lookingglass.cpp +++ b/effects/lookingglass/lookingglass.cpp @@ -28,7 +28,7 @@ along with this program. If not, see . #include #include -#include +#include #include #include #include @@ -53,20 +53,16 @@ LookingGlassEffect::LookingGlassEffect() , m_enabled(false) , m_valid(false) { - actionCollection = new KActionCollection(this); - actionCollection->setConfigGlobal(true); - actionCollection->setConfigGroup(QStringLiteral("LookingGlass")); - QAction* a; - a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())); + a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Equal); - a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())); + a = KStandardAction::zoomOut(this, SLOT(zoomOut()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Minus); - a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())); + a = KStandardAction::actualSize(this, SLOT(toggle()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_0); @@ -94,7 +90,6 @@ void LookingGlassEffect::reconfigure(ReconfigureFlags) initialradius = LookingGlassConfig::radius(); radius = initialradius; qCDebug(KWINEFFECTS) << QStringLiteral("Radius from config: %1").arg(radius) << endl; - actionCollection->readSettings(); m_valid = loadData(); } diff --git a/effects/lookingglass/lookingglass.h b/effects/lookingglass/lookingglass.h index 268a4ecd42..c4ab008faf 100644 --- a/effects/lookingglass/lookingglass.h +++ b/effects/lookingglass/lookingglass.h @@ -24,8 +24,6 @@ along with this program. If not, see . #include -class KActionCollection; - namespace KWin { @@ -72,7 +70,6 @@ private: bool polling; // Mouse polling int radius; int initialradius; - KActionCollection* actionCollection; GLTexture *m_texture; GLRenderTarget *m_fbo; GLVertexBuffer *m_vbo; diff --git a/effects/magnifier/magnifier.cpp b/effects/magnifier/magnifier.cpp index 27ce582583..1159134487 100644 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -26,8 +26,6 @@ along with this program. If not, see . #include #include - -#include #include #include @@ -55,17 +53,16 @@ MagnifierEffect::MagnifierEffect() , m_pixmap(XCB_PIXMAP_NONE) #endif { - KActionCollection* actionCollection = new KActionCollection(this); QAction* a; - a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())); + a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Equal); - a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())); + a = KStandardAction::zoomOut(this, SLOT(zoomOut()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Minus); - a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle())); + a = KStandardAction::actualSize(this, SLOT(toggle()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_0); diff --git a/effects/mouseclick/mouseclick.cpp b/effects/mouseclick/mouseclick.cpp index f2d34bda33..a888045c1a 100644 --- a/effects/mouseclick/mouseclick.cpp +++ b/effects/mouseclick/mouseclick.cpp @@ -31,7 +31,6 @@ along with this program. If not, see . #include #endif -#include #include #include @@ -46,8 +45,8 @@ MouseClickEffect::MouseClickEffect() { m_enabled = false; - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a = actionCollection->addAction(QStringLiteral("ToggleMouseClick")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("ToggleMouseClick")); a->setText(i18n("Toggle Effect")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Asterisk); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Asterisk); diff --git a/effects/mousemark/mousemark.cpp b/effects/mousemark/mousemark.cpp index 1276a43a6e..ece310ff32 100644 --- a/effects/mousemark/mousemark.cpp +++ b/effects/mousemark/mousemark.cpp @@ -27,7 +27,6 @@ along with this program. If not, see . #include #include #include -#include #include #include @@ -46,13 +45,14 @@ KWIN_EFFECT(mousemark, MouseMarkEffect) MouseMarkEffect::MouseMarkEffect() { - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a = actionCollection->addAction(QStringLiteral("ClearMouseMarks")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("ClearMouseMarks")); a->setText(i18n("Clear All Mouse Marks")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::SHIFT + Qt::META + Qt::Key_F11); KGlobalAccel::self()->setShortcut(a, QList() << Qt::SHIFT + Qt::META + Qt::Key_F11); connect(a, SIGNAL(triggered(bool)), this, SLOT(clear())); - a = actionCollection->addAction(QStringLiteral("ClearLastMouseMark")); + a = new QAction(this); + a->setObjectName(QStringLiteral("ClearLastMouseMark")); a->setText(i18n("Clear Last Mouse Mark")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::SHIFT + Qt::META + Qt::Key_F12); KGlobalAccel::self()->setShortcut(a, QList() << Qt::SHIFT + Qt::META + Qt::Key_F12); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 9626504728..7da72cc9f6 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -23,7 +23,6 @@ along with this program. If not, see . //KConfigSkeleton #include "presentwindowsconfig.h" #include -#include #include #include #include @@ -74,20 +73,22 @@ PresentWindowsEffect::PresentWindowsEffect() m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this); m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this); - KActionCollection* actionCollection = new KActionCollection(this); - QAction* exposeAction = actionCollection->addAction(QStringLiteral("Expose")); + QAction* exposeAction = new QAction(this); + exposeAction->setObjectName(QStringLiteral("Expose")); exposeAction->setText(i18n("Toggle Present Windows (Current desktop)")); KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList() << Qt::CTRL + Qt::Key_F9); KGlobalAccel::self()->setShortcut(exposeAction, QList() << Qt::CTRL + Qt::Key_F9); shortcut = KGlobalAccel::self()->shortcut(exposeAction); connect(exposeAction, SIGNAL(triggered(bool)), this, SLOT(toggleActive())); - QAction* exposeAllAction = actionCollection->addAction(QStringLiteral("ExposeAll")); + QAction* exposeAllAction = new QAction(this); + exposeAllAction->setObjectName(QStringLiteral("ExposeAll")); exposeAllAction->setText(i18n("Toggle Present Windows (All desktops)")); KGlobalAccel::self()->setDefaultShortcut(exposeAllAction, QList() << Qt::CTRL + Qt::Key_F10); KGlobalAccel::self()->setShortcut(exposeAllAction, QList() << Qt::CTRL + Qt::Key_F10); shortcutAll = KGlobalAccel::self()->shortcut(exposeAllAction); connect(exposeAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops())); - QAction* exposeClassAction = actionCollection->addAction(QStringLiteral("ExposeClass")); + QAction* exposeClassAction = new QAction(this); + exposeClassAction->setObjectName(QStringLiteral("ExposeClass")); exposeClassAction->setText(i18n("Toggle Present Windows (Window class)")); KGlobalAccel::self()->setDefaultShortcut(exposeClassAction, QList() << Qt::CTRL + Qt::Key_F7); KGlobalAccel::self()->setShortcut(exposeClassAction, QList() << Qt::CTRL + Qt::Key_F7); diff --git a/effects/thumbnailaside/thumbnailaside.cpp b/effects/thumbnailaside/thumbnailaside.cpp index 895f29795b..6a753a4f13 100644 --- a/effects/thumbnailaside/thumbnailaside.cpp +++ b/effects/thumbnailaside/thumbnailaside.cpp @@ -24,7 +24,6 @@ along with this program. If not, see . #include "thumbnailasideconfig.h" #include -#include #include #include @@ -35,8 +34,8 @@ KWIN_EFFECT(thumbnailaside, ThumbnailAsideEffect) ThumbnailAsideEffect::ThumbnailAsideEffect() { - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a = actionCollection->addAction(QStringLiteral("ToggleCurrentThumbnail")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("ToggleCurrentThumbnail")); a->setText(i18n("Toggle Thumbnail for Current Window")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_T); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::CTRL + Qt::Key_T); diff --git a/effects/trackmouse/trackmouse.cpp b/effects/trackmouse/trackmouse.cpp index 294a402e20..1c86912592 100644 --- a/effects/trackmouse/trackmouse.cpp +++ b/effects/trackmouse/trackmouse.cpp @@ -32,7 +32,6 @@ along with this program. If not, see . #include #include -#include #include #include @@ -57,8 +56,8 @@ TrackMouseEffect::TrackMouseEffect() m_angleBase = 90.0; m_mousePolling = false; - KActionCollection *actionCollection = new KActionCollection(this); - m_action = actionCollection->addAction(QStringLiteral("TrackMouse")); + m_action = new QAction(this); + m_action->setObjectName(QStringLiteral("TrackMouse")); m_action->setText(i18n("Track mouse")); KGlobalAccel::self()->setDefaultShortcut(m_action, QList()); KGlobalAccel::self()->setShortcut(m_action, QList()); diff --git a/effects/windowgeometry/windowgeometry.cpp b/effects/windowgeometry/windowgeometry.cpp index 604fca3190..3c20bb26b0 100644 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include #include #include -#include #include #include @@ -60,8 +59,8 @@ WindowGeometry::WindowGeometry() myMeasure[1]->setAlignment(Qt::AlignCenter); myMeasure[2]->setAlignment(Qt::AlignRight | Qt::AlignBottom); - KActionCollection* actionCollection = new KActionCollection(this); - QAction* a = actionCollection->addAction(QStringLiteral("WindowGeometry")); + QAction* a = new QAction(this); + a->setObjectName(QStringLiteral("WindowGeometry")); a->setText(i18n("Toggle window geometry display (effect only)")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::CTRL + Qt::SHIFT + Qt::Key_F11); diff --git a/effects/zoom/zoom.cpp b/effects/zoom/zoom.cpp index c5932fe5eb..97848aee18 100644 --- a/effects/zoom/zoom.cpp +++ b/effects/zoom/zoom.cpp @@ -28,7 +28,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -66,52 +65,57 @@ ZoomEffect::ZoomEffect() , yMove(0) , moveFactor(20.0) { - KActionCollection* actionCollection = new KActionCollection(this); QAction* a = 0; - a = actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn())); + a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Equal); - a = actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut())); + a = KStandardAction::zoomOut(this, SLOT(zoomOut()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Minus); - a = actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize())); + a = KStandardAction::actualSize(this, SLOT(actualSize()), this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_0); - a = actionCollection->addAction(QStringLiteral("MoveZoomLeft")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveZoomLeft")); a->setText(i18n("Move Zoomed Area to Left")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Left); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Left); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft())); - a = actionCollection->addAction(QStringLiteral("MoveZoomRight")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveZoomRight")); a->setText(i18n("Move Zoomed Area to Right")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Right); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Right); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight())); - a = actionCollection->addAction(QStringLiteral("MoveZoomUp")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveZoomUp")); a->setText(i18n("Move Zoomed Area Upwards")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Up); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Up); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp())); - a = actionCollection->addAction(QStringLiteral("MoveZoomDown")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveZoomDown")); a->setText(i18n("Move Zoomed Area Downwards")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Down); KGlobalAccel::self()->setShortcut(a, QList() << 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 = actionCollection->addAction(QStringLiteral("MoveMouseToFocus")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveMouseToFocus")); a->setText(i18n("Move Mouse to Focus")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_F5); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_F5); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToFocus())); - a = actionCollection->addAction(QStringLiteral("MoveMouseToCenter")); + a = new QAction(this); + a->setObjectName(QStringLiteral("MoveMouseToCenter")); a->setText(i18n("Move Mouse to Center")); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_F6); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_F6);