diff --git a/src/core/notification/notification.cpp b/src/core/notification/notification.cpp index e320de2..cc0a785 100644 --- a/src/core/notification/notification.cpp +++ b/src/core/notification/notification.cpp @@ -172,9 +172,13 @@ void Notification::setCloseReason(const NotificationEnums::CloseReasons::closeRe d->m_closeReason = r; } -const QVariant Notification::hint ( const QString &key ) const +const QVariant Notification::hint(const QString &key , const QVariant &defaultValue ) const { - return d->m_hints.value ( key ); + if(d->m_hints.contains(key)) + { + return d->m_hints.value ( key ); + } + return defaultValue; } bool Notification::hintExists ( const QString &key ) @@ -187,6 +191,11 @@ void Notification::insertHint ( const QString &key, const QVariant &val ) d->m_hints.insert ( key,val ); } +void Notification::setSilent(bool silent) +{ + d->m_hints["silent"] = silent; +} + bool Notification::isValid() const { return d; diff --git a/src/core/notification/notification.h b/src/core/notification/notification.h index 50b5d5c..f0769ee 100644 --- a/src/core/notification/notification.h +++ b/src/core/notification/notification.h @@ -72,10 +72,12 @@ public: void addAction(Action *a); const NotificationEnums::CloseReasons::closeReasons &closeReason(); void setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r); - const QVariant hint ( const QString &key ) const; + const QVariant hint(const QString &key , const QVariant &defaultValue ) const; bool hintExists ( const QString &key ); void insertHint ( const QString &key,const QVariant &val ); + void setSilent(bool silent); + bool isValid() const; //protected://TODO::make only accesable from a backend diff --git a/src/plugins/backends/snoretoast/snoretoast.cpp b/src/plugins/backends/snoretoast/snoretoast.cpp index 9c2ec1a..329d27d 100644 --- a/src/plugins/backends/snoretoast/snoretoast.cpp +++ b/src/plugins/backends/snoretoast/snoretoast.cpp @@ -67,6 +67,7 @@ void SnoreToast::slotUnregisterApplication(Application *application) void SnoreToast::slotNotify(Notification notification) { QProcess *p = new QProcess(this); + p->setReadChannelMode(QProcess::MergedChannels); connect(p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(slotToastNotificationClosed(int,QProcess::ExitStatus))); connect(qApp,SIGNAL(aboutToQuit()),p,SLOT(kill())); @@ -80,8 +81,13 @@ void SnoreToast::slotNotify(Notification notification) // << notification.icon().isLocalFile()?QDir::toNativeSeparators(notification.icon().localUrl()):notification.icon().url() << QDir::toNativeSeparators(notification.icon().localUrl()) << "-w" - << "-appID" - << m_appID; +// << "-appID" +// << m_appID + ; + if(notification.hint("silent",true).toBool()) + { + arguements << "-silent"; + } qDebug() << "SnoreToast" << arguements; p->start("SnoreToast", arguements); @@ -116,7 +122,7 @@ void SnoreToast::slotToastNotificationClosed(int code, QProcess::ExitStatus) break; case -1: //failed - qWarning() << "SnoreToast failed to display " << n; + qWarning() << "SnoreToast failed to display " << n << p->readAll(); break; }