diff options
author | Klaas Freitag <freitag@owncloud.com> | 2016-03-04 19:37:54 +0300 |
---|---|---|
committer | Klaas Freitag <freitag@owncloud.com> | 2016-03-10 19:22:36 +0300 |
commit | eb00b341915de2cb69b1f849dd3847e2031b2c16 (patch) | |
tree | 29397ed8dff589e9b01064a80df0afae71558f08 /src/gui/notificationconfirmjob.cpp | |
parent | a831b7417f4f9dba5308c164cb6081346f4e0bbc (diff) |
Minor wording fixes
Diffstat (limited to 'src/gui/notificationconfirmjob.cpp')
-rw-r--r-- | src/gui/notificationconfirmjob.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/gui/notificationconfirmjob.cpp b/src/gui/notificationconfirmjob.cpp new file mode 100644 index 000000000..f243656fc --- /dev/null +++ b/src/gui/notificationconfirmjob.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) by Klaas Freitag <freitag@owncloud.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program 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 General Public License + * for more details. + */ + +#include "notificationconfirmjob.h" +#include "networkjobs.h" +#include "account.h" +#include "json.h" + +#include <QBuffer> + +namespace OCC { + +NotificationConfirmJob::NotificationConfirmJob(AccountPtr account) +: AbstractNetworkJob(account, "") +{ + setIgnoreCredentialFailure(true); +} + +void NotificationConfirmJob::setLinkAndVerb(const QUrl& link, const QString &verb) +{ + _link = link; + _verb = verb; +} + +void NotificationConfirmJob::start() +{ + if( !_link.isValid() ) { + qDebug() << "Attempt to trigger invalid URL: " << _link.toString(); + return; + } + QNetworkRequest req; + req.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); + + QIODevice *iodevice = 0; + setReply(davRequest(_verb.toAscii(), _link, req, iodevice)); + setupConnections(reply()); + + AbstractNetworkJob::start(); +} + +bool NotificationConfirmJob::finished() +{ + int replyCode = 0; + // FIXME: check for the reply code! + const QString replyData = reply()->readAll(); + + emit jobFinished(replyData, replyCode); + + return true; + +} + +} |