Make constHints reuse hints(), set the hint for silent when hints are used and not when they are created.

This commit is contained in:
Patrick von Reth 2015-09-10 12:44:14 +02:00
parent 778d769fda
commit 4a9c2123b7
3 changed files with 3 additions and 3 deletions

View File

@ -91,12 +91,13 @@ bool Application::isValid() const
Hint &Application::hints() Hint &Application::hints()
{ {
d->m_hint.setValue("silent", SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING));
return d->m_hint; return d->m_hint;
} }
const Hint &Application::constHints() const const Hint &Application::constHints() const
{ {
return d->m_hint; return const_cast<Hint&>(const_cast<Application*>(this)->hints());
} }
QDebug operator<< (QDebug debug, const Snore::Application &app) QDebug operator<< (QDebug debug, const Snore::Application &app)

View File

@ -34,7 +34,6 @@ ApplicationData::ApplicationData(const QString &key, const QString &name, const
m_hint.setValue("pushover-token", QLatin1String("aFB1TPCyZkkr7mubCGEKy5vJEWak9t")); m_hint.setValue("pushover-token", QLatin1String("aFB1TPCyZkkr7mubCGEKy5vJEWak9t"));
m_hint.setValue("use-markup", false); m_hint.setValue("use-markup", false);
m_hint.setValue("silent", SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING));
} }
ApplicationData::~ApplicationData() ApplicationData::~ApplicationData()

View File

@ -139,7 +139,7 @@ Hint &Notification::hints()
const Hint &Notification::constHints() const const Hint &Notification::constHints() const
{ {
return d->m_hints; return const_cast<Hint&>(const_cast<Notification*>(this)->hints());
} }
bool Notification::isValid() const bool Notification::isValid() const