コード例 #1
0
			void KinotifyWidget::mousePressEvent (QMouseEvent *event)
			{
				const QWebHitTestResult& r = page ()->mainFrame ()->hitTestContent (event->pos ());
				if (!r.linkUrl ().isEmpty ())
				{
					QWebView::mousePressEvent (event);
					return;
				}

				QWebElement elem = r.element ();
				if (elem.isNull () || elem.attribute ("type") != "button")
				{
					disconnect (CheckTimer_,
							SIGNAL (timeout ()),
							this,
							SIGNAL (checkNotificationQueue ()));

					disconnect (&Machine_,
							SIGNAL (finished ()),
							this,
							SLOT (closeNotification ()));

					emit checkNotificationQueue ();
					closeNotification ();
				}
				else
					QWebView::mousePressEvent (event);
			}
コード例 #2
0
void KinotifyWidget::mouseReleaseEvent (QMouseEvent *)
{
    disconnect (CheckTimer_,
    SIGNAL (timeout ()),
    this,
    SIGNAL (checkNotificationQueue ()));

    disconnect (&Machine_,
    SIGNAL (finished ()),
    this,
    SLOT (closeNotification()));

    emit checkNotificationQueue ();
    closeNotification ();
}
コード例 #3
0
ファイル: notification.cpp プロジェクト: wizardofozzie/CopyQ
void Notification::mousePressEvent(QMouseEvent *event)
{
    if (event->button() != Qt::LeftButton) {
        if ( !m_textToCopy.isEmpty() )
            showNotificationInspectDialog(m_titleLabel->text(), m_textToCopy);
        return;
    }

    m_timer.stop();

    emit closeNotification(this);
}
コード例 #4
0
ファイル: qtui.cpp プロジェクト: bawNg/quassel
void QtUi::notificationActivated(uint notificationId) {
  if(notificationId != 0) {
    QList<AbstractNotificationBackend::Notification>::iterator i = _notifications.begin();
    while(i != _notifications.end()) {
      if(i->notificationId == notificationId) {
        BufferId bufId = i->bufferId;
        if(bufId.isValid())
          Client::bufferModel()->switchToBuffer(bufId);
        break;
      }
      ++i;
    }
  }
  closeNotification(notificationId);

  activateMainWidget();
}
コード例 #5
0
void SnorePlugin::Freedesktop::slotNotificationClosed(const uint id, const uint reason)
{
    /*
     *
     *  The reason the notification was closed.
     *
     *  1 - The notification expired.
     *
     *  2 - The notification was dismissed by the user.
     *
     *  3 - The notification was closed by a call to CloseNotification.
     *
     *  4 - Undefined/reserved reasons.
    */
    Snore::Notification::CloseReasons closeReason;
    switch (reason) {
    case (1):
        closeReason = Snore::Notification::TimedOut;
        break;
    case (2):
        closeReason = Snore::Notification::Dismissed;
        break;
    case (3):
        closeReason = Snore::Notification::Closed;
        break;
    default:
        closeReason = Snore::Notification::None;
    }

    qCDebug(SNORE) << id << "|" << closeReason << reason;
    if (id == 0) {
        return;
    }
    Snore::Notification noti =  m_dbusIdMap.take(id);
    if (noti.isValid()) {
        closeNotification(noti, closeReason);
    }
}
コード例 #6
0
ファイル: dunst_dbus.c プロジェクト: losciamano/dunst
void dbus_poll(int timeout)
{
        DBusMessage *dbus_msg;

        dbus_connection_read_write(dbus_conn, timeout);

        dbus_msg = dbus_connection_pop_message(dbus_conn);

        while (dbus_msg) {
                if (dbus_message_is_method_call
                    (dbus_msg, "org.freedesktop.DBus.Introspectable", "Introspect")) {
                        dbus_introspect(dbus_msg);
                }

                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "Notify")) {
                        notify(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "GetCapabilities")) {
                        getCapabilities(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "GetServerInformation")) {
                        getServerInformation(dbus_msg);
                }
                if (dbus_message_is_method_call(dbus_msg,
                                                "org.freedesktop.Notifications",
                                                "CloseNotification")) {
                        closeNotification(dbus_msg);
                }
                dbus_message_unref(dbus_msg);
                dbus_msg = dbus_connection_pop_message(dbus_conn);
        }
}
コード例 #7
0
ファイル: dunst_dbus.c プロジェクト: wm4/dunst
void
dbus_poll(void) {
    DBusMessage *dbus_msg;

    /* make timeout smaller if we are displaying a message
     * to improve responsivness for mouse clicks
     */
    if(msgqueue == NULL) {
        dbus_connection_read_write(dbus_conn, DBUS_POLL_TIMEOUT);
    } else {
        dbus_connection_read_write(dbus_conn, 100);
    }

    dbus_msg = dbus_connection_pop_message(dbus_conn);
    /* we don't have a new message */
    if(dbus_msg == NULL) {
        return;
    }

    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications","Notify")) {
        notify(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "GetCapabilities")) {
        getCapabilities(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "GetServerInformation")) {
        getServerInformation(dbus_msg);
    }
    if(dbus_message_is_method_call(dbus_msg,
                "org.freedesktop.Notifications", "CloseNotification")) {
        closeNotification(dbus_msg);
    }
    dbus_message_unref(dbus_msg);
}
コード例 #8
0
void NotificationWidget::expired()
{
	closeNotification(Timeout);
}
コード例 #9
0
void NotificationWidget::mousePressEvent(QMouseEvent *event)
{
	if (event->button()==Qt::LeftButton || event->button()==Qt::RightButton)
		closeNotification(UserAction);
}
コード例 #10
0
KinotifyWidget::KinotifyWidget (int timeout, QWidget *widget, int animationTimout)
: QWebView (widget)
, Timeout_ (timeout)
, AnimationTime_ (animationTimout)
{
    setWindowOpacity (0.0);
    this->setContextMenuPolicy(Qt::NoContextMenu);

    CloseTimer_ = new QTimer (this);
    CheckTimer_ = new QTimer (this);
    CloseTimer_->setSingleShot (true);
    CheckTimer_->setSingleShot (true);

    showStartState = new QState;
    showFinishState = new QState;
    closeStartState = new QState;
    closeFinishState = new QState;
    finalState = new QFinalState;

    QPropertyAnimation *opacityAmination = new QPropertyAnimation (this, "opacity");
    opacityAmination->setDuration (AnimationTime_);

    showStartState->assignProperty (this, "opacity", 0.0);
    showFinishState->assignProperty (this, "opacity", 0.8);
    closeStartState->assignProperty (this, "opacity", 0.8);
    closeFinishState->assignProperty (this, "opacity", 0.0);

    showStartState->addTransition (showFinishState);
    showFinishState->addTransition (this,
    SIGNAL (initiateCloseNotification ()), closeStartState);

    closeStartState->addTransition (closeFinishState);
    closeFinishState->addTransition (closeFinishState,
    SIGNAL (propertiesAssigned ()), finalState);


    Machine_.addState (showStartState);
    Machine_.addState (showFinishState);
    Machine_.addState (closeStartState);
    Machine_.addState (closeFinishState);
    Machine_.addState (finalState);

    Machine_.addDefaultAnimation (opacityAmination);
    Machine_.setInitialState (showStartState);

    connect (&Machine_,
    SIGNAL (finished ()),
    this,
    SLOT (closeNotification ()));

    connect (showFinishState,
    SIGNAL (entered ()),
    this,
    SLOT (stateMachinePause ()));

    connect (CloseTimer_,
    SIGNAL (timeout ()),
    this,
    SIGNAL (initiateCloseNotification ()));

    connect (CheckTimer_,
    SIGNAL (timeout ()),
    this,
    SIGNAL (checkNotificationQueue ()));
}
コード例 #11
0
ファイル: notification.cpp プロジェクト: wizardofozzie/CopyQ
void Notification::onTimeout()
{
    emit closeNotification(this);
}
コード例 #12
0
ファイル: notification.cpp プロジェクト: wizardofozzie/CopyQ
void Notification::hideEvent(QHideEvent *event)
{
    QWidget::hideEvent(event);
    emit closeNotification(this);
}