mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Creates navigation/apps API call class OcsNavigationAppsJob.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
f107b3348c
commit
c9bc20c63d
4 changed files with 14 additions and 103 deletions
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* 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 "ocsexternalsitesjob.h"
|
||||
|
||||
namespace OCC {
|
||||
|
||||
OcsExternalSitesJob::OcsExternalSitesJob(AccountPtr account)
|
||||
: OcsJob(account)
|
||||
{
|
||||
setPath("ocs/v2.php/apps/external/api/v1");
|
||||
connect(this, &OcsExternalSitesJob::jobFinished, this, &OcsExternalSitesJob::jobDone);
|
||||
}
|
||||
|
||||
void OcsExternalSitesJob::getExternalSites()
|
||||
{
|
||||
setVerb("GET");
|
||||
start();
|
||||
}
|
||||
|
||||
void OcsExternalSitesJob::jobDone(const QJsonDocument &reply)
|
||||
{
|
||||
|
||||
emit externalSitesJobFinished(reply);
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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 OCSEXTERNALSITESJOB_H
|
||||
#define OCSEXTERNALSITESJOB_H
|
||||
|
||||
#include "ocsjob.h"
|
||||
class QJsonDocument;
|
||||
|
||||
namespace OCC {
|
||||
|
||||
/**
|
||||
* @brief The OcsExternalSitesJob class
|
||||
* @ingroup gui
|
||||
*
|
||||
* Fetching expernal sites from the OCS External Sites API
|
||||
*/
|
||||
class OcsExternalSitesJob : public OcsJob
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OcsExternalSitesJob(AccountPtr account);
|
||||
|
||||
/**
|
||||
* Get a list of external sites
|
||||
*/
|
||||
void getExternalSites();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Result of the OCS request
|
||||
*
|
||||
* @param reply The reply
|
||||
*/
|
||||
void externalSitesJobFinished(const QJsonDocument &reply);
|
||||
|
||||
private slots:
|
||||
void jobDone(const QJsonDocument &reply);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // OCSEXTERNALSITESJOB_H
|
|
@ -12,24 +12,24 @@
|
|||
* for more details.
|
||||
*/
|
||||
|
||||
#include "ocsappsjob.h"
|
||||
#include "ocsnavigationappsjob.h"
|
||||
|
||||
namespace OCC {
|
||||
|
||||
OcsAppsJob::OcsAppsJob(AccountPtr account)
|
||||
OcsNavigationAppsJob::OcsNavigationAppsJob(AccountPtr account)
|
||||
: OcsJob(account)
|
||||
{
|
||||
setPath("ocs/v1.php/cloud/apps/enabled");
|
||||
connect(this, &OcsAppsJob::jobFinished, this, &OcsAppsJob::jobDone);
|
||||
setPath("ocs/v2.php/core/navigation/apps");
|
||||
connect(this, &OcsNavigationAppsJob::jobFinished, this, &OcsNavigationAppsJob::jobDone);
|
||||
}
|
||||
|
||||
void OcsAppsJob::getApps()
|
||||
void OcsNavigationAppsJob::getNavigationApps()
|
||||
{
|
||||
setVerb("GET");
|
||||
start();
|
||||
}
|
||||
|
||||
void OcsAppsJob::jobDone(const QJsonDocument &reply)
|
||||
void OcsNavigationAppsJob::jobDone(const QJsonDocument &reply)
|
||||
{
|
||||
|
||||
emit appsJobFinished(reply);
|
|
@ -12,8 +12,8 @@
|
|||
* for more details.
|
||||
*/
|
||||
|
||||
#ifndef OCSAPPSJOB_H
|
||||
#define OCSAPPSJOB_H
|
||||
#ifndef OCSNAVIGATIONAPPSJOB_H
|
||||
#define OCSNAVIGATIONAPPSJOB_H
|
||||
|
||||
#include "ocsjob.h"
|
||||
class QJsonDocument;
|
||||
|
@ -26,16 +26,17 @@ namespace OCC {
|
|||
*
|
||||
* Fetching enabled apps from the OCS Apps API
|
||||
*/
|
||||
class OcsAppsJob : public OcsJob
|
||||
class OcsNavigationAppsJob : public OcsJob
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OcsAppsJob(AccountPtr account);
|
||||
explicit OcsNavigationAppsJob(AccountPtr account);
|
||||
|
||||
/**
|
||||
* Get a list of enabled apps for the current user
|
||||
* Get a list of enabled apps and external sites
|
||||
* visible in the Navigation menu
|
||||
*/
|
||||
void getApps();
|
||||
void getNavigationApps();
|
||||
|
||||
signals:
|
||||
/**
|
||||
|
@ -50,4 +51,4 @@ private slots:
|
|||
};
|
||||
}
|
||||
|
||||
#endif // OCSAPPSJOB_H
|
||||
#endif // OCSNAVIGATIONAPPSJOB_H
|
Loading…
Reference in a new issue