Remove NMA support
Remove support for NotifyMyAndroid (NMA) as they are shutting down May 24, 2018 in response to GDPR Based on https://github.com/KDE/snorenotify/pull/21
This commit is contained in:
parent
0a4c21a94b
commit
27de669f28
|
@ -1,4 +1,3 @@
|
|||
ecm_optional_add_subdirectory(toasty)
|
||||
ecm_optional_add_subdirectory(nma)
|
||||
ecm_optional_add_subdirectory(sound)
|
||||
ecm_optional_add_subdirectory(pushover_backend)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
add_snore_plugin(NMA SOURCES nma.cpp SETTINGS_SOURCES nmasettings.cpp TYPE SecondaryBackend)
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Hannah von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "nma.h"
|
||||
|
||||
#include "libsnore/utils.h"
|
||||
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
void NotifyMyAndroid::slotNotify(Notification notification)
|
||||
{
|
||||
QString key = settingsValue(QStringLiteral("ApiKey")).toString();
|
||||
if (key.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkRequest request(QUrl::fromEncoded("https://www.notifymyandroid.com/publicapi/notify"));
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("application/x-www-form-urlencoded")));
|
||||
|
||||
QString data = QLatin1String("apikey=") + key
|
||||
+ QLatin1String("&application=") + notification.application().name()
|
||||
+ QLatin1String("&event=") + notification.title()
|
||||
+ QLatin1String("&priority=") + QString::number(notification.priority())
|
||||
+ QLatin1String("&description=");
|
||||
|
||||
if (notification.constHints().value("supports-markup").toBool()) {
|
||||
data += notification.text(Utils::Href | Utils::Bold | Utils::Break |
|
||||
Utils::Underline | Utils::Font | Utils::Italic)
|
||||
+ QLatin1String("&content-type=text/html");
|
||||
} else {
|
||||
data += notification.text();
|
||||
}
|
||||
|
||||
QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData());
|
||||
connect(reply, &QNetworkReply::finished, [reply]() {
|
||||
qCDebug(SNORE) << reply->error();
|
||||
qCDebug(SNORE) << reply->readAll();
|
||||
reply->close();
|
||||
reply->deleteLater();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void NotifyMyAndroid::setDefaultSettings()
|
||||
{
|
||||
setDefaultSettingsValue(QStringLiteral("ApiKey"), QString());
|
||||
SnoreSecondaryBackend::setDefaultSettings();
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Hannah von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NMA_H
|
||||
#define NMA_H
|
||||
|
||||
#include "libsnore/plugins/snoresecondarybackend.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
class NotifyMyAndroid : public Snore::SnoreSecondaryBackend
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(Snore::SnoreSecondaryBackend)
|
||||
Q_PLUGIN_METADATA(IID "org.Snore.SecondaryNotificationBackend/1.0" FILE "snore_plugin.json")
|
||||
public:
|
||||
NotifyMyAndroid() = default;
|
||||
~NotifyMyAndroid() = default;
|
||||
|
||||
protected:
|
||||
void setDefaultSettings() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void slotNotify(Snore::Notification notification) override;
|
||||
|
||||
private:
|
||||
QNetworkAccessManager m_manager;
|
||||
|
||||
};
|
||||
|
||||
#endif // NMA_H
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Hannah von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "nmasettings.h"
|
||||
|
||||
#include "libsnore/plugins/plugins.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
|
||||
NotifyMyAndroidSettings::NotifyMyAndroidSettings(Snore::SnorePlugin *plugin, QWidget *parent) :
|
||||
Snore::PluginSettingsWidget(plugin, parent),
|
||||
m_lineEdit(new QLineEdit)
|
||||
{
|
||||
addRow(tr("Api Key:"), m_lineEdit, tr("The api key which can be found in your account page at <a href=\"http://notifymyandroid.com/\">Notifymyandroid.com</a>."));
|
||||
addRow(QString(), new QLabel(tr("If you don't have an account yet please register at <a href=\"http://notifymyandroid.com/\">Notifymyandroid.com</a>."), this));
|
||||
}
|
||||
|
||||
NotifyMyAndroidSettings::~NotifyMyAndroidSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void NotifyMyAndroidSettings::load()
|
||||
{
|
||||
m_lineEdit->setText(settingsValue(QStringLiteral("ApiKey")).toString());
|
||||
}
|
||||
|
||||
void NotifyMyAndroidSettings::save()
|
||||
{
|
||||
setSettingsValue(QStringLiteral("ApiKey"), m_lineEdit->text());
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Hannah von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef NOTIFYMYANDROID_H
|
||||
#define NOTIFYMYANDROID_H
|
||||
|
||||
#include "libsnore/plugins/settingsplugin.h"
|
||||
#include "libsnore/settings/pluginsettingswidget.h"
|
||||
|
||||
class QLineEdit;
|
||||
|
||||
class NotifyMyAndroidSettings : public Snore::PluginSettingsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NotifyMyAndroidSettings(Snore::SnorePlugin *plugin, QWidget *parent = 0);
|
||||
~NotifyMyAndroidSettings();
|
||||
|
||||
void load() override;
|
||||
void save() override;
|
||||
|
||||
private:
|
||||
QLineEdit *m_lineEdit;
|
||||
|
||||
};
|
||||
|
||||
SNORE_DECLARE_SETTINGS_PLUGIN(NotifyMyAndroidSettings)
|
||||
|
||||
#endif // NOTIFYMYANDROID_HH
|
Loading…
Reference in New Issue