delay showing popups until the next processing of events

allows things like hidden panels to show before calculating where to show the popup

BUG:288999
This commit is contained in:
Aaron Seigo 2011-12-16 12:50:08 +01:00
parent 645439c299
commit 1b2d92c085
3 changed files with 31 additions and 14 deletions

View File

@ -600,6 +600,9 @@ void PopupApplet::timerEvent(QTimerEvent *event)
d->autohideTimer->stop();
}
}
} else if (event->timerId() == d->showDialogTimer.timerId()) {
d->showDialogTimer.stop();
d->showDialog();
} else {
Applet::timerEvent(event);
}
@ -607,6 +610,7 @@ void PopupApplet::timerEvent(QTimerEvent *event)
void PopupApplet::hidePopup()
{
d->showDialogTimer.stop();
d->delayedShowTimer.stop();
Dialog *dialog = d->dialogPtr.data();
@ -748,6 +752,17 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
}
ToolTipManager::self()->hide(q);
showDialogTimer.start(0, q);
}
}
void PopupAppletPrivate::showDialog()
{
Plasma::Dialog *dialog = dialogPtr.data();
if (!dialog) {
return;
}
updateDialogPosition();
KWindowSystem::setOnAllDesktops(dialog->winId(), true);
@ -766,7 +781,6 @@ void PopupAppletPrivate::internalTogglePopup(bool fromActivatedSignal)
if (!(dialog->windowFlags() & Qt::X11BypassWindowManagerHint)) {
KWindowSystem::activateWindow(dialog->winId());
}
}
}
void PopupAppletPrivate::hideTimedPopup()

View File

@ -107,6 +107,7 @@ void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
KNS3::DownloadDialog *knsDialog = m_knsDialog.data();
if (!knsDialog) {
m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent);
knsDialog->setProperty("DoNotCloseController", true);
connect(knsDialog, SIGNAL(accepted()), this, SIGNAL(newWidgetBrowserFinished()));
}

View File

@ -36,6 +36,7 @@ public:
void iconSizeChanged(int group);
void internalTogglePopup(bool fromActivatedSignal = false);
void showDialog();
void hideTimedPopup();
void clearPopupLostFocus();
void dialogSizeChanged();
@ -61,6 +62,7 @@ public:
Plasma::AspectRatioMode savedAspectRatio;
QTimer *autohideTimer;
QBasicTimer delayedShowTimer;
QBasicTimer showDialogTimer;
QPoint clicked;
ItemStatus preShowStatus;
bool popupLostFocus : 1;