if an applet overrode configChanged (it is virtual), the keyboard shortcuts wouldn't get picked up; so move that all to a private slot and now configChangedcan be safely used instead of connecting up to the dialog signals yourself as an added bonus
svn path=/trunk/KDE/kdelibs/; revision=906175
This commit is contained in:
parent
d8c68f8d5f
commit
be4c8c2c5e
33
applet.cpp
33
applet.cpp
@ -1398,10 +1398,10 @@ void Applet::showConfigurationInterface()
|
|||||||
|
|
||||||
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings", name()));
|
||||||
d->addGlobalShortcutsPage(dialog);
|
d->addGlobalShortcutsPage(dialog);
|
||||||
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configDialogFinished()));
|
||||||
connect(dialog, SIGNAL(okClicked()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(okClicked()), this, SLOT(configDialogFinished()));
|
||||||
//FIXME: in this case use another ad-hoc slot?
|
//FIXME: in this case use another ad-hoc slot?
|
||||||
connect(dialog, SIGNAL(finished()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(finished()), this, SLOT(configDialogFinished()));
|
||||||
dialog->show();
|
dialog->show();
|
||||||
} else if (d->script) {
|
} else if (d->script) {
|
||||||
//FIXME: global shorcuts?
|
//FIXME: global shorcuts?
|
||||||
@ -1417,9 +1417,9 @@ void Applet::showConfigurationInterface()
|
|||||||
connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
connect(dialog, SIGNAL(finished()), nullManager, SLOT(deleteLater()));
|
||||||
//TODO: Apply button does not correctly work for now, so do not show it
|
//TODO: Apply button does not correctly work for now, so do not show it
|
||||||
dialog->showButton(KDialog::Apply, false);
|
dialog->showButton(KDialog::Apply, false);
|
||||||
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configDialogFinished()));
|
||||||
connect(dialog, SIGNAL(okClicked()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(okClicked()), this, SLOT(configDialogFinished()));
|
||||||
connect(dialog, SIGNAL(finished()), this, SLOT(configChanged()));
|
connect(dialog, SIGNAL(finished()), this, SLOT(configDialogFinished()));
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1451,19 +1451,24 @@ void AppletPrivate::clearShortcutEditorPtr()
|
|||||||
shortcutEditor = 0;
|
shortcutEditor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppletPrivate::configDialogFinished()
|
||||||
|
{
|
||||||
|
if (shortcutEditor) {
|
||||||
|
QKeySequence sequence = shortcutEditor->keySequence();
|
||||||
|
if (sequence != q->globalShortcut().primary()) {
|
||||||
|
q->setGlobalShortcut(KShortcut(sequence));
|
||||||
|
emit q->configNeedsSaving();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
q->configChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void Applet::configChanged()
|
void Applet::configChanged()
|
||||||
{
|
{
|
||||||
if (d->script) {
|
if (d->script) {
|
||||||
d->script->configChanged();
|
d->script->configChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->shortcutEditor) {
|
|
||||||
QKeySequence sequence = d->shortcutEditor->keySequence();
|
|
||||||
if (sequence != globalShortcut().primary()) {
|
|
||||||
setGlobalShortcut(KShortcut(sequence));
|
|
||||||
emit configNeedsSaving();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
void Applet::createConfigurationInterface(KConfigDialog *parent)
|
||||||
|
1
applet.h
1
applet.h
@ -843,6 +843,7 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
|
|||||||
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())
|
Q_PRIVATE_SLOT(d, void clearShortcutEditorPtr())
|
||||||
|
Q_PRIVATE_SLOT(d, void configDialogFinished())
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplemented from QGraphicsItem
|
* Reimplemented from QGraphicsItem
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
void destroyMessageOverlay();
|
void destroyMessageOverlay();
|
||||||
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
||||||
void clearShortcutEditorPtr();
|
void clearShortcutEditorPtr();
|
||||||
|
void configDialogFinished();
|
||||||
|
|
||||||
static uint s_maxAppletId;
|
static uint s_maxAppletId;
|
||||||
static uint s_maxZValue;
|
static uint s_maxZValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user