mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
plasma: show the notifications applet popup only on new notification
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
58dea97cb3
commit
939e3630b2
4 changed files with 10 additions and 35 deletions
|
@ -180,7 +180,6 @@ void ApplicationsWidget::sourceAdded(const QString &name)
|
|||
adjustSize();
|
||||
|
||||
emit countChanged();
|
||||
emit ping();
|
||||
locker.unlock();
|
||||
m_dataengine->connectSource(name, this);
|
||||
}
|
||||
|
@ -252,8 +251,6 @@ void ApplicationsWidget::dataUpdated(const QString &name, const Plasma::DataEngi
|
|||
}
|
||||
frame->adjustSize();
|
||||
adjustSize();
|
||||
locker.unlock();
|
||||
emit ping();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,6 @@ void JobsWidget::sourceAdded(const QString &name)
|
|||
adjustSize();
|
||||
|
||||
emit countChanged();
|
||||
emit ping();
|
||||
locker.unlock();
|
||||
m_dataengine->connectSource(name, this);
|
||||
}
|
||||
|
@ -251,8 +250,6 @@ void JobsWidget::dataUpdated(const QString &name, const Plasma::DataEngine::Data
|
|||
}
|
||||
frame->adjustSize();
|
||||
adjustSize();
|
||||
locker.unlock();
|
||||
emit ping();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
|
||||
Q_SIGNALS:
|
||||
int countChanged();
|
||||
void ping();
|
||||
|
||||
public Q_SLOTS:
|
||||
void slotFrameDestroyed();
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
|
||||
private Q_SLOTS:
|
||||
void slotCountChanged();
|
||||
void slotJobPing();
|
||||
void slotApplicationPing();
|
||||
|
||||
private:
|
||||
NotificationsApplet* m_notifications;
|
||||
|
@ -85,10 +83,6 @@ NotificationsWidget::NotificationsWidget(NotificationsApplet* notifications)
|
|||
m_jobswidget, SIGNAL(countChanged()),
|
||||
this, SLOT(slotCountChanged())
|
||||
);
|
||||
connect(
|
||||
m_jobswidget, SIGNAL(ping()),
|
||||
this, SLOT(slotJobPing())
|
||||
);
|
||||
m_jobsscrollwidget->setWidget(m_jobswidget);
|
||||
addTab(KIcon("services"), i18n("Jobs"), m_jobsscrollwidget);
|
||||
|
||||
|
@ -99,10 +93,6 @@ NotificationsWidget::NotificationsWidget(NotificationsApplet* notifications)
|
|||
m_applicationswidget, SIGNAL(countChanged()),
|
||||
this, SLOT(slotCountChanged())
|
||||
);
|
||||
connect(
|
||||
m_applicationswidget, SIGNAL(ping()),
|
||||
this, SLOT(slotApplicationPing())
|
||||
);
|
||||
m_applicationsscrollwidget->setWidget(m_applicationswidget);
|
||||
addTab(KIcon("dialog-information"), i18n("Notifications"), m_applicationsscrollwidget);
|
||||
|
||||
|
@ -113,6 +103,16 @@ void NotificationsWidget::slotCountChanged()
|
|||
{
|
||||
const int totalcount = (m_jobswidget->count() + m_applicationswidget->count());
|
||||
if (totalcount > 0) {
|
||||
// if the popup was shown before the signal it is probably because it is being interacted
|
||||
// with so no automatic tab switching in that case
|
||||
if (!m_notifications->isPopupShowing()) {
|
||||
if (sender() == m_jobswidget) {
|
||||
setCurrentIndex(0);
|
||||
} else {
|
||||
setCurrentIndex(1);
|
||||
}
|
||||
m_notifications->showPopup(s_popuptimeout);
|
||||
}
|
||||
m_notifications->setPopupIcon(kNotificationIcon(m_notifications, true));
|
||||
m_notifications->setStatus(Plasma::ItemStatus::ActiveStatus);
|
||||
} else {
|
||||
|
@ -121,24 +121,6 @@ void NotificationsWidget::slotCountChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void NotificationsWidget::slotJobPing()
|
||||
{
|
||||
// if the popup was shown before the signal it is probably because it is being interacted with
|
||||
// so no automatic tab switching in that case
|
||||
if (!m_notifications->isPopupShowing()) {
|
||||
m_notifications->showPopup(s_popuptimeout);
|
||||
setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationsWidget::slotApplicationPing()
|
||||
{
|
||||
if (!m_notifications->isPopupShowing()) {
|
||||
m_notifications->showPopup(s_popuptimeout);
|
||||
setCurrentIndex(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NotificationsApplet::NotificationsApplet(QObject *parent, const QVariantList &args)
|
||||
: Plasma::PopupApplet(parent, args),
|
||||
|
|
Loading…
Add table
Reference in a new issue