fix toasty

This commit is contained in:
Patrick von Reth 2014-09-20 14:56:27 +02:00
parent 5ca8735398
commit 65931bdf9d
2 changed files with 6 additions and 5 deletions

View File

@ -17,9 +17,8 @@ Toasty::~Toasty()
void Toasty::slotNotify(Notification notification) void Toasty::slotNotify(Notification notification)
{ {
QString id = value("DEVICEID").toString(); if (!m_key.isEmpty()) {
if (!id.isEmpty()) { QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(m_key));
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(id));
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType); QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QHttpPart title; QHttpPart title;
title.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"title\"")); title.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"title\""));
@ -71,8 +70,9 @@ bool Toasty::initialize(SnoreCore *snore)
{ {
if (SnoreSecondaryBackend::initialize(snore)) { if (SnoreSecondaryBackend::initialize(snore)) {
setDefaultValue("DeviceID", "", "The ID provided for your device by Toasty"); setDefaultValue("DeviceID", "", "The ID provided for your device by Toasty");
snoreDebug(SNORE_DEBUG) << value("DeviceID"); m_key = value("DeviceID").toString();
return true; snoreDebug(SNORE_DEBUG) << m_key;
return !m_key.isEmpty();
} }
return false; return false;
} }

View File

@ -23,6 +23,7 @@ private slots:
void slotRequestFinished(); void slotRequestFinished();
private: private:
QString m_key;
QNetworkAccessManager m_manager; QNetworkAccessManager m_manager;
}; };