aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/function/GpgOperaHelper.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-01-27 22:12:00 +0000
committersaturneric <[email protected]>2025-01-27 22:12:00 +0000
commita66d868f500c0bd94fe9783172ac3d17b1dbb6f5 (patch)
tree3c2c07e0ec717fac5beec08d9678bd311a84e134 /src/ui/function/GpgOperaHelper.h
parentrefactor: reduce code duplication of gnupg file operations (diff)
downloadGpgFrontend-a66d868f500c0bd94fe9783172ac3d17b1dbb6f5.tar.gz
GpgFrontend-a66d868f500c0bd94fe9783172ac3d17b1dbb6f5.zip
refactor: reduce code duplication of gnupg operations
Diffstat (limited to 'src/ui/function/GpgOperaHelper.h')
-rw-r--r--src/ui/function/GpgOperaHelper.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/src/ui/function/GpgOperaHelper.h b/src/ui/function/GpgOperaHelper.h
index ca620574..bf11b37b 100644
--- a/src/ui/function/GpgOperaHelper.h
+++ b/src/ui/function/GpgOperaHelper.h
@@ -39,11 +39,37 @@ class GpgOperaHelper : QObject {
using GpgOperaFactory = std::function<OperaWaitingCb(
QSharedPointer<GpgOperaContext>& context, int channel, int index)>;
+ /**
+ * @brief
+ *
+ * @tparam ResultType
+ * @tparam AnalyseType
+ * @tparam OperaFunc
+ * @param context
+ * @param channel
+ * @param index
+ * @param opera_func
+ * @return OperaWaitingCb
+ */
template <typename ResultType, typename AnalyseType, typename OperaFunc>
static auto BuildSimpleGpgFileOperasHelper(
QSharedPointer<GpgOperaContext>& context, int channel, int index,
OperaFunc opera_func) -> OperaWaitingCb;
+ /**
+ * @brief
+ *
+ * @tparam ResultTypeA
+ * @tparam AnalyseTypeA
+ * @tparam ResultTypeB
+ * @tparam AnalyseTypeB
+ * @tparam OperaFunc
+ * @param context
+ * @param channel
+ * @param index
+ * @param opera_func
+ * @return OperaWaitingCb
+ */
template <typename ResultTypeA, typename AnalyseTypeA, typename ResultTypeB,
typename AnalyseTypeB, typename OperaFunc>
static auto BuildComplexGpgFileOperasHelper(
@@ -53,6 +79,43 @@ class GpgOperaHelper : QObject {
/**
* @brief
*
+ * @tparam ResultType
+ * @tparam AnalyseType
+ * @tparam OperaFunc
+ * @param context
+ * @param channel
+ * @param index
+ * @param opera_func
+ * @return OperaWaitingCb
+ */
+ template <typename ResultType, typename AnalyseType, typename OperaFunc>
+ static auto BuildSimpleGpgOperasHelper(
+ QSharedPointer<GpgOperaContext>& context, int channel, int index,
+ OperaFunc opera_func) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @tparam ResultTypeA
+ * @tparam AnalyseTypeA
+ * @tparam ResultTypeB
+ * @tparam AnalyseTypeB
+ * @tparam OperaFunc
+ * @param context
+ * @param channel
+ * @param index
+ * @param opera_func
+ * @return OperaWaitingCb
+ */
+ template <typename ResultTypeA, typename AnalyseTypeA, typename ResultTypeB,
+ typename AnalyseTypeB, typename OperaFunc>
+ static auto BuildComplexGpgOperasHelper(
+ QSharedPointer<GpgOperaContext>& context, int channel, int index,
+ OperaFunc opera_func) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
* @param base
* @param category
* @param channel
@@ -69,6 +132,17 @@ class GpgOperaHelper : QObject {
* @param index
* @return OperaWaitingCb
*/
+ static auto BuildOperasEncrypt(QSharedPointer<GpgOperaContext>& context,
+ int channel, int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
+ * @param channel
+ * @param index
+ * @return OperaWaitingCb
+ */
static auto BuildOperasFileEncrypt(QSharedPointer<GpgOperaContext>& context,
int channel, int index) -> OperaWaitingCb;
@@ -88,6 +162,17 @@ class GpgOperaHelper : QObject {
* @brief
*
* @param context
+ * @param channel
+ * @param index
+ * @return OperaWaitingCb
+ */
+ static auto BuildOperasDecrypt(QSharedPointer<GpgOperaContext>& context,
+ int channel, int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
*/
static auto BuildOperasFileDecrypt(QSharedPointer<GpgOperaContext>& context,
int channel, int index) -> OperaWaitingCb;
@@ -108,6 +193,17 @@ class GpgOperaHelper : QObject {
* @brief
*
* @param context
+ * @param channel
+ * @param index
+ * @return OperaWaitingCb
+ */
+ static auto BuildOperasSign(QSharedPointer<GpgOperaContext>& context,
+ int channel, int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
* @return OperaWaitingCb
*/
static auto BuildOperasFileSign(QSharedPointer<GpgOperaContext>& context,
@@ -121,6 +217,17 @@ class GpgOperaHelper : QObject {
* @param index
* @return OperaWaitingCb
*/
+ static auto BuildOperasVerify(QSharedPointer<GpgOperaContext>& context,
+ int channel, int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
+ * @param channel
+ * @param index
+ * @return OperaWaitingCb
+ */
static auto BuildOperasFileVerify(QSharedPointer<GpgOperaContext>& context,
int channel, int index) -> OperaWaitingCb;
@@ -130,6 +237,17 @@ class GpgOperaHelper : QObject {
* @param context
* @param channel
* @param index
+ * @return OperaWaitingCb
+ */
+ static auto BuildOperasEncryptSign(QSharedPointer<GpgOperaContext>& context,
+ int channel, int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
+ * @param channel
+ * @param index
*/
static auto BuildOperasFileEncryptSign(
QSharedPointer<GpgOperaContext>& context, int channel,
@@ -155,6 +273,18 @@ class GpgOperaHelper : QObject {
* @param index
* @return OperaWaitingCb
*/
+ static auto BuildOperasDecryptVerify(QSharedPointer<GpgOperaContext>& context,
+ int channel,
+ int index) -> OperaWaitingCb;
+
+ /**
+ * @brief
+ *
+ * @param context
+ * @param channel
+ * @param index
+ * @return OperaWaitingCb
+ */
static auto BuildOperasFileDecryptVerify(
QSharedPointer<GpgOperaContext>& context, int channel,
int index) -> OperaWaitingCb;