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:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-09-07 14:50:01 +0300
committerRoeland Jago Douma <rullzer@owncloud.com>2015-10-15 21:05:47 +0300
commitb293aa762c3b32fe00527647ab5b18b8dbc28541 (patch)
tree5dcab7749603a9f66a75d098051f978100b5ebce /src/gui/ocssharejob.h
parentb5e75afc171f79a3fa97dee438dde997e27a5558 (diff)
Split sharing code
There is now a generic OCSJob which must be inherited by other jobs. This is in prepartion for the other OCS job that will come (for the Sharee API endpoint for example). More logic is moved from the sharedialog to the OcsShareJob. So in the GUI code we now only say what we want (a new share, set the password etc). And the code in libsync will make that happen. Error handling is for now still done in the GUI part. For now the ocsjob and ocssharejob live in gui but probabaly we should create a libshare or libocs at some point.
Diffstat (limited to 'src/gui/ocssharejob.h')
-rw-r--r--src/gui/ocssharejob.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h
new file mode 100644
index 000000000..e662537b0
--- /dev/null
+++ b/src/gui/ocssharejob.h
@@ -0,0 +1,90 @@
+/*
+ * 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
+ */
+class OcsShareJob : public OCSJob {
+ Q_OBJECT
+public:
+
+ /**
+ * Support sharetypes
+ */
+ enum class SHARETYPE : int {
+ LINK = 3
+ };
+
+ /**
+ * Constructor for new shares or listing of shares
+ */
+ explicit OcsShareJob(AccountPtr account, QObject *parent = 0);
+
+ /**
+ * Constructors for existing shares of which we know the shareId
+ */
+ explicit OcsShareJob(int shareId, 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
+ */
+ void deleteShare();
+
+ /**
+ * Set the expiration date of a share
+ *
+ * @param date The expire date, if this date is invalid the expire date
+ * will be removed
+ */
+ void setExpireDate(const QDate& date);
+
+ /**
+ * Set the password of a share
+ *
+ * @param password The password of the share, if the password is empty the
+ * share will be removed
+ */
+ void setPassword(const QString& password);
+
+ /**
+ * 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
+ */
+ void createShare(const QString& path, SHARETYPE shareType, const QString& password = "", const QDate& date = QDate());
+};
+
+}
+
+#endif // OCSSHAREJOB_H