Add a undo() method that does what its name suggest for the global shortcuts

and call it where appropriate.

Leaving the dialog with cancel now leaves the user settings unchanged.
As expected.

svn path=/trunk/KDE/kdebase/workspace/; revision=1021767
This commit is contained in:
Michael Jansen 2009-09-09 23:44:08 +00:00
parent fff3477452
commit f37efe22c9
2 changed files with 16 additions and 0 deletions

View file

@ -220,6 +220,7 @@ void KWinDesktopConfig::init()
KWinDesktopConfig::~KWinDesktopConfig()
{
undo();
}
void KWinDesktopConfig::defaults()
@ -248,6 +249,9 @@ void KWinDesktopConfig::defaults()
void KWinDesktopConfig::load()
{
// This method is called on reset(). So undo all changes.
undo();
#ifdef Q_WS_X11
// get number of desktops
NETRootInfo info( QX11Info::display(), NET::NumberOfDesktops | NET::DesktopNames );
@ -350,6 +354,14 @@ void KWinDesktopConfig::save()
emit changed(false);
}
void KWinDesktopConfig::undo()
{
// The global shortcuts editor makes changes active immediately. In case
// of undo we have to undo them manually
m_editor->undoChanges();
}
QString KWinDesktopConfig::cachedDesktopName( int desktop )
{
if( desktop > m_desktopNames.size() )

View file

@ -52,11 +52,15 @@ class KWinDesktopConfig : public KCModule
~KWinDesktopConfig();
QString cachedDesktopName( int desktop );
// undo all changes
void undo();
public slots:
virtual void save();
virtual void load();
virtual void defaults();
private slots:
void slotChangeShortcuts( int number );
void slotShowAllShortcuts();