diff --git a/effects/coverswitch_config.cpp b/effects/coverswitch_config.cpp index b9cfb602dd..1af5824602 100644 --- a/effects/coverswitch_config.cpp +++ b/effects/coverswitch_config.cpp @@ -53,10 +53,6 @@ CoverSwitchEffectConfig::CoverSwitchEffectConfig(QWidget* parent, const QVariant load(); } -CoverSwitchEffectConfig::~CoverSwitchEffectConfig() - { - } - void CoverSwitchEffectConfig::load() { KCModule::load(); diff --git a/effects/coverswitch_config.h b/effects/coverswitch_config.h index a1d5895072..a120889d74 100644 --- a/effects/coverswitch_config.h +++ b/effects/coverswitch_config.h @@ -41,7 +41,6 @@ class CoverSwitchEffectConfig : public KCModule Q_OBJECT public: explicit CoverSwitchEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); - ~CoverSwitchEffectConfig(); public slots: virtual void save(); diff --git a/effects/desktopgrid_config.cpp b/effects/desktopgrid_config.cpp index 19c4b48a6a..53b4c2c3f9 100644 --- a/effects/desktopgrid_config.cpp +++ b/effects/desktopgrid_config.cpp @@ -71,16 +71,16 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant comboLayout->addWidget(mActivateCombo); layout->addLayout(comboLayout); - KGlobalAccel::self()->overrideMainComponentData(componentData()); - KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") ); + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* show = static_cast(actionCollection->addAction( "ShowDesktopGrid" )); show->setText( i18n("Show Desktop Grid" )); show->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::Key_F8 )); + show->setProperty("isConfigurationAction", true); - KShortcutsEditor* shortcutEditor = new KShortcutsEditor(actionCollection, this, + mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); - connect(shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed())); - layout->addWidget(shortcutEditor); + connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed())); + layout->addWidget(mShortcutEditor); layout->addStretch(); @@ -89,12 +89,14 @@ DesktopGridEffectConfig::DesktopGridEffectConfig(QWidget* parent, const QVariant DesktopGridEffectConfig::~DesktopGridEffectConfig() { - kDebug() ; + kDebug(); + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void DesktopGridEffectConfig::load() { - kDebug() ; + kDebug(); KCModule::load(); KConfigGroup conf = EffectsHandler::effectConfig("DesktopGrid"); @@ -122,6 +124,8 @@ void DesktopGridEffectConfig::save() conf.writeEntry("BorderActivate", activateBorder); conf.sync(); + mShortcutEditor->save(); // undo() will restore to this state from now on + emit changed(false); EffectsHandler::sendReloadMessage( "desktopgrid" ); } diff --git a/effects/desktopgrid_config.h b/effects/desktopgrid_config.h index 5267f822cf..6c91021ffe 100644 --- a/effects/desktopgrid_config.h +++ b/effects/desktopgrid_config.h @@ -25,6 +25,7 @@ along with this program. If not, see . class QComboBox; class QCheckBox; +class KShortcutsEditor; namespace KWin { @@ -44,6 +45,7 @@ class DesktopGridEffectConfig : public KCModule private: QCheckBox* mSlide; QComboBox* mActivateCombo; + KShortcutsEditor *mShortcutEditor; }; } // namespace diff --git a/effects/invert_config.cpp b/effects/invert_config.cpp index 67af7fef2a..0f972e7bc3 100644 --- a/effects/invert_config.cpp +++ b/effects/invert_config.cpp @@ -39,14 +39,14 @@ namespace KWin InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - KGlobalAccel::self()->overrideMainComponentData(componentData()); - kDebug() ; + kDebug(); QVBoxLayout* layout = new QVBoxLayout(this); - KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") ); + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* a = static_cast(actionCollection->addAction( "Invert" )); a->setText( i18n("Toggle Invert Effect" )); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_I)); + a->setProperty("isConfigurationAction", true); mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); @@ -60,7 +60,9 @@ InvertEffectConfig::InvertEffectConfig(QWidget* parent, const QVariantList& args InvertEffectConfig::~InvertEffectConfig() { - kDebug() ; + kDebug(); + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void InvertEffectConfig::load() @@ -76,6 +78,8 @@ void InvertEffectConfig::save() kDebug() ; KCModule::save(); + mShortcutEditor->save(); // undo() will restore to this state from now on + emit changed(false); EffectsHandler::sendReloadMessage( "invert" ); } diff --git a/effects/lookingglass_config.cpp b/effects/lookingglass_config.cpp index da5cfc5182..d52d1ac435 100644 --- a/effects/lookingglass_config.cpp +++ b/effects/lookingglass_config.cpp @@ -60,7 +60,6 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria connect(m_ui->radiusSpin, SIGNAL(valueChanged(int)), this, SLOT(changed())); // Shortcut config - KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); m_actionCollection->setConfigGroup("LookingGlass"); m_actionCollection->setConfigGlobal(true); @@ -68,19 +67,30 @@ LookingGlassEffectConfig::LookingGlassEffectConfig(QWidget* parent, const QVaria KAction* a; a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomIn)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomOut)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ActualSize)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setProperty("isConfigurationAction", true); - //m_ui->editor->addCollection(m_actionCollection); + m_ui->editor->addCollection(m_actionCollection); load(); } +LookingGlassEffectConfig::~LookingGlassEffectConfig() + { + // Undo (only) unsaved changes to global key shortcuts + m_ui->editor->undoChanges(); + } + void LookingGlassEffectConfig::load() { - kDebug() ; + kDebug(); KCModule::load(); KConfigGroup conf = EffectsHandler::effectConfig("LookingGlass"); @@ -106,6 +116,7 @@ void LookingGlassEffectConfig::save() conf.writeEntry("Radius", m_ui->radiusSpin->value()); m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on conf.sync(); diff --git a/effects/lookingglass_config.h b/effects/lookingglass_config.h index dacc7a450d..d3bd07a6d3 100644 --- a/effects/lookingglass_config.h +++ b/effects/lookingglass_config.h @@ -42,6 +42,7 @@ class LookingGlassEffectConfig : public KCModule Q_OBJECT public: explicit LookingGlassEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + virtual ~LookingGlassEffectConfig(); virtual void save(); virtual void load(); diff --git a/effects/magnifier_config.cpp b/effects/magnifier_config.cpp index 40150ce638..5939415506 100644 --- a/effects/magnifier_config.cpp +++ b/effects/magnifier_config.cpp @@ -60,7 +60,6 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed())); // Shortcut config - KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); m_actionCollection->setConfigGroup("Magnifier"); m_actionCollection->setConfigGlobal(true); @@ -68,14 +67,25 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList KAction* a; a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomIn)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ZoomOut)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( m_actionCollection->addAction( KStandardAction::ActualSize)); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setProperty("isConfigurationAction", true); load(); } +MagnifierEffectConfig::~MagnifierEffectConfig() + { + // Undo (only) unsaved changes to global key shortcuts + m_ui->editor->undoChanges(); + } + void MagnifierEffectConfig::load() { kDebug() ; @@ -105,6 +115,7 @@ void MagnifierEffectConfig::save() conf.writeEntry("Height", m_ui->spinHeight->value()); m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on conf.sync(); diff --git a/effects/magnifier_config.h b/effects/magnifier_config.h index 2ab11ee83c..908c55585f 100644 --- a/effects/magnifier_config.h +++ b/effects/magnifier_config.h @@ -42,6 +42,7 @@ class MagnifierEffectConfig : public KCModule Q_OBJECT public: explicit MagnifierEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + virtual ~MagnifierEffectConfig(); virtual void save(); virtual void load(); diff --git a/effects/mousemark_config.cpp b/effects/mousemark_config.cpp index 58ea7d26b4..ae5bab8bcf 100644 --- a/effects/mousemark_config.cpp +++ b/effects/mousemark_config.cpp @@ -61,20 +61,29 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList connect(m_ui->comboColors, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); // Shortcut config - KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); KAction* a = static_cast< KAction* >( m_actionCollection->addAction( "ClearMouseMarks" )); a->setText( i18n( "Clear Mouse Marks" )); a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F11 )); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( m_actionCollection->addAction( "ClearLastMouseMark" )); a->setText( i18n( "Clear Last Mouse Mark" )); a->setGlobalShortcut( KShortcut( Qt::SHIFT + Qt::META + Qt::Key_F12 )); + a->setProperty("isConfigurationAction", true); + m_ui->editor->addCollection(m_actionCollection); load(); } +MouseMarkEffectConfig::~MouseMarkEffectConfig() + { + // Undo (only) unsaved changes to global key shortcuts + m_ui->editor->undoChanges(); + } + void MouseMarkEffectConfig::load() { kDebug() ; @@ -100,6 +109,9 @@ void MouseMarkEffectConfig::save() conf.writeEntry("LineWidth", m_ui->spinWidth->value()); conf.writeEntry("Color", m_ui->comboColors->color()); + m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on + conf.sync(); emit changed(false); diff --git a/effects/mousemark_config.h b/effects/mousemark_config.h index ea610a47d3..e54cf357fa 100644 --- a/effects/mousemark_config.h +++ b/effects/mousemark_config.h @@ -41,7 +41,8 @@ class MouseMarkEffectConfig : public KCModule { Q_OBJECT public: - explicit MouseMarkEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit MouseMarkEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + virtual ~MouseMarkEffectConfig(); virtual void save(); virtual void load(); diff --git a/effects/presentwindows_config.cpp b/effects/presentwindows_config.cpp index 537841cc79..daef07a9f4 100644 --- a/effects/presentwindows_config.cpp +++ b/effects/presentwindows_config.cpp @@ -44,7 +44,7 @@ namespace KWin PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - kDebug() ; + kDebug(); QGridLayout* layout = new QGridLayout(this); @@ -71,14 +71,17 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding), 4, 0, 1, 3); // Shortcut config - KGlobalAccel::self()->overrideMainComponentData(componentData()); - KActionCollection* actionCollection = new KActionCollection( this ); + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* a = (KAction*)actionCollection->addAction( "Expose" ); a->setText( i18n("Toggle Expose Effect" )); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9)); + a->setProperty("isConfigurationAction", true); + KAction* b = (KAction*)actionCollection->addAction( "ExposeAll" ); b->setText( i18n("Toggle Expose Effect (incl. other desktops)" )); b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10)); + b->setProperty("isConfigurationAction", true); + mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); connect(mShortcutEditor, SIGNAL(keyChange()), this, SLOT(changed())); @@ -86,13 +89,14 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding), 6, 0, 1, 3); - load(); } PresentWindowsEffectConfig::~PresentWindowsEffectConfig() { - kDebug() ; + kDebug(); + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void PresentWindowsEffectConfig::addItems(QComboBox* combo) @@ -152,6 +156,8 @@ void PresentWindowsEffectConfig::save() conf.sync(); + mShortcutEditor->save(); // undo() will restore to this state from now on + emit changed(false); EffectsHandler::sendReloadMessage( "presentwindows" ); } diff --git a/effects/sharpen_config.cpp b/effects/sharpen_config.cpp index 01bac42cbf..b638994f09 100644 --- a/effects/sharpen_config.cpp +++ b/effects/sharpen_config.cpp @@ -39,14 +39,14 @@ namespace KWin SharpenEffectConfig::SharpenEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - KGlobalAccel::self()->overrideMainComponentData(componentData()); - kDebug() ; + kDebug(); QVBoxLayout* layout = new QVBoxLayout(this); - KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") ); + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* a = static_cast(actionCollection->addAction( "Sharpen" )); a->setText( i18n("Toggle Sharpen Effect" )); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_S)); + a->setProperty("isConfigurationAction", true); mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); @@ -60,12 +60,14 @@ SharpenEffectConfig::SharpenEffectConfig(QWidget* parent, const QVariantList& ar SharpenEffectConfig::~SharpenEffectConfig() { - kDebug() ; + kDebug(); + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void SharpenEffectConfig::load() { - kDebug() ; + kDebug(); KCModule::load(); emit changed(false); @@ -76,6 +78,8 @@ void SharpenEffectConfig::save() kDebug() ; KCModule::save(); + mShortcutEditor->save(); // undo() will restore to this state from now on + emit changed(false); EffectsHandler::sendReloadMessage( "sharpen" ); } diff --git a/effects/snow_config.cpp b/effects/snow_config.cpp index 5ceced187d..bc00a2f564 100644 --- a/effects/snow_config.cpp +++ b/effects/snow_config.cpp @@ -56,7 +56,6 @@ SnowEffectConfig::SnowEffectConfig(QWidget* parent, const QVariantList& args) : connect(m_ui->minSizeFlake, SIGNAL(valueChanged(int)), this, SLOT(changed())); connect(m_ui->maxSizeFlake, SIGNAL(valueChanged(int)), this, SLOT(changed())); - KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); m_actionCollection->setConfigGroup("Snow"); m_actionCollection->setConfigGlobal(true); @@ -64,12 +63,15 @@ SnowEffectConfig::SnowEffectConfig(QWidget* parent, const QVariantList& args) : KAction* a = (KAction*)m_actionCollection->addAction( "Snow" ); a->setText( i18n("Toggle Snow on Desktop" )); a->setGlobalShortcut( KShortcut( Qt::CTRL + Qt::META + Qt::Key_F12 )); + a->setProperty("isConfigurationAction", true); load(); } SnowEffectConfig::~SnowEffectConfig() { + // Undo (only) unsaved changes to global key shortcuts + m_ui->editor->undoChanges(); kDebug() ; } @@ -103,6 +105,7 @@ void SnowEffectConfig::save() conf.writeEntry("MaxFlakes", m_ui->maxSizeFlake->value()); m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on conf.sync(); diff --git a/effects/thumbnailaside_config.cpp b/effects/thumbnailaside_config.cpp index 8bc36c9d36..3c69c58127 100644 --- a/effects/thumbnailaside_config.cpp +++ b/effects/thumbnailaside_config.cpp @@ -62,7 +62,6 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV connect(m_ui->spinOpacity, SIGNAL(valueChanged(int)), this, SLOT(changed())); // Shortcut config - KGlobalAccel::self()->overrideMainComponentData(componentData()); m_actionCollection = new KActionCollection( this, componentData() ); m_actionCollection->setConfigGroup("ThumbnailAside"); m_actionCollection->setConfigGlobal(true); @@ -70,10 +69,18 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV KAction* a = (KAction*)m_actionCollection->addAction( "ToggleCurrentThumbnail" ); a->setText( i18n("Toggle Thumbnail for Current Window" )); a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T)); + a->setProperty("isConfigurationAction", true); load(); } +ThumbnailAsideEffectConfig::~ThumbnailAsideEffectConfig() + { + // Undo (only) unsaved changes to global key shortcuts + m_ui->editor->undoChanges(); + kDebug() ; + } + void ThumbnailAsideEffectConfig::load() { kDebug() ; @@ -106,6 +113,7 @@ void ThumbnailAsideEffectConfig::save() conf.writeEntry("Opacity", m_ui->spinOpacity->value()); m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on conf.sync(); diff --git a/effects/thumbnailaside_config.h b/effects/thumbnailaside_config.h index e5f129fd0b..e4eb5651d0 100644 --- a/effects/thumbnailaside_config.h +++ b/effects/thumbnailaside_config.h @@ -41,7 +41,8 @@ class ThumbnailAsideEffectConfig : public KCModule { Q_OBJECT public: - explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList()); + virtual ~ThumbnailAsideEffectConfig(); virtual void save(); virtual void load(); diff --git a/effects/trackmouse_config.cpp b/effects/trackmouse_config.cpp index b6d4cabca6..52907f6607 100644 --- a/effects/trackmouse_config.cpp +++ b/effects/trackmouse_config.cpp @@ -40,7 +40,6 @@ namespace KWin TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - KGlobalAccel::self()->overrideMainComponentData(componentData()); kDebug() ; QVBoxLayout* layout = new QVBoxLayout(this); diff --git a/effects/videorecord_config.cpp b/effects/videorecord_config.cpp index 666967de6c..b54200cb9c 100644 --- a/effects/videorecord_config.cpp +++ b/effects/videorecord_config.cpp @@ -49,8 +49,7 @@ namespace KWin VideoRecordEffectConfig::VideoRecordEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - KGlobalAccel::self()->overrideMainComponentData(componentData()); - kDebug() ; + kDebug(); QVBoxLayout* layout = new QVBoxLayout(this); QHBoxLayout* hlayout = new QHBoxLayout( this ); @@ -60,10 +59,12 @@ VideoRecordEffectConfig::VideoRecordEffectConfig(QWidget* parent, const QVariant saveVideo->setMode( KFile::Directory | KFile::LocalOnly ); hlayout->addWidget( saveVideo ); layout->addLayout( hlayout ); - KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") ); + + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* a = static_cast(actionCollection->addAction( "VideoRecord" )); a->setText( i18n("Toggle Video Recording" )); a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_V)); + a->setProperty("isConfigurationAction", true); mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); @@ -77,7 +78,9 @@ VideoRecordEffectConfig::VideoRecordEffectConfig(QWidget* parent, const QVariant VideoRecordEffectConfig::~VideoRecordEffectConfig() { - kDebug() ; + kDebug(); + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void VideoRecordEffectConfig::load() @@ -98,6 +101,9 @@ void VideoRecordEffectConfig::save() KConfigGroup conf = EffectsHandler::effectConfig("VideoRecord"); conf.writeEntry("videopath", saveVideo->url().path()); + + m_actionCollection->writeSettings(); + m_ui->editor->save(); // undo() will restore to this state from now on conf.sync(); diff --git a/effects/zoom_config.cpp b/effects/zoom_config.cpp index 31e720dd58..30896b3457 100644 --- a/effects/zoom_config.cpp +++ b/effects/zoom_config.cpp @@ -39,18 +39,22 @@ namespace KWin ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) : KCModule(EffectFactory::componentData(), parent, args) { - KGlobalAccel::self()->overrideMainComponentData(componentData()); - kDebug() ; + kDebug(); QVBoxLayout* layout = new QVBoxLayout(this); - KActionCollection* actionCollection = new KActionCollection( this, KComponentData("kwin") ); + KActionCollection* actionCollection = new KActionCollection( this, componentData() ); KAction* a; a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomIn )); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ZoomOut )); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setProperty("isConfigurationAction", true); + a = static_cast< KAction* >( actionCollection->addAction( KStandardAction::ActualSize )); a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setProperty("isConfigurationAction", true); mShortcutEditor = new KShortcutsEditor(actionCollection, this, KShortcutsEditor::GlobalAction, KShortcutsEditor::LetterShortcutsDisallowed); @@ -65,6 +69,8 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) : ZoomEffectConfig::~ZoomEffectConfig() { kDebug() ; + // Undo (only) unsaved changes to global key shortcuts + mShortcutEditor->undoChanges(); } void ZoomEffectConfig::load() @@ -80,6 +86,8 @@ void ZoomEffectConfig::save() kDebug() ; KCModule::save(); + mShortcutEditor->save(); // undo() will restore to this state from now on + emit changed(false); EffectsHandler::sendReloadMessage( "zoom" ); }