mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: cancel the automatic hide timer on mouse press in notifications applet
probably the most annoying thing about the old implementation of the notifications applet was that it could just disappear after it has been automatically shown and after being clicked on, that will not bother me anymore Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2a350ef8b8
commit
ff687e99e7
1 changed files with 17 additions and 1 deletions
|
@ -53,6 +53,9 @@ class NotificationsWidget : public Plasma::TabBar
|
|||
public:
|
||||
NotificationsWidget(NotificationsApplet* notifications);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) final;
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotCountChanged();
|
||||
|
||||
|
@ -62,13 +65,15 @@ private:
|
|||
JobsWidget* m_jobswidget;
|
||||
Plasma::ScrollWidget* m_applicationsscrollwidget;
|
||||
ApplicationsWidget* m_applicationswidget;
|
||||
bool m_automaticpopup;
|
||||
};
|
||||
|
||||
NotificationsWidget::NotificationsWidget(NotificationsApplet* notifications)
|
||||
: Plasma::TabBar(notifications),
|
||||
m_notifications(notifications),
|
||||
m_jobswidget(nullptr),
|
||||
m_applicationswidget(nullptr)
|
||||
m_applicationswidget(nullptr),
|
||||
m_automaticpopup(false)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
setMinimumSize(s_minimumsize);
|
||||
|
@ -96,8 +101,18 @@ NotificationsWidget::NotificationsWidget(NotificationsApplet* notifications)
|
|||
addTab(KIcon("dialog-information"), i18n("Notifications"), m_applicationsscrollwidget);
|
||||
}
|
||||
|
||||
void NotificationsWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
Plasma::TabBar::mousePressEvent(event);
|
||||
if (m_automaticpopup) {
|
||||
// stop auto-hide timer of the popup
|
||||
m_notifications->showPopup(0);
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationsWidget::slotCountChanged()
|
||||
{
|
||||
m_automaticpopup = false;
|
||||
const int totalcount = (m_jobswidget->count() + m_applicationswidget->count());
|
||||
if (totalcount > 0) {
|
||||
m_notifications->setPopupIcon(kNotificationIcon(m_notifications, true));
|
||||
|
@ -110,6 +125,7 @@ void NotificationsWidget::slotCountChanged()
|
|||
} else {
|
||||
setCurrentIndex(1);
|
||||
}
|
||||
m_automaticpopup = true;
|
||||
m_notifications->showPopup(s_popuptimeout);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue