* handle the activate()->setFocus() ourselves

* if we have a popup that is the extender and the extender is empty, don't show anything
BUG:190834

svn path=/trunk/KDE/kdelibs/; revision=959935
This commit is contained in:
Aaron J. Seigo 2009-04-27 15:25:02 +00:00
parent 8587298f41
commit 2e1ca49249

View File

@ -56,6 +56,7 @@ PopupApplet::PopupApplet(QObject *parent, const QVariantList &args)
{ {
int iconSize = IconSize(KIconLoader::Desktop); int iconSize = IconSize(KIconLoader::Desktop);
resize(iconSize, iconSize); resize(iconSize, iconSize);
disconnect(this, SIGNAL(activate()), (Applet*)this, SLOT(setFocus()));
connect(this, SIGNAL(activate()), this, SLOT(internalTogglePopup())); connect(this, SIGNAL(activate()), this, SLOT(internalTogglePopup()));
setAcceptDrops(true); setAcceptDrops(true);
} }
@ -499,6 +500,7 @@ PopupAppletPrivate::~PopupAppletPrivate()
void PopupAppletPrivate::internalTogglePopup() void PopupAppletPrivate::internalTogglePopup()
{ {
if (!dialog) { if (!dialog) {
q->setFocus(Qt::ShortcutFocusReason);
return; return;
} }
@ -512,7 +514,16 @@ void PopupAppletPrivate::internalTogglePopup()
} else { } else {
dialog->hide(); dialog->hide();
} }
dialog->clearFocus();
} else { } else {
if (q->graphicsWidget() &&
q->graphicsWidget() == static_cast<Applet*>(q)->d->extender &&
static_cast<Applet*>(q)->d->extender->attachedItems().isEmpty()) {
// we have nothing to show, so let's not.
return;
}
ToolTipManager::self()->hide(q); ToolTipManager::self()->hide(q);
updateDialogPosition(); updateDialogPosition();
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
@ -542,8 +553,6 @@ void PopupAppletPrivate::internalTogglePopup()
dialog->show(); dialog->show();
} }
} }
dialog->clearFocus();
} }
void PopupAppletPrivate::hideTimedPopup() void PopupAppletPrivate::hideTimedPopup()
@ -700,7 +709,7 @@ void PopupAppletPrivate::updateDialogPosition()
void PopupAppletPrivate::updateDialogFlags() void PopupAppletPrivate::updateDialogFlags()
{ {
Q_ASSERT(dialog); Q_ASSERT(dialog);
dialog->setAttribute(Qt::WA_X11NetWmWindowTypeNotification, passive); //dialog->setAttribute(Qt::WA_X11NetWmWindowTypeNotification, passive);
} }