コード例 #1
0
void NotificationLayout::removeNotification(uint key, uint reason)
{
    Notification *n = m_notifications.take(key);
    if (!n)
    {
        qDebug() << "Oooook! Expecting instance of notification, got:" << key;
        return;
    }

    int ix = m_layout->indexOf(n);
    if (ix == -1)
    {
        qDebug() << "Qooook! Widget not in layout. Impossible!" << n;
        return;
    }

    delete m_layout->takeAt(ix);
    n->deleteLater();
    emit notificationClosed(key, reason);

    if (m_notifications.count() == 0)
        emit allNotificationsClosed();

    checkHeight();
}
コード例 #2
0
bool NotificationAction::execute(Rule *rule)
{
    Q_D(NotificationAction);
    Q_UNUSED(rule);

    Notification *notification = new Notification(this);
    notification->setTimestamp(QDateTime::currentDateTime());
    notification->setSummary(d->summary);
    notification->publish();
    notification->deleteLater();
    return true;
}