if we show the message in a popup, ensure it can at least be dismissed

BUG:229832

svn path=/trunk/KDE/kdelibs/; revision=1100957
This commit is contained in:
Aaron J. Seigo 2010-03-09 03:07:29 +00:00
parent bb75767105
commit 639b39a9cd

View File

@ -1096,6 +1096,15 @@ void Applet::showMessage(const QIcon &icon, const QString &message, const Messag
KWindowSystem::setState(d->messageDialog.data()->winId(), NET::SkipTaskbar | NET::SkipPager);
d->messageDialog.data()->setGraphicsWidget(mainWidget);
connect(d->messageDialog.data(), SIGNAL(destroyed(QObject*)), mainWidget, SLOT(deleteLater()));
// if we are going to show it in a popup, then at least make sure it can be dismissed
if (buttonLayout->count() < 1) {
PushButton *ok = new PushButton(mainWidget);
ok->setText(i18n("OK"));
ok->setIcon(KIcon("dialog-ok"));
buttonLayout->addItem(ok);
connect(ok, SIGNAL(clicked()), this, SLOT(destroyMessageOverlay()));
}
} else {
delete d->messageDialog.data();
d->createMessageOverlay();