use cool new connects

This commit is contained in:
Patrick von Reth 2014-09-20 15:03:56 +02:00
parent 65931bdf9d
commit b331644379
2 changed files with 35 additions and 44 deletions

View File

@ -17,7 +17,6 @@ Toasty::~Toasty()
void Toasty::slotNotify(Notification notification)
{
if (!m_key.isEmpty()) {
QNetworkRequest request(QString("http://api.supertoasty.com/notify/%1").arg(m_key));
QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);
QHttpPart title;
@ -53,17 +52,12 @@ void Toasty::slotNotify(Notification notification)
mp->setParent(reply);
file->setParent(reply);
connect(reply, SIGNAL(finished()), this, SLOT(slotRequestFinished()));
}
}
void Toasty::slotRequestFinished()
{
QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
connect(reply, &QNetworkReply::finished, this, [reply](){
snoreDebug(SNORE_DEBUG) << reply->readAll();
reply->close();
reply->deleteLater();
});
}
bool Toasty::initialize(SnoreCore *snore)

View File

@ -19,9 +19,6 @@ public:
public slots:
virtual void slotNotify(Snore::Notification notification) override;
private slots:
void slotRequestFinished();
private:
QString m_key;
QNetworkAccessManager m_manager;