2015-09-07 14:50:01 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OCSSHAREJOB_H
|
|
|
|
#define OCSSHAREJOB_H
|
|
|
|
|
|
|
|
#include "ocsjob.h"
|
|
|
|
#include <QVector>
|
|
|
|
#include <QList>
|
|
|
|
#include <QPair>
|
|
|
|
|
|
|
|
namespace OCC {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The OcsShareJob class
|
|
|
|
* @ingroup gui
|
2015-10-15 21:54:52 +03:00
|
|
|
*
|
|
|
|
* Handle talking to the OCS Share API.
|
|
|
|
* For creation, deletion and modification of shares.
|
2015-09-07 14:50:01 +03:00
|
|
|
*/
|
2015-10-15 21:54:52 +03:00
|
|
|
class OcsShareJob : public OcsJob {
|
2015-09-07 14:50:01 +03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Support sharetypes
|
|
|
|
*/
|
2015-10-21 19:40:04 +03:00
|
|
|
enum class ShareType : int {
|
|
|
|
Link = 3
|
2015-09-07 14:50:01 +03:00
|
|
|
};
|
|
|
|
|
2015-10-16 09:09:57 +03:00
|
|
|
/**
|
|
|
|
* Possible permissions
|
|
|
|
*/
|
2015-10-21 19:40:04 +03:00
|
|
|
enum class Permission : int {
|
|
|
|
Read = 1,
|
|
|
|
Update = 2,
|
|
|
|
Create = 4,
|
|
|
|
Delete = 8,
|
|
|
|
Share = 16,
|
|
|
|
All = 31
|
2015-10-16 09:09:57 +03:00
|
|
|
};
|
|
|
|
|
2015-09-07 14:50:01 +03:00
|
|
|
/**
|
|
|
|
* Constructor for new shares or listing of shares
|
|
|
|
*/
|
|
|
|
explicit OcsShareJob(AccountPtr account, QObject *parent = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all the shares
|
|
|
|
*
|
|
|
|
* @param path Path to request shares for (default all shares)
|
|
|
|
*/
|
|
|
|
void getShares(const QString& path = "");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete the current Share
|
|
|
|
*/
|
2015-10-16 09:28:13 +03:00
|
|
|
void deleteShare(int shareId);
|
2015-09-07 14:50:01 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the expiration date of a share
|
|
|
|
*
|
|
|
|
* @param date The expire date, if this date is invalid the expire date
|
|
|
|
* will be removed
|
|
|
|
*/
|
2015-10-16 09:28:13 +03:00
|
|
|
void setExpireDate(int shareId, const QDate& date);
|
2015-09-07 14:50:01 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the password of a share
|
|
|
|
*
|
|
|
|
* @param password The password of the share, if the password is empty the
|
|
|
|
* share will be removed
|
|
|
|
*/
|
2015-10-16 09:28:13 +03:00
|
|
|
void setPassword(int shareId, const QString& password);
|
2015-09-07 14:50:01 +03:00
|
|
|
|
2015-10-15 21:34:56 +03:00
|
|
|
/**
|
2015-10-16 13:51:24 +03:00
|
|
|
* Void set the share to be public upload
|
2015-10-15 21:34:56 +03:00
|
|
|
*
|
|
|
|
* @param publicUpload Set or remove public upload
|
|
|
|
*/
|
2015-10-16 09:28:13 +03:00
|
|
|
void setPublicUpload(int shareId, bool publicUpload);
|
2015-10-15 21:34:56 +03:00
|
|
|
|
2015-09-07 14:50:01 +03:00
|
|
|
/**
|
|
|
|
* Create a new share
|
|
|
|
*
|
|
|
|
* @param path The path of the file/folder to share
|
|
|
|
* @param shareType The type of share (user/group/link/federated)
|
|
|
|
* @param password Optionally a password for the share
|
|
|
|
* @param date Optionally an expire date for the share
|
|
|
|
*/
|
2015-10-21 19:40:04 +03:00
|
|
|
void createShare(const QString& path, ShareType shareType, const QString& password = "", const QDate& date = QDate());
|
2015-09-07 14:50:01 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // OCSSHAREJOB_H
|