33 #include "core/function/basic/GpgFunctionObject.h"
34 #include "core/function/gpg/GpgContext.h"
35 #include "core/typedef/GpgTypedef.h"
61 auto SignKey(
const GpgKey& target, KeyArgsList& keys,
const QString& uid,
62 const std::unique_ptr<QDateTime>& expires) -> bool;
73 const GpgFrontend::SignIdArgsListPtr& signature_id) -> bool;
84 auto SetExpire(
const GpgKey& key, std::unique_ptr<GpgSubKey>& subkey,
85 std::unique_ptr<QDateTime>& expires) -> bool;
92 auto SetOwnerTrustLevel(
const GpgKey& key,
int trust_level) -> bool;
95 static auto interactor_cb_fnc(
void* handle,
const char* status,
96 const char* args,
int fd) -> gpgme_error_t;
98 using Command = QString;
99 using AutomatonState =
enum {
111 using AutomatonActionHandler =
113 using AutomatonNextStateHandler =
114 std::function<AutomatonState(AutomatonState, QString, QString)>;
117 void SetStatus(AutomatonState next_state) { current_state_ = next_state; }
118 auto CuurentStatus() -> AutomatonState {
return current_state_; }
119 void SetHandler(AutomatonNextStateHandler next_state_handler,
120 AutomatonActionHandler action_handler) {
121 next_state_handler_ = std::move(next_state_handler);
122 action_handler_ = std::move(action_handler);
124 auto NextState(QString gpg_status, QString args) -> AutomatonState {
125 return next_state_handler_(current_state_, std::move(gpg_status),
128 auto Action() -> Command {
return action_handler_(*
this, current_state_); }
130 void SetSuccess(
bool success) { success_ = success; }
132 [[nodiscard]]
auto Success()
const ->
bool {
return success_; }
134 auto KeyFpr() -> QString {
return key_fpr_; }
137 : key_fpr_(std::move(key_fpr)) {}
140 AutomatonState current_state_ = AS_START;
141 AutomatonNextStateHandler next_state_handler_;
142 AutomatonActionHandler action_handler_;
143 bool success_ =
false;
Definition: GpgContext.h:60
Definition: GpgKeyManager.h:44
Definition: GpgFunctionObject.h:57
auto GetChannel() const -> int
Get the Channel object.
Definition: GpgFunctionObject.h:139
static auto GetInstance(int channel=GpgFrontend::kGpgFrontendDefaultChannel) -> GpgContext &
Get the Instance object.
Definition: GpgFunctionObject.h:79
static auto GetDefaultChannel() -> int
Get the Default Channel object.
Definition: GpgFunctionObject.h:130
Definition: GpgKeyManager.h:116