29 #ifndef GPGFRONTEND_ZH_CN_TS_GPGKEYMANAGER_H
30 #define GPGFRONTEND_ZH_CN_TS_GPGKEYMANAGER_H
35 #include "core/GpgContext.h"
36 #include "core/GpgFunctionObject.h"
37 #include "core/GpgModel.h"
63 bool SignKey(
const GpgKey& target, KeyArgsList& keys,
const std::string& uid,
64 const std::unique_ptr<boost::posix_time::ptime>& expires);
75 const GpgFrontend::SignIdArgsListPtr& signature_id);
86 bool SetExpire(
const GpgKey& key, std::unique_ptr<GpgSubKey>& subkey,
87 std::unique_ptr<boost::posix_time::ptime>& expires);
94 bool SetOwnerTrustLevel(
const GpgKey& key,
int trust_level);
97 static gpgme_error_t interactor_cb_fnc(
void* handle,
const char* status,
98 const char* args,
int fd);
100 using Command = std::string;
101 using AutomatonState =
enum {
113 using AutomatonActionHandler =
115 using AutomatonNextStateHandler =
116 std::function<AutomatonState(AutomatonState, std::string, std::string)>;
119 void SetStatus(AutomatonState next_state) { current_state_ = next_state; }
120 AutomatonState CuurentStatus() {
return current_state_; }
121 void SetHandler(AutomatonNextStateHandler next_state_handler,
122 AutomatonActionHandler action_handler) {
123 next_state_handler_ = next_state_handler;
124 action_handler_ = action_handler;
126 AutomatonState NextState(std::string gpg_status, std::string args) {
127 return next_state_handler_(current_state_, gpg_status, args);
129 Command Action() {
return action_handler_(*
this, current_state_); }
131 void SetSuccess(
bool success) { success_ = success; }
133 bool Success() {
return success_; }
135 std::string KeyFpr() {
return key_fpr_; }
140 AutomatonState current_state_ = START;
141 AutomatonNextStateHandler next_state_handler_;
142 AutomatonActionHandler action_handler_;
143 bool success_ =
false;
144 std::string key_fpr_;
Definition: GpgContext.h:71
Definition: GpgKeyManager.h:46
Definition: GpgFunctionObject.h:150
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:251
static GpgContext & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:172
int GetChannel() const
Get the Channel object.
Definition: GpgFunctionObject.h:258
Definition: CoreCommonUtil.cpp:31
Definition: GpgKeyManager.h:118