mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
kwin: adjust to shortcut changes
tested it and settings are saved and restored but needs more testing Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
3b8a6bf261
commit
ad52daae2d
18 changed files with 60 additions and 54 deletions
|
@ -60,9 +60,6 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
|
|||
// Shortcut config. The shortcut belongs to the component "kwin"!
|
||||
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
|
||||
m_actionCollection->setConfigGroup("Magnifier");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a;
|
||||
a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn));
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
|
@ -80,6 +77,11 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList
|
|||
load();
|
||||
}
|
||||
|
||||
void MagnifierEffectConfig::load()
|
||||
{
|
||||
m_ui->editor->importConfiguration();
|
||||
}
|
||||
|
||||
void MagnifierEffectConfig::save()
|
||||
{
|
||||
kDebug(1212) << "Saving config of Magnifier" ;
|
||||
|
|
|
@ -43,8 +43,9 @@ class MagnifierEffectConfig : public KCModule
|
|||
public:
|
||||
explicit MagnifierEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
void load() final;
|
||||
void save() final;
|
||||
void defaults() final;
|
||||
|
||||
private:
|
||||
MagnifierEffectConfigForm* m_ui;
|
||||
|
|
|
@ -79,7 +79,6 @@ void MouseMarkEffectConfig::save()
|
|||
kDebug(1212) << "Saving config of MouseMark" ;
|
||||
KCModule::save();
|
||||
|
||||
m_actionCollection->writeSettings();
|
||||
m_ui->editor->exportConfiguration();
|
||||
|
||||
EffectsHandler::sendReloadMessage("mousemark");
|
||||
|
|
|
@ -53,9 +53,6 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
|
|||
// Shortcut config. The shortcut belongs to the component "kwin"!
|
||||
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
|
||||
m_actionCollection->setConfigGroup("PresentWindows");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a = (KAction*) m_actionCollection->addAction("ExposeAll");
|
||||
a->setText(i18n("Toggle Present Windows (All desktops)"));
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
|
@ -76,8 +73,12 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
|
|||
connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
|
||||
|
||||
addConfig(PresentWindowsConfig::self(), m_ui);
|
||||
}
|
||||
|
||||
load();
|
||||
void PresentWindowsEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
m_ui->shortcutEditor->importConfiguration();
|
||||
}
|
||||
|
||||
void PresentWindowsEffectConfig::save()
|
||||
|
|
|
@ -44,8 +44,9 @@ public:
|
|||
explicit PresentWindowsEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
void load() final;
|
||||
void save();
|
||||
void defaults();
|
||||
|
||||
private:
|
||||
PresentWindowsEffectConfigForm* m_ui;
|
||||
|
|
|
@ -60,9 +60,6 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
|
|||
// Shortcut config. The shortcut belongs to the component "kwin"!
|
||||
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
|
||||
m_actionCollection->setConfigGroup("ThumbnailAside");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a = (KAction*)m_actionCollection->addAction("ToggleCurrentThumbnail");
|
||||
a->setText(i18n("Toggle Thumbnail for Current Window"));
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
|
@ -73,6 +70,12 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV
|
|||
load();
|
||||
}
|
||||
|
||||
void ThumbnailAsideEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
m_ui->editor->importConfiguration();
|
||||
}
|
||||
|
||||
void ThumbnailAsideEffectConfig::save()
|
||||
{
|
||||
KCModule::save();
|
||||
|
|
|
@ -43,7 +43,8 @@ class ThumbnailAsideEffectConfig : public KCModule
|
|||
public:
|
||||
explicit ThumbnailAsideEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
|
||||
virtual void save();
|
||||
void load() final;
|
||||
void save() final;
|
||||
|
||||
private:
|
||||
ThumbnailAsideEffectConfigForm* m_ui;
|
||||
|
|
|
@ -56,8 +56,6 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
|
|||
addConfig(TrackMouseConfig::self(), m_ui);
|
||||
|
||||
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
m_actionCollection->setConfigGroup("TrackMouse");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction *a = static_cast< KAction* >(m_actionCollection->addAction("TrackMouse"));
|
||||
a->setText(i18n("Track mouse"));
|
||||
|
@ -69,10 +67,6 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi
|
|||
load();
|
||||
}
|
||||
|
||||
TrackMouseEffectConfig::~TrackMouseEffectConfig()
|
||||
{
|
||||
}
|
||||
|
||||
void TrackMouseEffectConfig::checkModifiers()
|
||||
{
|
||||
const bool modifiers = m_ui->kcfg_Shift->isChecked() || m_ui->kcfg_Alt->isChecked() ||
|
||||
|
@ -84,6 +78,7 @@ void TrackMouseEffectConfig::checkModifiers()
|
|||
void TrackMouseEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
m_actionCollection->readSettings();
|
||||
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("TrackMouse")))
|
||||
m_ui->shortcut->setKeySequence(a->globalShortcut());
|
||||
|
||||
|
@ -94,7 +89,7 @@ void TrackMouseEffectConfig::load()
|
|||
void TrackMouseEffectConfig::save()
|
||||
{
|
||||
KCModule::save();
|
||||
m_actionCollection->writeSettings();
|
||||
m_actionCollection->writeSettings(nullptr, true);
|
||||
EffectsHandler::sendReloadMessage("trackmouse");
|
||||
}
|
||||
|
||||
|
|
|
@ -44,16 +44,18 @@ class TrackMouseEffectConfig : public KCModule
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit TrackMouseEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
~TrackMouseEffectConfig();
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
virtual void defaults();
|
||||
void save() final;
|
||||
void load() final;
|
||||
void defaults() final;
|
||||
|
||||
private slots:
|
||||
void shortcutChanged(const QKeySequence &seq);
|
||||
|
||||
private:
|
||||
void checkModifiers();
|
||||
|
||||
TrackMouseEffectConfigForm* m_ui;
|
||||
KActionCollection* m_actionCollection;
|
||||
};
|
||||
|
|
|
@ -58,8 +58,6 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
|
|||
|
||||
// Shortcut config. The shortcut belongs to the component "kwin"!
|
||||
KActionCollection *actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
actionCollection->setConfigGroup("Zoom");
|
||||
actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a;
|
||||
a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn));
|
||||
|
@ -108,6 +106,12 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
|
|||
load();
|
||||
}
|
||||
|
||||
void ZoomEffectConfig::load()
|
||||
{
|
||||
KCModule::load();
|
||||
m_ui->editor->importConfiguration();
|
||||
}
|
||||
|
||||
void ZoomEffectConfig::save()
|
||||
{
|
||||
m_ui->editor->exportConfiguration();
|
||||
|
|
|
@ -44,7 +44,8 @@ public:
|
|||
explicit ZoomEffectConfig(QWidget* parent = 0, const QVariantList& args = QVariantList());
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
void load() final;
|
||||
void save() final;
|
||||
|
||||
private:
|
||||
ZoomEffectConfigForm* m_ui;
|
||||
|
|
|
@ -145,8 +145,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
|
||||
// toggle effects shortcut button stuff - /HAS/ to happen before load!
|
||||
m_actionCollection = new KActionCollection( this, KComponentData("kwin") );
|
||||
m_actionCollection->setConfigGroup("Suspend Compositing");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
KAction* a = static_cast<KAction*>(m_actionCollection->addAction( "Suspend Compositing" ));
|
||||
a->setProperty("isConfigurationAction", true);
|
||||
|
@ -175,10 +173,6 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
|
|||
ui.desktopSwitchingCombo->addItem(slide);
|
||||
}
|
||||
|
||||
KWinCompositingConfig::~KWinCompositingConfig()
|
||||
{
|
||||
}
|
||||
|
||||
void KWinCompositingConfig::reparseConfiguration(const QByteArray& conf)
|
||||
{
|
||||
KComponentData component(conf);
|
||||
|
@ -229,6 +223,8 @@ void KWinCompositingConfig::loadGeneralTab()
|
|||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
bool enabled = config.readEntry("Enabled", true);
|
||||
ui.useCompositing->setChecked(enabled);
|
||||
|
||||
m_actionCollection->readSettings();
|
||||
|
||||
// this works by global shortcut magics - it will pick the current sc
|
||||
// but the constructor line that adds the default alt+shift+f12 gsc is IMPORTANT!
|
||||
|
@ -271,7 +267,7 @@ void KWinCompositingConfig::toggleEffectShortcutChanged(const QKeySequence &seq)
|
|||
{
|
||||
if (KAction *a = qobject_cast<KAction*>(m_actionCollection->action("Suspend Compositing")))
|
||||
a->setGlobalShortcut(seq, KAction::ActiveShortcut);
|
||||
m_actionCollection->writeSettings();
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
bool KWinCompositingConfig::effectEnabled(const QString& effect, const KConfigGroup& cfg) const
|
||||
|
@ -319,8 +315,7 @@ void KWinCompositingConfig::updateStatusUI(bool compositingIsPossible)
|
|||
if (compositingIsPossible) {
|
||||
ui.compositingOptionsContainer->show();
|
||||
ui.statusTitleWidget->hide();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
OrgKdeKWinInterface kwin("org.kde.KWin", "/KWin", QDBusConnection::sessionBus());
|
||||
ui.compositingOptionsContainer->hide();
|
||||
QString text = i18n("Desktop effects are not available on this system due to the following technical issues:");
|
||||
|
@ -430,6 +425,9 @@ void KWinCompositingConfig::save()
|
|||
KConfigGroup config(mKWinConfig, "Compositing");
|
||||
mPreviousConfig = config.entryMap();
|
||||
|
||||
// Save shortcut changes
|
||||
m_actionCollection->writeSettings(nullptr, true);
|
||||
|
||||
// bah; tab content being dependent on the other is really bad; and
|
||||
// deprecated in the HIG for a reason. It is confusing!
|
||||
// Make sure we only call save on each tab once; as they are stateful due to the revert concept
|
||||
|
|
|
@ -42,16 +42,15 @@ class KWinCompositingConfig : public KCModule
|
|||
Q_OBJECT
|
||||
public:
|
||||
KWinCompositingConfig(QWidget *parent, const QVariantList &args);
|
||||
virtual ~KWinCompositingConfig();
|
||||
|
||||
virtual QString quickHelp() const;
|
||||
QString quickHelp() const final;
|
||||
|
||||
public slots:
|
||||
void currentTabChanged(int tab);
|
||||
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
void load() final;
|
||||
void save() final;
|
||||
void defaults() final;
|
||||
void reparseConfiguration(const QByteArray& conf);
|
||||
|
||||
void loadGeneralTab();
|
||||
|
|
|
@ -80,12 +80,8 @@ void KWinDesktopConfig::init()
|
|||
|
||||
// Shortcut config. The shortcut belongs to the component "kwin"!
|
||||
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
m_actionCollection->setConfigGroup("Desktop Switching");
|
||||
m_actionCollection->setConfigGlobal(true);
|
||||
|
||||
m_switchDesktopCollection = new KActionCollection(this, KComponentData("kwin"));
|
||||
m_switchDesktopCollection->setConfigGroup("Desktop Switching");
|
||||
m_switchDesktopCollection->setConfigGlobal(true);
|
||||
|
||||
// actions for switch desktop collection - other action is filled dynamically
|
||||
addAction("Switch to Next Desktop", i18n("Switch to Next Desktop"));
|
||||
|
|
|
@ -53,10 +53,9 @@ public:
|
|||
QString cachedDesktopName(int desktop);
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
virtual void defaults();
|
||||
|
||||
void save() final;
|
||||
void load() final;
|
||||
void defaults() final;
|
||||
|
||||
private slots:
|
||||
void slotChangeShortcuts(int number);
|
||||
|
|
|
@ -46,7 +46,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <netwm.h>
|
||||
|
||||
class KConfigGroup;
|
||||
class KActionCollection;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
|
|
@ -820,6 +820,9 @@ void Workspace::initShortcuts()
|
|||
#define IN_KWIN
|
||||
#include "kwinbindings.cpp"
|
||||
VirtualDesktopManager::self()->initShortcuts(actionCollection);
|
||||
foreach (KActionCollection* collection, KActionCollection::allCollections()) {
|
||||
collection->readSettings();
|
||||
}
|
||||
m_userActionsMenu->discard(); // so that it's recreated next time
|
||||
}
|
||||
|
||||
|
|
|
@ -729,8 +729,10 @@ void Workspace::slotReconfigure()
|
|||
bool borderlessMaximizedWindows = options->borderlessMaximizedWindows();
|
||||
|
||||
KGlobal::config()->reparseConfiguration();
|
||||
foreach (KActionCollection* collection, KActionCollection::allCollections()) {
|
||||
collection->readSettings();
|
||||
}
|
||||
unsigned long changed = options->updateSettings();
|
||||
|
||||
emit configChanged();
|
||||
m_userActionsMenu->discard();
|
||||
updateToolWindows(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue