diff --git a/src/libsnore/application.cpp b/src/libsnore/application.cpp index 37f3ec6..e18e96c 100644 --- a/src/libsnore/application.cpp +++ b/src/libsnore/application.cpp @@ -20,8 +20,6 @@ #include "application_p.h" #include "snore_p.h" -#include - using namespace Snore; Application::Application(): @@ -32,7 +30,6 @@ Application::Application(const QString &name, const Icon &icon) : d(new ApplicationData(name, icon)) { - addAlert(Alert(qApp->translate("Default Alert", "Default"), icon)); } Application::Application(const Application &other): @@ -55,7 +52,7 @@ void Application::addAlert(const Alert &alert) { Q_ASSERT_X(!SnoreCore::instance().aplications().contains(name()), Q_FUNC_INFO, "Alerts must be added before the application is Registered." ); - d->m_alerts.insert(alert.name().toUtf8(), alert); + d->m_alerts.insert(alert.name(), alert); } QString Application::name() const @@ -68,14 +65,14 @@ const Icon &Application::icon()const return d->m_icon; } -const QHash &Application::alerts() const +const QHash &Application::alerts() const { return d->m_alerts; } const Alert Application::defaultAlert() const { - return d->m_alerts.value("Default"); + return d->m_defaultAlert; } bool Application::isValid() const diff --git a/src/libsnore/application.h b/src/libsnore/application.h index a4c5786..f94fe7d 100644 --- a/src/libsnore/application.h +++ b/src/libsnore/application.h @@ -86,7 +86,7 @@ public: * * @return a QHash with the Alers registered with this Application. */ - const QHash &alerts() const; + const QHash &alerts() const; /** * diff --git a/src/libsnore/application_p.cpp b/src/libsnore/application_p.cpp index 83b9b37..f046b6b 100644 --- a/src/libsnore/application_p.cpp +++ b/src/libsnore/application_p.cpp @@ -19,13 +19,18 @@ #include "application_p.h" #include "snore_p.h" +#include + using namespace Snore; ApplicationData::ApplicationData(const QString &name, const Icon &icon): m_name(name), - m_icon(icon) + m_icon(icon), + m_defaultAlert(qApp->translate("Default Alert", "Default"), icon) { Q_ASSERT_X(!name.isEmpty(), Q_FUNC_INFO, "invalid name detected"); + m_alerts.insert(m_defaultAlert.name(), m_defaultAlert); + m_hint.setValue("pushover-token", QLatin1String("aFB1TPCyZkkr7mubCGEKy5vJEWak9t")); m_hint.setValue("use-markup", false); m_hint.setValue("silent", SnoreCore::instance().settingsValue(QLatin1String("Silent"), LOCAL_SETTING)); diff --git a/src/libsnore/application_p.h b/src/libsnore/application_p.h index 2bc31ce..9c3f2fa 100644 --- a/src/libsnore/application_p.h +++ b/src/libsnore/application_p.h @@ -34,8 +34,10 @@ public: QString m_name; Icon m_icon; - QHash m_alerts; + QHash m_alerts; Hint m_hint; + Alert m_defaultAlert; + }; } diff --git a/src/plugins/frontends/snarlnetwork/parser.cpp b/src/plugins/frontends/snarlnetwork/parser.cpp index 1d18776..416f531 100644 --- a/src/plugins/frontends/snarlnetwork/parser.cpp +++ b/src/plugins/frontends/snarlnetwork/parser.cpp @@ -102,8 +102,8 @@ void Parser::parse(Notification &sNotification, const QString &msg, QTcpSocket * } if (!alertName.isEmpty() && app.isValid()) { - if (app.alerts().contains(alertName.toLatin1())) { - alert = app.alerts().value(alertName.toLatin1()); + if (app.alerts().contains(alertName)) { + alert = app.alerts().value(alertName); } }