Adds OcsAppsJob to retrieve apps enabled for the user.

Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
Camila San 2018-01-26 13:11:35 +01:00
parent 89d743396a
commit 08769b2803
No known key found for this signature in database
GPG key ID: A0A1A2FD03979524
3 changed files with 92 additions and 1 deletions

View file

@ -59,8 +59,9 @@ set(client_SRCS
logbrowser.cpp
navigationpanehelper.cpp
networksettings.cpp
ocsjob.cpp
ocsappsjob.cpp
ocsexternalsitesjob.cpp
ocsjob.cpp
ocssharejob.cpp
ocsshareejob.cpp
openfilemanager.cpp

37
src/gui/ocsappsjob.cpp Normal file
View file

@ -0,0 +1,37 @@
/*
* Copyright (C) by Camila Ayres <camila@nextcloud.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; either version 2 of the License, or
* (at your option) any later version.
*
* 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 "ocsappsjob.h"
namespace OCC {
OcsAppsJob::OcsAppsJob(AccountPtr account)
: OcsJob(account)
{
setPath("ocs/v1.php/cloud/apps/enabled");
connect(this, &OcsAppsJob::jobFinished, this, &OcsAppsJob::jobDone);
}
void OcsAppsJob::getApps()
{
setVerb("GET");
start();
}
void OcsAppsJob::jobDone(const QJsonDocument &reply)
{
emit appsJobFinished(reply);
}
}

53
src/gui/ocsappsjob.h Normal file
View file

@ -0,0 +1,53 @@
/*
* Copyright (C) by Camila Ayres <camila@nextcloud.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; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*/
#ifndef OCSAPPSJOB_H
#define OCSAPPSJOB_H
#include "ocsjob.h"
class QJsonDocument;
namespace OCC {
/**
* @brief The OcsAppsJob class
* @ingroup gui
*
* Fetching enabled apps from the OCS Apps API
*/
class OcsAppsJob : public OcsJob
{
Q_OBJECT
public:
explicit OcsAppsJob(AccountPtr account);
/**
* Get a list of enabled apps for the current user
*/
void getApps();
signals:
/**
* Result of the OCS request
*
* @param reply The reply
*/
void appsJobFinished(const QJsonDocument &reply);
private slots:
void jobDone(const QJsonDocument &reply);
};
}
#endif // OCSAPPSJOB_H