clear the shortcuts editor pointer only when the dialog is actually dead and gone

BUG:175722

svn path=/trunk/KDE/kdelibs/; revision=887090
This commit is contained in:
Aaron J. Seigo 2008-11-21 03:43:45 +00:00
parent c6f32b32f9
commit 23a7c83164
3 changed files with 8 additions and 3 deletions

View File

@ -1409,6 +1409,7 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
if (!shortcutEditor) { if (!shortcutEditor) {
shortcutEditor = new KKeySequenceWidget(page); shortcutEditor = new KKeySequenceWidget(page);
QObject::connect(shortcutEditor, SIGNAL(destroyed(QObject*)), q, SLOT(clearShortcutEditorPtr()));
} }
shortcutEditor->setKeySequence(q->globalShortcut().primary()); shortcutEditor->setKeySequence(q->globalShortcut().primary());
@ -1417,6 +1418,11 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard"); dialog->addPage(page, i18n("Keyboard Shortcut"), "preferences-desktop-keyboard");
} }
void AppletPrivate::clearShortcutEditorPtr()
{
shortcutEditor = 0;
}
void Applet::configChanged() void Applet::configChanged()
{ {
if (d->script) { if (d->script) {
@ -1429,9 +1435,6 @@ void Applet::configChanged()
setGlobalShortcut(KShortcut(sequence)); setGlobalShortcut(KShortcut(sequence));
emit configNeedsSaving(); emit configNeedsSaving();
} }
delete d->shortcutEditor;
d->shortcutEditor = 0;
} }
} }

View File

@ -834,6 +834,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
Q_PRIVATE_SLOT(d, void selectItemToDestroy()) Q_PRIVATE_SLOT(d, void selectItemToDestroy())
Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect)) Q_PRIVATE_SLOT(d, void updateRect(const QRectF& rect))
Q_PRIVATE_SLOT(d, void destroyMessageOverlay()) Q_PRIVATE_SLOT(d, void destroyMessageOverlay())
Q_PRIVATE_SLOT(d, void clearShortcutEditorPtr())
/** /**
* Reimplemented from QGraphicsItem * Reimplemented from QGraphicsItem

View File

@ -76,6 +76,7 @@ public:
void createMessageOverlay(); void createMessageOverlay();
void destroyMessageOverlay(); void destroyMessageOverlay();
void addGlobalShortcutsPage(KConfigDialog *dialog); void addGlobalShortcutsPage(KConfigDialog *dialog);
void clearShortcutEditorPtr();
static uint s_maxAppletId; static uint s_maxAppletId;
static uint s_maxZValue; static uint s_maxZValue;