emit cancel signal

both when clicking cancel and pressing esc
CCBUG:265738
This commit is contained in:
Marco Martin 2011-02-09 00:02:28 +01:00
parent e193b7eab0
commit 11d3b789a4
2 changed files with 8 additions and 4 deletions

View File

@ -655,9 +655,12 @@ void AppletPrivate::destroyMessageOverlay()
buttonCode = ButtonNo; buttonCode = ButtonNo;
} }
if (button->text() == i18n("Cancel")) { if (button->text() == i18n("Cancel")) {
buttonCode = ButtonCancel;
} }
emit q->messageButtonPressed(buttonCode); emit q->messageButtonPressed(buttonCode);
} else if (q->sender() == messageOverlay) {
emit q->messageButtonPressed(ButtonCancel);
} }
} }
@ -1116,10 +1119,10 @@ void Applet::showMessage(const QIcon &icon, const QString &message, const Messag
connect(cancel, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay())); connect(cancel, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay()));
} }
QAction *action = new QAction(this); d->messageCloseAction = new QAction(d->messageOverlay);
action->setShortcut(Qt::Key_Escape); d->messageCloseAction.data()->setShortcut(Qt::Key_Escape);
mainWidget->addAction(action); mainWidget->addAction(d->messageCloseAction.data());
connect(action, SIGNAL(triggered()), this, SLOT(destroyMessageOverlay())); connect(d->messageCloseAction.data(), SIGNAL(triggered()), this, SLOT(destroyMessageOverlay()));
buttonLayout->addStretch(); buttonLayout->addStretch();

View File

@ -177,6 +177,7 @@ public:
AppletScript *script; AppletScript *script;
Package *package; Package *package;
ConfigLoader *configLoader; ConfigLoader *configLoader;
QWeakPointer<QAction> messageCloseAction;
// actions stuff; put activationAction into actions? // actions stuff; put activationAction into actions?
KActionCollection *actions; KActionCollection *actions;