Disable global shortcut handling in all effects

KAction and KShortcut needs porting, so disabled for now.
This commit is contained in:
Martin Gräßlin 2013-07-24 07:52:29 +02:00
parent 2144f547d0
commit ba7d50fdc5
22 changed files with 81 additions and 0 deletions

View file

@ -54,6 +54,8 @@ 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"));
@ -74,6 +76,7 @@ CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
sphereAction->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
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

@ -51,6 +51,8 @@ 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"));
@ -63,6 +65,7 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant
a->setGlobalShortcut(KShortcut(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

@ -49,6 +49,8 @@ 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"));
@ -62,6 +64,7 @@ FlipSwitchEffectConfig::FlipSwitchEffectConfig(QWidget* parent, const QVariantLi
m_actionCollection->setConfigGlobal(true);
m_ui->shortcutEditor->addCollection(m_actionCollection);
#endif
addConfig(FlipSwitchConfig::self(), m_ui);

View file

@ -44,6 +44,8 @@ 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"));
@ -55,6 +57,7 @@ InvertEffect::InvertEffect()
b->setText(i18n("Toggle Invert Effect on Window"));
b->setGlobalShortcut(KShortcut(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

@ -41,6 +41,8 @@ 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"));
@ -58,14 +60,18 @@ InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args
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()
@ -79,7 +85,10 @@ 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"));
@ -87,7 +96,10 @@ void InvertEffectConfig::save()
void InvertEffectConfig::defaults()
{
#warning Global Shortcuts need porting
#if KWIN_QT5_PORTING
mShortcutEditor->allDefault();
#endif
emit changed(true);
}

View file

@ -59,6 +59,8 @@ 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));
@ -66,6 +68,7 @@ LookingGlassEffect::LookingGlassEffect()
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
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

@ -58,6 +58,8 @@ 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"));
@ -78,6 +80,7 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
m_ui->editor->addCollection(m_actionCollection);
#endif
}
LookingGlassEffectConfig::~LookingGlassEffectConfig()

View file

@ -54,6 +54,8 @@ 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())));
@ -62,6 +64,7 @@ MagnifierEffect::MagnifierEffect()
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
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

@ -58,6 +58,8 @@ 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"));
@ -78,6 +80,7 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0));
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View file

@ -44,11 +44,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")));
a->setText(i18n("Toggle Effect"));
a->setGlobalShortcut(KShortcut(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

@ -51,6 +51,8 @@ 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"));
@ -60,6 +62,7 @@ MouseClickEffectConfig::MouseClickEffectConfig(QWidget* parent, const QVariantLi
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Asterisk));
m_ui->editor->addCollection(m_actionCollection);
#endif
addConfig(MouseClickConfig::self(), m_ui);
load();

View file

@ -48,6 +48,8 @@ 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")));
a->setText(i18n("Clear All Mouse Marks"));
@ -57,6 +59,7 @@ MouseMarkEffect::MouseMarkEffect()
a->setText(i18n("Clear Last Mouse Mark"));
a->setGlobalShortcut(KShortcut(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

@ -57,6 +57,8 @@ 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"));
@ -71,6 +73,7 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12));
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View file

@ -50,6 +50,8 @@ 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"));
@ -72,6 +74,7 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7));
m_ui->shortcutEditor->addCollection(m_actionCollection);
#endif
connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));

View file

@ -34,11 +34,14 @@ 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"));
a->setText(i18n("Toggle Thumbnail for Current Window"));
a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + 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

@ -58,6 +58,8 @@ 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"));
@ -70,6 +72,7 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T));
m_ui->editor->addCollection(m_actionCollection);
#endif
load();
}

View file

@ -60,12 +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->setText(i18n("Track mouse"));
m_action->setGlobalShortcut(KShortcut());
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

@ -56,6 +56,8 @@ 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->setConfigGroup(QStringLiteral("TrackMouse"));
m_actionCollection->setConfigGlobal(true);
@ -64,6 +66,7 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
a->setText(i18n("Track mouse"));
a->setProperty("isConfigurationAction", true);
a->setGlobalShortcut(KShortcut());
#endif
connect(m_ui->shortcut, SIGNAL(keySequenceChanged(QKeySequence)),
SLOT(shortcutChanged(QKeySequence)));
@ -85,8 +88,11 @@ 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);
@ -108,8 +114,11 @@ 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
// m_actionCollection->writeSettings();
emit changed(true);
}

View file

@ -60,11 +60,14 @@ 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")));
a->setText(i18n("Toggle window geometry display (effect only)"));
a->setGlobalShortcut(KShortcut(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

@ -44,6 +44,8 @@ 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"));
@ -52,6 +54,7 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList&
a->setGlobalShortcut(KShortcut(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

@ -66,6 +66,8 @@ 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())));
@ -105,6 +107,7 @@ ZoomEffect::ZoomEffect()
a->setText(i18n("Move Mouse to Center"));
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToCenter()));
#endif
timeline.setDuration(350);
timeline.setFrameRange(0, 100);

View file

@ -54,6 +54,8 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
addConfig(ZoomConfig::self(), m_ui);
#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"));
actionCollection->setConfigGroup(QStringLiteral("Zoom"));
@ -109,6 +111,7 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6));
m_ui->editor->addCollection(actionCollection);
#endif
load();
}