mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-25 06:25:56 +03:00
Adds OcsAppsJob to retrieve apps enabled for the user.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
89d743396a
commit
08769b2803
3 changed files with 92 additions and 1 deletions
|
@ -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
37
src/gui/ocsappsjob.cpp
Normal 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
53
src/gui/ocsappsjob.h
Normal 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
|
Loading…
Reference in a new issue