Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2017-05-17 11:55:42 +0300
committerckamm <mail@ckamm.de>2017-05-17 13:26:27 +0300
commitc8d0f788e00bdae125a26d9159ce9efdd6325cd2 (patch)
treead77cb515fe650984e6b76dfffe09838090d77bd /src/gui/servernotificationhandler.cpp
parentae263d60bd6d1bc0eb0c3712bab11de120b8cdd3 (diff)
Apply clang-format
Diffstat (limited to 'src/gui/servernotificationhandler.cpp')
-rw-r--r--src/gui/servernotificationhandler.cpp53
1 files changed, 24 insertions, 29 deletions
diff --git a/src/gui/servernotificationhandler.cpp b/src/gui/servernotificationhandler.cpp
index 62ba5e973..afbd66ddf 100644
--- a/src/gui/servernotificationhandler.cpp
+++ b/src/gui/servernotificationhandler.cpp
@@ -20,30 +20,26 @@
#include <QJsonDocument>
#include <QJsonObject>
-namespace OCC
-{
+namespace OCC {
Q_LOGGING_CATEGORY(lcServerNotification, "gui.servernotification", QtInfoMsg)
ServerNotificationHandler::ServerNotificationHandler(QObject *parent)
: QObject(parent)
{
-
}
void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr)
{
// check connectivity and credentials
- if( !( ptr && ptr->isConnected() && ptr->account() &&
- ptr->account()->credentials() &&
- ptr->account()->credentials()->ready() ) ) {
+ if (!(ptr && ptr->isConnected() && ptr->account() && ptr->account()->credentials() && ptr->account()->credentials()->ready())) {
deleteLater();
return;
}
// check if the account has notifications enabled. If the capabilities are
// not yet valid, its assumed that notifications are available.
- if( ptr->account()->capabilities().isValid() ) {
- if( ! ptr->account()->capabilities().notificationsAvailable() ) {
+ if (ptr->account()->capabilities().isValid()) {
+ if (!ptr->account()->capabilities().notificationsAvailable()) {
qCInfo(lcServerNotification) << "Account" << ptr->account()->displayName() << "does not have notifications enabled.";
deleteLater();
return;
@@ -51,17 +47,17 @@ void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr)
}
// if the previous notification job has finished, start next.
- _notificationJob = new JsonApiJob( ptr->account(), QLatin1String("ocs/v2.php/apps/notifications/api/v1/notifications"), this );
+ _notificationJob = new JsonApiJob(ptr->account(), QLatin1String("ocs/v2.php/apps/notifications/api/v1/notifications"), this);
QObject::connect(_notificationJob.data(), SIGNAL(jsonReceived(QJsonDocument, int)),
- this, SLOT(slotNotificationsReceived(QJsonDocument, int)));
- _notificationJob->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(ptr));
+ this, SLOT(slotNotificationsReceived(QJsonDocument, int)));
+ _notificationJob->setProperty("AccountStatePtr", QVariant::fromValue<AccountState *>(ptr));
_notificationJob->start();
}
-void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument& json, int statusCode)
+void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &json, int statusCode)
{
- if( statusCode != 200 ) {
+ if (statusCode != 200) {
qCWarning(lcServerNotification) << "Notifications failed with status code " << statusCode;
deleteLater();
return;
@@ -69,40 +65,39 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument& j
auto notifies = json.object().value("ocs").toObject().value("data").toArray();
- AccountState* ai = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
+ AccountState *ai = qvariant_cast<AccountState *>(sender()->property("AccountStatePtr"));
ActivityList list;
- foreach( auto element, notifies ) {
+ foreach (auto element, notifies) {
Activity a;
- auto json = element.toObject();
- a._type = Activity::NotificationType;
- a._accName = ai->account()->displayName();
- a._id = json.value("notification_id").toInt();
- a._subject = json.value("subject").toString();
- a._message = json.value("message").toString();
- QString s = json.value("link").toString();
- if( !s.isEmpty() ) {
- a._link = QUrl(s);
+ auto json = element.toObject();
+ a._type = Activity::NotificationType;
+ a._accName = ai->account()->displayName();
+ a._id = json.value("notification_id").toInt();
+ a._subject = json.value("subject").toString();
+ a._message = json.value("message").toString();
+ QString s = json.value("link").toString();
+ if (!s.isEmpty()) {
+ a._link = QUrl(s);
}
a._dateTime = QDateTime::fromString(json.value("datetime").toString(), Qt::ISODate);
auto actions = json.value("actions").toArray();
- foreach( auto action, actions) {
+ foreach (auto action, actions) {
auto actionJson = action.toObject();
ActivityLink al;
al._label = QUrl::fromPercentEncoding(actionJson.value("label").toString().toUtf8());
- al._link = actionJson.value("link").toString();
- al._verb = actionJson.value("type").toString().toUtf8();
+ al._link = actionJson.value("link").toString();
+ al._verb = actionJson.value("type").toString().toUtf8();
al._isPrimary = actionJson.value("primary").toBool();
a._links.append(al);
}
list.append(a);
}
- emit newNotificationList( list );
+ emit newNotificationList(list);
deleteLater();
}
-
}